@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Design Tokens (matching landing page) ─────────────────────────────── */
:root {
  --white:        #ffffff;
  --bg:           #f5f5f7;
  --bg-card:      #ffffff;
  --bg-card-2:    #f9f9f7;

  --olive:        #3b5323;
  --olive-mid:    #4a6630;
  --olive-light:  #6b8c54;
  --olive-pale:   #eef2ea;
  --olive-dim:    rgba(59,83,35,.08);
  --olive-border: rgba(59,83,35,.2);
  --olive-glow:   rgba(59,83,35,.25);

  --text:         #1d1d1f;
  --text-2:       #6e6e73;
  --text-3:       #a1a1a6;

  --border:       rgba(0,0,0,.07);
  --border-2:     rgba(0,0,0,.12);

  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --error:        #dc2626;
  --error-bg:     #fef2f2;

  --m0: #ef4444;
  --m1: #f97316;
  --m2: #eab308;
  --m3: #84cc16;
  --m4: #22c55e;

  --shadow-sm:  0 2px 12px rgba(0,0,0,.05), 0 1px 4px rgba(0,0,0,.04);
  --shadow:     0 4px 24px rgba(0,0,0,.07), 0 8px 32px rgba(0,0,0,.05);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.10), 0 24px 80px rgba(0,0,0,.08);

  --r:          14px;
  --r-lg:       20px;
  --r-pill:     100px;

  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --font-head:  'Oswald', sans-serif;
  --mono:       'Consolas', 'Monaco', monospace;

  --ease:       cubic-bezier(0.0,0,0.2,1);
  --transition: .22s var(--ease);

  /* legacy aliases so old markup still works */
  --bg-primary:    var(--bg);
  --bg-secondary:  var(--bg);
  --accent:        var(--olive);
  --accent-dark:   var(--olive-mid);
  --accent-dim:    var(--olive-dim);
  --border-accent: var(--olive-border);
  --radius:        var(--r);
  --radius-lg:     var(--r-lg);
  --text-primary:  var(--text);
  --text-secondary:var(--text-2);
  --text-muted:    var(--text-3);
  --border-light:  var(--border-2);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  overflow-x: hidden;
}
a { color: var(--olive); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--olive-light); }
img { max-width: 100%; display: block; }

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes bar-fill {
  from { width: 0; }
}
@keyframes answer-correct {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(5px); }
  75%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}
@keyframes answer-wrong {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-7px); }
  75%      { transform: translateX(7px); }
}

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 60px;
  background: rgba(255,255,255,.95);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head);
  font-size: 1.1rem; font-weight: 700; letter-spacing: 2px;
  color: var(--text); text-transform: uppercase;
}
.nav-brand img { height: 36px; width: auto; }
.nav-icon { color: var(--olive); font-size: 1.4rem; }
.nav-back {
  color: var(--text-2); font-size: .85rem;
  display: flex; align-items: center; gap: 6px;
  transition: color var(--transition); padding: 6px 12px;
  border: 1px solid transparent; border-radius: var(--r-pill);
}
.nav-back:hover { color: var(--olive); border-color: var(--olive-border); background: var(--olive-dim); }
.nav-center { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: center; }
.nav-user { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-username { color: var(--text-3); font-size: .82rem; font-family: var(--mono); }
#quiz-progress-text { color: var(--olive); font-family: var(--mono); font-weight: 700; font-size: .88rem; }

.mode-badge {
  padding: 4px 14px; border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
}
.mode-learn { background: var(--olive-dim); color: var(--olive); border: 1px solid var(--olive-border); }
.mode-exam  { background: rgba(239,68,68,.1); color: #dc2626; border: 1px solid rgba(239,68,68,.25); }
.chapter-label { color: var(--text-3); font-size: .8rem; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--r-pill);
  border: none;
  font-family: var(--font); font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; letter-spacing: .2px;
}
.btn-primary {
  background: var(--olive);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--olive-mid);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--olive-glow);
}
.btn-outline {
  background: transparent; color: var(--text-2);
  border: 1.5px solid var(--border-2);
}
.btn-outline:hover {
  border-color: var(--olive); color: var(--olive);
  background: var(--olive-dim);
}
.btn-danger {
  background: rgba(220,38,38,.1); color: var(--error);
  border: 1.5px solid rgba(220,38,38,.2);
}
.btn-danger:hover { background: rgba(220,38,38,.18); transform: translateY(-1px); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: .78rem; }
.btn-lg { padding: 14px 32px; font-size: .95rem; }
kbd {
  display: inline-block; padding: 1px 6px;
  background: var(--bg); border: 1px solid var(--border-2);
  border-radius: 6px; font-size: .72rem; font-family: var(--mono);
}

/* ─── Auth Pages ──────────────────────────────────────────────────────────── */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 80px 20px 40px;
  background: var(--bg);
}
.auth-container { width: 100%; max-width: 440px; }

.auth-logo { text-align: center; margin-bottom: 32px; }
.logo-icon { display: inline-block; margin-bottom: 0; }
.logo-sub {
  font-size: .68rem; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--text-3); margin-top: 6px;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow);
  animation: fadeSlideUp .4s ease;
}
.auth-card h2 {
  font-family: var(--font-head);
  font-size: 1.8rem; letter-spacing: 3px; font-weight: 700;
  margin-bottom: 24px; text-align: center; color: var(--text);
}
.auth-switch { text-align: center; margin-top: 20px; color: var(--text-2); font-size: .84rem; }

.auth-features {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; margin-top: 24px;
}
.feature-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: .76rem; color: var(--text-2);
}
.feature-icon { font-size: 1rem; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-size: .78rem; color: var(--text-2); font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 12px 16px;
  background: var(--bg); border: 1.5px solid var(--border-2);
  border-radius: var(--r);
  color: var(--text); font-family: var(--font); font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(59,83,35,.1);
  background: var(--white);
}
.form-group input::placeholder { color: var(--text-3); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select option { background: var(--white); }

/* ─── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--r); margin-bottom: 18px;
  font-size: .88rem; font-weight: 500; animation: fadeIn .3s ease;
}
.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(220,38,38,.2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(22,163,74,.2); }
.alert-info    { background: var(--olive-dim);  color: var(--olive);   border: 1px solid var(--olive-border); }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.main-content { padding: 40px 24px; }
.container { max-width: 1140px; margin: 0 auto; }

/* ─── Dashboard Greeting ──────────────────────────────────────────────────── */
.hero-greeting { margin-bottom: 32px; animation: fadeSlideUp .4s ease; }
.hero-greeting h1 {
  font-family: var(--font-head);
  font-size: 2.2rem; font-weight: 700; letter-spacing: 2px;
  color: var(--text); margin-bottom: 4px;
}
.hero-greeting p { color: var(--text-2); font-size: .95rem; }

/* ─── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 32px; }
@media(max-width:768px) { .stat-cards { grid-template-columns: repeat(2,1fr); } }
@media(max-width:480px) { .stat-cards { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px;
  text-align: center;
  transition: all var(--transition);
  animation: fadeSlideUp .4s ease both;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover {
  border-color: var(--olive-border);
  box-shadow: var(--shadow), 0 0 0 1px var(--olive-border);
  transform: translateY(-2px);
}
.stat-card.accent {
  border-color: var(--olive-border);
  background: linear-gradient(135deg, var(--white), var(--olive-pale));
}
.stat-value { font-size: 2.4rem; font-weight: 800; color: var(--olive); line-height: 1; font-family: var(--font-head); letter-spacing: 1px; }
.stat-label { font-size: .7rem; color: var(--text-2); margin: 8px 0 4px; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; }
.stat-sub   { font-size: .75rem; color: var(--text-3); }

/* ─── Mastery Bar ─────────────────────────────────────────────────────────── */
.mastery-section { margin-bottom: 32px; animation: fadeSlideUp .45s .2s ease both; }
.mastery-section h3 {
  font-size: .72rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.mastery-section h3::after { content: ''; flex: 1; height: 1px; background: var(--border-2); }

.mastery-bar {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg); margin-bottom: 10px;
}
.mastery-seg { transition: width .8s cubic-bezier(.4,0,.2,1); height: 100%; }
.ms0 { background: var(--m0); }
.ms1 { background: var(--m1); }
.ms2 { background: var(--m2); }
.ms3 { background: var(--m3); }
.ms4 { background: var(--m4); }

.mastery-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.mastery-legend-item { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--text-2); }
.mastery-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ─── Progress Bar ────────────────────────────────────────────────────────── */
.progress-section { margin-bottom: 32px; animation: fadeSlideUp .4s .1s ease both; }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: .82rem; color: var(--text-2); }
.progress-bar-bg {
  width: 100%; height: 7px;
  background: var(--border); border-radius: 4px; overflow: hidden;
}
.progress-bar-sm { height: 4px; }
.progress-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--olive-mid), var(--olive-light));
  animation: bar-fill .8s ease;
}

/* ─── Section Headers ─────────────────────────────────────────────────────── */
.section-header {
  font-size: .72rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.section-header::after { content: ''; flex: 1; height: 1px; background: var(--border-2); }

/* ─── Action Grid ─────────────────────────────────────────────────────────── */
.quick-actions { margin-bottom: 32px; }
.action-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
@media(max-width:900px) { .action-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:560px) { .action-grid { grid-template-columns: 1fr; } }

.action-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px;
  text-decoration: none; color: var(--text);
  transition: all var(--transition); display: block; cursor: pointer;
  box-shadow: var(--shadow-sm);
  animation: fadeSlideUp .45s ease both;
}
.action-card:hover {
  border-color: var(--olive-border);
  box-shadow: var(--shadow), 0 0 0 1px var(--olive-border);
  transform: translateY(-3px);
  color: var(--text);
}
.action-card-exam {
  border-color: rgba(220,38,38,.15);
  background: linear-gradient(135deg, var(--white), rgba(220,38,38,.03));
}
.action-card-exam:hover { border-color: rgba(220,38,38,.35); box-shadow: 0 8px 32px rgba(220,38,38,.12); }
.action-card-memory {
  border-color: var(--olive-border);
  background: linear-gradient(135deg, var(--white), var(--olive-pale));
}
.action-card-memory:hover { border-color: var(--olive); box-shadow: 0 8px 32px var(--olive-glow); }
.action-icon { font-size: 2rem; margin-bottom: 14px; }
.action-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.action-desc  { font-size: .8rem; color: var(--text-2); line-height: 1.5; }

/* ─── Chapter List ────────────────────────────────────────────────────────── */
.chapter-breakdown { margin-bottom: 32px; }
.chapter-list {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.chapter-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  animation: fadeSlideUp .45s ease both;
}
.chapter-row:last-child { border-bottom: none; }
.chapter-row:hover { background: var(--bg); }
.chapter-info { flex: 1; }
.chapter-name { font-weight: 600; margin-bottom: 3px; }
.chapter-meta { font-size: .76rem; color: var(--text-3); }
.chapter-progress { width: 180px; text-align: right; }
.chapter-pct { font-size: .88rem; font-weight: 700; color: var(--olive); margin-bottom: 6px; }

.empty-state { padding: 40px; text-align: center; color: var(--text-3); }

/* ─── Quiz Layout ─────────────────────────────────────────────────────────── */
.quiz-main {
  min-height: calc(100vh - 60px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 20px;
  background: var(--bg);
}
.quiz-container { width: 100%; max-width: 820px; }

.quiz-progress {
  width: 100%; height: 3px;
  background: var(--border-2); border-radius: 2px; overflow: hidden; margin-bottom: 24px;
}
.quiz-progress-bar {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--olive-mid), var(--olive-light));
  transition: width .5s ease;
}

.question-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 36px;
  box-shadow: var(--shadow); min-height: 320px;
  animation: fadeSlideUp .35s ease;
}

/* Loading */
.question-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; gap: 18px; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-2); border-top-color: var(--olive);
  border-radius: 50%; animation: spin .75s linear infinite;
}
.question-loading p { color: var(--text-3); font-size: .9rem; }

/* Question Meta */
.question-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.question-chapter {
  padding: 3px 12px; border-radius: var(--r-pill);
  background: var(--olive-dim); border: 1px solid var(--olive-border);
  font-size: .7rem; color: var(--olive); font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
}
.question-num { color: var(--text-3); font-size: .78rem; font-family: var(--mono); }

/* Mastery Indicator */
.mastery-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: .7rem; font-weight: 600; letter-spacing: .4px;
  border: 1px solid transparent;
}
.mi-0 { background: rgba(239,68,68,.08);  color: var(--m0); border-color: rgba(239,68,68,.2); }
.mi-1 { background: rgba(249,115,22,.08); color: var(--m1); border-color: rgba(249,115,22,.2); }
.mi-2 { background: rgba(234,179,8,.08);  color: #a16207;   border-color: rgba(234,179,8,.3); }
.mi-3 { background: rgba(132,204,22,.08); color: #4d7c0f;   border-color: rgba(132,204,22,.25); }
.mi-4 { background: rgba(34,197,94,.08);  color: var(--success); border-color: rgba(34,197,94,.2); }

/* Question Image */
.question-image {
  margin-bottom: 20px; border-radius: var(--r);
  overflow: hidden; border: 1px solid var(--border);
  max-height: 280px; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.question-image img { max-width: 100%; max-height: 280px; object-fit: contain; }

.question-text {
  font-size: 1.1rem; font-weight: 600; line-height: 1.65;
  margin-bottom: 26px; color: var(--text);
}

/* ─── Answer Buttons ──────────────────────────────────────────────────────── */
.answers-grid { display: flex; flex-direction: column; gap: 10px; }

.answer-btn {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px;
  background: var(--bg); border: 1.5px solid var(--border-2);
  border-radius: var(--r);
  color: var(--text); font-family: var(--font); font-size: .93rem;
  text-align: left; cursor: pointer;
  transition: all var(--transition); width: 100%;
}
.answer-btn:hover:not(:disabled) {
  border-color: var(--olive);
  background: var(--olive-pale);
  transform: translateX(4px);
}
.answer-btn:disabled { cursor: default; }

.answer-key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px;
  background: var(--white); border: 1.5px solid var(--border-2);
  border-radius: 8px; font-weight: 700; font-size: .8rem;
  color: var(--text-2); flex-shrink: 0; font-family: var(--mono);
  transition: all var(--transition);
}
.answer-text { padding-top: 4px; line-height: 1.5; }

.answer-btn.selected {
  border-color: var(--olive); background: var(--olive-pale);
}
.answer-btn.selected .answer-key {
  background: var(--olive); border-color: var(--olive); color: #ffffff;
}
.answer-btn.correct {
  border-color: #16a34a; background: var(--success-bg);
  animation: answer-correct .4s ease;
}
.answer-btn.correct .answer-key { background: #16a34a; border-color: #16a34a; color: #fff; }
.answer-btn.wrong {
  border-color: var(--error); background: var(--error-bg);
  animation: answer-wrong .4s ease;
}
.answer-btn.wrong .answer-key { background: var(--error); border-color: var(--error); color: #fff; }
.answer-btn.info-card { cursor: default; pointer-events: none; background: var(--olive-pale); }
.answer-btn.info-card-hidden { display: none !important; }

/* ─── Explanation Box ─────────────────────────────────────────────────────── */
.explanation-box {
  margin-top: 20px; padding: 20px; border-radius: var(--r);
  border: 1px solid var(--border-2); background: var(--bg);
  animation: fadeSlideUp .3s ease;
}
.explanation-box.correct-box { border-color: rgba(22,163,74,.2); background: var(--success-bg); }
.explanation-box.wrong-box   { border-color: rgba(220,38,38,.2); background: var(--error-bg); }

.explanation-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  font-weight: 700; font-size: .95rem;
}
.mastery-advance {
  font-size: .7rem; padding: 2px 10px; border-radius: var(--r-pill);
  background: var(--olive-dim); color: var(--olive); border: 1px solid var(--olive-border);
  font-weight: 600; letter-spacing: .4px;
}

#explanation-text { color: var(--text-2); font-size: .88rem; line-height: 1.65; margin-bottom: 18px; }
.explanation-actions { display: flex; justify-content: flex-end; }

/* ─── Exam ────────────────────────────────────────────────────────────────── */
.exam-submit-zone { display: flex; justify-content: center; margin-top: 22px; }

.exam-result {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 60px); padding: 24px;
  background: var(--bg);
}
.result-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 52px 44px;
  text-align: center; max-width: 520px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeSlideUp .5s ease;
}
.result-icon { font-size: 4rem; margin-bottom: 18px; }
.result-card h2 { font-family: var(--font-head); font-size: 1.8rem; letter-spacing: 3px; margin-bottom: 22px; font-weight: 700; }
.result-score { font-family: var(--font-head); font-size: 4rem; font-weight: 800; color: var(--olive); letter-spacing: 2px; line-height: 1; margin-bottom: 10px; }
.result-details { color: var(--text-2); margin-bottom: 32px; font-size: .95rem; line-height: 2; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ─── Admin ───────────────────────────────────────────────────────────────── */
.admin-mobile-subnav { display: none; }
@media(max-width:480px) {
  .admin-mobile-subnav {
    display: flex; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 60px; z-index: 199;
    backdrop-filter: blur(12px);
  }
  .admin-mobile-subnav .btn { flex: 1; justify-content: center; }
}

.admin-nav-badge {
  background: rgba(220,38,38,.1); color: #dc2626;
  border: 1px solid rgba(220,38,38,.2);
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
}

.admin-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 32px; }
@media(max-width:768px) { .admin-grid { grid-template-columns: repeat(2,1fr); } }

.admin-stat {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px; text-align: center;
  transition: all var(--transition); animation: fadeSlideUp .4s ease both;
  box-shadow: var(--shadow-sm);
}
.admin-stat:hover { border-color: var(--olive-border); transform: translateY(-2px); box-shadow: var(--shadow); }
.admin-stat-val { font-size: 2rem; font-weight: 800; color: var(--olive); font-family: var(--font-head); letter-spacing: 1px; }
.admin-stat-lbl { font-size: .7rem; color: var(--text-2); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 6px; font-weight: 700; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  text-align: left; padding: 12px 16px;
  background: var(--bg); border-bottom: 1px solid var(--border-2);
  color: var(--text-2); font-weight: 700; text-transform: uppercase;
  font-size: .7rem; letter-spacing: 1px;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg); }
.data-table tr:last-child td { border-bottom: none; }

.table-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; overflow-x: auto;
  box-shadow: var(--shadow-sm); animation: fadeSlideUp .45s ease;
}

/* Filter bar */
.filter-bar { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select {
  background: var(--white); border: 1.5px solid var(--border-2);
  border-radius: var(--r); padding: 8px 14px; color: var(--text);
  font-family: var(--font); font-size: .88rem; outline: none;
  transition: border-color var(--transition);
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--olive); }
.filter-bar input { flex: 1; min-width: 200px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); font-size: .7rem; font-weight: 700; letter-spacing: .5px; }
.badge-admin   { background: rgba(220,38,38,.1);  color: #dc2626; border: 1px solid rgba(220,38,38,.2); }
.badge-user    { background: var(--olive-dim);     color: var(--olive); border: 1px solid var(--olive-border); }
.badge-chapter { background: rgba(99,102,241,.1);  color: #6366f1; border: 1px solid rgba(99,102,241,.2); }

/* Page header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; letter-spacing: 2px; }

/* Settings */
.settings-card {
  max-width: 560px; margin: 0 auto;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 32px;
  box-shadow: var(--shadow-sm);
  animation: fadeSlideUp .4s ease;
}
.settings-card h2 { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; letter-spacing: 2px; margin-bottom: 24px; }

/* Pagination */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.page-btn {
  padding: 6px 14px; border-radius: var(--r-pill); border: 1.5px solid var(--border-2);
  background: var(--white); color: var(--text-2); font-size: .85rem; cursor: pointer;
  transition: all var(--transition); text-decoration: none;
}
.page-btn:hover, .page-btn.active { border-color: var(--olive); color: var(--olive); background: var(--olive-pale); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
.nav-brand-short { display: none; }

@media(max-width:768px) {
  .navbar { padding: 0 16px; gap: 8px; }
  .nav-brand-full  { display: none; }
  .nav-brand-short { display: inline; font-family: var(--font-head); font-size: 1rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
  .nav-username    { display: none; }
  .main-content    { padding: 24px 16px; }
}
@media(max-width:480px) {
  .navbar { padding: 0 12px; }
  .nav-settings-link { display: none; }
  .nav-admin-extra   { display: none; }
  .nav-user { gap: 6px; }
}
@media(max-width:600px) {
  .question-card  { padding: 20px 16px; }
  .question-text  { font-size: 1rem; }
  .nav-center .chapter-label { display: none; }
  .auth-features  { flex-direction: column; align-items: stretch; }
  .mastery-legend { gap: 10px; }
}
