/* ======================================================
   Veterinaria Hub — Shared site styles + dark mode
   ====================================================== */

/* ===== SHARED LIGHT-MODE PRIMITIVES (homogenization) ===== */

/* Back-link — used on hub & quiz pages */
.back-link,
a[class*="back"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 18px;
  transition: color 0.15s, transform 0.15s;
}
.back-link:hover,
a[class*="back"]:hover {
  color: #4f46e5;
  transform: translateX(-2px);
}

/* Section title used across hub & planning pages */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 28px 12px 14px;
}

/* Floating toggles spacing (theme + lang buttons) */
#__themeToggle, #__langToggle {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ======================================================
   MOBILE RESPONSIVE — global fixes for screens < 700px
   ====================================================== */
@media (max-width: 700px) {
  /* Body padding reduction across all pages */
  body { padding: 16px 12px 80px !important; }

  /* Floating toggle buttons smaller + position adjusted */
  #__themeToggle, #__langToggle {
    width: 38px !important; height: 38px !important;
    font-size: 14px !important;
  }
  #__langToggle {
    width: auto !important; min-width: 48px;
    padding: 4px 10px !important; font-size: 12px !important;
  }

  /* HERO sections — reduce padding & font size */
  .hero, header {
    padding: 22px 16px !important;
    text-align: center;
  }
  .hero h1, header h1 {
    font-size: clamp(26px, 8vw, 36px) !important;
    word-wrap: break-word;
    line-height: 1.15 !important;
  }
  .hero p, header p { font-size: 14px !important; }
  .hero .badges { gap: 6px !important; }
  .hero .badge { font-size: 10px !important; padding: 4px 8px !important; }

  /* GRIDS — stack to single column on mobile */
  .tools-grid, .subjects-grid, .year-grid, .today-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .tool-card, .subject-card, .year-card {
    padding: 18px 16px !important;
  }
  .year-card { padding: 24px 18px !important; }
  .year-icon { font-size: 42px !important; }
  .year-title { font-size: 22px !important; }
  .tool-title, .subject-title { font-size: 16px !important; }
  .tool-desc, .subject-desc { font-size: 12.5px !important; }

  /* TABS — horizontally scrollable on mobile */
  .tabs, .main-tabs {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .tabs::-webkit-scrollbar, .main-tabs::-webkit-scrollbar { display: none; }
  .tab, .main-tab {
    flex-shrink: 0 !important;
    font-size: 12.5px !important;
    padding: 8px 12px !important;
  }

  /* Section titles smaller */
  .section-title { font-size: 11px !important; margin: 18px 6px 10px !important; }

  /* Back-link a touch smaller but still tappable */
  .back-link { font-size: 12px !important; margin-bottom: 12px !important; }

  /* Quick-stats grid (homepage) */
  .quick-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .quick-stat .num { font-size: 18px !important; }
  .quick-stat .lbl { font-size: 9px !important; }

  /* Buttons general */
  button, .btn, input[type="button"], input[type="submit"] {
    min-height: 40px;
  }

  /* Modal overlays */
  .modal, .picker, .fiche-modal {
    padding: 18px !important;
    max-width: 95vw !important;
  }

  /* === Planning page mobile === */
  .calendar {
    margin-left: -12px; margin-right: -12px;
    padding-left: 12px !important; padding-right: 12px !important;
  }
  .day-block { width: 200px !important; padding: 12px !important; }
  .compare-row { gap: 10px !important; }
  .compare-side .num { font-size: 22px !important; }
  .today-hero { padding: 20px 18px !important; }
  .today-hero .date-big { font-size: 22px !important; }
  .today-hero .countdown-row { gap: 8px !important; }
  .today-hero .cd { padding: 8px 10px !important; font-size: 12px !important; }

  /* Subject row in planning settings */
  .subj-row .subj-top {
    grid-template-columns: auto 1fr !important;
  }
  .subj-row .date-wrap {
    grid-column: 1 / -1 !important;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-left: 36px;
  }
  .chapters-grid {
    grid-template-columns: 1fr !important;
  }

  /* === Quiz page mobile === */
  .option, .opt-btn {
    font-size: 13.5px !important;
    padding: 10px 12px !important;
  }
  .question { font-size: 15px !important; line-height: 1.4 !important; }
  .chapter-grid, .chap-grid {
    grid-template-columns: 1fr !important;
  }

  /* Anki-style buttons (Ancora/Difficile/Buono/Facile) */
  .anki-btn { padding: 8px 4px !important; font-size: 11px !important; }

  /* Fiche cards stack on mobile */
  .fiche-card, .topic-card {
    padding: 12px 14px !important;
  }

  /* Heatmap shrinks on mobile */
  .heatmap, .heatmap-row {
    grid-template-columns: repeat(10, 1fr) !important;
  }
  .heatmap-grid {
    grid-template-columns: repeat(15, 1fr) !important;
  }

  /* Pratica image grid — 2 cols on mobile */
  .img-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Mastery chart scales down */
  .chart-wrap { height: 160px !important; }

  /* Action bars wrap */
  .action-bar, .badges-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .action-bar button { width: 100%; }

  /* Stats cards mobile */
  .stat-card, .sc, .big-stat {
    padding: 12px !important;
  }
  .stat-card .value, .sc .sc-num, .big-stat-num {
    font-size: 20px !important;
  }
}

/* Even tighter on very narrow phones */
@media (max-width: 380px) {
  body { padding: 10px 8px 70px !important; }
  .hero h1, header h1 { font-size: 24px !important; }
  .day-block { width: 180px !important; }
  .quick-stats-grid { grid-template-columns: 1fr !important; }
}



/* Smooth transitions */
html, body, .card, .tool-card, .year-card, .subject-card,
.quick-stats, .quick-stat, .exam-info, .hero,
.fiche-card, .fiche-modal, .img-card, .cheat-card,
.stat-card, .chapter-chip, .breakdown-row, .review-item,
.weak-item, .heatmap-cell {
  transition: background-color 0.25s, color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

/* === DARK THEME === */
html[data-theme="dark"] {
  color-scheme: dark;
  /* Variables CSS overrides — pour les pages qui utilisent var(--bg), var(--card)…
     (ex. quiz_anapat2 qui définit son propre :root) */
  --bg: #4a455f !important;
  --bg-primary: #4a455f !important;
  --card: #5a5470 !important;
  --bg-card: #5a5470 !important;
  --text: #f2f0f8 !important;
  --text-primary: #f2f0f8 !important;
  --text-muted: #c2bdd0 !important;
  --border: #6b6580 !important;
  --chip-bg: #574f72 !important;
  --primary-light: #574f72 !important;
  --primary-bg: #4a455f !important;
  --success-light: #2e5a47 !important;
  --danger-light: #6e2e2e !important;
}

html[data-theme="dark"] body {
  background: linear-gradient(135deg, #3a3450 0%, #423b5a 50%, #38334e 100%) !important;
  color: #ffffff !important;
}

/* Bump global readability — toutes les écritures plus blanches */
html[data-theme="dark"] p,
html[data-theme="dark"] span,
html[data-theme="dark"] li,
html[data-theme="dark"] label,
html[data-theme="dark"] div {
  color: inherit;
}

/* Cards, hero, etc. — un cran plus clair que le fond */
html[data-theme="dark"] .hero,
html[data-theme="dark"] .card,
html[data-theme="dark"] .year-card,
html[data-theme="dark"] .tool-card,
html[data-theme="dark"] .subject-card,
html[data-theme="dark"] .quick-stats,
html[data-theme="dark"] .quick-stat,
html[data-theme="dark"] .exam-info,
html[data-theme="dark"] .fiche-card,
html[data-theme="dark"] .fiche-modal,
html[data-theme="dark"] .img-card,
html[data-theme="dark"] .cheat-card,
html[data-theme="dark"] .stat-card {
  background: #5a5470 !important;
  color: #f2f0f8 !important;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2) !important;
}

/* Sous-cards encore un cran plus clair pour de la hiérarchie */
html[data-theme="dark"] .breakdown-row,
html[data-theme="dark"] .review-item,
html[data-theme="dark"] .weak-item {
  background: #6b6580 !important;
  color: #e8e4f0 !important;
}
html[data-theme="dark"] .img-card.unlabeled { background: #65576f !important; }
html[data-theme="dark"] .img-card.labeled { background: #3d5a48 !important; }
html[data-theme="dark"] .img-card.excluded { background: #5a3a3a !important; opacity: 0.6; }

/* Titles colored — pure white pour max lisibilité */
html[data-theme="dark"] header h1,
html[data-theme="dark"] .hero h1,
html[data-theme="dark"] .year-title,
html[data-theme="dark"] .tool-title,
html[data-theme="dark"] .subject-title,
html[data-theme="dark"] .fiche-card .title,
html[data-theme="dark"] .img-card .label-input,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .quick-stat .num,
html[data-theme="dark"] .question,
html[data-theme="dark"] .stat-card .value,
html[data-theme="dark"] .quick-stat .lbl {
  color: #ffffff !important;
}

/* Texte normal — blanc cassé très lisible */
html[data-theme="dark"] header p,
html[data-theme="dark"] .hero p,
html[data-theme="dark"] .year-desc,
html[data-theme="dark"] .tool-desc,
html[data-theme="dark"] .subject-desc,
html[data-theme="dark"] .stat-card .label {
  color: #e8e0f5 !important;
}

/* Texte secondaire — gris-violet très clair, toujours lisible */
html[data-theme="dark"] .fiche-card .num,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .stats h3,
html[data-theme="dark"] footer,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .stat-trend,
html[data-theme="dark"] .tool-meta,
html[data-theme="dark"] .subject-meta {
  color: #c8c0db !important;
}

/* Force la couleur claire sur tout texte avec inline color trop sombre */
html[data-theme="dark"] [style*="color:#1f2937"],
html[data-theme="dark"] [style*="color: #1f2937"],
html[data-theme="dark"] [style*="color:#374151"],
html[data-theme="dark"] [style*="color: #374151"],
html[data-theme="dark"] [style*="color:#4b5563"],
html[data-theme="dark"] [style*="color: #4b5563"],
html[data-theme="dark"] [style*="color:#6b7280"],
html[data-theme="dark"] [style*="color: #6b7280"],
html[data-theme="dark"] [style*="color:#9ca3af"],
html[data-theme="dark"] [style*="color: #9ca3af"] {
  color: #d8d2e8 !important;
}

/* Force la couleur claire sur les texts indigo trop foncés */
html[data-theme="dark"] [style*="color:#3730a3"],
html[data-theme="dark"] [style*="color: #3730a3"],
html[data-theme="dark"] [style*="color:#4f46e5"],
html[data-theme="dark"] [style*="color: #4f46e5"],
html[data-theme="dark"] [style*="color:#6d28d9"],
html[data-theme="dark"] [style*="color: #6d28d9"] {
  color: #c4b5fd !important;
}

/* Tabs */
html[data-theme="dark"] .tab,
html[data-theme="dark"] .main-tab,
html[data-theme="dark"] .chapter-chip {
  background: #4f4866 !important;
  color: #d8d4e2 !important;
}
html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .main-tab.active,
html[data-theme="dark"] .chapter-chip.selected {
  background: #818cf8 !important;
  color: white !important;
}

/* Inputs */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .label-input,
html[data-theme="dark"] #search,
html[data-theme="dark"] #ficheSearch,
html[data-theme="dark"] #cheatSearch,
html[data-theme="dark"] #domandeSearch {
  background: #2d2a3e !important;
  color: #ebe9f2 !important;
  border-color: #6b6580 !important;
}

/* Buttons (keep accents) */
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .chip {
  background: #5a5470 !important;
  color: #ebe9f2 !important;
}
html[data-theme="dark"] .btn-ghost {
  color: #b8b3c8 !important;
}

/* Options inside quizzes */
html[data-theme="dark"] .option,
html[data-theme="dark"] .opt-btn {
  background: #4a455f !important;
  color: #ebe9f2 !important;
  border-color: #6b6580 !important;
}
html[data-theme="dark"] .option:hover:not(:disabled),
html[data-theme="dark"] .opt-btn:hover:not(:disabled) {
  background: #574f72 !important;
  border-color: #a5b4fc !important;
}
html[data-theme="dark"] .option.correct,
html[data-theme="dark"] .opt-btn.correct {
  background: #2e5a47 !important;
  border-color: #34d399 !important;
  color: #d1fae5 !important;
}
html[data-theme="dark"] .option.wrong,
html[data-theme="dark"] .opt-btn.wrong {
  background: #6e2e2e !important;
  border-color: #f87171 !important;
  color: #fecaca !important;
}

/* Modals */
html[data-theme="dark"] .modal-overlay,
html[data-theme="dark"] .fiche-modal-overlay {
  background: rgba(0,0,0,0.75) !important;
}
html[data-theme="dark"] .modal {
  background: #3d3955 !important;
  color: #ebe9f2 !important;
}

/* Heatmap */
html[data-theme="dark"] .heatmap-cell { background: #4a455f !important; }
html[data-theme="dark"] .heatmap-cell[data-level="1"] { background: #2a5a4a !important; }
html[data-theme="dark"] .heatmap-cell[data-level="2"] { background: #2f7560 !important; }
html[data-theme="dark"] .heatmap-cell[data-level="3"] { background: #34a07a !important; }
html[data-theme="dark"] .heatmap-cell[data-level="4"] { background: #4ad19c !important; }

/* Explanation / amber boxes */
html[data-theme="dark"] .explanation,
html[data-theme="dark"] .feedback {
  background: #5a4528 !important;
  color: #fde68a !important;
}

/* Quiz tab badges (keep contrast) */
html[data-theme="dark"] .tag-chip {
  background: #6b46c1 !important;
  color: #ede9fe !important;
}
html[data-theme="dark"] .mastery-mastered { background: #2e5a47 !important; color: #6ee7b7 !important; }
html[data-theme="dark"] .mastery-learning { background: #5a4528 !important; color: #fde68a !important; }
html[data-theme="dark"] .mastery-new { background: #2e4a8a !important; color: #bfdbfe !important; }
html[data-theme="dark"] .mastery-lapsed { background: #6e2e2e !important; color: #fecaca !important; }

/* Toggles button background in dark */
html[data-theme="dark"] #__themeToggle,
html[data-theme="dark"] #__langToggle {
  background: rgba(74, 69, 95, 0.95) !important;
  color: #ebe9f2 !important;
}

/* Badges */
html[data-theme="dark"] .badge,
html[data-theme="dark"] .stat-pill,
html[data-theme="dark"] .year-badge {
  background: rgba(129, 140, 248, 0.25) !important;
  color: #c7d2fe !important;
}

/* Code/table */
html[data-theme="dark"] code,
html[data-theme="dark"] .fiche-content code {
  background: #4f4866 !important;
  color: #fde68a !important;
}
html[data-theme="dark"] .fiche-content th {
  background: #4f4866 !important;
  color: #c7d2fe !important;
}
html[data-theme="dark"] .fiche-content td {
  border-color: #6b6580 !important;
}
html[data-theme="dark"] .fiche-content tr:nth-child(even) td {
  background: #4a455f !important;
}

/* Fiche close button */
html[data-theme="dark"] .fiche-close {
  background: #5a5470 !important;
  color: #ebe9f2 !important;
}

/* ====== ANAPAT 2 — specific dark overrides ====== */
/* ANAPAT 2 uses different class names (.fiche-detail, .fiche-qa, .anki-btn, .quiz-bar, etc.) */
html[data-theme="dark"] .fiche-detail,
html[data-theme="dark"] .fiche-qa,
html[data-theme="dark"] .quiz-bar,
html[data-theme="dark"] .results-hero,
html[data-theme="dark"] .progress-bar {
  background: #6b6580 !important;
  color: #f2f0f8 !important;
  border-color: #7a7390 !important;
}
html[data-theme="dark"] .progress-fill {
  background: linear-gradient(90deg, #a5b4fc, #c4b5fd) !important;
}
html[data-theme="dark"] .fiche-qa-q,
html[data-theme="dark"] .results-score,
html[data-theme="dark"] .results-percent {
  color: #f2f0f8 !important;
}
html[data-theme="dark"] .fiche-qa-a {
  color: #6ee7b7 !important;
}
html[data-theme="dark"] .fiche-qa-e {
  color: #fde68a !important;
  background: rgba(251, 191, 36, 0.15) !important;
}
html[data-theme="dark"] .anki-btn {
  border-color: #6b6580 !important;
}
html[data-theme="dark"] .anki-btn.again { background: #6e2e2e !important; color: #fecaca !important; }
html[data-theme="dark"] .anki-btn.hard { background: #5a4528 !important; color: #fde68a !important; }
html[data-theme="dark"] .anki-btn.good { background: #2e5a47 !important; color: #6ee7b7 !important; }
html[data-theme="dark"] .anki-btn.easy { background: #2e4a8a !important; color: #bfdbfe !important; }

html[data-theme="dark"] .tab-badge {
  background: #818cf8 !important;
  color: white !important;
}
html[data-theme="dark"] .btn-next,
html[data-theme="dark"] .fiche-detail-action {
  background: #818cf8 !important;
  color: white !important;
}
html[data-theme="dark"] .btn-quit {
  background: #6b6580 !important;
  color: #ebe9f2 !important;
}
html[data-theme="dark"] .badges-row .badge,
html[data-theme="dark"] .stats-empty,
html[data-theme="dark"] .due-list-empty,
html[data-theme="dark"] .fiche-empty-search {
  color: #c2bdd0 !important;
}
html[data-theme="dark"] .question {
  color: #f2f0f8 !important;
}
html[data-theme="dark"] .feedback.correct {
  background: #2e5a47 !important;
  color: #d1fae5 !important;
}
html[data-theme="dark"] .feedback.wrong {
  background: #6e2e2e !important;
  color: #fecaca !important;
}

/* ====== ANAPAT 2 — fix all white-background classes ====== */
/* ANAPAT 2 uses background:white hardcoded in many CSS classes which bypass --card variable */

/* Stat cards (.sc) on Statistiche tab — Padroneggiate / Accuratezza / etc. */
html[data-theme="dark"] .sc {
  background: #5a5470 !important;
  border-color: #6b6580 !important;
  color: #f2f0f8 !important;
}
html[data-theme="dark"] .sc .sc-num {
  color: #ffffff !important;
}
html[data-theme="dark"] .sc .sc-lbl {
  color: #e8e0f5 !important;
}
html[data-theme="dark"] .sc .sc-sub {
  color: #c8c0db !important;
}
html[data-theme="dark"] .sc.green .sc-num,
html[data-theme="dark"] .sc.orange .sc-num,
html[data-theme="dark"] .sc.red .sc-num,
html[data-theme="dark"] .sc.blue .sc-num,
html[data-theme="dark"] .sc.purple .sc-num,
html[data-theme="dark"] .sc.gray .sc-num {
  /* keep the colored numbers but lighter for contrast */
  filter: brightness(1.5) saturate(1.2);
}

/* Stat section wrapper */
html[data-theme="dark"] .stat-section {
  background: #5a5470 !important;
  border-color: #6b6580 !important;
  color: #f2f0f8 !important;
}

/* Encouragement (motivational) box — light purple gradient in light mode */
html[data-theme="dark"] .encouragement {
  background: linear-gradient(135deg, #4a3d6b 0%, #3d3960 100%) !important;
  border-color: #6b5fa8 !important;
  color: #e8dcff !important;
}
html[data-theme="dark"] .encouragement strong,
html[data-theme="dark"] .encouragement .tt {
  color: #f0e9ff !important;
}

/* Due tab — inner white cards */
html[data-theme="dark"] .due-hero,
html[data-theme="dark"] .due-list-card {
  background: #5a5470 !important;
  border-color: #6b6580 !important;
  color: #f2f0f8 !important;
}
html[data-theme="dark"] .due-list-title {
  color: #c4b5fd !important;
}
html[data-theme="dark"] .due-list-empty {
  color: #c8c0db !important;
}

/* Fiche cards / detail / topic / search */
html[data-theme="dark"] .fiche-card,
html[data-theme="dark"] .fiche-detail,
html[data-theme="dark"] .topic-card {
  background: #5a5470 !important;
  border-color: #6b6580 !important;
  color: #f2f0f8 !important;
}
html[data-theme="dark"] .fiche-detail summary {
  color: #ffffff !important;
}
html[data-theme="dark"] .fiche-search {
  background: #2d2a3e !important;
  color: #ebe9f2 !important;
  border-color: #6b6580 !important;
}
html[data-theme="dark"] .fiche-detail-action.secondary {
  background: #5a5470 !important;
  color: #c4b5fd !important;
}

/* Mode buttons / options / select */
html[data-theme="dark"] .mode-btn,
html[data-theme="dark"] .opt-field select,
html[data-theme="dark"] .opt-toggle .check {
  background: #4a455f !important;
  color: #ebe9f2 !important;
  border-color: #6b6580 !important;
}

/* Big stats grid (.big-stat) — gradient → solid card */
html[data-theme="dark"] .big-stat,
html[data-theme="dark"] .big-stat.streak,
html[data-theme="dark"] .big-stat.due,
html[data-theme="dark"] .big-stat.mastered {
  background: #5a5470 !important;
  border-color: #6b6580 !important;
  color: #f2f0f8 !important;
}
html[data-theme="dark"] .big-stat-num { color: #ffffff !important; }
html[data-theme="dark"] .big-stat-lbl { color: #c8c0db !important; }
html[data-theme="dark"] .big-stat.streak .big-stat-num { color: #fdba74 !important; }
html[data-theme="dark"] .big-stat.due .big-stat-num { color: #fde68a !important; }
html[data-theme="dark"] .big-stat.mastered .big-stat-num { color: #6ee7b7 !important; }

/* Stat mini (in quiz bar) */
html[data-theme="dark"] .stat-mini {
  background: #574f72 !important;
}
html[data-theme="dark"] .stat-mini-num { color: #ffffff !important; }
html[data-theme="dark"] .stat-mini-lbl { color: #c8c0db !important; }

/* Heatmap cells — light grey on light theme, much darker on dark */
html[data-theme="dark"] .heatmap-cell-big,
html[data-theme="dark"] .heatmap-cell {
  background: #4a455f !important;
}
html[data-theme="dark"] .heatmap-cell-big[data-i="1"],
html[data-theme="dark"] .heatmap-cell[data-i="1"] {
  background: #6b5fa8 !important;
}
html[data-theme="dark"] .heatmap-cell-big[data-i="2"],
html[data-theme="dark"] .heatmap-cell[data-i="2"] {
  background: #8b7fd8 !important;
}
html[data-theme="dark"] .heatmap-cell-big[data-i="3"],
html[data-theme="dark"] .heatmap-cell[data-i="3"] {
  background: #a78bfa !important;
}
html[data-theme="dark"] .heatmap-cell-big[data-i="4"],
html[data-theme="dark"] .heatmap-cell[data-i="4"] {
  background: #c4b5fd !important;
}
html[data-theme="dark"] .heatmap-legend-cell { border: 1px solid #6b6580; }

/* Inline gradient welcome box (statistiche zero-state) — injected via JS */
html[data-theme="dark"] [style*="linear-gradient(135deg,#eef2ff"],
html[data-theme="dark"] [style*="linear-gradient(135deg, #eef2ff"] {
  background: linear-gradient(135deg, #4a3d6b, #3d3960) !important;
  border-color: #6b5fa8 !important;
  color: #e8dcff !important;
}

/* Review-expl small white boxes */
html[data-theme="dark"] .review-expl {
  background: #4a455f !important;
  color: #ebe9f2 !important;
}

/* Inline "background:white" / "background:linear-gradient" patterns (catch-all) */
html[data-theme="dark"] [style*="background:white"],
html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"] {
  background: #5a5470 !important;
  color: #ebe9f2 !important;
}

/* Force colored inline texts (primary-dark etc.) to be lighter */
html[data-theme="dark"] [style*="color:#5b21b6"],
html[data-theme="dark"] [style*="color: #5b21b6"],
html[data-theme="dark"] [style*="color:#4338ca"],
html[data-theme="dark"] [style*="color: #4338ca"] {
  color: #c4b5fd !important;
}

/* Forza tutte les couleurs basées sur var(--primary-dark) dans inline style */
html[data-theme="dark"] [style*="color:var(--primary-dark)"],
html[data-theme="dark"] [style*="color: var(--primary-dark)"] {
  color: #c4b5fd !important;
}
html[data-theme="dark"] [style*="color:var(--text-muted)"],
html[data-theme="dark"] [style*="color: var(--text-muted)"] {
  color: #c8c0db !important;
}

/* ====== Back-link / exam-info (hub pages) ====== */
html[data-theme="dark"] .back-link {
  color: #c8c0db !important;
}
html[data-theme="dark"] .back-link:hover {
  color: #ffffff !important;
}
html[data-theme="dark"] .exam-info h2 {
  color: #c4b5fd !important;
}
html[data-theme="dark"] .exam-info p,
html[data-theme="dark"] .exam-info li,
html[data-theme="dark"] .exam-info ul {
  color: #e8e0f5 !important;
}

/* ===== Hero & logo glow tweaks for dark mode (fix halo) ===== */
html[data-theme="dark"] .hero::before {
  /* The light radial gradient creates an ugly halo on dark bg → tone it way down */
  background: radial-gradient(circle, rgba(255, 255, 255, 0.025) 0%, transparent 60%) !important;
}
html[data-theme="dark"] .hero-logo {
  /* Soft neutral shadow instead of violet glow that haloed on dark */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

/* Light theme — make sure ANAPAT 2 light works too (it has its own CSS) */
html[data-theme="light"] {
  /* reset variables in case dark left them */
  --bg: initial;
  --card: initial;
  --text: initial;
}
