/* ============================================================
   ASTROVERSE AI — Premium Cosmic Stylesheet
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --bg-black:       #05070D;
  --bg-navy:        #0B1026;
  --bg-card:        rgba(11, 16, 38, 0.55);
  --bg-card-hover:  rgba(11, 16, 38, 0.7);

  --accent-purple:  #7B61FF;
  --accent-blue:    #4DA3FF;
  --accent-gold:    #FFD166;

  --text-primary:   #EAEAF0;
  --text-secondary: #A0A3B1;
  --text-muted:     #5A5E72;

  --border-subtle:  rgba(123, 97, 255, 0.15);
  --border-focus:   rgba(123, 97, 255, 0.55);
  --glow-purple:    rgba(123, 97, 255, 0.25);
  --glow-blue:      rgba(77, 163, 255, 0.2);
  --glow-gold:      rgba(255, 209, 102, 0.2);

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  22px;
  --radius-xl:  32px;

  --font-main:  'Outfit', system-ui, sans-serif;

  --transition-fast:   0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   0.6s  cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 240px;
  --right-panel-width: 260px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  font-family: var(--font-main);
  background: var(--bg-black);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(123, 97, 255, 0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(123, 97, 255, 0.5); }


/* ============================================================
   BACKGROUND: STARFIELD CANVAS + NEBULA
   ============================================================ */
#starfield {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.nebula-bg {
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none;
  overflow: hidden;
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}

.nebula-1 {
  width: 500px; height: 400px;
  top: -100px; left: -100px;
  background: radial-gradient(ellipse, rgba(123, 97, 255, 0.06) 0%, transparent 70%);
  opacity: 1;
}
.nebula-2 {
  width: 600px; height: 500px;
  bottom: -150px; right: -100px;
  background: radial-gradient(ellipse, rgba(77, 163, 255, 0.05) 0%, transparent 70%);
  opacity: 1;
}
.nebula-3 {
  width: 400px; height: 300px;
  top: 40%; left: 30%;
  background: radial-gradient(ellipse, rgba(255, 209, 102, 0.03) 0%, transparent 70%);
  opacity: 1;
}


/* ============================================================
   GLASSMORPHISM CARD
   ============================================================ */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}


/* ============================================================
   PAGE TRANSITIONS
   ============================================================ */
.page {
  position: fixed; inset: 0;
  z-index: 1;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.page.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.page.exit {
  opacity: 0;
  transform: translateY(-16px);
}


/* ============================================================
   PAGE 1 — BIRTH DETAILS
   ============================================================ */
#page-birth {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.birth-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  padding: 20px;
  z-index: 2;
}

/* Constellation decoration */
.constellation-lines {
  position: absolute;
  inset: -60px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}
.constellation-svg { width: 100%; height: 100%; }

/* Main form card */
.birth-card {
  position: relative;
  z-index: 1;
  padding: 48px 44px 36px;
  border-color: rgba(123, 97, 255, 0.2);
  box-shadow:
    0 0 0 1px rgba(123, 97, 255, 0.08),
    0 0 60px rgba(123, 97, 255, 0.06),
    0 32px 64px rgba(0, 0, 0, 0.5);
}

/* Header / logo */
.birth-header {
  text-align: center;
  margin-bottom: 36px;
}

.logo-mark {
  display: inline-block;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 12px rgba(123, 97, 255, 0.5));
}

.brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-purple);
  margin-bottom: 14px;
  opacity: 0.9;
}

.birth-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 10px;
  background: linear-gradient(135deg, #EAEAF0 0%, #A0A3B1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.birth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.auth-card {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(123, 97, 255, 0.24);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(123, 97, 255, 0.12), rgba(77, 163, 255, 0.06));
}

.auth-card.hidden {
  display: none;
}

.auth-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.auth-google-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(123, 97, 255, 0.4);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  background: rgba(123, 97, 255, 0.18);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.auth-google-btn:hover {
  background: rgba(123, 97, 255, 0.28);
  border-color: rgba(123, 97, 255, 0.65);
  box-shadow: 0 0 16px rgba(123, 97, 255, 0.24);
}

/* Form */
.birth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Input wrapper */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color var(--transition-fast);
  z-index: 1;
}

input[type="text"],
input[type="date"],
input[type="time"] {
  width: 100%;
  padding: 13px 16px 13px 42px;
  background: rgba(5, 7, 13, 0.6);
  border: 1px solid rgba(123, 97, 255, 0.18);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5) sepia(1) hue-rotate(220deg);
  opacity: 0.6;
  cursor: pointer;
}

input::placeholder { color: var(--text-muted); }

input:hover {
  border-color: rgba(123, 97, 255, 0.3);
  background: rgba(5, 7, 13, 0.7);
}

input:focus {
  border-color: var(--accent-purple);
  background: rgba(5, 7, 13, 0.75);
  box-shadow:
    0 0 0 3px rgba(123, 97, 255, 0.12),
    0 0 20px rgba(123, 97, 255, 0.12);
}

input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--accent-purple);
}

/* Custom Time Picker */
.time-picker-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(5, 7, 13, 0.6);
  border: 1px solid rgba(123, 97, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 0 14px 0 42px;
  height: 48px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.time-picker-wrapper:focus-within {
  border-color: var(--accent-purple);
  background: rgba(5, 7, 13, 0.75);
  box-shadow:
    0 0 0 3px rgba(123, 97, 255, 0.12),
    0 0 20px rgba(123, 97, 255, 0.12);
}

.time-picker-wrapper:focus-within .input-icon {
  color: var(--accent-purple);
}

.time-picker-wrapper .input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color var(--transition-fast);
}

.time-picker-wrapper input.time-input {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  box-sizing: border-box;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 500;
  padding: 0 2px;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
  border-radius: 0;
}

.time-picker-wrapper input.time-input::placeholder {
  color: var(--text-muted);
}

.time-picker-wrapper input.time-input.invalid {
  color: #ff6b6b;
  text-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

.time-picker-wrapper input.time-input:hover,
.time-picker-wrapper input.time-input:focus {
  background: transparent;
  border: none;
  box-shadow: none;
}

.time-select option {
  background: #0d1228;
  color: var(--text-primary);
}

.time-colon {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  padding: 0 1px;
  user-select: none;
}

.ampm-btn {
  margin-left: 8px;
  padding: 4px 10px;
  background: rgba(123, 97, 255, 0.1);
  border: 1px solid rgba(123, 97, 255, 0.25);
  border-radius: 6px;
  color: var(--accent-purple);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
  line-height: 1;
}

.ampm-btn:hover,
.ampm-btn.pm {
  background: rgba(123, 97, 255, 0.22);
  border-color: rgba(123, 97, 255, 0.55);
  box-shadow: 0 0 10px rgba(123, 97, 255, 0.2);
  color: #fff;
}

.time-error-message {
  font-size: 12px;
  color: #ff6b6b;
  margin-top: 6px;
  padding: 0 4px;
  display: none;
  animation: slideDown 0.2s ease-out;
}

.time-error-message:not(.hidden) {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Autocomplete */
.autocomplete-wrapper { flex-direction: column; align-items: stretch; }
.autocomplete-wrapper input { padding-right: 16px; }

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 100;
  background: rgba(11, 16, 38, 0.97);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(123, 97, 255, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 180px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
}

.autocomplete-dropdown.visible { display: block; }

.autocomplete-item {
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border-bottom: 1px solid rgba(123, 97, 255, 0.06);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background: rgba(123, 97, 255, 0.12);
  color: var(--text-primary);
}

/* CTA Button */
.cta-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 28px;
  margin-top: 8px;
  background: linear-gradient(135deg, rgba(123, 97, 255, 0.25) 0%, rgba(77, 163, 255, 0.2) 100%);
  border: 1px solid rgba(123, 97, 255, 0.45);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  overflow: hidden;
  transition:
    transform var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.btn-text { position: relative; z-index: 1; }
.btn-icon { position: relative; z-index: 1; transition: transform var(--transition-fast); }

.btn-glow {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(123, 97, 255, 0.15) 0%, rgba(77, 163, 255, 0.1) 100%);
  opacity: 0;
  transition: opacity var(--transition-fast);
  border-radius: inherit;
}

.cta-button:hover {
  transform: translateY(-2px) scale(1.012);
  border-color: rgba(123, 97, 255, 0.7);
  box-shadow:
    0 0 30px rgba(123, 97, 255, 0.3),
    0 0 60px rgba(77, 163, 255, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.3);
}
.cta-button:hover .btn-glow { opacity: 1; }
.cta-button:hover .btn-icon { transform: translateX(3px); }

.cta-button:active { transform: translateY(0) scale(1.005); }

/* Birth footer */
.birth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 28px;
  font-size: 12px;
  color: var(--text-muted);
}
.birth-footer svg { opacity: 0.6; }


/* ============================================================
   PAGE 2 — CHAT DASHBOARD
   ============================================================ */
#page-chat {
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.dashboard-layout {
  display: flex;
  width: 100%; height: 100%;
  z-index: 2;
  position: relative;
  gap: 0;
}


/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 24px 16px;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
  border-right: 1px solid rgba(123, 97, 255, 0.12);
  background: rgba(7, 9, 20, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow-y: auto;
  transition: transform var(--transition-medium);
  z-index: 10;
  position: relative;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 20px;
  border-bottom: 1px solid rgba(123, 97, 255, 0.1);
  margin-bottom: 20px;
}

.user-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7B61FF, #4DA3FF);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(123, 97, 255, 0.4);
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.user-zodiac {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.zodiac-symbol {
  color: var(--accent-gold);
  font-size: 13px;
}

/* New Chat button */
.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 24px;
  background: rgba(123, 97, 255, 0.1);
  border: 1px solid rgba(123, 97, 255, 0.25);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.new-chat-btn:hover {
  background: rgba(123, 97, 255, 0.18);
  border-color: rgba(123, 97, 255, 0.5);
  box-shadow: 0 0 16px rgba(123, 97, 255, 0.2);
}

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 12px 14px 8px;
}

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
  overflow-y: auto;
  max-height: 250px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item:hover {
  background: rgba(123, 97, 255, 0.08);
  color: var(--text-primary);
}

.history-item.active {
  background: rgba(123, 97, 255, 0.15);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent-purple);
}

.history-item svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.session-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-actions {
  display: flex;
  align-items: center;
}

.delete-session-btn, .rename-session-btn {
  padding: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all var(--transition-fast);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-item:hover .delete-session-btn,
.history-item:hover .rename-session-btn {
  opacity: 1;
}

.delete-session-btn:hover {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
}

.rename-session-btn:hover {
  background: rgba(123, 97, 255, 0.15);
  color: var(--accent-purple);
}

/* Nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
  position: relative;
  text-align: left;
}

.nav-item svg { flex-shrink: 0; transition: color var(--transition-fast); }

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(123, 97, 255, 0.08);
}

.nav-item.active {
  color: var(--text-primary);
  background: rgba(123, 97, 255, 0.12);
  box-shadow: inset 3px 0 0 var(--accent-purple);
}
.nav-item.active svg { color: var(--accent-purple); }

/* Sidebar footer */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 20px;
  border-top: 1px solid rgba(123, 97, 255, 0.1);
  margin-top: auto;
}

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.sidebar-footer-btn:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}


/* ===== MAIN CHAT AREA ===== */
.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
  position: relative;
}

/* Top bar */
.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(123, 97, 255, 0.1);
  flex-shrink: 0;
  backdrop-filter: blur(20px);
  background: rgba(5, 7, 13, 0.4);
}

.chat-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-toggle {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  display: none;
}
.sidebar-toggle:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.chat-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.chat-topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.topbar-icon-btn:hover {
  color: var(--text-primary);
  background: rgba(123, 97, 255, 0.1);
  box-shadow: 0 0 12px rgba(123, 97, 255, 0.15);
}
.topbar-icon-btn.active { color: var(--accent-purple); background: rgba(123, 97, 255, 0.12); }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
  contain: layout style; /* isolate paint/layout for message list */
  overscroll-behavior: contain;
}

/* Message bubbles */
.message {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: msgFadeIn 0.3s ease forwards;
  opacity: 0;
  will-change: opacity, transform;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message.user-message { flex-direction: row-reverse; }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.ai-avatar {
  background: linear-gradient(135deg, rgba(123, 97, 255, 0.3), rgba(77, 163, 255, 0.3));
  border: 1px solid rgba(123, 97, 255, 0.3);
  box-shadow: 0 0 12px rgba(123, 97, 255, 0.2);
  color: var(--accent-purple);
  font-size: 16px;
}

.user-msg-avatar {
  background: linear-gradient(135deg, #7B61FF, #4DA3FF);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 0 10px rgba(123, 97, 255, 0.3);
}

.msg-content {
  max-width: 72%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.user-message .msg-name { text-align: right; }

.msg-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.7;
  position: relative;
}

/* AI bubble */
.ai-bubble {
  background: rgba(123, 97, 255, 0.08);
  border: 1px solid rgba(123, 97, 255, 0.15);
  border-top-left-radius: 4px;
  color: var(--text-primary);
  box-shadow: 0 2px 20px rgba(123, 97, 255, 0.06);
}

/* User bubble */
.user-bubble {
  background: rgba(77, 163, 255, 0.1);
  border: 1px solid rgba(77, 163, 255, 0.2);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}

.user-message .msg-content { align-items: flex-end; }

/* Typing indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
}

.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-purple);
  opacity: 0.4;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 80%, 100% { opacity: 0.4; transform: translateY(0); }
  40%            { opacity: 1;   transform: translateY(-5px); }
}

/* Welcome state */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 20px;
  padding: 40px;
  text-align: center;
}

.welcome-icon {
  font-size: 52px;
  filter: drop-shadow(0 0 16px rgba(123, 97, 255, 0.5));
  animation: welcomeFloat 4s ease-in-out infinite;
}

@keyframes welcomeFloat {
  0%, 100% { transform: translateY(0px) scale(1); }
  50%       { transform: translateY(-8px) scale(1.03); }
}

.welcome-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.welcome-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 340px;
  line-height: 1.7;
}

.welcome-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.welcome-chip {
  padding: 9px 18px;
  background: rgba(123, 97, 255, 0.08);
  border: 1px solid rgba(123, 97, 255, 0.2);
  border-radius: 50px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.welcome-chip:hover {
  background: rgba(123, 97, 255, 0.16);
  border-color: rgba(123, 97, 255, 0.45);
  color: var(--text-primary);
  box-shadow: 0 0 16px rgba(123, 97, 255, 0.2);
  transform: translateY(-1px);
}

/* Input area */
.chat-input-area {
  padding: 20px 28px 24px;
  border-top: 1px solid rgba(123, 97, 255, 0.08);
  background: rgba(5, 7, 13, 0.5);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: rgba(11, 16, 38, 0.7);
  border: 1px solid rgba(123, 97, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 12px 16px 12px 20px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input-wrapper:focus-within {
  border-color: rgba(123, 97, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.08), 0 0 30px rgba(123, 97, 255, 0.1);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}

.chat-input::placeholder { color: var(--text-muted); }

.send-btn {
  position: relative;
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(123, 97, 255, 0.3), rgba(77, 163, 255, 0.25));
  border: 1px solid rgba(123, 97, 255, 0.35);
  color: var(--accent-purple);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.send-btn:not([disabled]):hover {
  background: linear-gradient(135deg, rgba(123, 97, 255, 0.5), rgba(77, 163, 255, 0.4));
  border-color: rgba(123, 97, 255, 0.7);
  box-shadow: 0 0 20px rgba(123, 97, 255, 0.4);
  transform: scale(1.08);
  color: #fff;
}

.send-btn:not([disabled]):active { transform: scale(1.02); }

.send-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.send-glow {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123, 97, 255, 0.5), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.send-btn:not([disabled]):hover .send-glow { opacity: 1; }

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  line-height: 1.5;
}


/* ===== RIGHT PANEL ===== */
.right-panel {
  width: var(--right-panel-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 20px;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-right: none;
  border-left: 1px solid rgba(123, 97, 255, 0.12);
  background: rgba(7, 9, 20, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow-y: auto;
  transition: transform var(--transition-medium), opacity var(--transition-medium);
  position: relative;
}

.right-panel.hidden {
  transform: translateX(var(--right-panel-width));
  opacity: 0;
  pointer-events: none;
  width: 0;
  padding: 0;
  border: none;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.panel-close-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.panel-close-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

/* Birth chart canvas */
.chart-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  background:
    radial-gradient(circle at 35% 30%, rgba(123, 97, 255, 0.22), transparent 52%),
    radial-gradient(circle at 70% 75%, rgba(77, 163, 255, 0.18), transparent 58%),
    rgba(9, 13, 26, 0.72);
  border: 1px solid rgba(140, 154, 230, 0.34);
  border-radius: 50%;
  width: 180px; height: 180px;
  flex-shrink: 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 16px 38px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(123, 97, 255, 0.2);
}

#birth-chart-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

.chart-center-label {
  position: relative;
  z-index: 2;
  font-size: 28px;
  color: rgba(249, 232, 180, 0.95);
  text-shadow:
    0 0 10px rgba(255, 209, 102, 0.45),
    0 0 22px rgba(123, 97, 255, 0.3);
}

/* Insights */
.insights-section { display: flex; flex-direction: column; gap: 12px; }

.insights-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.insight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(5, 7, 13, 0.5);
  border: 1px solid rgba(123, 97, 255, 0.1);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.insight-item:hover {
  border-color: rgba(123, 97, 255, 0.25);
  box-shadow: 0 0 12px rgba(123, 97, 255, 0.08);
}

.insight-icon { font-size: 18px; line-height: 1; }
.insight-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; letter-spacing: 0.5px; text-transform: uppercase; }
.insight-value { font-size: 14px; color: var(--text-primary); font-weight: 600; }

/* Daily card */
.daily-card {
  padding: 16px;
  background: linear-gradient(135deg, rgba(123, 97, 255, 0.08), rgba(77, 163, 255, 0.05));
  border: 1px solid rgba(123, 97, 255, 0.15);
  border-radius: var(--radius-md);
  margin-top: auto;
}

.daily-card-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 8px;
  opacity: 0.9;
}

.daily-card-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  font-style: italic;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .right-panel {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    z-index: 20;
    box-shadow: -8px 0 40px rgba(0,0,0,0.4);
  }
  .right-panel.hidden { transform: translateX(100%); }
}

@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    box-shadow: 8px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }

  .chat-messages { padding: 20px 20px; }
  .chat-topbar { padding: 14px 18px; }
  .chat-input-area { padding: 14px 16px 18px; }

  .msg-content { max-width: 88%; }

  .birth-card { padding: 36px 26px 28px; }
  .form-row { grid-template-columns: 1fr; }
  .birth-title { font-size: 22px; }
}

@media (max-width: 480px) {
  #page-birth { padding: 20px 14px; }
  .birth-card { padding: 28px 20px 24px; }
  .birth-title { font-size: 19px; }
  .welcome-chips { gap: 8px; }
  .welcome-chip { font-size: 12px; padding: 8px 14px; }
}

/* Responsive Vertical Heights to fit laptop screens without losing premium feel */
@media (max-height: 820px) {
  .birth-card { padding: 32px 36px 24px; }
  .birth-header { margin-bottom: 20px; }
  .logo-mark { margin-bottom: 8px; }
  .logo-mark svg { width: 48px; height: 48px; }
  .birth-title { font-size: 22px; margin-bottom: 6px; }
  .birth-subtitle { font-size: 13px; }
  .birth-form { gap: 14px; }
  .form-group { gap: 6px; }
  input[type="text"], input[type="date"], input[type="time"] { padding: 10px 16px 10px 42px; }
  .time-picker-wrapper { height: 44px; }
  .mode-btn { padding: 10px !important; font-size: 13px; }
  .cta-button { padding: 14px 24px; font-size: 14px; margin-top: 6px; }
  .birth-footer { margin-top: 16px; }
}

@media (max-height: 680px) {
  .birth-container { transform: scale(0.88); transform-origin: center center; }
}


/* ============================================================
   DASHBOARD SECTIONS
   ============================================================ */
.dashboard-section {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow-y: auto;
  animation: fadeIn var(--transition-medium);
}

.dashboard-section.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   COSMIC PROFILE PAGE
   ============================================================ */
.profile-container {
  padding: 40px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.profile-header {
  margin-bottom: 40px;
  text-align: left;
}

.profile-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.profile-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.profile-chart-card {
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.detailed-chart-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
}

#detailed-chart-canvas {
  width: 100%;
  height: 100%;
}

.detailed-chart-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  color: var(--accent-purple);
  text-shadow: 0 0 20px rgba(123, 97, 255, 0.4);
}

.profile-data-card {
  padding: 30px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.planetary-table-wrapper {
  overflow-x: auto;
}

.planetary-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.planetary-table th {
  padding: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.planetary-table td {
  padding: 14px 12px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.planetary-table tr:hover td {
  color: var(--text-primary);
  background: rgba(123, 97, 255, 0.03);
}

.planet-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 500;
}

.sign-badge {
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  font-size: 12px;
}

/* Analysis Bottom Grid */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.analysis-card {
  padding: 24px;
}

.analysis-content {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.analysis-tag {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: rgba(123, 97, 255, 0.1);
  border: 1px solid rgba(123, 97, 255, 0.2);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-label { color: var(--text-secondary); }
.tag-value { font-weight: 600; color: var(--text-primary); }

@media (max-width: 1024px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .analysis-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   SUBSCRIPTION MODAL
   ============================================================ */
.sub-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 15, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--transition-medium), visibility var(--transition-medium);
}
.sub-modal-backdrop.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sub-modal-container {
  position: relative;
  width: 90%;
  max-width: 600px;
  padding: 32px 40px;
  border-radius: var(--radius-lg);
  background: rgba(11, 16, 38, 0.85);
  border: 1px solid rgba(123, 97, 255, 0.25);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(123, 97, 255, 0.15);
  transform: translateY(0) scale(1);
  transition: transform var(--transition-medium);
}
.sub-modal-backdrop.hidden .sub-modal-container {
  transform: translateY(20px) scale(0.98);
}

.sub-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.sub-modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.sub-modal-header {
  text-align: center;
  margin-bottom: 32px;
}
.sub-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.sub-modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sub-cards-wrapper {
  display: flex;
  gap: 20px;
}

.sub-card {
  flex: 1;
  background: rgba(19, 25, 48, 0.6);
  border: 1px solid rgba(123, 97, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium);
}
.sub-card:hover {
  transform: translateY(-4px);
  border-color: rgba(123, 97, 255, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(123, 97, 255, 0.1);
}

.sub-card.best-value {
  background: rgba(123, 97, 255, 0.08);
  border-color: rgba(123, 97, 255, 0.4);
}
.sub-card.best-value:hover {
  border-color: rgba(123, 97, 255, 0.7);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), 0 0 30px rgba(123, 97, 255, 0.2);
}

.best-value-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #FFD166, #FF9F43);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(255, 159, 67, 0.3);
}

.sub-card-header {
  margin-bottom: 16px;
}
.sub-plan-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.sub-price {
  margin-bottom: 24px;
  display: flex;
  align-items: baseline;
}
.sub-price .currency {
  font-size: 18px;
  color: var(--text-secondary);
  margin-right: 2px;
}
.sub-price .amount {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}
.sub-price .duration {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 4px;
}

.sub-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
  flex: 1;
}
.sub-features li {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  line-height: 1.4;
}
.sub-features li svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.sub-select-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(123, 97, 255, 0.1);
  border: 1px solid rgba(123, 97, 255, 0.3);
  color: var(--text-primary);
}
.sub-select-btn:hover {
  background: rgba(123, 97, 255, 0.2);
  border-color: rgba(123, 97, 255, 0.5);
}

.sub-select-btn.best-value-btn {
  background: linear-gradient(135deg, #7B61FF, #4DA3FF);
  border: none;
  color: #fff;
  box-shadow: 0 4px 15px rgba(123, 97, 255, 0.3);
}
.sub-select-btn.best-value-btn:hover {
  box-shadow: 0 6px 20px rgba(123, 97, 255, 0.4);
  transform: translateY(-2px);
}
