@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,800;1,400;1,600&family=Inter:wght@400;500;600;700&display=swap');

/* ===========================
   STUDIFY — Shared Styles
   Navy Blue + Light Cream
=========================== */

:root {
  --navy:        #1B3A6B;
  --navy-dark:   #0F2444;
  --navy-mid:    #243F75;
  --navy-light:  #2E5499;
  --cream:       #FDF8F0;
  --cream-2:     #F2EAD8;
  --cream-3:     #E6D9C0;
  --gold:        #C8942A;
  --gold-light:  #E8B84B;
  --text-dark:   #1A202C;
  --text-mid:    #4A5568;
  --text-light:  #718096;
  --white:       #FFFFFF;
  --success:     #2D7D46;
  --error:       #C53030;
  --shadow-sm:   0 2px 8px rgba(15,36,68,0.08);
  --shadow-md:   0 4px 20px rgba(15,36,68,0.12);
  --shadow-lg:   0 8px 40px rgba(15,36,68,0.18);
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6,
.section-title, .logo, .hero h1 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

/* ── NAV ── */
nav {
  background: var(--navy-dark);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.logo span { color: var(--cream); }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: 'Playfair Display', Georgia, serif;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--white); }
.nav-links a.active {
  padding-bottom: 2px;
  border-bottom: 2px solid var(--cream);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--navy-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-secondary {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
}
.btn-secondary:hover {
  background: var(--navy);
  color: var(--white);
}
.btn-gold {
  background: var(--cream);
  color: var(--navy-dark);
  box-shadow: var(--shadow-sm);
}
.btn-gold:hover {
  background: var(--cream-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-lg { padding: 16px 36px; font-size: 1.1rem; }
.btn-sm { padding: 8px 18px; font-size: 0.875rem; }

/* ── CONTAINERS ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--cream-3);
}

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-navy   { background: rgba(27,58,107,0.12); color: var(--navy); }
.badge-gold   { background: rgba(15,36,68,0.08); color: var(--navy); }
.badge-green  { background: rgba(45,125,70,0.12); color: var(--success); }
.badge-purple { background: rgba(107,70,193,0.12); color: #6B46C1; }

/* ── FORM ELEMENTS ── */
input[type="number"], input[type="text"], select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--cream-3);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--cream);
  color: var(--text-dark);
  transition: border-color 0.2s;
  appearance: none;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--navy);
  background: var(--white);
}
label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-mid);
  margin-bottom: 6px;
}
.form-group { margin-bottom: 20px; }
.form-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ── FOOTER ── */
footer {
  background: var(--cream-2);
  color: var(--text-mid);
  padding: 40px 2rem;
  margin-top: 0;
  text-align: center;
  border-top: 1px solid var(--cream-3);
}
footer .logo { font-size: 1.2rem; color: var(--navy-dark); }
footer .logo span { color: var(--navy); }
footer p { margin-top: 8px; font-size: 0.875rem; color: var(--text-mid); }
footer a { color: var(--text-mid); text-decoration: none; }
footer a:hover { color: var(--navy-dark); }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-mid) 100%);
  color: var(--white);
  padding: 100px 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(253,248,240,0.06) 0%, transparent 60%);
}
.hero-inner { position: relative; max-width: 800px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -1px;
}
.hero h1 .highlight { color: var(--cream-2); }
.hero p {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.85);
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.hero-ctas { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ── FEATURE CARDS ── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.feature-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--cream-3);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.feature-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 24px;
}
.icon-navy   { background: rgba(27,58,107,0.1); }
.icon-gold   { background: rgba(27,58,107,0.08); }
.feature-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin-bottom: 12px;
}
.feature-card p {
  color: var(--text-mid);
  font-size: 0.975rem;
  line-height: 1.7;
  margin-bottom: 24px;
}

/* ── STATS BAR ── */
.stats-bar {
  background: var(--navy);
  padding: 32px 2rem;
}
.stats-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 24px;
}
.stat { text-align: center; color: var(--white); }
.stat-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--cream);
  line-height: 1;
  font-family: 'Playfair Display', Georgia, serif;
}
.stat-label {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  margin-top: 6px;
}

/* ── PAGE HEADER ── */
.page-header {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  color: var(--white);
  padding: 60px 2rem;
}
.page-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}
.page-header p {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.8);
  max-width: 600px;
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--cream-2);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
}
.tab-btn {
  padding: 10px 24px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-mid);
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--white);
  color: var(--navy-dark);
  box-shadow: var(--shadow-sm);
}

/* ── RESULTS PANEL ── */
.result-panel {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  color: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  display: none;
}
.result-panel.visible { display: block; }
.result-panel h3 {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 8px;
  font-weight: 500;
}
.result-score {
  font-size: 4rem;
  font-weight: 800;
  color: var(--cream);
  line-height: 1;
  margin-bottom: 4px;
  font-family: 'Playfair Display', Georgia, serif;
}
.result-label {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 24px;
}
.result-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.breakdown-item { text-align: center; }
.breakdown-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
}
.breakdown-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}
.result-note {
  margin-top: 20px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
}

/* ── PROGRESS BAR ── */
.progress-bar-wrap {
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  height: 10px;
  margin: 16px 0;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--cream-2), var(--cream));
  transition: width 0.6s ease;
}

/* ── QUESTION BANK ── */
.qbank-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}
.filters-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--cream-3);
  position: sticky;
  top: 80px;
}
.filters-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--cream-2);
}
.filter-group { margin-bottom: 20px; }
.filter-group label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 8px;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--cream-3);
  background: var(--cream);
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--navy); color: var(--navy); }
.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.questions-area h3 {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 16px;
  font-weight: 500;
}
.q-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.q-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--cream-3);
  border-left: 4px solid var(--navy);
  transition: box-shadow 0.2s;
}
.q-card:hover { box-shadow: var(--shadow-md); }
.q-card.topic-calculus { border-left-color: #2E5499; }
.q-card.topic-functions { border-left-color: #8B6914; }
.q-card.topic-probability { border-left-color: #2D7D46; }
.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.q-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin-bottom: 8px;
}
.q-content {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.65;
  font-family: 'Georgia', serif;
}
.q-expand-btn {
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.q-expand-btn:hover { text-decoration: underline; }
.q-full { display: none; margin-top: 12px; }
.q-full.open { display: block; }
.search-bar-wrap {
  position: relative;
  margin-bottom: 24px;
}
.search-bar-wrap input {
  padding-left: 44px;
  font-size: 1rem;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 1.1rem;
  pointer-events: none;
}
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.no-results p { font-size: 1.1rem; margin-top: 8px; }

/* ── TOPIC LEGEND ── */
.topic-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-mid);
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .features-grid { grid-template-columns: 1fr; }
  .qbank-layout { grid-template-columns: 1fr; }
  .filters-panel { position: static; }
  .hero h1 { font-size: 2rem; }
  .result-breakdown { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
}

/* ── PROFILE DROPDOWN ── */
#profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--cream-3);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  padding: 18px 16px 14px;
  min-width: 210px;
  z-index: 2000;
  text-align: center;
}
.pd-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-family: 'Playfair Display', serif;
}
.pd-email {
  font-size: 0.82rem;
  color: var(--text-mid);
  margin-bottom: 14px;
  word-break: break-all;
}
.pd-divider {
  border: none;
  border-top: 1px solid var(--cream-3);
  margin: 0 0 12px;
}
.pd-btn {
  width: 100%;
  padding: 8px;
  background: none;
  border: 1.5px solid var(--cream-3);
  border-radius: 6px;
  color: var(--text-mid);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.pd-btn:hover { border-color: var(--navy); color: var(--navy-dark); }

/* ── AUTH NAV BUTTON ── */
.nav-auth-btn {
  background: rgba(255,255,255,0.12);
  color: var(--white) !important;
  border: 1.5px solid rgba(255,255,255,0.3) !important;
  border-radius: 6px;
  padding: 6px 16px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.nav-auth-btn:hover {
  background: rgba(255,255,255,0.22) !important;
  border-color: rgba(255,255,255,0.55);
  color: var(--white) !important;
}

/* ── AUTH MODAL ── */
#authModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.auth-modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
}
.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
}
.auth-modal-close:hover { color: #555; }
.auth-modal-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy-dark);
  margin-bottom: 20px;
  text-align: center;
}
.auth-modal-logo span { color: var(--navy); }
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--cream-3);
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-mid);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.auth-tab:hover { color: var(--navy); }
.auth-tab-active {
  color: var(--navy-dark) !important;
  border-bottom-color: var(--navy-dark) !important;
}
.auth-field {
  margin-bottom: 14px;
}
.auth-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--cream-3);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--navy-dark);
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--navy);
}
.auth-submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--navy-dark);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.2s;
  font-family: inherit;
}
.auth-submit-btn:hover { background: var(--navy); }
.auth-error {
  color: #c0392b;
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 18px;
}
.auth-success {
  color: #27ae60;
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 18px;
}
