/* ============================================================
   SMART STUDY HUB - THEMES
   ============================================================ */

/* Removed backdrop filter support for glass themes to improve Safari performance and prevent crashes */
.subject-card,
.navbar,
.phase2-banner {
  /* No backdrop-filter */
}

html,
body {
  background-color: var(--bg);
  color: var(--text);
  --text-main: var(--text);
  --text-color: var(--text);
  --bg-color: var(--bg);
  --card-bg: var(--card);
}

/* 01. Default Dark & Base Root Tokens */
:root {
  /* Core Spacing Scale (4/8px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Typography Scale */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 20px;
  --text-xl: 28px;
  --text-2xl: 40px;

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font: var(--font-sans);

  /* Ember Black Base Colors */
  --bg-default: #0d0a08;
  --card-default: #17120e;
  --border-default: #33281f;
  /* 25% lighter than card */
  --text-default: #f5ece1;
  --text-muted-default: #a89a8c;

  /* Brand / Action */
  --primary: #f59e0b;
  --primary-hover: #fbbf24;
  --primary-contrast: #0c0907;
  --accent: var(--primary);

  --bg-nav: rgba(20, 15, 12, 0.95);
  --card2: #1c140f;
  --card-backdrop: blur(12px);

  /* Motion Tokens */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High-Contrast Action & Navigation Tokens per Theme */
body.theme-default {
  --primary-contrast: #0c0907;
  --bg-nav: rgba(20, 15, 12, 0.95);
}

body.theme-light {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(255, 255, 255, 0.96);
}

body.theme-oled {
  --primary: #3b82f6;
  --primary-contrast: #ffffff;
  --bg-nav: rgba(5, 5, 5, 0.98);
}

body.theme-ocean {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(10, 28, 52, 0.95);
}

body.theme-forest {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(14, 38, 25, 0.95);
}

body.theme-dracula {
  --primary-contrast: #282a36;
  --bg-nav: rgba(40, 42, 54, 0.95);
}

body.theme-monokai {
  --primary-contrast: #272822;
  --bg-nav: rgba(43, 40, 44, 0.95);
}

body.theme-nord {
  --primary-contrast: #2e3440;
  --bg-nav: rgba(46, 52, 64, 0.95);
}

body.theme-cobalt {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(18, 35, 78, 0.95);
}

body.theme-rose-gold {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(255, 241, 242, 0.96);
}

body.theme-macchiato {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(40, 30, 25, 0.95);
}

body.theme-solar-light {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(253, 246, 227, 0.96);
}

body.theme-minimal {
  --primary-contrast: #111111;
  --bg-nav: rgba(24, 24, 24, 0.95);
}

body.theme-sakura {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(46, 29, 39, 0.95);
}

body.theme-abyss {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(10, 22, 50, 0.95);
}

body.theme-glass-canva {
  --primary-contrast: #0c0907;
  --bg-nav: rgba(20, 15, 12, 0.82);
}

body.theme-glass-aurora {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(15, 23, 42, 0.82);
}

body.theme-glass-emerald {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(2, 44, 34, 0.82);
}

body.theme-glass-amethyst {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(46, 16, 101, 0.82);
}

body.theme-chalkboard {
  --primary-contrast: #14201A;
  --bg-nav: rgba(20, 32, 26, 0.96);
}

body.theme-field-notebook {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(235, 229, 218, 0.96);
}

body.theme-observatory {
  --primary-contrast: #10122B;
  --bg-nav: rgba(17, 20, 46, 0.95);
}

body.theme-dark-academia-refined {
  --primary-contrast: #ffffff;
  --bg-nav: rgba(32, 24, 17, 0.95);
}

body.theme-dark-academia-clean {
  --primary-contrast: #0c0907;
  --bg-nav: rgba(20, 15, 12, 0.95);
}


/* 02. Light Mode */
body.theme-light {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --card: #ffffff;
  --card2: #f8fafc;
  --border: rgba(0, 0, 0, 0.1);
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent1: #9333ea;
  --accent2: #db2777;
}

/* 03. OLED (True Dark) */
body.theme-oled {
  --bg: #000000;
  --bg2: #050505;
  --bg3: #0a0a0a;
  --card: #0a0a0a;
  --card2: #121212;
  --border: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-muted: #a3a3a3;
}

/* 04. Ocean */
body.theme-ocean {
  --bg: #031525;
  --bg2: #05213b;
  --card: #0a2f52;
  --border: rgba(56, 189, 248, 0.2);
  --text: #e0f2fe;
  --text-muted: #7dd3fc;
  --primary: #0284c7;
}

/* 05. Forest */
body.theme-forest {
  --bg: #061c12;
  --bg2: #0a2b1d;
  --card: #103b29;
  --border: rgba(52, 211, 153, 0.2);
  --text: #d1fae5;
  --text-muted: #6ee7b7;
  --primary: #059669;
}

/* 06. Dracula */
body.theme-dracula {
  --bg: #282a36;
  --bg2: #343746;
  --card: #44475a;
  --border: rgba(255, 121, 198, 0.2);
  --text: #f8f8f2;
  --text-muted: #6272a4;
  --primary: #bd93f9;
  --accent1: #ff79c6;
  --accent2: #8be9fd;
}

/* 07. Monokai */
body.theme-monokai {
  --bg: #272822;
  --bg2: #303129;
  --card: #3e3d32;
  --border: rgba(249, 38, 114, 0.3);
  --text: #f8f8f2;
  --text-muted: #75715e;
  --primary: #a6e22e;
  --accent1: #f92672;
  --accent2: #66d9ef;
}

/* 08. Nord */
body.theme-nord {
  --bg: #2e3440;
  --bg2: #3b4252;
  --card: #434c5e;
  --border: rgba(136, 192, 208, 0.3);
  --text: #eceff4;
  --text-muted: #d8dee9;
  --primary: #88c0d0;
  --accent1: #81a1c1;
  --accent2: #5e81ac;
}

/* 09. Cobalt */
body.theme-cobalt {
  --bg: #0f1c3f;
  --bg2: #142755;
  --card: #1a336f;
  --border: rgba(96, 165, 250, 0.2);
  --text: #eff6ff;
  --text-muted: #93c5fd;
  --primary: #3b82f6;
}


/* 13. Rose Gold */
body.theme-rose-gold {
  --bg: #fff1f2;
  --bg2: #ffe4e6;
  --card: #ffffff;
  --border: rgba(225, 29, 72, 0.15);
  --text: #4c0519;
  --text-muted: #881337;
  --primary: #e11d48;
}

/* 14. Macchiato */
body.theme-macchiato {
  --bg: #241b17;
  --bg2: #342823;
  --card: #47352f;
  --border: rgba(217, 119, 6, 0.2);
  --text: #fefce8;
  --text-muted: #fde047;
  --primary: #d97706;
}

/* 15. Solarized Light */
body.theme-solar-light {
  --bg: #fdf6e3;
  --bg2: #eee8d5;
  --card: #ffffff;
  --border: rgba(181, 137, 0, 0.2);
  --text: #073642;
  --text-muted: #586e75;
  --primary: #268bd2;
  --accent1: #cb4b16;
}


/* 17. Minimalist */
body.theme-minimal {
  --bg: #111111;
  --bg2: #1a1a1a;
  --card: #222222;
  --border: rgba(255, 255, 255, 0.05);
  --text: #eeeeee;
  --text-muted: #888888;
  --primary: #ffffff;
  --accent1: #aaaaaa;
}

/* 18. Sakura */
body.theme-sakura {
  --bg: #2a1b24;
  --bg2: #3b2834;
  --card: #4e3546;
  --border: rgba(244, 114, 182, 0.2);
  --text: #fdf2f8;
  --text-muted: #f9a8d4;
  --primary: #db2777;
}

/* 19. Abyss */
body.theme-abyss {
  --bg: #020617;
  --bg2: #0b1120;
  --card: #0f172a;
  --border: rgba(125, 211, 252, 0.1);
  --text: #f0f9ff;
  --text-muted: #38bdf8;
  --primary: #0284c7;
}


/* 21. Glass Canva (Original Glass UX) */
body.theme-glass-canva {
  --bg: #0c0907;
  --card: rgba(20, 15, 12, 0.65);
  --card2: rgba(28, 20, 15, 0.75);
  --card-backdrop: blur(16px);
  --border: rgba(245, 158, 11, 0.2);
  --text: #fefaf6;
  --text-muted: #d6cbbe;
  --primary: #f59e0b;
  --primary-hover: #fbbf24;
  --accent1: #d97706;
}

body.theme-glass-canva .navbar {
  background: rgba(18, 13, 10, 0.75);
}

/* 22. Glass Aurora */
body.theme-glass-aurora {
  --bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #064e3b 100%);
  --card: rgba(255, 255, 255, 0.05);
  --card2: rgba(255, 255, 255, 0.1);
  --card-backdrop: blur(16px);
  --border: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-muted: #94a3b8;
  --primary: #10b981;
}

body.theme-glass-aurora .navbar {
  background: rgba(255, 255, 255, 0.03);
}


/* 24. Glass Emerald */
body.theme-glass-emerald {
  --bg: linear-gradient(135deg, #022c22 0%, #064e3b 100%);
  --card: rgba(0, 0, 0, 0.2);
  --card2: rgba(0, 0, 0, 0.3);
  --card-backdrop: blur(20px);
  --border: rgba(52, 211, 153, 0.2);
  --text: #ecfdf5;
  --text-muted: #6ee7b7;
  --primary: #10b981;
}

body.theme-glass-emerald .navbar {
  background: rgba(0, 0, 0, 0.15);
}

/* 25. Glass Amethyst */
body.theme-glass-amethyst {
  --bg: linear-gradient(135deg, #2e1065 0%, #4c1d95 100%);
  --card: rgba(255, 255, 255, 0.08);
  --card2: rgba(255, 255, 255, 0.12);
  --card-backdrop: blur(16px);
  --border: rgba(192, 132, 252, 0.25);
  --text: #faf5ff;
  --text-muted: #d8b4fe;
  --primary: #a855f7;
}

body.theme-glass-amethyst .navbar {
  background: rgba(255, 255, 255, 0.04);
}

/* 26. Chalkboard Slate */
body.theme-chalkboard {
  --bg: #1C2620;
  --bg2: #14201A;
  --bg3: #0F1713;
  --card: #14201A;
  --card2: #192720;
  --card-hover: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --text: #EDEAE0;
  --text-muted: #9FB09A;
  --primary: #E8D9A0;
  --primary-hover: #F2E7BE;
  --accent1: #E8D9A0;
  --font-alt: Georgia, serif;
}

body.theme-chalkboard h1,
body.theme-chalkboard h2,
body.theme-chalkboard h3,
body.theme-chalkboard h4,
body.theme-chalkboard .hero-title,
body.theme-chalkboard .section-title,
body.theme-chalkboard .sub-title,
body.theme-chalkboard .modal-title {
  font-family: Georgia, serif;
}


/* 28. Field Notebook */
body.theme-field-notebook {
  --bg: #EAE3D3;
  --bg2: #E0D8C4;
  --bg3: #D4CBBA;
  --card: #E0D8C4;
  --card2: #D7CFBA;
  --card-hover: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.12);
  --text: #2E2A22;
  --text-muted: #574c3e;
  --primary: #A23E2A;
  --primary-hover: #8B3220;
  --accent1: #A23E2A;
  --font-alt: Palatino, Georgia, serif;
}

body.theme-field-notebook h1,
body.theme-field-notebook h2,
body.theme-field-notebook h3,
body.theme-field-notebook h4,
body.theme-field-notebook .hero-title,
body.theme-field-notebook .section-title,
body.theme-field-notebook .sub-title,
body.theme-field-notebook .modal-title {
  font-family: Palatino, Georgia, serif;
}

/* 29. Observatory Midnight */
body.theme-observatory {
  --bg: #10122B;
  --bg2: #171A3D;
  --bg3: #1D214D;
  --card: #171A3D;
  --card2: #1E224F;
  --card-hover: rgba(201, 162, 39, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --text: #E7E6F2;
  --text-muted: #A6A8C9;
  --primary: #C9A227;
  --primary-hover: #DDB435;
  --accent1: #C9A227;
  --font-alt: Georgia, serif;
}

body.theme-observatory h1,
body.theme-observatory h2,
body.theme-observatory h3,
body.theme-observatory h4,
body.theme-observatory .hero-title,
body.theme-observatory .section-title,
body.theme-observatory .sub-title,
body.theme-observatory .modal-title {
  font-family: Georgia, serif;
}

/* 30. Dark Academia, Refined */
body.theme-dark-academia-refined {
  --bg: #1B140F;
  --bg2: #241B14;
  --bg3: #2E2219;
  --card: #241B14;
  --card2: #2F231A;
  --card-hover: rgba(184, 112, 62, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --text: #EFE6D8;
  --text-muted: #BBA88A;
  --primary: #B8703E;
  --primary-hover: #CF7E46;
  --accent1: #B8703E;
  --font-alt: Georgia, serif;
}

body.theme-dark-academia-refined h1,
body.theme-dark-academia-refined h2,
body.theme-dark-academia-refined h3,
body.theme-dark-academia-refined h4,
body.theme-dark-academia-refined .hero-title,
body.theme-dark-academia-refined .section-title,
body.theme-dark-academia-refined .sub-title,
body.theme-dark-academia-refined .modal-title {
  font-family: Georgia, serif;
}

/* 31. Dark Academia (Clean Dark - No Canva) */
body.theme-dark-academia-clean {
  --bg: #0c0907;
  --bg2: #140f0c;
  --bg3: #1c140f;
  --card: #140f0c;
  --card2: #1c140f;
  --card-hover: rgba(245, 158, 11, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #fefaf6;
  --text-muted: #d6cbbe;
  --primary: #f59e0b;
  --primary-hover: #fbbf24;
  --accent1: #d97706;
  --accent2: #b45309;
}

/* ============================================================
   BEAUTIFUL THEME SELECTOR MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 10005;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 0;
}

/* Ensure floating sidebar tabs (like AI Tutor tab) never overlap Theme Gallery */
body.theme-drawer-open .sp-toggle-tab,
body.theme-drawer-open .sp-first-visit-tip,
body:has(#themeSelectorModal.open:not(.minimized)) .sp-toggle-tab,
body:has(#themeSelectorModal.open:not(.minimized)) .sp-first-visit-tip {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-50%) translateX(120%) !important;
}

.modal-overlay.open:not(.minimized) {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay.minimized {
  pointer-events: none;
}

.modal-content {
  background: var(--bg2, var(--card, #0f172a));
  border-left: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-radius: 20px 0 0 20px;
  padding: 1.15rem 1.15rem 1rem 1.15rem;
  width: 420px;
  max-width: 92vw;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -15px 0 45px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  color: var(--text, #f8fafc);
  pointer-events: auto;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
}

.modal-overlay.open .modal-content {
  transform: translateX(0);
}

.modal-overlay.minimized .modal-content {
  transform: translateX(105%);
  pointer-events: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text, #fff);
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
}

.modal-count-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary, #3b82f6);
  border: 1px solid rgba(59, 130, 246, 0.25);
  font-weight: 600;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  line-height: 1.3;
  white-space: normal;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-peek-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  color: var(--text, #fff);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-peek-btn:hover {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  color: var(--primary-contrast, #ffffff);
  transform: translateY(-1px);
}

.modal-close,
.close-btn {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  color: var(--text-muted, #94a3b8);
  font-size: 1.25rem;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.modal-close:hover,
.close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text, #fff);
  transform: rotate(90deg);
}

/* Theme Scope Bar - Modern Segmented Control Switch */
.theme-scope-bar {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin: 0.75rem 0 0.5rem;
}

.theme-scope-btn {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
  min-width: 0;
}

.theme-scope-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.theme-scope-btn.active {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.theme-scope-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.theme-scope-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}

.theme-scope-btn.active .theme-scope-title {
  color: var(--text, #fff);
  font-weight: 700;
}

.theme-scope-current-tag {
  display: none;
}

/* Category Filter Tabs - Sleek horizontal chips */
.theme-filter-bar {
  display: flex;
  gap: 5px;
  padding: 0.35rem 0 0.65rem;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.07));
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.theme-filter-bar::-webkit-scrollbar {
  display: none;
}

.theme-filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  color: var(--text-muted, #94a3b8);
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  font-family: 'Inter', sans-serif;
  flex: 1 1 auto;
  text-align: center;
  box-sizing: border-box;
}

.theme-filter-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text, #fff);
}

.theme-filter-btn.active {
  background: var(--primary, #3b82f6) !important;
  border-color: var(--primary, #3b82f6) !important;
  color: var(--primary-contrast, #ffffff) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  font-weight: 600;
}

/* Theme Search Box inside Drawer */
.theme-search-wrap {
  padding: 0.35rem 0 0.25rem;
}

.theme-search-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  color: var(--text, #fff);
  border-radius: 9px;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.theme-search-input:focus {
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.theme-search-input::placeholder {
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem 0;
  min-height: 0;
  max-height: none;
}

.theme-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

/* Theme Item Card */
.theme-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  height: auto;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
  text-align: left;
}

.theme-item.hidden {
  display: none !important;
}

.theme-item:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  background: rgba(255, 255, 255, 0.06);
}

.theme-item.active {
  border-color: var(--primary, #3b82f6) !important;
  background: rgba(59, 130, 246, 0.12) !important;
  box-shadow: 0 0 0 1px var(--primary, #3b82f6), 0 6px 20px rgba(59, 130, 246, 0.2) !important;
}

/* Swatch Box */
.theme-swatch-box {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-swatch-accent {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  opacity: 0.9;
}

.theme-swatch-icon {
  font-size: 1.1rem;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Theme Info */
.theme-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Outfit', sans-serif;
}

.theme-desc-text {
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  white-space: normal;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Radio checkmark */
.theme-radio-circle {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.theme-item.active .theme-radio-circle {
  border-color: var(--primary, #3b82f6);
  background: var(--primary, #3b82f6);
}

.theme-radio-circle svg {
  display: none;
}

.theme-item.active .theme-radio-circle svg {
  display: block;
}

/* Modal Footer */
.modal-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-preview-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
}

.theme-preview-scope-text {
  font-size: 0.76rem;
  white-space: nowrap;
  color: var(--text-muted, #94a3b8);
}

.theme-preview-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.theme-preview-name-wrap strong {
  color: var(--text, #fff);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.theme-preview-badge {
  font-size: 0.62rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.18);
  color: var(--primary, #3b82f6);
  font-weight: 700;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.theme-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.theme-btn-cancel {
  flex: 0 0 auto;
  padding: 0.55rem 0.9rem;
  text-align: center;
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  color: var(--text-muted, #94a3b8);
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.theme-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #fff);
}

.theme-btn-apply-all {
  flex: 1;
  padding: 0.55rem 0.75rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  color: var(--text, #fff);
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.theme-btn-apply-all:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.theme-btn-apply {
  flex: 1.25;
  padding: 0.55rem 0.9rem;
  text-align: center;
  background: var(--primary, #3b82f6);
  border: none;
  color: var(--primary-contrast, #ffffff);
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.theme-btn-apply:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* Floating Peek Mini-Bar */
.theme-minibar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  background: var(--bg2, var(--card, #1e293b));
  border: 1.5px solid var(--border, rgba(255, 255, 255, 0.2));
  border-radius: 50px;
  padding: 8px 14px 8px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: var(--text, #f8fafc);
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-width: calc(100vw - 48px);
}

.modal-overlay.open.minimized .theme-minibar {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.theme-minibar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.theme-minibar-icon {
  font-size: 1.1rem;
}

.theme-minibar-text {
  color: var(--text, #fff);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-minibar-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.25);
  color: var(--primary, #3b82f6);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.theme-minibar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-minibar-btn {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  border: none;
}

.theme-minibar-btn.expand {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text, #fff);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.2));
}

.theme-minibar-btn.expand:hover {
  background: rgba(255, 255, 255, 0.22);
}

.theme-minibar-btn.cancel {
  background: transparent;
  color: var(--text-muted, #94a3b8);
}

.theme-minibar-btn.cancel:hover {
  color: var(--text, #fff);
}

.theme-minibar-btn.apply {
  background: var(--primary, #3b82f6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.theme-minibar-btn.apply:hover {
  filter: brightness(1.1);
}

/* Responsive adjustment for small screens */
@media (max-width: 640px) {
  .modal-content {
    width: 100vw;
    max-width: 100vw;
    border-radius: 20px 20px 0 0;
    height: 75vh;
    max-height: 75vh;
    align-self: flex-end;
    transform: translateY(100%);
  }

  .modal-overlay.open .modal-content {
    transform: translateY(0);
  }

  .modal-overlay.minimized .modal-content {
    transform: translateY(105%);
  }
}

/* Scrollbars */
.theme-grid::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.theme-grid::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

.theme-grid::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.theme-grid::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Toast */
.theme-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: #f8fafc;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.theme-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive Table Wrappers & Usability */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: var(--card, rgba(255, 255, 255, 0.02));
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  scrollbar-width: thin;
}

.table-wrap table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  margin: 0;
}

.table-wrap th,
.table-wrap td {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  font-size: 0.88rem;
}

.table-wrap th {
  background: var(--card2, rgba(255, 255, 255, 0.05));
  font-weight: 700;
  color: var(--primary, #3b82f6);
}

/* Desktop Smooth Page Push When Drawer Is Open */
@media (min-width: 1200px) {
  body.theme-drawer-open {
    padding-right: 370px;
    transition: padding-right 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.theme-drawer-open .navbar {
    right: 370px !important;
    transition: right 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

/* Floating Sticky Unit Quick-Jumper */
.unit-quick-jumper {
  position: fixed;
  left: 20px;
  bottom: 24px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  background: var(--card, rgba(15, 23, 42, 0.8));
  border: 1.5px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: 50px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.25s ease;
  user-select: none;
}

.unit-quick-jumper:hover {
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.unit-quick-jumper-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #94a3b8);
  padding: 0 4px;
}

.unit-jump-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: rgba(255, 255, 255, 0.05);
  color: var(--text, #f8fafc);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', sans-serif;
  text-decoration: none;
}

.unit-jump-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  color: #fff;
  border-color: var(--primary, #3b82f6);
}

.unit-jump-pill.active {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  color: var(--primary-contrast, #ffffff);
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.4);
}

@media (max-width: 768px) {
  .unit-quick-jumper {
    left: 50%;
    transform: translateX(-50%);
    bottom: 16px;
    padding: 4px 6px;
    gap: 4px;
  }

  .unit-quick-jumper:hover {
    transform: translateX(-50%) translateY(-1px);
  }

  .unit-quick-jumper-label {
    display: none;
  }

  .unit-jump-pill {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
  }
}

/* Nav Dropdown for Secondary Links */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn,
.nav-dropdown:focus-within .nav-dropdown-btn {
  color: var(--text, #fff);
  background: rgba(255, 255, 255, 0.08);
}

.nav-dropdown-caret {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-caret,
.nav-dropdown:focus-within .nav-dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--bg2, var(--card, #0f172a));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  animation: fadeInDown 0.15s ease-out;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-menu .nav-link {
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-dropdown-menu .nav-link:hover {
  color: var(--text, #fff);
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.nav-dropdown-menu .nav-link.active {
  color: var(--primary, #3b82f6);
  background: rgba(59, 130, 246, 0.12);
  font-weight: 600;
}

/* ============================================================
   STANDALONE PYQ PAPERS & QUESTION CARDS THEME INTEGRATION
   ============================================================ */
.pyq-standalone-navbar {
  position: sticky;
  top: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--card2, rgba(20, 15, 12, 0.95));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-bottom: 2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.pyq-standalone-navbar .btn-back {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary, #f59e0b);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  background: rgba(245, 158, 11, 0.1);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(245, 158, 11, 0.2));
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.pyq-standalone-navbar .btn-back:hover {
  background: var(--primary, #f59e0b);
  color: #fff;
  transform: translateX(-2px);
}

.pyq-standalone-navbar .nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pyq-standalone-navbar .btn-theme-selector {
  padding: 0.45rem 0.9rem;
  background: var(--card, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: 8px;
  color: var(--text, #fff);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.pyq-standalone-navbar .btn-theme-selector:hover {
  background: var(--primary, #f59e0b);
  color: #fff;
  border-color: var(--primary, #f59e0b);
}

/* Standalone paper question cards and typography theme bindings */
body.theme-chalkboard,
body.theme-field-notebook,
body.theme-observatory,
body.theme-dark-academia-refined,
body[class*="theme-"] {
  background-color: var(--bg) !important;
  color: var(--text) !important;
}

body[class*="theme-"] .question-card,
body[class*="theme-"] .header-info,
body[class*="theme-"] .card,
body[class*="theme-"] #paperContentContainer {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}

/* Headers and Accent Titles */
body[class*="theme-"] .question-header,
body[class*="theme-"] .part-header,
body[class*="theme-"] .section-title,
body[class*="theme-"] .step-title,
body[class*="theme-"] #paperContent .question-header,
body[class*="theme-"] #paperContent .part-header,
body[class*="theme-"] #paperContent .section-title,
body[class*="theme-"] #paperContent span.step-title {
  color: var(--primary) !important;
}

/* Question & Paper Main Text */
body[class*="theme-"] .question-text,
body[class*="theme-"] .final-answer,
body[class*="theme-"] h1,
body[class*="theme-"] h2,
body[class*="theme-"] h3,
body[class*="theme-"] h4,
body[class*="theme-"] .header-title,
body[class*="theme-"] .header-subtitle,
body[class*="theme-"] #paperTitle,
body[class*="theme-"] #paperContent,
body[class*="theme-"] #paperContent .question-text,
body[class*="theme-"] #paperContent p,
body[class*="theme-"] #paperContent li,
body[class*="theme-"] #paperContent div.step,
body[class*="theme-"] #paperContent span:not(.step-title):not(.badge) {
  color: var(--text) !important;
  text-shadow: none !important;
}

body[class*="theme-"] .subtitle,
body[class*="theme-"] #paperContent .subtitle,
body[class*="theme-"] #paperContent .header-subtitle {
  color: var(--text-muted, var(--text)) !important;
}

/* Solution Container */
body[class*="theme-"] .solution-content,
body[class*="theme-"] #paperContent .solution-content {
  background: var(--card2, rgba(255, 255, 255, 0.04)) !important;
  border: 1px solid var(--border) !important;
  border-left: 4px solid var(--primary) !important;
  color: var(--text) !important;
}

/* Click to Reveal Button - Prominent, Theme-Harmonious & High Contrast */
body[class*="theme-"] .reveal-solution summary,
body[class*="theme-"] #paperContent .reveal-solution summary,
.reveal-solution summary {
  background-color: var(--primary) !important;
  color: var(--primary-contrast, #ffffff) !important;
  padding: 0.75rem 1.4rem !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  cursor: pointer !important;
  user-select: none !important;
  list-style: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  letter-spacing: 0.2px !important;
}

body[class*="theme-"] .reveal-solution summary:hover,
body[class*="theme-"] #paperContent .reveal-solution summary:hover,
.reveal-solution summary:hover {
  filter: brightness(1.1) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
}

body[class*="theme-"] .reveal-solution summary:active,
body[class*="theme-"] #paperContent .reveal-solution summary:active,
.reveal-solution summary:active {
  transform: translateY(0) !important;
}

/* MCQ Options */
body[class*="theme-"] .mcq-options li,
body[class*="theme-"] #paperContent .mcq-options li {
  background: var(--card2, rgba(255, 255, 255, 0.03)) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

body[class*="theme-"] .mcq-options li:hover:not(.answered-state),
body[class*="theme-"] #paperContent .mcq-options li:hover:not(.answered-state) {
  border-color: var(--primary) !important;
  background: var(--card-hover, rgba(255, 255, 255, 0.08)) !important;
  color: var(--primary) !important;
}

body[class*="theme-"] .mcq-options li.correct,
body[class*="theme-"] #paperContent .mcq-options li.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}

body[class*="theme-"] .mcq-options li.wrong,
body[class*="theme-"] #paperContent .mcq-options li.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

/* ============================================================
   GLOBAL THEME HEADER / NAVBAR HARMONIZATION
   ============================================================ */
body[class*="theme-"] .navbar,
body[class*="theme-"] .pyq-navbar,
body[class*="theme-"] .pyq-standalone-navbar,
body.theme-default .navbar {
  background: var(--bg-nav, var(--card)) !important;
  border-bottom: 1px solid var(--border) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Nav Brand text */
body[class*="theme-"] .nav-brand,
body[class*="theme-"] .nav-title,
body[class*="theme-"] .pyq-navbar .nav-title {
  color: var(--text) !important;
}

body[class*="theme-"] .nav-sub,
body[class*="theme-"] .pyq-navbar .nav-sub {
  color: var(--text-muted) !important;
}

/* Nav Links */
body[class*="theme-"] .nav-link {
  color: var(--text-muted) !important;
  transition: color 0.2s ease, background 0.2s ease !important;
}

body[class*="theme-"] .nav-link:hover {
  color: var(--text) !important;
  background: var(--card-hover, rgba(255, 255, 255, 0.08)) !important;
}

body[class*="theme-"] .nav-link.active {
  color: var(--primary) !important;
  background: var(--card2, rgba(255, 255, 255, 0.12)) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
}

/* Light Theme Active Nav Link adjustment */
body.light-theme .nav-link.active,
body.theme-light .nav-link.active,
body.theme-field-notebook .nav-link.active,
body.theme-solar-light .nav-link.active,
body.theme-rose-gold .nav-link.active {
  background: rgba(0, 0, 0, 0.07) !important;
}

/* Search input in Navbar */
body[class*="theme-"] #globalSearch {
  background: var(--card2, rgba(255, 255, 255, 0.06)) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

body[class*="theme-"] #globalSearch::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.8 !important;
}

body[class*="theme-"] #globalSearch:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1) !important;
}

body.light-theme #globalSearch,
body.theme-light #globalSearch,
body.theme-field-notebook #globalSearch,
body.theme-solar-light #globalSearch,
body.theme-rose-gold #globalSearch {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

body[class*="theme-"] .search-results-dropdown {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
}

body[class*="theme-"] .search-result-item {
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
}

body[class*="theme-"] .search-result-item:hover {
  background: var(--card-hover, rgba(255, 255, 255, 0.08)) !important;
}

/* Dark mode toggle & theme selector in Navbar */
body[class*="theme-"] .btn-dark-toggle {
  background: var(--card2, rgba(255, 255, 255, 0.06)) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

body[class*="theme-"] .btn-dark-toggle:hover {
  background: var(--card-hover, rgba(255, 255, 255, 0.12)) !important;
}

body[class*="theme-"] #themeSelectorBtn,
body[class*="theme-"] .btn-theme-selector {
  background: var(--card2, rgba(255, 255, 255, 0.08)) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

body[class*="theme-"] #themeSelectorBtn:hover,
body[class*="theme-"] .btn-theme-selector:hover {
  background: var(--primary) !important;
  color: var(--primary-contrast, #ffffff) !important;
  border-color: var(--primary) !important;
}

/* Progress Action Button in Navbar */
body[class*="theme-"] .btn-progress:not(#themeSelectorBtn) {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover, var(--primary))) !important;
  color: var(--primary-contrast, #ffffff) !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Back Button in Navbar */
body[class*="theme-"] .btn-back,
body[class*="theme-"] .pyq-navbar .btn-back,
body[class*="theme-"] .pyq-standalone-navbar .btn-back {
  background: var(--card2, rgba(255, 255, 255, 0.08)) !important;
  border: 1px solid var(--border) !important;
  color: var(--primary) !important;
}

body[class*="theme-"] .btn-back:hover,
body[class*="theme-"] .pyq-navbar .btn-back:hover,
body[class*="theme-"] .pyq-standalone-navbar .btn-back:hover {
  background: var(--primary) !important;
  color: var(--primary-contrast, #ffffff) !important;
  border-color: var(--primary) !important;
}

/* Mobile Hamburger */
body[class*="theme-"] .nav-hamburger {
  color: var(--text) !important;
}