/*
 * Shared colour themes for every browser UI the backend serves: /admin, /account
 * (both link this file from /api/static/themes.css) and the /watch web client
 * (web/src/styles/index.css imports it at build time). Keep the theme ids in sync
 * with themes.js (admin/account picker) and web/src/lib/theme.ts (web picker).
 *
 * The active theme is <html data-theme="…">, chosen per browser and stored in
 * localStorage "mediastorm.theme". No attribute = midnight.
 *
 * Each theme sets the base tokens below; the derived tokens at the bottom are
 * computed from them, so a new theme only needs the base set.
 *   --tint-rgb   the "ink" channel for translucent overlays: 255 255 255 on dark
 *                themes, 0 0 0 on light ones. Use rgb(var(--tint-rgb) / 0.08)
 *                instead of rgba(255,255,255,0.08) so overlays work on both.
 */

:root,
:root[data-theme='midnight'] {
  --accent: #f5b400;
  --accent-contrast: #111111;
  --bg: #0b0b0f;
  --bg-elevated: #13131a;
  --bg-tertiary: #1b1b24;
  --bg-hover: #23232f;
  --border: #262630;
  --text: #f5f6fa;
  --text-secondary: #a3a7ba;
  --text-faint: #6c7085;
  --tint-rgb: 255 255 255;
  --shadow-color: rgb(0 0 0 / 0.7);
  --danger: #ef5350;
  --success: #2ecc71;
  --warning: #f1c40f;
  color-scheme: dark;
}

:root[data-theme='indigo'] {
  --accent: #5f62ed;
  --accent-contrast: #ffffff;
  --bg: #0d0d12;
  --bg-elevated: #16161e;
  --bg-tertiary: #1c1c26;
  --bg-hover: #242433;
  --border: #2a2a36;
  --text: #ffffff;
  --text-secondary: #9ca3af;
  --text-faint: #7d8592;
  --tint-rgb: 255 255 255;
  --shadow-color: rgb(0 0 0 / 0.5);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  color-scheme: dark;
}

:root[data-theme='oled'] {
  --accent: #14b8a6;
  --accent-contrast: #04120f;
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-tertiary: #141414;
  --bg-hover: #1e1e1e;
  --border: #232323;
  --text: #f2f2f2;
  --text-secondary: #a1a1a1;
  --text-faint: #6b6b6b;
  --tint-rgb: 255 255 255;
  --shadow-color: rgb(0 0 0 / 0.9);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  color-scheme: dark;
}

:root[data-theme='slate'] {
  --accent: #38bdf8;
  --accent-contrast: #062030;
  --bg: #0f172a;
  --bg-elevated: #172135;
  --bg-tertiary: #1e293b;
  --bg-hover: #273449;
  --border: #2c3a52;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-faint: #64748b;
  --tint-rgb: 226 232 240;
  --shadow-color: rgb(2 6 23 / 0.6);
  --danger: #f87171;
  --success: #34d399;
  --warning: #fbbf24;
  color-scheme: dark;
}

:root[data-theme='ember'] {
  --accent: #ff7a45;
  --accent-contrast: #1a0a03;
  --bg: #120d0b;
  --bg-elevated: #1b1411;
  --bg-tertiary: #241b17;
  --bg-hover: #2e231e;
  --border: #352821;
  --text: #f7efe9;
  --text-secondary: #b8a89d;
  --text-faint: #80716a;
  --tint-rgb: 255 240 230;
  --shadow-color: rgb(0 0 0 / 0.7);
  --danger: #ef5350;
  --success: #4caf50;
  --warning: #f5b400;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --accent: #4f46e5;
  --accent-contrast: #ffffff;
  --bg: #f4f5f8;
  --bg-elevated: #ffffff;
  --bg-tertiary: #eceef3;
  --bg-hover: #e2e5ec;
  --border: #d7dbe3;
  --text: #15161c;
  --text-secondary: #4d5266;
  --text-faint: #7b8093;
  --tint-rgb: 15 18 30;
  --shadow-color: rgb(15 18 30 / 0.14);
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #b45309;
  color-scheme: light;
}

/* A dimmer light theme: grey paper instead of white, softer contrast. */
:root[data-theme='mist'] {
  --accent: #3f6fb5;
  --accent-contrast: #ffffff;
  --bg: #d9dce1;
  --bg-elevated: #e4e6ea;
  --bg-tertiary: #ced2d8;
  --bg-hover: #c5c9d0;
  --border: #b9bec7;
  --text: #22252d;
  --text-secondary: #4a4f5c;
  --text-faint: #6b707c;
  --tint-rgb: 20 24 34;
  --shadow-color: rgb(20 24 34 / 0.16);
  --danger: #c62828;
  --success: #2e7d32;
  --warning: #a15c07;
  color-scheme: light;
}

/* Derived tokens (shared by every theme). */
:root {
  --surface: rgb(var(--tint-rgb) / 0.05);
  --surface-strong: rgb(var(--tint-rgb) / 0.09);
  --surface-glass: color-mix(in srgb, var(--bg-elevated) 78%, transparent);
  --line: rgb(var(--tint-rgb) / 0.08);
  --line-strong: rgb(var(--tint-rgb) / 0.16);
  --accent-hover: color-mix(in srgb, var(--accent) 75%, var(--text));
  --accent-strong: color-mix(in srgb, var(--accent) 85%, #000);
}
