/* ============================================================
   IRIS GATE — Shared Stylesheet
   Iris Tutoring Centre | GATE Year 6 Exam Prep Platform
   ============================================================ */

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

:root {
  --primary:        #1A4731;
  --primary-dark:   #0f2c1e;
  --primary-mid:    #245e41;
  --primary-light:  #2d7a55;
  --primary-soft:   #e8f5ee;
  --gold:           #B8903C;
  --gold-light:     #d4a84e;
  --gold-dark:      #9a7630;
  --gold-soft:      #fef3c7;
  --white:          #ffffff;
  --bg:             #f0f5f2;
  --bg2:            #e8f0eb;
  --text:           #111827;
  --text-mid:       #374151;
  --text-muted:     #6b7280;
  --border:         #dde6e0;
  --success:        #059669;
  --success-soft:   #d1fae5;
  --danger:         #dc2626;
  --danger-soft:    #fee2e2;
  --warning:        #d97706;
  --warning-soft:   #fef3c7;
  --sidebar-w:      72px;
  --topbar-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
  --shadow-md:      0 4px 24px rgba(26,71,49,.12);
  --shadow-lg:      0 8px 40px rgba(26,71,49,.16);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   SIDEBAR — Icon-only slim rail (72px)
   Completely different from any competitor's wide text sidebar.
   ============================================================ */

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--primary-dark);
  display: flex; flex-direction: column;
  align-items: center;
  z-index: 200; overflow: visible;
  border-right: 1px solid rgba(255,255,255,.06);
}

/* Logo mark — no text, centered */
.sb-logo {
  padding: 18px 0 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  width: 100%; display: flex; justify-content: center;
}
.sb-logo-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-light));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(184,144,60,.45);
  flex-shrink: 0;
}

/* Icon nav — centered column */
.sb-nav {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 12px 0; gap: 4px; width: 100%;
}

/* Thin divider between sections */
.sb-divider {
  width: 28px; height: 1px; background: rgba(255,255,255,.1);
  margin: 6px auto;
}

/* Individual icon button */
.sb-item {
  position: relative;
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.45); text-decoration: none;
  transition: all .18s; cursor: pointer; flex-shrink: 0;
}
.sb-item:hover { background: rgba(255,255,255,.09); color: rgba(255,255,255,.9); }
.sb-item.active {
  background: var(--gold);
  color: white;
  box-shadow: 0 3px 14px rgba(184,144,60,.5);
}
.sb-item svg { display: block; }

/* Tooltip — appears to the right */
.sb-item::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--text); color: white;
  padding: 6px 12px; border-radius: 7px;
  font-size: .76rem; font-weight: 700; white-space: nowrap;
  font-family: 'Inter', sans-serif;
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
  transform: translateY(-50%) translateX(-4px);
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  z-index: 300;
}
.sb-item::before {
  content: '';
  position: absolute; left: calc(100% + 6px); top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--text);
  opacity: 0; pointer-events: none; transition: opacity .15s;
  z-index: 300;
}
.sb-item:hover::after  { opacity: 1; transform: translateY(-50%) translateX(0); }
.sb-item:hover::before { opacity: 1; }

/* Bottom user area */
.sb-bottom {
  padding: 10px 0 14px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-mid), var(--primary-light));
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: .72rem; font-weight: 800; cursor: default;
}

.sb-logout {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.3); cursor: pointer; transition: all .18s;
  text-decoration: none; position: relative;
}
.sb-logout:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); }
.sb-logout::after {
  content: 'Sign Out';
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--text); color: white; padding: 6px 12px; border-radius: 7px;
  font-size: .76rem; font-weight: 700; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 300;
}
.sb-logout:hover::after { opacity: 1; }

/* Upgrade dot — gold pulsing dot for free users */
.sb-upgrade {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-light); cursor: pointer; transition: all .18s;
  position: relative;
}
.sb-upgrade:hover { background: rgba(184,144,60,.15); }
.sb-upgrade::after {
  content: 'Unlock Premium';
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--gold-dark); color: white; padding: 6px 12px; border-radius: 7px;
  font-size: .76rem; font-weight: 700; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 300;
}
.sb-upgrade:hover::after { opacity: 1; }
.sb-upgrade-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--gold);
  position: absolute; top: 6px; right: 6px;
  animation: sb-pulse 2s ease-in-out infinite;
}
@keyframes sb-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(184,144,60,.6); }
  50%      { box-shadow: 0 0 0 5px rgba(184,144,60,0); }
}

/* ── Keep old classes working (fallback) ── */
.upgrade-banner { display: none; }
.sidebar-nav    { display: none; }
.sidebar-logo   { display: none; }
.sidebar-user   { display: none; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-mid), var(--primary-light));
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: .78rem; font-weight: 800;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */

.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: white; border-bottom: 1px solid var(--border);
  height: var(--topbar-h); padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}
.topbar-left { display: flex; flex-direction: column; }
.topbar-left h2 { font-size: 1.05rem; font-weight: 800; color: var(--text); line-height: 1; }
.topbar-left p { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.tier-pill {
  padding: 5px 12px; border-radius: 20px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
}
.tier-pill.free { background: var(--bg); border: 1.5px solid var(--border); color: var(--text-muted); }
.tier-pill.premium { background: var(--gold-soft); border: 1.5px solid var(--gold-light); color: var(--gold-dark); }

.topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: .78rem; font-weight: 800; cursor: pointer;
  transition: border-color .2s;
}
.topbar-avatar:hover { border-color: var(--gold); }

.page-content { padding: 28px; flex: 1; }

/* ============================================================
   STAT CARDS
   ============================================================ */

.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 28px; }

.stat-card {
  background: white; border-radius: var(--radius); padding: 18px 20px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.stat-card .s-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 10px;
}
.s-icon.green { background: var(--primary-soft); }
.s-icon.gold  { background: var(--gold-soft); }
.s-icon.blue  { background: #dbeafe; }
.s-icon.red   { background: #fee2e2; }
.stat-card .s-val { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat-card .s-label { font-size: .76rem; color: var(--text-muted); margin-top: 3px; }
.stat-card .s-note { font-size: .7rem; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.s-note.up { color: var(--success); }
.s-note.down { color: var(--danger); }

/* ============================================================
   CARDS & SECTIONS
   ============================================================ */

.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h3 { font-size: .95rem; font-weight: 800; }
.section-head a { font-size: .8rem; color: var(--primary); font-weight: 600; text-decoration: none; }
.section-head a:hover { text-decoration: underline; }

.card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 22px; }
.card-header {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h4 { font-size: .9rem; font-weight: 800; }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 700; cursor: pointer;
  border: none; text-decoration: none; transition: all .18s;
  font-family: inherit; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-mid); box-shadow: 0 4px 12px rgba(26,71,49,.3); }
.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { background: var(--gold-light); box-shadow: 0 4px 12px rgba(184,144,60,.35); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-mid); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm  { padding: 6px 13px; font-size: .78rem; }
.btn-lg  { padding: 12px 28px; font-size: .95rem; }
.btn-xl  { padding: 15px 36px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */

.progress { height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; transition: width .5s ease; }
.progress-bar.green { background: var(--primary); }
.progress-bar.gold  { background: var(--gold); }
.progress-bar.blue  { background: #3b82f6; }
.progress-bar.red   { background: var(--danger); }

/* ============================================================
   TOPIC / SUBJECT CARDS (Question Bank)
   ============================================================ */

.topic-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

.topic-card {
  background: white; border-radius: var(--radius); padding: 22px;
  border: 2px solid var(--border); cursor: pointer;
  transition: all .2s; position: relative; overflow: hidden;
}
.topic-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  opacity: 0; transition: opacity .2s;
}
.topic-card.reading::before  { background: #3b82f6; opacity: 1; }
.topic-card.numerical::before { background: var(--primary); opacity: 1; }
.topic-card.abstract::before  { background: var(--gold); opacity: 1; }
.topic-card.writing::before   { background: #8b5cf6; opacity: 1; }

.topic-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.topic-card.locked { cursor: default; }
.topic-card.locked:hover { transform: none; border-color: var(--border); box-shadow: none; }

.tc-icon { font-size: 30px; margin-bottom: 12px; }
.tc-title { font-size: .95rem; font-weight: 800; margin-bottom: 3px; }
.tc-desc  { font-size: .78rem; color: var(--text-muted); margin-bottom: 14px; }
.tc-meta  { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; color: var(--text-muted); margin-bottom: 8px; }

.lock-overlay {
  position: absolute; inset: 0;
  background: rgba(240,245,242,.88);
  backdrop-filter: blur(2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; border-radius: var(--radius);
}
.lock-overlay .lo-icon { font-size: 28px; }
.lock-overlay h4 { font-size: .85rem; font-weight: 800; color: var(--text-mid); }
.lock-overlay p { font-size: .75rem; color: var(--text-muted); text-align: center; padding: 0 20px; }
.lock-overlay .btn { margin-top: 4px; }

/* ============================================================
   QUESTION INTERFACE
   ============================================================ */

.q-layout { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }

.q-nav-panel { background: white; border-radius: var(--radius); border: 1px solid var(--border); padding: 16px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.q-nav-title { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: 10px; }
.q-nav-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
.q-nav-btn {
  aspect-ratio: 1; width: 100%; border-radius: 6px;
  border: 1.5px solid var(--border); background: white;
  font-size: .76rem; font-weight: 700; cursor: pointer; transition: all .15s;
}
.q-nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.q-nav-btn.active  { background: var(--primary); border-color: var(--primary); color: white; }
.q-nav-btn.answered { background: #EEF2FF; border-color: #6366F1; color: #4338CA; }
.q-nav-btn.correct { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.q-nav-btn.wrong   { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.q-nav-btn.seen    { background: var(--bg); }
.q-nav-legend { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.q-nav-legend .leg { display: flex; align-items: center; gap: 6px; font-size: .68rem; color: var(--text-muted); }
.q-nav-legend .leg-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

.q-card { background: white; border-radius: var(--radius); border: 1px solid var(--border); padding: 28px; box-shadow: var(--shadow); }
.q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.q-num { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.q-diff { padding: 3px 10px; border-radius: 20px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.q-diff.easy   { background: var(--success-soft); color: var(--success); }
.q-diff.medium { background: var(--warning-soft); color: var(--warning); }
.q-diff.hard   { background: var(--danger-soft); color: var(--danger); }
.q-subject { margin-left: auto; font-size: .72rem; color: var(--text-muted); font-weight: 600; }

.q-passage {
  background: var(--bg); border-left: 4px solid var(--primary);
  padding: 16px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 22px; font-size: .88rem; line-height: 1.85; color: var(--text-mid);
  font-style: italic;
}
.q-passage strong { font-style: normal; color: var(--text); }
.q-passage.q-passage-img {
  background: #FAFAFA;
  border-left: none;
  border: 1px solid #E5EBF0;
  padding: 16px;
  border-radius: 12px;
  font-style: normal;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}
.q-passage.q-passage-img img {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 240px;
  max-height: 460px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.q-stem { font-size: 1rem; font-weight: 600; line-height: 1.65; margin-bottom: 4px; }

.q-options { list-style: none; margin-top: 18px; display: flex; flex-direction: column; gap: 9px; }
.q-option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px; border-radius: var(--radius-sm); border: 2px solid var(--border);
  cursor: pointer; transition: all .15s; font-size: .9rem; font-weight: 500;
}
.q-option:hover { border-color: var(--primary-light); background: var(--primary-soft); }
.q-option.selected { border-color: var(--primary); background: var(--primary-soft); }
.q-option.selected-only { border-color: #6366F1; background: #EEF2FF; cursor: default; }
.q-option.correct   { border-color: var(--success); background: var(--success-soft); cursor: default; }
.q-option.incorrect { border-color: var(--danger); background: var(--danger-soft); cursor: default; }

.opt-badge {
  min-width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  border: 2px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; color: var(--text-muted); transition: all .15s;
}
.q-option.selected       .opt-badge { background: var(--primary); border-color: var(--primary); color: white; }
.q-option.selected-only  .opt-badge { background: #6366F1; border-color: #6366F1; color: white; }
.q-option.correct        .opt-badge { background: var(--success); border-color: var(--success); color: white; }
.q-option.incorrect      .opt-badge { background: var(--danger); border-color: var(--danger); color: white; }

.q-feedback {
  margin-top: 16px; padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: .875rem; line-height: 1.55; display: none;
}
.q-feedback.show { display: block; }
.q-feedback.correct   { background: var(--success-soft); border: 1px solid #6ee7b7; color: #065f46; }
.q-feedback.incorrect { background: var(--danger-soft);  border: 1px solid #fca5a5; color: #991b1b; }

.q-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
}

/* ============================================================
   MOCK EXAM CARDS
   ============================================================ */

.exam-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }

.exam-card { background: white; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; transition: all .2s; }
.exam-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.exam-card-stripe { height: 5px; }
.exam-card-body { padding: 20px; }
.exam-card h4 { font-size: 1rem; font-weight: 800; margin-bottom: 5px; }
.exam-card p  { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }
.exam-info {
  display: flex; gap: 14px; margin: 14px 0;
  padding: 10px 14px; background: var(--bg); border-radius: var(--radius-sm);
}
.exam-info-item { display: flex; align-items: center; gap: 5px; font-size: .76rem; color: var(--text-muted); }
.exam-info-item strong { color: var(--text); font-weight: 700; }

/* ============================================================
   EXAM INTERFACE (Full-screen)
   ============================================================ */

.exam-wrap { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.exam-topbar {
  background: var(--primary-dark); color: white;
  padding: 0 28px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.exam-topbar-left h3 { font-size: .9rem; font-weight: 800; }
.exam-topbar-left p  { font-size: .72rem; color: rgba(255,255,255,.5); }

.exam-timer-wrap { text-align: center; }
.exam-timer { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.exam-timer.warning { color: #fca5a5; animation: pulse-warn .8s ease-in-out infinite; }
@keyframes pulse-warn { 0%,100%{opacity:1} 50%{opacity:.6} }
.exam-timer-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.45); }

.exam-section-tabs {
  background: white; border-bottom: 1px solid var(--border);
  display: flex; padding: 0 28px;
}
.exam-tab {
  padding: 12px 20px; font-size: .82rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 3px solid transparent; cursor: pointer; transition: all .2s; white-space: nowrap;
}
.exam-tab.active { color: var(--primary); border-color: var(--primary); font-weight: 800; }
.exam-tab.done { color: var(--success); }

.exam-progress-track { height: 3px; background: rgba(255,255,255,.15); }
.exam-progress-fill  { height: 100%; background: var(--gold); transition: width .5s; }

.exam-body { padding: 24px; max-width: 820px; margin: 0 auto; width: 100%; }

/* ============================================================
   LEARNING HUB
   ============================================================ */

.subject-tabs { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.subject-tab {
  padding: 8px 18px; border-radius: 20px; border: 2px solid var(--border);
  background: white; font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: all .2s; color: var(--text-muted);
}
.subject-tab.active { border-color: var(--primary); background: var(--primary); color: white; box-shadow: 0 2px 10px rgba(26,71,49,.3); }
.subject-tab:hover:not(.active) { border-color: var(--primary-light); color: var(--primary); background: var(--primary-soft); }

.lesson-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

.lesson-card {
  background: white; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px; cursor: pointer; transition: all .2s; box-shadow: var(--shadow);
}
.lesson-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lesson-card.locked { cursor: default; opacity: .65; }
.lesson-card.locked:hover { transform: none; border-color: var(--border); box-shadow: var(--shadow); }
.lc-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 12px; }
.lc-icon.reading   { background: #dbeafe; }
.lc-icon.numerical { background: var(--primary-soft); }
.lc-icon.abstract  { background: var(--gold-soft); }
.lc-icon.writing   { background: #ede9fe; }
.lesson-card h4 { font-size: .88rem; font-weight: 800; margin-bottom: 4px; }
.lesson-card p  { font-size: .76rem; color: var(--text-muted); line-height: 1.5; }
.lc-meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.lc-type { font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; padding: 3px 8px; border-radius: 4px; }
.lc-type.guide   { background: var(--primary-soft); color: var(--primary); }
.lc-type.video   { background: #fee2e2; color: #991b1b; }
.lc-type.tips    { background: var(--gold-soft); color: var(--gold-dark); }
.lc-dur { font-size: .7rem; color: var(--text-muted); }

/* Lesson modal */
.lesson-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 300; display: flex; align-items: flex-start; justify-content: center; padding: 32px 20px; overflow-y: auto; display: none; }
.lesson-modal-overlay.open { display: flex; }
.lesson-modal { background: white; border-radius: 16px; width: 100%; max-width: 680px; box-shadow: var(--shadow-lg); overflow: hidden; }
.lm-header { background: var(--primary-dark); padding: 24px 28px; display: flex; align-items: flex-start; justify-content: space-between; }
.lm-header h3 { color: white; font-size: 1.1rem; font-weight: 800; }
.lm-header p  { color: rgba(255,255,255,.6); font-size: .8rem; margin-top: 4px; }
.lm-close { background: rgba(255,255,255,.12); border: none; color: white; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.lm-close:hover { background: rgba(255,255,255,.22); }
.lm-body { padding: 28px; }
.lm-body h4 { font-size: .95rem; font-weight: 800; margin: 18px 0 8px; color: var(--primary-dark); }
.lm-body h4:first-child { margin-top: 0; }
.lm-body p  { font-size: .875rem; line-height: 1.75; color: var(--text-mid); margin-bottom: 8px; }
.lm-body ul, .lm-body ol { padding-left: 18px; }
.lm-body li { font-size: .875rem; line-height: 1.75; color: var(--text-mid); margin-bottom: 4px; }
.lm-tip {
  background: var(--gold-soft); border-left: 4px solid var(--gold);
  padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 14px 0;
  font-size: .85rem; color: var(--gold-dark); font-weight: 500;
}
.lm-example {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 12px 0; font-size: .85rem;
}

/* ============================================================
   PERFORMANCE
   ============================================================ */

.perf-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.acc-bars { display: flex; flex-direction: column; gap: 13px; }
.acc-row { display: flex; align-items: center; gap: 12px; }
.acc-name { min-width: 170px; font-size: .83rem; font-weight: 600; }
.acc-track { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.acc-fill  { height: 100%; border-radius: 5px; transition: width .6s ease; }
.acc-pct   { min-width: 38px; text-align: right; font-size: .8rem; font-weight: 800; }

.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg); border-radius: var(--radius-sm); }
.hi-icon { width: 34px; height: 34px; border-radius: 8px; background: white; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.hi-info { flex: 1; }
.hi-info .hi-name { font-size: .83rem; font-weight: 700; }
.hi-info .hi-date { font-size: .72rem; color: var(--text-muted); }
.hi-score { font-size: .88rem; font-weight: 800; }
.hi-score.good { color: var(--success); }
.hi-score.mid  { color: var(--warning); }
.hi-score.bad  { color: var(--danger); }

.streak-wrap { }
.streak-label { font-size: .75rem; color: var(--text-muted); margin-bottom: 8px; }
.streak-cal { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.streak-day { aspect-ratio: 1; border-radius: 3px; background: var(--bg); }
.streak-day.active  { background: var(--primary); }
.streak-day.today   { background: var(--gold); border-radius: 50%; }

/* ============================================================
   AUTH PAGES (Login / Register)
   ============================================================ */

.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }

.auth-brand {
  background: var(--primary-dark); position: relative;
  display: flex; flex-direction: column; justify-content: center; padding: 60px 56px;
  overflow: hidden;
}
.auth-brand::before {
  content: ''; position: absolute; width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(26,71,49,.6) 0%, transparent 70%);
  top: -200px; right: -200px; pointer-events: none;
}
.auth-brand::after {
  content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, rgba(184,144,60,.12) 0%, transparent 70%);
  bottom: -100px; left: -100px; pointer-events: none;
}

.ab-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 52px; position: relative; z-index: 1; }
.ab-mark { width: 52px; height: 52px; background: linear-gradient(135deg, var(--gold-dark), var(--gold-light)); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; color: white; font-family: 'Playfair Display', serif; box-shadow: 0 4px 16px rgba(184,144,60,.5); }
.ab-text h1 { color: white; font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 800; line-height: 1.2; }
.ab-text span { color: var(--gold-light); font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; }

.ab-hero { position: relative; z-index: 1; }
.ab-hero h2 { color: white; font-size: 2.1rem; font-weight: 800; line-height: 1.25; font-family: 'Playfair Display', serif; margin-bottom: 14px; }
.ab-hero h2 em { font-style: normal; color: var(--gold-light); }
.ab-hero p { color: rgba(255,255,255,.62); font-size: .95rem; line-height: 1.7; margin-bottom: 36px; }

.ab-features { display: flex; flex-direction: column; gap: 14px; }
.ab-feat { display: flex; align-items: center; gap: 14px; }
.ab-feat-icon { width: 38px; height: 38px; border-radius: 10px; background: rgba(184,144,60,.18); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.ab-feat-text strong { display: block; color: white; font-size: .875rem; font-weight: 700; }
.ab-feat-text span   { color: rgba(255,255,255,.5); font-size: .78rem; }

.auth-form-side { background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-box { background: white; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 36px 38px; width: 100%; max-width: 420px; }
.auth-box h2 { font-size: 1.45rem; font-weight: 800; margin-bottom: 4px; }
.auth-box .auth-sub { color: var(--text-muted); font-size: .875rem; margin-bottom: 28px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .78rem; font-weight: 700; color: var(--text-mid); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.form-group input, .form-group select {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: white; font-size: .88rem;
  outline: none; transition: border-color .2s; font-family: inherit; color: var(--text);
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.form-group input.error { border-color: var(--danger); }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { color: var(--text-muted); font-size: .78rem; white-space: nowrap; }

.auth-switch { text-align: center; margin-top: 18px; font-size: .85rem; color: var(--text-muted); }
.auth-switch a { color: var(--primary); font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.error-msg { background: var(--danger-soft); border: 1px solid #fca5a5; color: #991b1b; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .82rem; margin-bottom: 16px; display: none; }
.error-msg.show { display: block; }

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.tag-green { background: var(--success-soft); color: var(--success); }
.tag-gold  { background: var(--gold-soft); color: var(--gold-dark); }
.tag-red   { background: var(--danger-soft); color: var(--danger); }
.tag-blue  { background: #dbeafe; color: #1d4ed8; }
.tag-grey  { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state .es-icon { font-size: 44px; margin-bottom: 14px; }
.empty-state h3 { font-size: 1rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: .875rem; margin-bottom: 20px; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-gold    { color: var(--gold); }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-sm  { font-size: .82rem; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.flex   { display: flex; }
.items-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive */
@media (max-width: 1024px) {
  :root { --sidebar-w: 72px; }
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .topic-grid { grid-template-columns: repeat(2,1fr); }
  .lesson-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .exam-grid { grid-template-columns: 1fr; }
  .perf-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   STIMULUS CARDS (QR exam passages inside exam.html)
   ============================================================ */
.stim-badge {
  display: inline-block; background: #F0F9F4; color: #1A4731;
  border: 1px solid #A7D7BE; border-radius: 20px;
  padding: 3px 11px; font-size: .66rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px;
}
.stim-title { font-size: 1.05rem; font-weight: 900; color: #0f2c1e; margin-bottom: 10px; }
.stim-body  { font-size: .87rem; line-height: 1.7; color: #374151; }
.stim-body p  { margin-bottom: 8px; }
.stim-body ul { padding-left: 18px; margin-bottom: 8px; }
.stim-body li { margin-bottom: 4px; }
.stim-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .82rem; }
.stim-table th {
  background: #1A4731; color: white; padding: 7px 10px;
  text-align: center; font-weight: 700; font-size: .78rem;
}
.stim-table th:first-child { text-align: left; }
.stim-table td { padding: 7px 10px; border-bottom: 1px solid #E5E7EB; text-align: center; }
.stim-table td:first-child { text-align: left; font-weight: 600; }
.stim-table tr:nth-child(even) td { background: #F9FAFB; }
.stim-table tr:last-child td { border-bottom: none; }
.stim-note {
  background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 8px;
  padding: 8px 12px; font-size: .78rem; color: #92400E; margin-top: 10px;
}
.gear-diagram { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin: 10px 0; }
.gear-box {
  background: #F9FAFB; border: 1px solid #E5E7EB; border-radius: 8px;
  padding: 10px 12px; text-align: center; min-width: 90px;
}
.gear-box .gear-label { font-size: .7rem; font-weight: 800; color: #6B7280; text-transform: uppercase; margin-bottom: 6px; }
.gear-window { font-size: 1.4rem; font-weight: 900; color: #1A4731; }
.gear-nums   { font-size: .68rem; color: #9CA3AF; margin-top: 4px; }
.gear-rule   { font-size: .75rem; color: #374151; background: #F0F9F4; border-radius: 6px; padding: 6px 10px; margin-top: 8px; }
.pie-row  { display: flex; gap: 20px; flex-wrap: wrap; margin: 12px 0; }
.pie-item { text-align: center; }
.pie-lbl  { font-size: .75rem; font-weight: 700; color: #374151; }
.pie-sublbl { font-size: .7rem; color: #6B7280; }
.zoo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.zoo-animal {
  background: #F9FAFB; border: 1px solid #E5E7EB; border-radius: 8px; padding: 10px; text-align: center;
}
.zoo-animal .zoo-code { font-size: .8rem; font-weight: 900; color: #1A4731; }
.zoo-animal .zoo-name { font-size: .72rem; color: #6B7280; margin-top: 2px; }
.zoo-edges {
  font-size: .78rem; color: #374151; background: #FEF2F2;
  border: 1px solid #FECACA; border-radius: 6px; padding: 8px 10px; margin-top: 8px;
}
.dot-grid {
  display: inline-grid; grid-template-columns: repeat(3, 36px); gap: 4px;
  background: #F9FAFB; border-radius: 8px; padding: 10px; margin: 6px 2px;
}
.dot { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #374151; }
.dot.black { background: #1f2937; }
.dot.white { background: white; }
.dots-caption { font-size: .75rem; color: #6B7280; text-align: center; margin-bottom: 4px; }
