/* ============================================================
   TKA ENGLISH LEARNING CASA — DESIGN SYSTEM & STYLES
   Botanical Casa × Editorial Learning Platform × Modern Study Dashboard
   ============================================================ */

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

/* ── DESIGN TOKENS (LIGHT THEME) ─────────────────────────── */
:root {
  /* Brand Palette */
  --botanical-dark:    #163319;
  --botanical-primary: #1E4624;
  --botanical-mid:     #2D5E34;
  --sage-dark:         #466D52;
  --sage:              #5E8B6C;
  --sage-light:        #E5EFE7;
  --sage-subtle:       #F2F7F3;
  
  /* Warm Accents */
  --terracotta:        #C46244;
  --terracotta-soft:   #F7ECE8;
  --gold:              #D19E45;
  --gold-soft:         #FAF3E6;
  --coral:             #DE5B5B;
  --coral-soft:        #FDECEC;

  /* Neutrals & Surfaces (Warm Cream / Ivory) */
  --bg-main:           #FBF8F1;
  --bg-surface:        #FFFDF8;
  --bg-surface-2:      #FFFFFF;
  --sidebar-bg:        #F6F0E4;
  --card-bg:           #FFFFFF;
  
  /* Typography Colors */
  --text-heading:      #1A2C1F;
  --text-body:         #334A3A;
  --text-muted:        #667D6E;
  --text-subtle:       #96A89D;
  --border:            #E5DACB;
  --border-focus:      #1E4624;

  /* State Colors */
  --success:           #2D8A4E;
  --success-bg:        #EAF6EE;
  --warning:           #D19E45;
  --warning-bg:        #FAF3E6;
  --danger:            #D94343;
  --danger-bg:         #FDEEEE;
  --info:              #3B7EA1;
  --info-bg:           #EAF3F8;

  /* Typography Stacks */
  --font-display:      'DM Serif Display', Georgia, serif;
  --font-body:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading:      'Nunito', var(--font-body);
  --font-mono:         'DM Sans', ui-monospace, monospace;

  /* Reading Preferences (dynamic via JS) */
  --content-font-size: 15px;
  --content-line-height: 1.75;
  --content-max-width: 800px;

  /* Layout Dimensions */
  --sidebar-w:         270px;
  --topbar-h:          66px;
  --bottom-nav-h:      68px;

  /* Spacing */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;
  --sp-4: 16px;  --sp-5: 20px;  --sp-6: 24px;
  --sp-8: 32px;  --sp-10: 40px; --sp-12: 48px;

  /* Border Radii */
  --r-sm: 8px;   --r-md: 14px;  --r-lg: 20px;  --r-xl: 28px;  --r-full: 9999px;

  /* Elevation Shadows */
  --shadow-sm: 0 2px 6px rgba(22, 51, 25, 0.05);
  --shadow-md: 0 6px 20px rgba(22, 51, 25, 0.08);
  --shadow-lg: 0 12px 36px rgba(22, 51, 25, 0.12);
  --shadow-glow: 0 0 24px rgba(209, 158, 69, 0.25);
  --shadow-glow-leaf: 0 0 24px rgba(94, 139, 108, 0.2);

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── DARK THEME: MAGICAL NIGHT ───────────────────────────── */
body.dark {
  --botanical-dark:    #0B140E;
  --botanical-primary: #387847;
  --botanical-mid:     #4D965E;
  --sage-dark:         #679776;
  --sage:              #88B796;
  --sage-light:        #1A2E20;
  --sage-subtle:       #14241A;

  --terracotta:        #E2785B;
  --terracotta-soft:   #2E1B15;
  --gold:              #E5B55E;
  --gold-soft:         #2B2212;
  --coral:             #F07171;
  --coral-soft:        #2C1717;

  --bg-main:           #0E1712;
  --bg-surface:        #15221A;
  --bg-surface-2:      #1B2B21;
  --sidebar-bg:        #121D16;
  --card-bg:           #17261D;

  --text-heading:      #F5EFE3;
  --text-body:         #D6E3D8;
  --text-muted:        #96ACA0;
  --text-subtle:       #677D70;
  --border:            #26382C;
  --border-focus:      #5E8B6C;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(229, 181, 94, 0.18);
  --shadow-glow-leaf: 0 0 30px rgba(77, 150, 94, 0.25);
}

/* ── ACCESSIBILITY & MOTION ──────────────────────────────── */
body.no-animations *,
body.no-animations *::before,
body.no-animations *::after {
  animation-duration: 0.001s !important;
  transition-duration: 0.001s !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* ── BASE RESET & SMOOTHING ──────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text-body);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 5% 10%, rgba(94, 139, 108, 0.08) 0%, transparent 25%),
    radial-gradient(circle at 95% 15%, rgba(209, 158, 69, 0.07) 0%, transparent 22%),
    radial-gradient(circle at 85% 85%, rgba(196, 98, 68, 0.05) 0%, transparent 28%),
    radial-gradient(circle at 15% 90%, rgba(30, 70, 36, 0.06) 0%, transparent 24%);
  min-height: 100vh;
  line-height: var(--content-line-height);
  overflow-x: hidden;
  transition: background-color var(--t-base), color var(--t-base);
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
::selection { background: rgba(94, 139, 108, 0.25); color: var(--text-heading); }

/* Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(94, 139, 108, 0.3); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(94, 139, 108, 0.5); }

/* ── MAGICAL SPARKLES BACKGROUND ─────────────────────────── */
.magical-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.magical-dot {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(209, 158, 69, 0.7) 0%, rgba(209, 158, 69, 0) 70%);
  animation: sparkle-drift 8s ease-in-out infinite alternate;
}

@keyframes sparkle-drift {
  0% { transform: translateY(0) scale(0.8); opacity: 0.2; }
  50% { transform: translateY(-25px) scale(1.2); opacity: 0.7; }
  100% { transform: translateY(-50px) scale(0.9); opacity: 0.3; }
}

/* ── LAYOUT SHELL ────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--t-base), background-color var(--t-base);
}

.sidebar-brand {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--sage-light), var(--gold-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(30, 70, 36, 0.12);
  flex-shrink: 0;
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-heading);
  line-height: 1.15;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  padding: var(--sp-4) var(--sp-3);
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  margin-top: var(--sp-2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 14px;
  border-radius: var(--r-md);
  color: var(--text-body);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--t-fast);
  position: relative;
}

.nav-link:hover {
  background: rgba(94, 139, 108, 0.12);
  color: var(--botanical-dark);
  transform: translateX(3px);
}

body.dark .nav-link:hover {
  background: rgba(136, 183, 150, 0.12);
  color: #FFFFFF;
}

.nav-link.active {
  background: var(--botanical-primary);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(30, 70, 36, 0.25);
}

.nav-link.active .nav-icon {
  transform: scale(1.1);
}

.nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  transition: transform var(--t-fast);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: var(--gold);
  color: #FFFFFF;
}

.sidebar-footer {
  padding: var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.profile-card-mini {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: rgba(94, 139, 108, 0.08);
  cursor: pointer;
  transition: background var(--t-fast);
}

.profile-card-mini:hover {
  background: rgba(94, 139, 108, 0.16);
}

.profile-avatar {
  font-size: 1.5rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.profile-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.profile-streak {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── MAIN CONTENT AREA ───────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--t-base);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(251, 248, 241, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  transition: background-color var(--t-base);
}

body.dark .topbar {
  background: rgba(14, 23, 18, 0.88);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.topbar-hamburger {
  display: none;
  font-size: 1.3rem;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--text-heading);
}

.topbar-breadcrumbs {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.topbar-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-body);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-sm);
}

.topbar-action-btn:hover {
  background: var(--sage-light);
  border-color: var(--sage);
  color: var(--botanical-dark);
  transform: translateY(-1px);
}

body.dark .topbar-action-btn:hover {
  background: var(--sage-light);
  color: #FFFFFF;
}

.shortcut-badge {
  font-size: 0.68rem;
  background: rgba(94, 139, 108, 0.15);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── PROGRESS BAR ON TOPBAR ──────────────────────────────── */
.global-reading-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
}

.global-reading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sage), var(--gold));
  transition: width 150ms ease-out;
}

/* ── MAIN CONTENT CONTAINER ──────────────────────────────── */
.main-outlet {
  flex: 1;
  padding: var(--sp-8) var(--sp-8) var(--sp-12);
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ── EDITORIAL HEADERS & TYPOGRAPHY ──────────────────────── */
.page-header {
  margin-bottom: var(--sp-8);
}

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sage-dark);
  margin-bottom: var(--sp-2);
}

body.dark .page-eyebrow {
  color: var(--sage);
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 400;
  color: var(--text-heading);
  line-height: 1.2;
  margin-bottom: var(--sp-2);
}

.page-desc {
  font-size: 1.02rem;
  color: var(--text-muted);
  max-width: 720px;
  line-height: 1.6;
}

/* ── CARDS & SURFACES ────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
  position: relative;
  overflow: hidden;
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--sage);
}

.card-botanical-corner::after {
  content: '';
  position: absolute;
  bottom: -20px;
  right: -20px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(94, 139, 108, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* ── BUTTON SYSTEM ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--r-full);
  font-size: 0.92rem;
  font-weight: 600;
  transition: all var(--t-fast);
  cursor: pointer;
}

.btn-primary {
  background: var(--botanical-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(30, 70, 36, 0.25);
}

.btn-primary:hover {
  background: var(--botanical-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(30, 70, 36, 0.35);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  color: var(--text-body);
}

.btn-secondary:hover {
  border-color: var(--sage);
  background: var(--sage-light);
  color: var(--botanical-dark);
}

body.dark .btn-secondary:hover {
  color: #FFFFFF;
}

.btn-terracotta {
  background: var(--terracotta);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(196, 98, 68, 0.25);
}

.btn-terracotta:hover {
  background: #A94F34;
  transform: translateY(-2px);
}

.btn-ghost {
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text-heading);
  background: rgba(94, 139, 108, 0.1);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
}

/* ── CHIPS & BADGES ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 0.74rem;
  font-weight: 600;
}

.badge-sage { background: var(--sage-light); color: var(--botanical-dark); }
.badge-gold { background: var(--gold-soft); color: #8F6517; }
.badge-terracotta { background: var(--terracotta-soft); color: var(--terracotta); }
.badge-outline { border: 1px solid var(--border); color: var(--text-muted); }

body.dark .badge-sage { color: #A5D6B2; }
body.dark .badge-gold { color: #F3CD80; }

/* ── DASHBOARD: GREETING & WIDGETS ───────────────────────── */
.greeting-hero {
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.95), rgba(246, 240, 228, 0.9)),
              radial-gradient(circle at top right, rgba(94, 139, 108, 0.15), transparent 60%);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-8);
  margin-bottom: var(--sp-8);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}

body.dark .greeting-hero {
  background: linear-gradient(135deg, rgba(23, 38, 29, 0.95), rgba(18, 29, 22, 0.9)),
              radial-gradient(circle at top right, rgba(77, 150, 94, 0.25), transparent 60%);
}

.greeting-content {
  max-width: 640px;
}

.greeting-stats-strip {
  display: flex;
  gap: var(--sp-6);
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.stat-pill-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-sm);
}

.stat-pill-data {
  display: flex;
  flex-direction: column;
}

.stat-pill-num {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1;
}

.stat-pill-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.casa-floating-art {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  animation: gentle-float 6s ease-in-out infinite alternate;
}

@keyframes gentle-float {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
  100% { transform: translateY(4px) rotate(-1deg); }
}

/* ── MODULAR DASHBOARD GRID ──────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--sp-6);
  margin-bottom: var(--sp-8);
}

/* Continue Learning Banner */
.continue-card {
  background: linear-gradient(135deg, var(--botanical-primary), var(--sage-dark));
  color: #FFFFFF;
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--sp-6);
}

.continue-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.continue-meta {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Quick Access Banners */
.quick-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.qa-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  cursor: pointer;
  transition: all var(--t-fast);
}

.qa-box:hover {
  transform: translateY(-3px);
  border-color: var(--sage);
  box-shadow: var(--shadow-md);
}

.qa-box-icon {
  font-size: 1.8rem;
  margin-bottom: var(--sp-1);
}

.qa-box-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
}

.qa-box-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Word of the Day Widget */
.wod-widget {
  background: linear-gradient(135deg, var(--gold-soft), var(--bg-surface));
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

.wod-term {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-heading);
  margin: 4px 0 2px;
}

.wod-phonetic {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: var(--sp-2);
}

.wod-meaning {
  font-size: 0.88rem;
  color: var(--text-body);
  margin-bottom: var(--sp-3);
  line-height: 1.5;
}

/* ── MATERI LIBRARY ──────────────────────────────────────── */
.category-filter-bar {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

.filter-chip {
  padding: 7px 16px;
  border-radius: var(--r-full);
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}

.filter-chip:hover {
  border-color: var(--sage);
  color: var(--botanical-dark);
}

.filter-chip.active {
  background: var(--botanical-primary);
  color: #FFFFFF;
  border-color: var(--botanical-primary);
  box-shadow: 0 2px 8px rgba(30, 70, 36, 0.2);
}

.materi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-6);
}

.materi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.materi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-3);
}

.materi-card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text-heading);
  margin-bottom: var(--sp-2);
  line-height: 1.3;
}

.materi-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: var(--sp-5);
  flex: 1;
}

.materi-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── EDITORIAL READER (SPLIT LAYOUT) ─────────────────────── */
.reader-split-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--sp-8);
  position: relative;
}

.reader-article {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-10) var(--sp-10);
  box-shadow: var(--shadow-sm);
  font-size: var(--content-font-size);
  line-height: var(--content-line-height);
  max-width: var(--content-max-width);
}

.reader-article h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text-heading);
  margin: var(--sp-8) 0 var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 1.5px solid var(--border);
}

.reader-article h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin: var(--sp-6) 0 var(--sp-3);
  color: var(--text-heading);
}

.reader-article p {
  margin-bottom: var(--sp-4);
}

/* Sticky TOC Sidebar Rail */
.reader-toc-rail {
  position: sticky;
  top: calc(var(--topbar-h) + var(--sp-4));
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.toc-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}

.toc-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: var(--sp-3);
}

.toc-links-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
  line-height: 1.4;
}

.toc-link:hover, .toc-link.active {
  background: var(--sage-light);
  color: var(--botanical-dark);
  font-weight: 600;
  transform: translateX(3px);
}

body.dark .toc-link:hover, body.dark .toc-link.active {
  color: #FFFFFF;
}

/* Callout Boxes */
.callout {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border-radius: var(--r-md);
  margin: var(--sp-6) 0;
  border-left: 4px solid var(--botanical-primary);
  background: var(--sage-subtle);
}

body.dark .callout {
  background: var(--bg-surface-2);
}

.callout-gold {
  border-left-color: var(--gold);
  background: var(--gold-soft);
}

.callout-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.callout-body {
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Editorial Tables */
.editorial-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-6) 0;
  font-size: 0.9rem;
}

.editorial-table th {
  background: var(--sage-light);
  color: var(--text-heading);
  text-align: left;
  padding: 12px 16px;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
}

.editorial-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

/* Accordions */
.accordion-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: var(--sp-6) 0;
}

.editorial-accordion {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.editorial-accordion summary {
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background: var(--bg-surface);
  transition: background var(--t-fast);
}

.editorial-accordion summary:hover {
  background: var(--sage-subtle);
}

.editorial-accordion .accordion-body {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.65;
  background: var(--card-bg);
}

/* ── EDUCATIONAL SECTIONS SYSTEM ─────────────────────────── */
.objectives-box {
  background: linear-gradient(135deg, var(--sage-light), var(--bg-surface));
  border: 1.5px solid var(--sage);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-6);
}

.objectives-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--botanical-dark);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark .objectives-title {
  color: var(--sage);
}

.objectives-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--text-body);
}

.objectives-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.objectives-item-icon {
  color: var(--botanical-primary);
  font-weight: 700;
  flex-shrink: 0;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
}

.comparison-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  transition: all var(--t-fast);
}

.comparison-card:hover {
  border-color: var(--sage);
}

.comparison-card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--botanical-primary);
  margin-bottom: var(--sp-2);
}

body.dark .comparison-card-title {
  color: var(--sage);
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
}

.step-card {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--botanical-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.step-content-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.reading-box {
  background: var(--bg-surface-2);
  border: 1.5px solid var(--sage-light);
  border-left: 4px solid var(--botanical-primary);
  border-radius: var(--r-md);
  padding: var(--sp-6);
  margin: var(--sp-6) 0;
  position: relative;
}

.reading-box-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--botanical-primary);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

body.dark .reading-box-title {
  color: var(--sage);
}

.reading-box-text {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-heading);
}

.analysis-box {
  background: var(--sage-subtle);
  border: 1px solid var(--sage);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  margin: var(--sp-4) 0 var(--sp-6);
  font-size: 0.92rem;
  line-height: 1.65;
}

.summary-card {
  background: linear-gradient(135deg, var(--card-bg), var(--bg-surface));
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin: var(--sp-6) 0;
}

.summary-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--botanical-primary);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.keypoints-box {
  background: var(--gold-soft);
  border: 1.5px solid var(--gold);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  margin: var(--sp-6) 0;
}

.mistakes-box {
  background: var(--danger-bg);
  border: 1.5px solid var(--danger);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  margin: var(--sp-6) 0;
}

/* ── LATIHAN / PRACTICE INTERFACE ────────────────────────── */
.practice-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--sp-6);
  margin-bottom: var(--sp-8);
}

.mode-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
}

.mode-card:hover {
  border-color: var(--botanical-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.mode-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  background: var(--sage-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.mode-card-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-heading);
}

.mode-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── IMMERSIVE PRACTICE WORKSPACE (SPLIT VIEW) ───────────── */
.practice-workspace {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: var(--sp-6);
  align-items: start;
}

/* Left Pane: Reading Passage */
.passage-pane {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--topbar-h) - 80px);
  overflow-y: auto;
  position: sticky;
  top: calc(var(--topbar-h) + var(--sp-4));
}

.passage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.passage-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
}

.passage-body {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text-body);
}

/* Right Pane: Question & Options Controls */
.question-pane {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

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

.question-counter {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--botanical-primary);
}

.timer-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-soft);
  color: #8F6517;
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
  border: 1px solid rgba(209, 158, 69, 0.3);
}

.question-prompt {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.45;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  text-align: left;
  transition: all var(--t-fast);
  cursor: pointer;
}

.option-btn:hover {
  border-color: var(--sage);
  background: var(--sage-subtle);
}

.option-key {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--t-fast);
}

.option-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-body);
  flex: 1;
}

.option-btn.selected {
  border-color: var(--botanical-primary);
  background: var(--sage-light);
  box-shadow: 0 2px 10px rgba(30, 70, 36, 0.15);
}

.option-btn.selected .option-key {
  background: var(--botanical-primary);
  border-color: var(--botanical-primary);
  color: #FFFFFF;
}

/* Question Action Footer */
.question-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* Question Palette Drawer / Strip */
.palette-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.palette-item {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t-fast);
}

.palette-item.active { border-color: var(--botanical-primary); outline: 2px solid var(--botanical-primary); }
.palette-item.answered { background: var(--botanical-primary); color: #FFFFFF; border-color: var(--botanical-primary); }
.palette-item.flagged { background: var(--gold); color: #FFFFFF; border-color: var(--gold); }

/* ── FOCUS MODE ──────────────────────────────────────────── */
body.focus-mode {
  background-color: var(--bg-main);
}

body.focus-mode .sidebar,
body.focus-mode .topbar,
body.focus-mode .bottom-nav,
body.focus-mode .magical-field {
  display: none !important;
}

body.focus-mode .main-wrapper {
  margin-left: 0 !important;
}

body.focus-mode .main-outlet {
  padding-top: var(--sp-6);
  max-width: 1100px;
}

.focus-bar {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 8px 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  box-shadow: var(--shadow-md);
}

body.focus-mode .focus-bar {
  display: flex;
}

/* ── PEMBAHASAN / ANSWER REVIEW ──────────────────────────── */
.review-score-hero {
  background: linear-gradient(135deg, var(--sage-light), var(--gold-soft));
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  margin-bottom: var(--sp-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}

body.dark .review-score-hero {
  background: linear-gradient(135deg, var(--bg-surface-2), var(--sage-light));
}

.score-badge-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--botanical-primary);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.score-num {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.score-label {
  font-size: 0.7rem;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.review-item-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
  box-shadow: var(--shadow-sm);
}

.pembahasan-section {
  margin-top: var(--sp-5);
  padding-top: var(--sp-5);
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.evidence-box {
  background: var(--sage-subtle);
  border-left: 3px solid var(--sage);
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-style: italic;
  font-size: 0.9rem;
}

.option-analysis-table {
  width: 100%;
  font-size: 0.88rem;
  border-collapse: collapse;
}

.option-analysis-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* ── VOCABULARY HUB ──────────────────────────────────────── */
.dict-alphabet-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: var(--sp-2) 0 var(--sp-4);
  margin-bottom: var(--sp-6);
}

.alpha-btn {
  min-width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
}

.alpha-btn:hover, .alpha-btn.active {
  background: var(--botanical-primary);
  color: #FFFFFF;
  border-color: var(--botanical-primary);
}

.dict-search-box {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  margin-bottom: var(--sp-6);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast);
}

.dict-search-box:focus-within {
  border-color: var(--botanical-primary);
  box-shadow: 0 0 16px rgba(30, 70, 36, 0.15);
}

.dict-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 1rem;
  color: var(--text-heading);
}

.audio-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sage-light);
  color: var(--botanical-primary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 0.95rem;
}

.audio-btn:hover {
  transform: scale(1.1);
  background: var(--botanical-primary);
  color: #FFFFFF;
}

.dict-load-more {
  text-align: center;
  padding: var(--sp-8) 0;
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-5);
}

.vocab-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
}

.vocab-card:hover {
  transform: translateY(-3px);
  border-color: var(--sage);
  box-shadow: var(--shadow-md);
}

/* 3D Flashcard Scene */
.flashcard-scene {
  perspective: 1000px;
  width: 100%;
  max-width: 540px;
  height: 320px;
  margin: var(--sp-6) auto;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard-inner.flipped,
.fc-inner.flipped {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back,
.fc-front, .fc-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--r-xl);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  box-sizing: border-box;
}

.flashcard-back,
.fc-back {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  background: linear-gradient(135deg, var(--bg-surface), var(--sage-light));
}

/* ── PROGRESS & MASTERY ──────────────────────────────────── */
.mastery-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}

.mastery-ring {
  position: relative;
  width: 160px;
  height: 160px;
}

.ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 12;
}

.ring-fill {
  fill: none;
  stroke: var(--botanical-primary);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-in-out;
}

.mastery-center-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.mastery-pct {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1;
}

/* Growth Stages */
.growth-garden {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.garden-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.4;
  transition: opacity var(--t-fast);
}

.garden-stage.reached {
  opacity: 1;
  font-weight: 700;
}

.stage-icon {
  font-size: 1.8rem;
}

.stage-name {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── GLOBAL SEARCH MODAL (CTRL+K) ────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 18, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.modal-overlay.active {
  display: flex;
}

.search-modal-box {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  width: 90%;
  max-width: 640px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-pop 200ms ease-out;
}

@keyframes modal-pop {
  from { transform: scale(0.96) translateY(-10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.search-bar-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.15rem;
  background: transparent;
  color: var(--text-heading);
}

.search-results-list {
  max-height: 420px;
  overflow-y: auto;
  padding: var(--sp-3);
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
}

.search-result-item:hover {
  background: var(--sage-light);
}

/* ── SETTINGS & CONTENT IMPORT/EXPORT ────────────────────── */
.settings-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-info {
  display: flex;
  flex-direction: column;
}

.setting-label {
  font-weight: 600;
  color: var(--text-heading);
}

.setting-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: var(--border);
  border-radius: var(--r-full);
  transition: var(--t-fast);
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: var(--t-fast);
}

.toggle input:checked + .toggle-slider {
  background-color: var(--botanical-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ── TOAST NOTIFICATIONS ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  background: var(--botanical-dark);
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 250ms ease-out;
  pointer-events: auto;
}

@keyframes toast-in {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── SKELETON LOADER & EMPTY STATES ──────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-surface) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  gap: var(--sp-3);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: var(--sp-2);
}

.empty-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-heading);
}

.empty-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 440px;
}

/* ── MOBILE BOTTOM NAVIGATION ────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: rgba(251, 248, 241, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--sp-2);
}

body.dark .bottom-nav {
  background: rgba(14, 23, 18, 0.96);
}

.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-md);
  transition: all var(--t-fast);
}

.bnav-item.active {
  color: var(--botanical-primary);
}

.bnav-icon {
  font-size: 1.25rem;
}

/* ── RESPONSIVE MEDIA QUERIES ────────────────────────────── */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .reader-split-layout {
    grid-template-columns: 1fr;
  }
  .reader-toc-rail {
    display: none;
  }
  .practice-workspace {
    grid-template-columns: 1fr;
  }
  .passage-pane {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
    padding-bottom: var(--bottom-nav-h);
  }
  .topbar-hamburger {
    display: block;
  }
  .bottom-nav {
    display: flex;
  }
  .main-outlet {
    padding: var(--sp-6) var(--sp-4) var(--sp-10);
  }
  .greeting-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .casa-floating-art {
    display: none;
  }
  .greeting-stats-strip {
    flex-wrap: wrap;
    gap: var(--sp-4);
  }
}

/* ── MISTAKE BANK & QUICK CHECK EXTENSIONS ───────────────── */
@keyframes alert-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.nav-badge.badge-danger {
  background: #E53935;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(229, 57, 53, 0.4);
  animation: alert-pulse 2s infinite ease-in-out;
}

.badge-danger {
  background: rgba(229, 57, 53, 0.12);
  color: #D32F2F;
  border: 1px solid rgba(229, 57, 53, 0.28);
}

body.dark .badge-danger {
  background: rgba(239, 83, 80, 0.18);
  color: #EF5350;
  border-color: rgba(239, 83, 80, 0.35);
}

.mistake-card {
  background: var(--card-bg);
  border: 1.5px solid rgba(229, 57, 53, 0.28);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.mistake-card:hover {
  box-shadow: var(--shadow-md);
}

body.dark .mistake-card {
  background: rgba(36, 20, 20, 0.6);
  border-color: rgba(239, 83, 80, 0.35);
}

/* Studied state: blue-tinted card */
.mistake-card.mistake-studied {
  border-color: rgba(26, 115, 232, 0.4);
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.04), var(--card-bg));
  box-shadow: 0 0 0 1px rgba(26, 115, 232, 0.12), var(--shadow-sm);
}

.mistake-card.mistake-studied::before {
  content: '📖';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1.4rem;
  opacity: 0.25;
}

body.dark .mistake-card.mistake-studied {
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.08), rgba(36, 20, 20, 0.6));
  border-color: rgba(26, 115, 232, 0.45);
}

/* Understood state: green-tinted card with success feel */
.mistake-card.mistake-understood {
  border-color: rgba(39, 110, 84, 0.45);
  background: linear-gradient(135deg, rgba(39, 110, 84, 0.06), rgba(39, 110, 84, 0.02), var(--card-bg));
  box-shadow: 0 0 0 1px rgba(39, 110, 84, 0.15), var(--shadow-sm);
  opacity: 0.85;
}

.mistake-card.mistake-understood::before {
  content: '🌟';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1.4rem;
  opacity: 0.3;
}

body.dark .mistake-card.mistake-understood {
  background: linear-gradient(135deg, rgba(39, 110, 84, 0.1), rgba(36, 20, 20, 0.6));
  border-color: rgba(39, 110, 84, 0.5);
}

.mistake-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}

@media (max-width: 640px) {
  .mistake-comparison {
    grid-template-columns: 1fr;
  }
}

.mistake-choice-box {
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 0.88rem;
  line-height: 1.5;
}

.mistake-choice-box.wrong {
  background: rgba(229, 57, 53, 0.08);
  border: 1px solid rgba(229, 57, 53, 0.3);
  color: #D32F2F;
}

body.dark .mistake-choice-box.wrong {
  background: rgba(239, 83, 80, 0.15);
  color: #EF9A9A;
}

.mistake-choice-box.correct {
  background: rgba(46, 125, 50, 0.08);
  border: 1px solid rgba(46, 125, 50, 0.3);
  color: #2E7D32;
}

body.dark .mistake-choice-box.correct {
  background: rgba(129, 199, 132, 0.15);
  color: #A5D6A7;
}

/* Quick Check Card */
.quick-check-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-md);
  max-width: 820px;
  margin: 0 auto;
}

.quick-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  text-align: left;
  font-size: 0.95rem;
  color: var(--text-heading);
  cursor: pointer;
  transition: all var(--t-fast);
}

.quick-option-btn:hover {
  border-color: var(--botanical-primary);
  background: rgba(94, 139, 108, 0.06);
}

.quick-option-btn.selected {
  border-color: var(--botanical-primary);
  background: rgba(94, 139, 108, 0.14);
  font-weight: 600;
}

.quick-option-btn.correct-reveal {
  border-color: #2E7D32 !important;
  background: rgba(46, 125, 50, 0.15) !important;
  color: #2E7D32 !important;
  font-weight: 700;
}

.quick-option-btn.wrong-reveal {
  border-color: #E53935 !important;
  background: rgba(229, 57, 53, 0.15) !important;
  color: #D32F2F !important;
}
