/* ============================================================
   Tema cerah & gelap halaman publik Divisi Hukum UB.
   - Token --t-*: nilai cerah = warna asli halaman, nilai gelap di blok
     html[data-theme="dark"]. CSS halaman memakai var(--t-...) untuk
     latar, teks, dan garis.
   - Tema dipasang di <html data-theme="light|dark"> oleh skrip di <head>
     (base.blade.php) dan diubah lewat tombol di header (navbar.blade.php).
   ============================================================ */

:root {
    --t-accent-line: #fde6c6;
    --t-accent-text: #c2410c;
    --t-accent-text-2: #c2650a;
    --t-accent-text-3: #b45309;
    --t-accent-tint: #fff5e8;
    --t-accent-tint-2: #fff7ed;
    --t-accent-tint-3: #fef1e0;
    --t-bg: #f6f8fb;
    --t-bg-line: #e2e8f0;
    --t-bg-line-3: #cbd5e1;
    --t-black: #000000;
    --t-blue-line: #dbe5fb;
    --t-blue-solid: #1d4ed8;
    --t-blue-tint: #eef3ff;
    --t-blue-tint-3: #e6eeff;
    --t-danger-text: #dc2626;
    --t-danger-text-2: #b91c1c;
    --t-teal-text: #0f766e;
    --t-purple-text: #7e22ce;
    --t-danger-tint: #fef2f2;
    --t-danger-tint-2: #fee2e2;
    --t-faint: #cbd5e1;
    --t-ink: #0f172a;
    --t-ink-2: #1e293b;
    --t-line: #e2e8f0;
    --t-line-2: #eef2f7;
    --t-line-3: #cbd5e1;
    --t-line-d: #dddddd;
    --t-line-soft: #f1f5f9;
    --t-link: #1d4ed8;
    --t-link-2: #2563eb;
    --t-link-4: #1e3a8a;
    --t-muted: #64748b;
    --t-strong: #0f172a;
    --t-strong-2: #1e293b;
    --t-subtle: #94a3b8;
    --t-success-text: #15803d;
    --t-success-text-2: #16a34a;
    --t-surface: #ffffff;
    --t-surface-2: #f8fafc;
    --t-surface-3: #f1f5f9;
    --t-surface-warm: #fffdf9;
    --t-text: #334155;
    --t-text-2: #475569;
    --t-warn-tint: #fffbeb;
}
html[data-theme="dark"] {
    --t-accent-line: rgba(239, 140, 0, 0.22);
    --t-accent-text: #ffad5c;
    --t-accent-text-2: #ffad5c;
    --t-accent-text-3: #fbbf24;
    --t-accent-tint: rgba(239, 140, 0, 0.07);
    --t-accent-tint-2: rgba(239, 140, 0, 0.12);
    --t-accent-tint-3: rgba(239, 140, 0, 0.16);
    --t-bg: #0b1220;
    --t-bg-line: #243049;
    --t-bg-line-3: #334155;
    --t-black: #f1f5f9;
    --t-blue-line: #2a3d66;
    --t-blue-solid: #2563eb;
    --t-blue-tint: rgba(96, 140, 255, 0.14);
    --t-blue-tint-3: rgba(96, 140, 255, 0.18);
    --t-danger-text: #f87171;
    --t-danger-text-2: #fca5a5;
    --t-teal-text: #5eead4;
    --t-purple-text: #d8b4fe;
    --t-danger-tint: rgba(220, 38, 38, 0.14);
    --t-danger-tint-2: rgba(220, 38, 38, 0.2);
    --t-faint: #55647c;
    --t-ink: #f1f5f9;
    --t-ink-2: #e2e8f0;
    --t-line: #243049;
    --t-line-2: #1f2a40;
    --t-line-3: #334155;
    --t-line-d: #2a3650;
    --t-line-soft: #1c2740;
    --t-link: #8fb1ff;
    --t-link-2: #8fb1ff;
    --t-link-4: #a8c2ff;
    --t-muted: #94a3b8;
    --t-strong: #2b3a55;
    --t-strong-2: #334155;
    --t-subtle: #7d8ba1;
    --t-success-text: #4ade80;
    --t-success-text-2: #4ade80;
    --t-surface: #111a2e;
    --t-surface-2: #0f1729;
    --t-surface-3: #1a2438;
    --t-surface-warm: #121a2c;
    --t-text: #cbd5e1;
    --t-text-2: #b4c0d0;
    --t-warn-tint: rgba(245, 158, 11, 0.12);
}

html[data-theme="dark"] { color-scheme: dark; }

/* ===== Dasar halaman ===== */
html[data-theme="dark"] body {
    background-color: var(--t-bg) !important;
    color: var(--t-text);
}
:where(html[data-theme="dark"]) p { color: var(--t-text); }
:where(html[data-theme="dark"]) :is(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6) { color: var(--t-ink); }
:where(html[data-theme="dark"]) a:not([class]) { color: var(--t-link); }
:where(html[data-theme="dark"]) hr { border-color: var(--t-line); opacity: 1; }
html[data-theme="dark"] ::selection { background: rgba(239, 140, 0, 0.35); color: #fff; }

/* ===== Utilitas Bootstrap yang tertulis langsung di markup ===== */
html[data-theme="dark"] .bg-white { background-color: var(--t-surface) !important; }
html[data-theme="dark"] .bg-light { background-color: var(--t-surface-3) !important; }
html[data-theme="dark"] .text-dark { color: var(--t-ink) !important; }
html[data-theme="dark"] .text-black { color: var(--t-ink) !important; }
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-secondary { color: var(--t-muted) !important; }
html[data-theme="dark"] .text-body { color: var(--t-text) !important; }
html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start,
html[data-theme="dark"] .border-end { border-color: var(--t-line) !important; }
html[data-theme="dark"] .shadow,
html[data-theme="dark"] .shadow-sm { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important; }

/* ===== Komponen Bootstrap 5.0 (warnanya tertulis langsung, tidak ikut data-bs-theme) ===== */
html[data-theme="dark"] .card {
    background-color: var(--t-surface);
    border-color: var(--t-line);
    color: var(--t-text);
}
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer { background-color: var(--t-surface-2); border-color: var(--t-line); }

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: var(--t-surface-2);
    border-color: var(--t-line-3);
    color: var(--t-ink);
}
html[data-theme="dark"] .form-control::placeholder { color: var(--t-subtle); }
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus { background-color: var(--t-surface-2); color: var(--t-ink); }
html[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}
html[data-theme="dark"] .form-select option { background-color: #111a2e; color: #e2e8f0; }
html[data-theme="dark"] .form-check-input { background-color: var(--t-surface-2); border-color: var(--t-line-3); }
html[data-theme="dark"] .form-label,
html[data-theme="dark"] label { color: var(--t-ink-2); }
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select { color: var(--t-ink); }

html[data-theme="dark"] .dropdown-menu {
    background-color: var(--t-surface);
    border-color: var(--t-line);
    color: var(--t-text);
}
html[data-theme="dark"] .dropdown-item { color: var(--t-text); }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background-color: var(--t-surface-3); color: var(--t-ink); }
html[data-theme="dark"] .dropdown-divider { border-color: var(--t-line); }

html[data-theme="dark"] .modal-content {
    background-color: var(--t-surface);
    color: var(--t-text);
    border-color: var(--t-line);
}
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer { border-color: var(--t-line); }
html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

html[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    color: var(--t-text);
    border-color: var(--t-line);
}
html[data-theme="dark"] .table > :not(caption) > * > * { color: inherit; border-color: var(--t-line); }
html[data-theme="dark"] td,
html[data-theme="dark"] th { border-color: var(--t-line); }

html[data-theme="dark"] .page-link {
    background-color: var(--t-surface);
    border-color: var(--t-line);
    color: var(--t-link);
}
html[data-theme="dark"] .page-item.disabled .page-link { background-color: var(--t-surface-2); color: var(--t-subtle); }

html[data-theme="dark"] .list-group-item { background-color: var(--t-surface); border-color: var(--t-line); color: var(--t-text); }
html[data-theme="dark"] .accordion-item,
html[data-theme="dark"] .accordion-button { background-color: var(--t-surface); color: var(--t-ink); border-color: var(--t-line); }
html[data-theme="dark"] .accordion-button::after { filter: invert(1) brightness(1.6); }
html[data-theme="dark"] .accordion-button:not(.collapsed) { background-color: var(--t-surface-3); color: var(--t-ink); }
html[data-theme="dark"] .nav-tabs { border-color: var(--t-line); }
html[data-theme="dark"] .nav-tabs .nav-link.active { background-color: var(--t-surface); border-color: var(--t-line) var(--t-line) var(--t-surface); color: var(--t-ink); }
html[data-theme="dark"] .btn-light { background-color: var(--t-surface-3); border-color: var(--t-line); color: var(--t-ink); }
html[data-theme="dark"] .btn-outline-dark { color: var(--t-ink); border-color: var(--t-line-3); }
html[data-theme="dark"] .btn-outline-dark:hover { background-color: var(--t-surface-3); color: var(--t-ink); }
html[data-theme="dark"] .alert-light { background-color: var(--t-surface-3); border-color: var(--t-line); color: var(--t-text); }

/* ===== Bagian halaman & footer ===== */
/* Bagian selebar layar (putih di mode cerah) memakai latar halaman, supaya kartu di
   dalamnya menonjol dan tidak ada pita beda warna sebelum footer. Beranda dikecualikan
   karena selang-seling warna section-nya disengaja. */
html[data-theme="dark"] #main > section:not(:first-of-type):not(.hm-section) { background-color: var(--t-bg); }
/* Jarak 96px (<br> di layout) sebelum footer ikut warna section terakhir: latar section
   dilukis sampai bawah border transparan, margin negatif menjaga tinggi totalnya. */
html[data-theme="dark"] #main > section:last-of-type:not(:first-of-type) {
    border-bottom: 96px solid transparent;
    margin-bottom: -96px;
}
/* Warna footer mode gelap diatur di footer.blade.php */

/* Pagination: style.css lama menulis warna navy dengan selector yang lebih spesifik */
html[data-theme="dark"] .pagination .page-item:not(.active):not(.disabled) .page-link {
    background-color: var(--t-surface);
    border-color: var(--t-line);
    color: var(--t-text);
}
html[data-theme="dark"] .pagination .page-item:not(.active):not(.disabled) .page-link:hover {
    background-color: var(--t-surface-3);
    border-color: var(--t-line-3);
    color: var(--t-ink);
}
html[data-theme="dark"] .pagination .page-item.disabled .page-link {
    background-color: var(--t-surface-2);
    border-color: var(--t-line);
    color: var(--t-subtle);
}
html[data-theme="dark"] .pagination .page-item.active .page-link { border-color: transparent; }

/* ===== Lain-lain ===== */
html[data-theme="dark"] mark { background: rgba(239, 140, 0, 0.3); color: inherit; }
html[data-theme="dark"] .lb-data .lb-caption { color: #fff; }

/* Peralihan warna halus saat tombol tema ditekan (tidak saat halaman dimuat) */
html.theme-transisi,
html.theme-transisi *,
html.theme-transisi *::before,
html.theme-transisi *::after {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease !important;
}
@media (prefers-reduced-motion: reduce) {
    html.theme-transisi,
    html.theme-transisi * { transition: none !important; }
}
