/* =====================================================================
   Pic Media — dark theme
   Same dark palette as the admin panel. app.css draws every surface,
   text and border from tokens, so the dark theme is a token swap plus a
   handful of things tokens can't reach (native controls, icons, shadows).
   Activated by html[data-theme="dark"] (set before paint in base.html),
   with a no-JS fallback that follows the OS preference.
   ===================================================================== */

:root[data-theme="dark"] {
  --brand: #e86642;
  --brand-ink: #f08a68;
  --brand-ink-hover: #f5a084;
  --brand-soft: #3a2420;
  --on-brand-soft: #f39a7b;
  --indigo: #9c95ea;
  --indigo-hover: #b1abf0;
  --indigo-soft: #2a2846;
  --on-indigo: #15142a;
  --mist: #1b1a28;
  --page: #13121d;
  --surface: #1d1c2b;
  --ink: #ecebf3;
  --sub: #a9a6bd;
  --line: #2f2d42;
  --line-strong: #44415c;
  --warn: #f0a070;
  --ok: #6fd3a4;
  --ok-fill: #2b7a55;
  --ok-fill-hover: #33906a;
  --ok-soft: #173327;
  --danger: #ff8a80;
  --danger-fill: #b3261e;
  --danger-soft: #3b1d1d;
  --amber: #f2c37b;
  --amber-soft: #3b2e1a;
  --hover: rgb(236 235 243 / .06);
  --ring: rgb(156 149 234 / .3);
  --overlay: rgb(0 0 0 / .55);
  --pop-shadow: 0 18px 48px rgb(0 0 0 / .5);
  color-scheme: dark;
}

/* No-JS fallback: follow the OS unless the user picked light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --brand-ink: #f08a68; --brand-ink-hover: #f5a084; --brand-soft: #3a2420; --on-brand-soft: #f39a7b;
    --indigo: #9c95ea; --indigo-hover: #b1abf0; --indigo-soft: #2a2846; --on-indigo: #15142a;
    --mist: #1b1a28; --page: #13121d; --surface: #1d1c2b; --ink: #ecebf3; --sub: #a9a6bd;
    --line: #2f2d42; --line-strong: #44415c; --warn: #f0a070;
    --ok: #6fd3a4; --ok-fill-hover: #33906a; --ok-soft: #173327;
    --danger: #ff8a80; --danger-soft: #3b1d1d; --amber: #f2c37b; --amber-soft: #3b2e1a;
    --hover: rgb(236 235 243 / .06); --ring: rgb(156 149 234 / .3); --overlay: rgb(0 0 0 / .55);
    --pop-shadow: 0 18px 48px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}

/* Bootstrap's own semantic RGB triplets feed utilities like .text-danger and .link-*. */
[data-theme="dark"] {
  --bs-primary-rgb: 240, 138, 104;
  --bs-success-rgb: 111, 211, 164;
  --bs-danger-rgb: 255, 138, 128;
  --bs-warning-rgb: 242, 195, 123;
  --bs-info-rgb: 156, 149, 234;
  --bs-link-color-rgb: 240, 138, 104;
  --bs-link-hover-color-rgb: 245, 160, 132;
  --bs-body-bg-rgb: 19, 18, 29;
  --bs-secondary-bg-rgb: 19, 18, 29;
  --bs-tertiary-bg-rgb: 19, 18, 29;
}

/* Native controls and glyphs that tokens don't reach */
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type=time]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: invert(.85); }
[data-theme="dark"] select option, [data-theme="dark"] select optgroup { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .login-card { box-shadow: 0 24px 60px rgb(0 0 0 / .45); }
[data-theme="dark"] .brand img, [data-theme="dark"] .mobile-mark, [data-theme="dark"] .login-brand img { box-shadow: 0 0 0 1px var(--line); }
[data-theme="dark"] .trophy-card .trophy-picture img,
[data-theme="dark"] .trophy-preview { filter: drop-shadow(0 0 1px rgb(255 255 255 / .25)); }
[data-theme="dark"] .notification-dot.kind-revision { background: var(--amber); }
[data-theme="dark"] ::-webkit-scrollbar { inline-size: 10px; block-size: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid var(--page); }
[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }

/* Charts drawn with inline colors: keep them legible on dark surfaces */
[data-theme="dark"] .panel svg:not(.ic) text { fill: var(--sub); }
