/* ============================================================================
   dark-mode.css — centralized dark-mode overrides (admin + frontend)

   Loaded via <link> from layouts/admin.blade.php and layouts/app.blade.php.
   Lives in public/ so it is NOT processed by Vite/PurgeCSS.

   Specificity strategy:
   - Variable overrides use `html[data-bs-theme="dark"]` (0,1,1) so they beat
     per-page `:root { ... }` blocks (0,1,0) regardless of source order.
   - Class overrides use `html[data-bs-theme="dark"] .x` (0,2,1) so they beat
     per-page `.x` rules (0,1,0) that render later in <body>.
   - `!important` is only added where the page itself uses `!important`.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   0. Palette
   ------------------------------------------------------------------------ */
html[data-bs-theme="dark"] {
    color-scheme: dark;

    /* Surfaces */
    --dm-bg: #141a22;
    --dm-surface: #1b222c;
    --dm-surface-2: #222a35;
    --dm-surface-3: #2a3340;
    --dm-surface-4: #333d4b;

    /* Text */
    --dm-text: #e5eaf1;
    --dm-text-2: #b6c0cd;
    --dm-text-3: #8b97a8;

    /* Lines */
    --dm-border: #303a47;
    --dm-border-soft: #273039;

    /* Accents (emerald, readable on dark) */
    --dm-emerald: #34d399;
    --dm-emerald-strong: #10b981;

    /* Page-level vars redeclared by ~18 blades */
    --text-dark: #e5eaf1;
    --text-muted: #8b97a8;
    --text-light: #6f7b8c;
    --text-color-primary: #e5eaf1;
    --text-color-secondary: #b6c0cd;
    --bg-light: #141a22;
    --bg-lighter: #1b222c;
    --bg-color-primary: #1b222c;
    --bg-color-secondary: #1f2731;
    --border-light: #303a47;
    --border-lighter: #273039;
    --soft-grey: #1f2731;

    /* Tailwind-ish ramps redeclared by several blades */
    --slate-50: #1f2731;
    --slate-100: #222a35;
    --slate-200: #2a3340;
    --slate-300: #3a4553;
    --slate-400: #8b97a8;
    --slate-500: #8b97a8;
    --slate-600: #b6c0cd;
    --slate-700: #cbd5e1;
    --slate-800: #e5eaf1;
    --slate-900: #f1f5f9;

    /* Emerald pastels → dark emerald tints */
    --emerald-50: #0f3b2e;
    --emerald-100: #14523e;
    --emerald-200: #1a6b4f;
    --emerald-soft: #0f3b2e;
    --light-emerald: #0f3b2e;

    /* Glass */
    --glass-bg: rgba(27, 34, 44, 0.95);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* ---------------------------------------------------------------------------
   1. Global element regressions from resources/css/styles.css
   ------------------------------------------------------------------------ */
html[data-bs-theme="dark"] body {
    background: var(--dm-bg);
}

html[data-bs-theme="dark"] h1,
html[data-bs-theme="dark"] h2,
html[data-bs-theme="dark"] h3,
html[data-bs-theme="dark"] h4,
html[data-bs-theme="dark"] h5,
html[data-bs-theme="dark"] h6 {
    color: var(--dm-text);
}

html[data-bs-theme="dark"] p,
html[data-bs-theme="dark"] li {
    color: var(--dm-text-2);
}

/* blog/show — blog-show.css is @vite'd inside @section('content') (body), so it
   loads after this file and wins same-specificity ties; outrank it explicitly.
   Also fixes MathJax equations in .raw-html-embed, which inherit article color. */
html[data-bs-theme="dark"] article.content {
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] article.content h1,
html[data-bs-theme="dark"] article.content h2,
html[data-bs-theme="dark"] article.content h3,
html[data-bs-theme="dark"] article.content h4,
html[data-bs-theme="dark"] article.content h5,
html[data-bs-theme="dark"] article.content h6 {
    color: var(--dm-text);
}

html[data-bs-theme="dark"] .mathjax {
    color: var(--dm-text-2);
}

/* blog/show table of contents — #475569 is too dim on dark */
html[data-bs-theme="dark"] .toc-list a {
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .toc-list a:hover,
html[data-bs-theme="dark"] .toc-list a.active {
    color: var(--dm-emerald);
}

html[data-bs-theme="dark"] .nav-link:not(.modern-sidebar-link):not(.v-nav-link) {
    color: #cdd6e0 !important;
}

html[data-bs-theme="dark"] .nav-link:not(.modern-sidebar-link):not(.v-nav-link):hover {
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .navbar {
    background-color: var(--dm-surface);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

html[data-bs-theme="dark"] .search-results {
    border-color: var(--dm-border);
}

html[data-bs-theme="dark"] .search-results a {
    border-bottom-color: var(--dm-border-soft);
}

html[data-bs-theme="dark"] .search-results a:hover {
    background-color: var(--dm-surface-2);
}

html[data-bs-theme="dark"] .primary-color {
    color: #7dd3c0;
}

/* ---------------------------------------------------------------------------
   2. Bootstrap utilities that are not theme-aware
   ------------------------------------------------------------------------ */
html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .bg-light {
    background-color: var(--dm-surface) !important;
}

html[data-bs-theme="dark"] .bg-white.border,
html[data-bs-theme="dark"] .bg-light.border,
html[data-bs-theme="dark"] .bg-white.border-top,
html[data-bs-theme="dark"] .bg-white.border-bottom,
html[data-bs-theme="dark"] .bg-white.border-start,
html[data-bs-theme="dark"] .bg-white.border-end {
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .text-dark {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .text-body {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .table {
    --bs-table-color: var(--dm-text-2);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--dm-border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .table > :not(caption) > * > * {
    background-color: transparent;
    color: inherit;
    border-bottom-color: var(--dm-border);
}

html[data-bs-theme="dark"] .table thead th {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-text-3) !important;
    border-bottom-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.04);
    color: inherit;
}

html[data-bs-theme="dark"] .btn-light,
html[data-bs-theme="dark"] .btn-outline-light {
    --bs-btn-color: var(--dm-text);
    --bs-btn-bg: var(--dm-surface-3);
    --bs-btn-border-color: var(--dm-border);
    --bs-btn-hover-color: var(--dm-text);
    --bs-btn-hover-bg: var(--dm-surface-4);
    --bs-btn-hover-border-color: var(--dm-border);
    --bs-btn-focus-shadow-rgb: 130, 140, 155;
    --bs-btn-active-color: var(--dm-text);
    --bs-btn-active-bg: var(--dm-surface-4);
    --bs-btn-active-border-color: var(--dm-border);
    --bs-btn-disabled-color: var(--dm-text-3);
    --bs-btn-disabled-bg: var(--dm-surface-2);
    --bs-btn-disabled-border-color: var(--dm-border-soft);
}

html[data-bs-theme="dark"] .text-bg-light {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .list-group-item {
    background-color: var(--dm-surface);
    color: var(--dm-text-2);
    border-color: var(--dm-border);
}

html[data-bs-theme="dark"] .list-group-item.active {
    background-color: var(--dm-emerald-strong);
    border-color: var(--dm-emerald-strong);
    color: #fff;
}

html[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--dm-surface);
    border-color: var(--dm-border);
}

html[data-bs-theme="dark"] .dropdown-item {
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: var(--dm-surface-3);
    color: var(--dm-text);
}

html[data-bs-theme="dark"] .modal-content {
    background-color: var(--dm-surface);
    color: var(--dm-text);
    border-color: var(--dm-border);
}

html[data-bs-theme="dark"] .modal-header,
html[data-bs-theme="dark"] .modal-footer {
    border-color: var(--dm-border);
}

html[data-bs-theme="dark"] .offcanvas {
    background-color: var(--dm-surface);
    color: var(--dm-text);
}

html[data-bs-theme="dark"] .card {
    --bs-card-bg: var(--dm-surface);
    --bs-card-color: var(--dm-text-2);
    --bs-card-border-color: var(--dm-border);
    background-color: var(--dm-surface);
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .card-title,
html[data-bs-theme="dark"] .card-header {
    color: var(--dm-text);
}

html[data-bs-theme="dark"] .card-header {
    background-color: transparent;
    border-bottom-color: var(--dm-border);
}

html[data-bs-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--dm-text-3);
}

html[data-bs-theme="dark"] .breadcrumb-item a {
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .page-link {
    background-color: var(--dm-surface-2);
    color: var(--dm-text-2);
    border-color: var(--dm-border);
}

html[data-bs-theme="dark"] .page-link:hover {
    background-color: var(--dm-surface-3);
    color: var(--dm-text);
}

html[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: var(--dm-emerald-strong);
    border-color: var(--dm-emerald-strong);
    color: #fff;
}

html[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: var(--dm-surface-2);
    color: var(--dm-text-3);
    border-color: var(--dm-border-soft);
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
    background-color: var(--dm-surface-2);
    border-color: var(--dm-border);
    color: var(--dm-text);
}

html[data-bs-theme="dark"] .form-control::placeholder {
    color: var(--dm-text-3);
}

/* In form-floating the label IS the placeholder; Bootstrap keeps ::placeholder
   transparent — re-hide it or the attr text overlaps the label in dark mode */
html[data-bs-theme="dark"] .form-floating > .form-control::placeholder {
    color: transparent;
}

html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus {
    background-color: var(--dm-surface-3);
    color: var(--dm-text);
    border-color: var(--dm-emerald-strong);
}

html[data-bs-theme="dark"] .form-control[readonly] {
    background-color: var(--dm-surface-2);
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .input-group-text {
    background-color: var(--dm-surface-3);
    border-color: var(--dm-border);
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .form-check-input {
    background-color: var(--dm-surface-3);
    border-color: var(--dm-border);
}

html[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--dm-emerald-strong);
    border-color: var(--dm-emerald-strong);
}

html[data-bs-theme="dark"] .form-label,
html[data-bs-theme="dark"] label {
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .form-text,
html[data-bs-theme="dark"] .valid-feedback,
html[data-bs-theme="dark"] .invalid-feedback {
    color: var(--dm-text-3);
}

html[data-bs-theme="dark"] .form-select option {
    background-color: var(--dm-surface);
    color: var(--dm-text);
}

html[data-bs-theme="dark"] .alert {
    --bs-alert-bg: var(--dm-surface-2);
    --bs-alert-color: var(--dm-text-2);
    --bs-alert-border-color: var(--dm-border);
    background-color: var(--dm-surface-2);
    color: var(--dm-text-2);
    border-color: var(--dm-border);
}

html[data-bs-theme="dark"] .progress {
    background-color: var(--dm-surface-3);
}

html[data-bs-theme="dark"] .accordion {
    --bs-accordion-bg: var(--dm-surface);
    --bs-accordion-color: var(--dm-text-2);
    --bs-accordion-border-color: var(--dm-border);
    --bs-accordion-btn-color: var(--dm-text);
    --bs-accordion-btn-active-color: var(--dm-text);
    --bs-accordion-btn-bg: transparent;
    --bs-accordion-btn-active-bg: transparent;
    --bs-accordion-body-color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .accordion-item {
    background-color: var(--dm-surface);
    border-color: var(--dm-border);
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .nav-tabs {
    border-bottom-color: var(--dm-border);
}

html[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: var(--dm-text-3);
}

html[data-bs-theme="dark"] .nav-tabs .nav-link.active,
html[data-bs-theme="dark"] .nav-tabs .nav-link:hover {
    color: var(--dm-text);
    background-color: transparent;
}

html[data-bs-theme="dark"] .nav-pills .nav-link:not(.active) {
    color: var(--dm-text-3);
}

html[data-bs-theme="dark"] .placeholder {
    color: var(--dm-text-3);
}

html[data-bs-theme="dark"] .text-muted {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
}

/* Inline style="background-color: white" / "background: white" surfaces */
html[data-bs-theme="dark"] [style*="background-color: white"],
html[data-bs-theme="dark"] [style*="background-color: #ffffff"],
html[data-bs-theme="dark"] [style*="background-color:#ffffff"],
html[data-bs-theme="dark"] [style*="background: white"],
html[data-bs-theme="dark"] [style*="background: #ffffff"],
html[data-bs-theme="dark"] [style*="background:#ffffff"],
html[data-bs-theme="dark"] [style*="background-color: #fff;"],
html[data-bs-theme="dark"] [style*="background: #fff;"] {
    background-color: var(--dm-surface) !important;
}

/* Inline very-light backgrounds */
html[data-bs-theme="dark"] [style*="background-color: #f9fafb"],
html[data-bs-theme="dark"] [style*="background-color:#f9fafb"],
html[data-bs-theme="dark"] [style*="background: #f8fafc"],
html[data-bs-theme="dark"] [style*="background: #f8f9fa"],
html[data-bs-theme="dark"] [style*="background-color: #f8fafc"],
html[data-bs-theme="dark"] [style*="background-color: #f1f5f9"],
html[data-bs-theme="dark"] [style*="background-color: #F4F6F9"],
html[data-bs-theme="dark"] [style*="background: #F4F6F9"] {
    background-color: var(--dm-bg) !important;
}

/* Inline dark text */
html[data-bs-theme="dark"] [style*="color: black"],
html[data-bs-theme="dark"] [style*="color: black;"],
html[data-bs-theme="dark"] [style*="color: #000"],
html[data-bs-theme="dark"] [style*="color: #1e293b"],
html[data-bs-theme="dark"] [style*="color: #0f172a"],
html[data-bs-theme="dark"] [style*="color: rgb(75, 85, 99)"],
html[data-bs-theme="dark"] [style*="color: #334155"],
html[data-bs-theme="dark"] [style*="color: #374151"],
html[data-bs-theme="dark"] [style*="color: #4b5563"] {
    color: var(--dm-text-2) !important;
}

/* ---------------------------------------------------------------------------
   3. Shared page-level custom classes (defined in many blades)
   ------------------------------------------------------------------------ */
html[data-bs-theme="dark"] .text-slate-400,
html[data-bs-theme="dark"] .text-slate-500,
html[data-bs-theme="dark"] .text-slate-600,
html[data-bs-theme="dark"] .text-slate-700,
html[data-bs-theme="dark"] .text-slate-800,
html[data-bs-theme="dark"] .text-slate-900 {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .text-slate-400 { color: var(--dm-text-3) !important; }

html[data-bs-theme="dark"] .bg-slate-50,
html[data-bs-theme="dark"] .bg-slate-100 {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .bg-slate-800 {
    background-color: var(--dm-surface-4) !important;
}

html[data-bs-theme="dark"] .border-slate-100,
html[data-bs-theme="dark"] .border-slate-200 {
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .bg-emerald-soft,
html[data-bs-theme="dark"] .bg-emerald-soft-flat,
html[data-bs-theme="dark"] .bg-light-emerald,
html[data-bs-theme="dark"] .bg-emerald-light {
    background-color: #0f3b2e !important;
}

html[data-bs-theme="dark"] .bg-light-emerald-subtle {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .bg-emerald-100 {
    background-color: #14523e !important;
}

html[data-bs-theme="dark"] .bg-rose-50,
html[data-bs-theme="dark"] .bg-rose-100 {
    background-color: #452028 !important;
}

html[data-bs-theme="dark"] .bg-violet-100,
html[data-bs-theme="dark"] .bg-purple-soft {
    background-color: #2f2a4a !important;
}

html[data-bs-theme="dark"] .bg-danger-soft {
    background-color: #452028 !important;
}

html[data-bs-theme="dark"] .bg-success-light {
    background-color: #14523e !important;
}

html[data-bs-theme="dark"] .bg-danger-light {
    background-color: #4a2229 !important;
}

html[data-bs-theme="dark"] .bg-danger-soft {
    color: #fca5a5 !important;
}

html[data-bs-theme="dark"] .text-violet-600,
html[data-bs-theme="dark"] .text-indigo-600 {
    color: #a5b4fc !important;
}

html[data-bs-theme="dark"] .text-emerald-600,
html[data-bs-theme="dark"] .text-emerald {
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .glass-card,
html[data-bs-theme="dark"] .glass-pill,
html[data-bs-theme="dark"] .glass-stat,
html[data-bs-theme="dark"] .glass-donation-card {
    background: rgba(27, 34, 44, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-bs-theme="dark"] .bg-white-20,
html[data-bs-theme="dark"] .bg-white-10 {
    background: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .dashboard-modern {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .border-bottom-dashed {
    border-bottom-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .table-modern th {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-text-3) !important;
    border-bottom-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .table-modern td {
    border-bottom-color: var(--dm-border-soft) !important;
}

html[data-bs-theme="dark"] .clean-card,
html[data-bs-theme="dark"] .modern-card,
html[data-bs-theme="dark"] .section-card,
html[data-bs-theme="dark"] .stat-card,
html[data-bs-theme="dark"] .faq-card,
html[data-bs-theme="dark"] .course-card,
html[data-bs-theme="dark"] .simulation-card,
html[data-bs-theme="dark"] .gen-loading-card,
html[data-bs-theme="dark"] .elegant-media-card,
html[data-bs-theme="dark"] .past-paper-card,
html[data-bs-theme="dark"] .past-stat-chip,
html[data-bs-theme="dark"] .past-type-pill,
html[data-bs-theme="dark"] .chat-assistant,
html[data-bs-theme="dark"] .chat-composer,
html[data-bs-theme="dark"] .glass-donation-card {
    background-color: var(--dm-surface) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .card-header-premium {
    background-color: var(--dm-surface) !important;
    border-bottom-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .table-search-box,
html[data-bs-theme="dark"] .search-container {
    background-color: transparent !important;
}

html[data-bs-theme="dark"] .premium-search,
html[data-bs-theme="dark"] .premium-search-input,
html[data-bs-theme="dark"] .form-control-modern,
html[data-bs-theme="dark"] .search-input,
html[data-bs-theme="dark"] .premium-search-box {
    background-color: var(--dm-surface-2) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .premium-search:focus-within,
html[data-bs-theme="dark"] .premium-search-input:focus,
html[data-bs-theme="dark"] .form-control-modern:focus,
html[data-bs-theme="dark"] .search-input:focus,
html[data-bs-theme="dark"] .premium-search-box:focus-within {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .modern-input,
html[data-bs-theme="dark"] .modern-filter-select,
html[data-bs-theme="dark"] .past-input {
    background-color: var(--dm-surface-2) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .modern-input:focus,
html[data-bs-theme="dark"] .modern-filter-select:focus,
html[data-bs-theme="dark"] .past-input:focus {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .modern-input-group-text {
    background-color: var(--dm-surface-3) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .modern-form-label {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .form-section-title {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .form-section-title::after {
    background-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .notification-glass,
html[data-bs-theme="dark"] .selection-card {
    background-color: var(--dm-surface-2) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .selection-card:hover,
html[data-bs-theme="dark"] .selection-card:has(.form-check-input:checked) {
    background-color: #0f3b2e !important;
}

html[data-bs-theme="dark"] .image-upload-wrapper,
html[data-bs-theme="dark"] .course-image-upload {
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .image-upload-wrapper:hover,
html[data-bs-theme="dark"] .course-image-upload:hover {
    background-color: var(--dm-surface-3) !important;
}

html[data-bs-theme="dark"] .ai-tool-btn-outline,
html[data-bs-theme="dark"] .improve-mode-pill,
html[data-bs-theme="dark"] .improve-mode-btn {
    background-color: var(--dm-surface-2) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .premium-btn-outline {
    background-color: var(--dm-surface-2) !important;
    border-color: var(--dm-emerald-strong) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .btn-outline-emerald,
html[data-bs-theme="dark"] .btn-outline-emerald-hero {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-emerald) !important;
    border-color: var(--dm-emerald-strong) !important;
}

html[data-bs-theme="dark"] .btn-outline-emerald:hover,
html[data-bs-theme="dark"] .btn-outline-emerald:focus,
html[data-bs-theme="dark"] .btn-outline-emerald.active {
    background-color: #0f3b2e !important;
    color: var(--dm-emerald) !important;
    border-color: var(--dm-emerald-strong) !important;
}

html[data-bs-theme="dark"] .btn-emerald-soft {
    background-color: #0f3b2e !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .btn-emerald-soft:hover {
    background-color: #14523e !important;
    color: #6ee7b7 !important;
}

html[data-bs-theme="dark"] .nav-pills .nav-link.active {
    background-color: var(--dm-surface) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .nav-pills .nav-link:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .status-badge-admin {
    background-color: #14523e !important;
    color: #6ee7b7 !important;
}

html[data-bs-theme="dark"] .status-badge-student,
html[data-bs-theme="dark"] .status-inactive,
html[data-bs-theme="dark"] .status-no,
html[data-bs-theme="dark"] .badge-regular,
html[data-bs-theme="dark"] .tag-pill,
html[data-bs-theme="dark"] .status-slate {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .status-active,
html[data-bs-theme="dark"] .status-yes,
html[data-bs-theme="dark"] .status-success {
    background-color: #14523e !important;
    color: #6ee7b7 !important;
}

html[data-bs-theme="dark"] .badge-featured,
html[data-bs-theme="dark"] .badge-score,
html[data-bs-theme="dark"] .badge-free,
html[data-bs-theme="dark"] .past-filter-badge {
    background-color: #0f3b2e !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .badge-premium {
    background-color: #3d3316 !important;
    color: #fbbf24 !important;
}

html[data-bs-theme="dark"] .badge-locked {
    background-color: #452028 !important;
    color: #fca5a5 !important;
}

html[data-bs-theme="dark"] .alert-success,
html[data-bs-theme="dark"] .premium-alert.alert-success {
    background-color: #0f3b2e !important;
    color: #6ee7b7 !important;
    border-color: #14523e !important;
}

html[data-bs-theme="dark"] .btn-edit,
html[data-bs-theme="dark"] .btn-edit-sm,
html[data-bs-theme="dark"] .action-btn-edit {
    background-color: #232a4d !important;
    color: #a5b4fc !important;
}

html[data-bs-theme="dark"] .btn-delete,
html[data-bs-theme="dark"] .btn-delete-sm,
html[data-bs-theme="dark"] .action-btn-delete {
    background-color: #452028 !important;
    color: #fca5a5 !important;
}

html[data-bs-theme="dark"] .avatar-upload-wrapper .avatar-edit label {
    background-color: var(--dm-surface-3) !important;
}

html[data-bs-theme="dark"] .avatar-upload-wrapper .avatar-edit label:hover {
    background-color: var(--dm-surface-4) !important;
}

html[data-bs-theme="dark"] .template-btn,
html[data-bs-theme="dark"] .qnav-btn.active-nav,
html[data-bs-theme="dark"] .create-settings-fab,
html[data-bs-theme="dark"] .nav-btn,
html[data-bs-theme="dark"] .btn-white,
html[data-bs-theme="dark"] .option-result,
html[data-bs-theme="dark"] .default-answer,
html[data-bs-theme="dark"] .choice-box,
html[data-bs-theme="dark"] .option-label,
html[data-bs-theme="dark"] .step-indicator {
    background-color: var(--dm-surface) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .btn-white:hover,
html[data-bs-theme="dark"] .nav-square:hover,
html[data-bs-theme="dark"] .floating-submit-bar .btn-white:hover {
    background-color: var(--dm-surface-3) !important;
}

html[data-bs-theme="dark"] .nav-square {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .skeleton-card {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .option-letter {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .choice-wrong,
html[data-bs-theme="dark"] .wrong-answer {
    background-color: #4a2229 !important;
}

html[data-bs-theme="dark"] .btn-outline-emerald.active {
    background-color: #0f3b2e !important;
}

html[data-bs-theme="dark"] .text-dark-blue {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .hupen-select select,
html[data-bs-theme="dark"] .hupen-select select option {
    background-color: var(--dm-surface-2);
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .ring-warning {
    background-color: #3d3316 !important;
}

html[data-bs-theme="dark"] .ring-danger {
    background-color: #452028 !important;
}

html[data-bs-theme="dark"] .stat-pill,
html[data-bs-theme="dark"] .stat-pill-modern {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .video-thumb {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .share-btn {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .curriculum-section {
    background-color: var(--dm-bg) !important;
}

html[data-bs-theme="dark"] .curriculum-fade-top {
    background: linear-gradient(180deg, var(--dm-bg) 0%, transparent 100%);
}

html[data-bs-theme="dark"] .curriculum-fade-bottom {
    background: linear-gradient(0deg, var(--dm-bg) 0%, transparent 100%);
}

html[data-bs-theme="dark"] .btn-view.active {
    background-color: var(--dm-surface) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .chat-page {
    background-color: var(--dm-bg) !important;
}

html[data-bs-theme="dark"] .profile-wrapper {
    background-color: var(--dm-bg) !important;
}

html[data-bs-theme="dark"] .profile-nav .nav-link {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .profile-nav .nav-link:hover:not(.active) {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .profile-nav .nav-link.active {
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .hero-shape {
    background-color: var(--dm-surface) !important;
}

html[data-bs-theme="dark"] .empty-icon-box {
    background-color: #0f3b2e !important;
}

html[data-bs-theme="dark"] .faq-q {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .faq-a,
html[data-bs-theme="dark"] .qr-toggle-btn {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .qr-toggle-btn,
html[data-bs-theme="dark"] .qr-image-container {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .btn-glow:hover {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .past-spec-list dt {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .past-spec-list dd,
html[data-bs-theme="dark"] .past-price,
html[data-bs-theme="dark"] .past-stat-chip strong {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .past-stat-chip small {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .past-type-pill {
    color: var(--dm-text-2) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .chapter-breadcrumb a {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .chapter-breadcrumb li {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .past-viewer-frame {
    background-color: var(--dm-surface-2) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .past-loading-overlay {
    background: rgba(20, 26, 34, 0.72) !important;
}

html[data-bs-theme="dark"] .favourite-btn {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .resources-offcanvas {
    background: rgba(27, 34, 44, 0.97) !important;
}

html[data-bs-theme="dark"] .hupen-lightbox-close {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text) !important;
}

/* partials/chapter/navigation */
html[data-bs-theme="dark"] .navigation-card {
    background: linear-gradient(135deg, var(--dm-surface) 0%, var(--dm-surface-2) 100%) !important;
    border-color: var(--dm-border) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

html[data-bs-theme="dark"] .navigation-card .border-top,
html[data-bs-theme="dark"] .border-slate-50 {
    border-color: var(--dm-border-soft) !important;
}

html[data-bs-theme="dark"] .view-course {
    background: var(--dm-surface-2) !important;
    color: var(--dm-emerald) !important;
    border: 2px solid var(--dm-emerald-strong) !important;
}

html[data-bs-theme="dark"] .view-course:hover {
    background: var(--dm-emerald-strong) !important;
    color: #ffffff !important;
    border-color: var(--dm-emerald-strong) !important;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3) !important;
}

html[data-bs-theme="dark"] .btn-success#btn {
    background: var(--dm-emerald-strong) !important;
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .btn-success#btn:hover:not(:disabled) {
    background: #059669 !important;
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.3) !important;
}

html[data-bs-theme="dark"] .btn-primary#btn,
html[data-bs-theme="dark"] .next {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

html[data-bs-theme="dark"] .btn-primary#btn:hover:not(:disabled),
html[data-bs-theme="dark"] .next:hover:not(:disabled) {
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: 0 12px 24px rgba(255, 255, 255, 0.15) !important;
}

html[data-bs-theme="dark"] .next:disabled,
html[data-bs-theme="dark"] .next.disabled,
html[data-bs-theme="dark"] .btn-primary#btn:disabled {
    background: var(--dm-surface-3) !important;
    color: var(--dm-text-3) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .hover-emerald:hover {
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .comment-item:hover {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .border-dashed {
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .comments-section .pagination .page-link {
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .comments-section .pagination .page-item.disabled .page-link {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-text-3) !important;
    border-color: var(--dm-border-soft) !important;
}

html[data-bs-theme="dark"] .ch-ai-hint {
    background: rgba(27, 34, 44, 0.7) !important;
    color: var(--dm-text-3) !important;
    border-color: #5b4fa8 !important;
}

html[data-bs-theme="dark"] .ch-ai-error {
    background: #452028 !important;
    color: #fca5a5 !important;
}

html[data-bs-theme="dark"] .explain-this-popup {
    background: var(--dm-surface) !important;
    border-color: #4c3f7a !important;
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .explain-key-point {
    background: #3d3316 !important;
    border-color: #6b5518 !important;
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .option-label:hover .option-letter {
    background-color: var(--dm-surface-3) !important;
}

html[data-bs-theme="dark"] .avatar-edit label {
    background-color: var(--dm-surface-3) !important;
}

html[data-bs-theme="dark"] .profile-item-premium:hover {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .profile-item-premium {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .profile-info-premium h6,
html[data-bs-theme="dark"] .user-info h6 {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .profile-email-premium,
html[data-bs-theme="dark"] .user-info small {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .profile-body-premium {
    background-color: var(--dm-surface) !important;
}

html[data-bs-theme="dark"] .profile-item-icon {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .profile-item-premium:hover .profile-item-icon {
    background-color: #0f3b2e !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .profile-footer-premium {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .logout-btn-premium {
    background-color: var(--dm-surface-3) !important;
    color: #f87171 !important;
}

html[data-bs-theme="dark"] .navbar-toggler-custom,
html[data-bs-theme="dark"] .btn-custom-icon,
html[data-bs-theme="dark"] .btn-close-custom {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .navbar-toggler-custom:hover,
html[data-bs-theme="dark"] .btn-custom-icon:hover {
    background-color: var(--dm-surface-4) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .btn-close-custom:hover {
    background-color: #452028 !important;
    color: #f87171 !important;
}

html[data-bs-theme="dark"] .nav-pill-link {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .nav-pill-link:hover {
    background-color: rgba(52, 211, 153, 0.12) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .active-pill {
    background-color: rgba(52, 211, 153, 0.16) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .pill-icon {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .modernized-offcanvas {
    background-color: var(--dm-bg) !important;
}

html[data-bs-theme="dark"] .modernized-header {
    background: var(--dm-surface) !important;
}

/* Logos sit on dark surfaces in dark mode → whiten (same trick as .footer-logo) */
html[data-bs-theme="dark"] .navbar-logo-img,
html[data-bs-theme="dark"] .brand-logo img,
html[data-bs-theme="dark"] .auth-logo {
    filter: brightness(0) invert(1);
}

html[data-bs-theme="dark"] .user-profile-card {
    background: var(--dm-surface) !important;
}

html[data-bs-theme="dark"] .v-nav-link {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .v-nav-icon {
    background: var(--dm-surface-2) !important;
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .v-nav-link:hover {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .v-nav-link:hover .v-nav-icon {
    background-color: #0f3b2e !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .text-danger.v-nav-link:hover {
    background-color: #452028 !important;
}

html[data-bs-theme="dark"] .text-danger.v-nav-link:hover .v-nav-icon {
    background-color: #4a2229 !important;
}

html[data-bs-theme="dark"] .nav-section-label {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .search-suggestions-dropdown {
    background: var(--dm-surface) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .search-suggestion-item {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .search-suggestion-item:hover,
html[data-bs-theme="dark"] .search-suggestion-item.is-active {
    background: var(--dm-surface-3) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .search-suggestion-thumb {
    background: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .search-suggestion-meta {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .mobile-search-box {
    background: var(--dm-surface) !important;
}

html[data-bs-theme="dark"] .search-suggestion-thumb-fallback {
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .modern-profile-panel {
    background: var(--dm-surface) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .profile-header-premium {
    background: linear-gradient(135deg, var(--dm-surface-2) 0%, #0f3b2e 100%) !important;
}

html[data-bs-theme="dark"] #mobile-search-submit {
    background-color: #0f3b2e !important;
    color: var(--dm-emerald) !important;
}

/* ---------------------------------------------------------------------------
   4. Admin-only specifics
   ------------------------------------------------------------------------ */

/* Sidebar avatar: must stay a light disc so dark-green initials stay readable */
html[data-bs-theme="dark"] .avatar-initials-circle.bg-white {
    background-color: #f1f5f9 !important;
    color: #065f46 !important;
}

html[data-bs-theme="dark"] .app-sidebar .user-panel .info a {
    color: #fff !important;
}

html[data-bs-theme="dark"] .app-footer {
    background-color: var(--dm-surface);
    border-top-color: var(--dm-border);
    color: var(--dm-text-3);
}

html[data-bs-theme="dark"] .app-content {
    background-color: transparent;
}

html[data-bs-theme="dark"] .app-header {
    background-color: var(--dm-surface) !important;
}

html[data-bs-theme="dark"] .app-header .nav-link {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .app-header .nav-link:hover,
html[data-bs-theme="dark"] .app-header .nav-link.active {
    color: var(--dm-emerald) !important;
}

/* admin/index + admin/show */
html[data-bs-theme="dark"] .premium-table thead th {
    background-color: var(--dm-surface) !important;
    color: var(--dm-text-3) !important;
    border-bottom-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .premium-table tbody tr:hover {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .premium-table td {
    color: var(--dm-text-2) !important;
    border-bottom-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .course-name,
html[data-bs-theme="dark"] .chapter-link {
    color: var(--dm-text) !important;
}

/* admin/show metric cards keep their gradients */
html[data-bs-theme="dark"] .btn-new-chapter {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .btn-new-chapter:hover {
    background-color: var(--dm-surface-4) !important;
}

/* admin/users/index */
html[data-bs-theme="dark"] .modern-table tbody tr {
    background: var(--dm-surface) !important;
}

html[data-bs-theme="dark"] .modern-table td {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .modern-table tbody tr:hover {
    background-color: #0f3b2e !important;
}

html[data-bs-theme="dark"] .modern-table thead th {
    background-color: var(--emerald-700, #047857) !important;
}

html[data-bs-theme="dark"] .modern-pagination .page-item .page-link {
    background-color: var(--dm-surface-3) !important;
    color: var(--dm-text-2) !important;
}

/* admin/users/show */
html[data-bs-theme="dark"] .activity-item:hover,
html[data-bs-theme="dark"] .fav-item:hover {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .activity-item,
html[data-bs-theme="dark"] .fav-item {
    border-bottom-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .badge-ai {
    background-color: #2f2a4a !important;
    color: #c4b5fd !important;
}

/* admin/media/index */
html[data-bs-theme="dark"] .media-preview-box {
    background-color: var(--dm-surface-2) !important;
}

html[data-bs-theme="dark"] .pagination .page-link {
    color: var(--dm-text-2) !important;
}

/* admin/announcements/create — email preview frame keeps a light surface */
html[data-bs-theme="dark"] .email-preview-frame {
    background-color: #ffffff !important;
    border-color: #edf2f7 !important;
}

/* CKEditor */
html[data-bs-theme="dark"] .ck.ck-toolbar {
    background-color: var(--dm-surface-2) !important;
    border-bottom-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .ck-content,
html[data-bs-theme="dark"] .ck-editor__editable_inline,
html[data-bs-theme="dark"] .ck.ck-editor__editable {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .ck.ck-toolbar .ck-toolbar__separator,
html[data-bs-theme="dark"] .ck.ck-toolbar .ck-button {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .ck.ck-toolbar .ck-button:hover:not(.ck-disabled) {
    background: var(--dm-surface-4) !important;
}

/* chapter/show content pane */
html[data-bs-theme="dark"] #content-div,
html[data-bs-theme="dark"] #link {
    background-color: var(--dm-surface) !important;
    color: var(--dm-text-2) !important;
}

/* admin/about wrapper */
html[data-bs-theme="dark"] .container-fluid[style*="#f9fafb"],
html[data-bs-theme="dark"] .container-fluid[style*=" #f9fafb"] {
    background-color: var(--dm-bg) !important;
}

/* ---------------------------------------------------------------------------
   5. Frontend layout specifics
   ------------------------------------------------------------------------ */
html[data-bs-theme="dark"] .modernized-navbar {
    background: rgba(20, 26, 34, 0.88) !important;
    backdrop-filter: blur(12px);
}

@media (max-width: 991.98px) {
    html[data-bs-theme="dark"] .modernized-navbar {
        background: var(--dm-surface) !important;
    }
}

html[data-bs-theme="dark"] .navbar-brand.text-white,
html[data-bs-theme="dark"] .navbar-brand .text-white {
    color: #fff !important;
}

html[data-bs-theme="dark"] .btn-outline-emerald-nav {
    color: var(--dm-emerald) !important;
    border-color: var(--dm-emerald-strong) !important;
    background-color: transparent !important;
}

html[data-bs-theme="dark"] .premium-search-input {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .search-icon-fixed {
    color: var(--dm-text-3) !important;
}

/* Footer / misc shared */
html[data-bs-theme="dark"] .callout {
    background-color: var(--dm-surface-2);
    border-color: var(--dm-border);
    color: var(--dm-text-2);
}

html[data-bs-theme="dark"] .callout h4 {
    color: var(--dm-text);
}

html[data-bs-theme="dark"] code,
html[data-bs-theme="dark"] pre {
    background-color: var(--dm-surface-2);
    color: var(--dm-text);
}

html[data-bs-theme="dark"] .raw-html-embed:not(:has(pre)) {
    background-color: var(--dm-surface-2);
}

html[data-bs-theme="dark"] .code-block-wrapper pre::-webkit-scrollbar-track,
html[data-bs-theme="dark"] .code-block-wrapper pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

/* Divider waves (welcome/allcourse/blog + hero) — hardcoded white fills glare in dark mode */
html[data-bs-theme="dark"] .shape-bottom svg path,
html[data-bs-theme="dark"] #hero svg path[fill] {
    fill: var(--dm-bg);
}

/* Scrollbars */
html[data-bs-theme="dark"] ::-webkit-scrollbar {
    background-color: var(--dm-bg);
}

html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background-color: #3d4855;
}

html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background-color: #4c5866;
}

/* Prism / code themes are already dark-friendly; keep selection readable */
html[data-bs-theme="dark"] ::selection {
    background-color: rgba(16, 185, 129, 0.35);
    color: #fff;
}

/* ---------------------------------------------------------------------------
   6. Leftover page-specific light rules (caught by coverage scan)
   ------------------------------------------------------------------------ */

/* admin/users/show — tailwind-ish stat chips */
html[data-bs-theme="dark"] .bg-amber-50 {
    background-color: #3a2e10 !important;
}

html[data-bs-theme="dark"] .bg-violet-50 {
    background-color: #2c2450 !important;
}

html[data-bs-theme="dark"] .bg-red-50 {
    background-color: #3a1c22 !important;
}

html[data-bs-theme="dark"] .bg-rose-50 {
    background-color: #3a1f28 !important;
}

/* admin/comments */
html[data-bs-theme="dark"] .text-dark-soft {
    color: var(--dm-text-2) !important;
}

/* partials/chapter/ai */
html[data-bs-theme="dark"] .chapter-ai-summary-card {
    background: linear-gradient(135deg, #241f3d 0%, #1e2430 100%) !important;
    border-color: #4c3f7a !important;
}

html[data-bs-theme="dark"] .chapter-ai-summary-card::before {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.22) 0%, transparent 70%) !important;
}

html[data-bs-theme="dark"] .ch-ai-label {
    color: #a78bfa !important;
}

html[data-bs-theme="dark"] .ch-ai-title {
    color: #c7d2fe !important;
}

html[data-bs-theme="dark"] .ch-ai-bullets li {
    color: var(--dm-text-2) !important;
    border-bottom-color: rgba(167, 139, 250, 0.22) !important;
}

html[data-bs-theme="dark"] .ch-notes-title {
    color: var(--dm-text) !important;
    border-bottom-color: #14523e !important;
}

/* blog/show page AI Summary Card */
html[data-bs-theme="dark"] .ai-summary-card {
    background: linear-gradient(135deg, #241f3d 0%, #1e2430 100%) !important;
    border-color: #4c3f7a !important;
}

html[data-bs-theme="dark"] .ai-summary-card::before {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.22) 0%, transparent 70%) !important;
}

html[data-bs-theme="dark"] .ai-summary-icon {
    background: linear-gradient(135deg, #7c3aed, #4f46e5) !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3) !important;
}

html[data-bs-theme="dark"] .ai-summary-label {
    color: #a78bfa !important;
}

html[data-bs-theme="dark"] .ai-summary-title {
    color: #c7d2fe !important;
}

html[data-bs-theme="dark"] .ai-summary-btn-generate {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%) !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25) !important;
}

html[data-bs-theme="dark"] .ai-summary-btn-generate:hover {
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35) !important;
    color: #fff !important;
}

html[data-bs-theme="dark"] .ai-summary-hint {
    color: var(--dm-text-2) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(167, 139, 250, 0.3) !important;
}

html[data-bs-theme="dark"] .ai-summary-loading {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .ai-dots span {
    background: #a78bfa !important;
}

html[data-bs-theme="dark"] .ai-summary-bullets li {
    color: var(--dm-text-2) !important;
    border-bottom-color: rgba(167, 139, 250, 0.22) !important;
}

html[data-bs-theme="dark"] .ai-summary-bullets li::before {
    background: linear-gradient(135deg, #7c3aed, #4f46e5) !important;
}

html[data-bs-theme="dark"] .ai-summary-error {
    color: #fca5a5 !important;
    background: #450a0a !important;
    border-color: #fecaca !important;
}

html[data-bs-theme="dark"] .ai-summary-error i {
    color: #fca5a5 !important;
}

/* my-quizzes pages */
html[data-bs-theme="dark"] .my-quizzes-page .stat-pill,
html[data-bs-theme="dark"] .stat-pill {
    background: var(--dm-surface-3) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .template-btn {
    background-color: var(--dm-surface-2) !important;
    border-color: var(--dm-border) !important;
}

/* allcourse filter select */
html[data-bs-theme="dark"] .form-select-emerald {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-emerald) !important;
}

/* admin/past_papers — vars are declared on .pp-page, so override there */
html[data-bs-theme="dark"] .pp-page {
    --pp-emerald: #34d399;
    --pp-emerald-dark: #6ee7b7;
    --pp-emerald-soft: #0f3b2e;
    --pp-emerald-ring: rgba(52, 211, 153, 0.18);
    --pp-amber-soft: #3a2e10;
    --pp-amber: #fbbf24;
    --pp-rose-soft: #3a1c22;
    --pp-rose: #f87171;
    --pp-slate-900: #e5eaf1;
    --pp-slate-700: #b6c0cd;
    --pp-slate-500: #8b97a8;
    --pp-border: #303a47;
}

html[data-bs-theme="dark"] .pp-page .pp-card,
html[data-bs-theme="dark"] .pp-page .pp-card-header,
html[data-bs-theme="dark"] .pp-page .pp-stat-card {
    background: var(--dm-surface) !important;
}

html[data-bs-theme="dark"] .pp-page .pp-badge-draft {
    background: var(--dm-surface-3) !important;
}

html[data-bs-theme="dark"] .pp-page .pp-btn-ghost-emerald {
    background: transparent !important;
    border-color: #10b981 !important;
}

html[data-bs-theme="dark"] .pp-page .pp-form {
    background: var(--dm-surface-2) !important;
    border-color: #10b981 !important;
}

html[data-bs-theme="dark"] .pp-page .pp-spec-list {
    background: var(--dm-surface-3) !important;
}

html[data-bs-theme="dark"] .pp-page .pp-action-btn {
    background: var(--dm-surface-3) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text-2) !important;
}

/* ---------------------------------------------------------------------------
   Search page — hero gradient, search box, results, tabs, cards
   ------------------------------------------------------------------------ */
html[data-bs-theme="dark"] .search-header,
html[data-bs-theme="dark"] section.search-header {
    background: linear-gradient(135deg, #141a22 0%, #0d2820 50%, #141a22 100%) !important;
    border-bottom: 1px solid var(--dm-border) !important;
}

html[data-bs-theme="dark"] .search-hero-shape.shape-1 {
    background: rgba(52, 211, 153, 0.12) !important;
    filter: blur(60px) !important;
}

html[data-bs-theme="dark"] .search-hero-shape.shape-2 {
    background: rgba(16, 185, 129, 0.1) !important;
    filter: blur(75px) !important;
}

html[data-bs-theme="dark"] .search-header h1 {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .search-header .lead {
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .search-input-wrapper {
    background: var(--dm-surface-2) !important;
    border: 1px solid var(--dm-border) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html[data-bs-theme="dark"] .search-input-wrapper:focus-within {
    border-color: var(--dm-emerald-strong) !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2) !important;
}

html[data-bs-theme="dark"] .search-input-wrapper .search-input {
    color: var(--dm-text) !important;
    background: transparent !important;
}

html[data-bs-theme="dark"] .search-input-wrapper .search-input::placeholder {
    color: var(--dm-text-3) !important;
}

html[data-bs-theme="dark"] .search-results-section,
html[data-bs-theme="dark"] section.search-results-section {
    background-color: var(--dm-bg) !important;
}

html[data-bs-theme="dark"] .search-results-heading,
html[data-bs-theme="dark"] .search-section-subheading,
html[data-bs-theme="dark"] .no-results-title,
html[data-bs-theme="dark"] .popular-categories-title {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .search-tabs .btn {
    background: var(--dm-surface-2) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text-2) !important;
}

html[data-bs-theme="dark"] .search-tabs .btn:hover {
    background: var(--dm-surface-3) !important;
    border-color: var(--dm-emerald-strong) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .search-tabs .btn.active {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

html[data-bs-theme="dark"] .search-card,
html[data-bs-theme="dark"] .category-quick-card {
    background: var(--dm-surface) !important;
    border: 1px solid var(--dm-border) !important;
}

html[data-bs-theme="dark"] .search-card:hover,
html[data-bs-theme="dark"] .category-quick-card:hover {
    border-color: rgba(52, 211, 153, 0.35) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5) !important;
}

html[data-bs-theme="dark"] .badge-course-class {
    background-color: var(--dm-surface-2) !important;
    color: var(--dm-emerald) !important;
    border: 1px solid var(--dm-border) !important;
}

html[data-bs-theme="dark"] .search-chapter-item {
    background: var(--dm-surface) !important;
    border: 1px solid var(--dm-border) !important;
}

html[data-bs-theme="dark"] .search-chapter-item:hover {
    background: var(--dm-surface-2) !important;
    border-color: var(--dm-emerald-strong) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4) !important;
}

html[data-bs-theme="dark"] .search-chapter-item h6 {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .search-chapter-icon {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: var(--dm-emerald) !important;
}

html[data-bs-theme="dark"] .suggested-search-chip {
    background: var(--dm-surface-2) !important;
    color: var(--dm-emerald) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .suggested-search-chip:hover {
    background: #0f3b2e !important;
    border-color: var(--dm-emerald-strong) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
}

html[data-bs-theme="dark"] .category-quick-card h5 {
    color: var(--dm-text) !important;
}

html[data-bs-theme="dark"] .category-quick-card p {
    color: var(--dm-text-2) !important;
}

/* ---------------------------------------------------------------------------
   blog/show — share buttons (Facebook, X, LinkedIn, Copy Link)
   ------------------------------------------------------------------------ */
html[data-bs-theme="dark"] .btn-emerald-soft-light,
html[data-bs-theme="dark"] .card .btn-emerald-soft-light,
html[data-bs-theme="dark"] .sticky-sidebar .btn-emerald-soft-light,
html[data-bs-theme="dark"] .modal-body .btn-emerald-soft-light {
    background-color: var(--dm-surface-2) !important;
    background-image: none !important;
    color: var(--dm-text) !important;
    border: 1px solid var(--dm-border) !important;
}

html[data-bs-theme="dark"] .btn-emerald-soft-light:hover,
html[data-bs-theme="dark"] .card .btn-emerald-soft-light:hover,
html[data-bs-theme="dark"] .sticky-sidebar .btn-emerald-soft-light:hover,
html[data-bs-theme="dark"] .modal-body .btn-emerald-soft-light:hover {
    background-color: var(--dm-surface-3) !important;
    background-image: none !important;
    color: var(--dm-emerald) !important;
    border: 1px solid var(--dm-emerald-strong) !important;
}

/* Share icon color override (text-emerald on light bg needs to be dark on dark) */
html[data-bs-theme="dark"] .btn-emerald-soft-light i,
html[data-bs-theme="dark"] .btn-emerald-soft-light .fa-facebook-f,
html[data-bs-theme="dark"] .btn-emerald-soft-light .fa-x-twitter,
html[data-bs-theme="dark"] .btn-emerald-soft-light .fa-linkedin-in,
html[data-bs-theme="dark"] .btn-emerald-soft-light .fa-link {
    color: var(--dm-emerald) !important;
}

/* Share modal title */
html[data-bs-theme="dark"] .modal-title,
html[data-bs-theme="dark"] #shareModal .modal-body h5 {
    color: var(--dm-text) !important;
}

/* Share modal cancel button */
html[data-bs-theme="dark"] .modal-footer .btn-outline-secondary {
    color: var(--dm-text) !important;
    border-color: var(--dm-border) !important;
}

html[data-bs-theme="dark"] .modal-footer .btn-outline-secondary:hover {
    background-color: var(--dm-surface-3) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text) !important;
}
