/* Existing styles from index.html */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --navy: #0B1E3D;
  --blue: #1A3F7A;
  --orange: #F5A623;
  --teal: #00C2B2;
  --light: #F4F6FB;
  --white: #FFFFFF;
  --gray: #8898AA;
  --border: #E2E8F4;
  --success: #22C55E;
  --error: #EF4444;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--light);
  color: var(--navy);
  min-height: 100vh;
}

/* HEADER */
.header {
  background: var(--navy);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: white;
  letter-spacing: -0.5px;
}
.logo span { color: var(--orange); }
.header-badge {
  background: rgba(245,166,35,0.15);
  border: 1px solid rgba(245,166,35,0.3);
  color: var(--orange);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* AUTH OVERLAY */
#auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 400px;
  width: calc(100% - 40px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(11,30,61,0.12);
}
.auth-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: var(--navy);
  margin-bottom: 6px;
}
.auth-logo span { color: var(--orange); }
.auth-tagline {
  font-size: 12px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}
.auth-divider { height: 1px; background: var(--border); margin: 28px 0; }
.auth-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.auth-sub {
  font-size: 13.5px;
  color: var(--gray);
  line-height: 1.6;
  margin-bottom: 24px;
}
.ms-signin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 13px 24px;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.ms-signin-btn:hover { background: var(--blue); }
.ms-signin-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 0 4px;
}
.auth-loading.visible { display: flex; }
.auth-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.auth-loading-text { font-size: 13px; color: var(--gray); }
#user-info button {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
#user-info button:hover { background: rgba(255,255,255,0.2); }

/* LAYOUT */
.container { display: flex; min-height: calc(100vh - 64px); }

/* SIDEBAR */
.sidebar {
  width: 280px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-title {
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray);
  padding: 0 24px 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  font-size: 13.5px;
  font-weight: 400;
  color: #444;
}
.nav-item:hover { background: var(--light); color: var(--navy); }
.nav-item.locked {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}
.nav-item.locked .nav-num { background: var(--light); border-color: var(--border); color: var(--gray); }
.nav-item.active {
  background: rgba(26,63,122,0.06);
  border-left-color: var(--orange);
  color: var(--navy);
  font-weight: 500;
}
.nav-item.completed .nav-num { background: var(--success) !important; color: white !important; }
.nav-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--light);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray);
  flex-shrink: 0;
  font-family: 'Syne', sans-serif;
}
.nav-item.active .nav-num { background: var(--orange); border-color: var(--orange); color: white; }
.nav-divider { height: 1px; background: var(--border); margin: 16px 24px; }
.quiz-nav {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  margin: 0 16px;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s;
}
.quiz-nav:hover { transform: translateY(-1px); }
.quiz-nav.locked {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}
.quiz-nav-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: white;
  margin-bottom: 4px;
}
.quiz-nav-sub { font-size: 12px; color: rgba(255,255,255,0.6); }
.quiz-nav-icon { font-size: 24px; margin-bottom: 8px; }

/* MAIN */
.main {
  flex: 1;
  padding: 40px 48px;
  max-width: 860px;
}

/* MODULE PAGE */
.module-page { display: none; animation: fadeIn 0.3s ease; }
.module-page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.module-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--orange);
  margin-bottom: 12px;
}
.module-tag::before { content: ''; width: 20px; height: 2px; background: var(--orange); border-radius: 2px; }

h1 {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--navy);
  margin-bottom: 16px;
}

.module-intro {
  font-size: 16px;
  line-height: 1.7;
  color: #555;
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin: 32px 0 12px;
}

p { font-size: 15px; line-height: 1.75; color: #444; margin-bottom: 16px; }

.highlight-box {
  background: linear-gradient(135deg, rgba(26,63,122,0.05), rgba(0,194,178,0.05));
  border: 1px solid rgba(26,63,122,0.12);
  border-left: 4px solid var(--teal);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: #333;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.stat-num {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-num span { color: var(--orange); }
.stat-label { font-size: 12px; color: var(--gray); line-height: 1.4; }

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.pill {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
}
.pill.orange { background: rgba(245,166,35,0.1); border-color: rgba(245,166,35,0.3); color: #9A6200; }
.pill.teal { background: rgba(0,194,178,0.1); border-color: rgba(0,194,178,0.3); color: #007A72; }

.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card-icon { font-size: 24px; margin-bottom: 10px; }
.card-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; color: var(--navy); margin-bottom: 8px; }
.card-body { font-size: 13.5px; line-height: 1.6; color: #555; }

.step-list { margin: 20px 0; }
.step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.step:last-child { border-bottom: none; }
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-content h3 { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.step-content p { font-size: 13.5px; margin: 0; }

.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--blue); }
.btn-secondary { background: var(--light); color: var(--navy); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-orange { background: var(--orange); color: white; }
.btn-orange:hover { background: #D4891A; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 8px;
  color: #166534;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.complete-btn:hover { background: rgba(34,197,94,0.2); }
.complete-btn.done { background: var(--success); color: white; border-color: var(--success); cursor: default; }

/* QUIZ PAGE */
.quiz-header {
  background: linear-gradient(135deg, var(--navy) 0%, #1A3F7A 100%);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
  color: white;
}
.quiz-header h1 { color: white; font-size: 28px; margin-bottom: 8px; }
.quiz-header p { color: rgba(255,255,255,0.7); font-size: 15px; margin: 0; }

.progress-bar-wrap { background: rgba(255,255,255,0.1); border-radius: 4px; height: 6px; margin-top: 20px; }
.progress-bar-fill { height: 6px; border-radius: 4px; background: var(--orange); transition: width 0.4s ease; }

.question-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
}
.q-num { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--gray); margin-bottom: 8px; }
.q-text { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; color: var(--navy); margin-bottom: 20px; line-height: 1.4; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14.5px;
  color: #444;
}
.option:hover:not(.disabled) { border-color: var(--blue); background: rgba(26,63,122,0.03); }
.option.selected { border-color: var(--blue); background: rgba(26,63,122,0.05); }
.option.correct { border-color: var(--success); background: rgba(34,197,94,0.08); color: #166534; }
.option.incorrect { border-color: var(--error); background: rgba(239,68,68,0.08); color: #991B1B; }
.option.disabled { cursor: default; }
.opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--light);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  flex-shrink: 0;
}
.option.correct .opt-letter { background: var(--success); border-color: var(--success); color: white; }
.option.incorrect .opt-letter { background: var(--error); border-color: var(--error); color: white; }
.option.selected .opt-letter { background: var(--blue); border-color: var(--blue); color: white; }

.explanation {
  background: rgba(0,194,178,0.06);
  border: 1px solid rgba(0,194,178,0.2);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #166665;
  display: none;
}
.explanation.visible { display: block; }

.score-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  display: none;
}
.score-card.visible { display: block; }
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.score-pct { font-family: 'Syne', sans-serif; font-size: 32px; font-weight: 800; color: white; }
.score-label-sm { font-size: 11px; color: rgba(255,255,255,0.7); }
.score-card h2 { font-family: 'Syne', sans-serif; font-size: 24px; margin-bottom: 8px; }
.score-card p { font-size: 15px; color: #666; max-width: 400px; margin: 0 auto 24px; }

.share-box {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0;
  text-align: left;
}
.share-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; color: var(--navy); margin-bottom: 12px; }
.share-text {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #444;
  margin-bottom: 12px;
  font-style: italic;
}
.copy-btn {
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { background: var(--blue); }
.copy-btn.copied { background: var(--success); }

.breakdown-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; text-align: left; }
.bd-item {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bd-icon { font-size: 20px; }
.bd-label { font-size: 12px; color: var(--gray); }
.bd-val { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; color: var(--navy); }

/* WELCOME */
.welcome-page { display: none; }
.welcome-page.active { display: block; }
.welcome-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1A3F7A 60%, #0D3060 100%);
  border-radius: 20px;
  padding: 48px;
  color: white;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.welcome-hero::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: rgba(245,166,35,0.08);
  pointer-events: none;
}
.welcome-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--orange);
  margin-bottom: 12px;
}
.welcome-hero h1 { color: white; font-size: 36px; line-height: 1.15; margin-bottom: 16px; }
.welcome-hero p { color: rgba(255,255,255,0.75); font-size: 16px; line-height: 1.7; max-width: 480px; margin-bottom: 28px; }
.module-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.how-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}
.how-icon { font-size: 32px; margin-bottom: 12px; }
.how-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; color: var(--navy); margin-bottom: 8px; }
.how-body { font-size: 13px; color: #666; line-height: 1.5; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 24px 20px; }
  .stat-grid, .card-grid, .breakdown-grid, .how-grid { grid-template-columns: 1fr; }
}