/* Dynamic WBS themes. Default theme: Light. */
html[data-theme="light"] {
  color-scheme: light;
  --theme-primary: #4f46e5;
  --theme-primary-hover: #4338ca;
  --theme-accent: #818cf8;
  --theme-bg: #f8fafc;
  --theme-surface: #ffffff;
  --theme-surface-alt: #f8fafc;
  --theme-soft: #eef2ff;
  --theme-border: #e2e8f0;
  --theme-border-strong: #cbd5e1;
  --theme-text: #0f172a;
  --theme-muted: #64748b;
  --theme-sidebar-start: #ffffff;
  --theme-sidebar-end: #f8fafc;
  --theme-sidebar-text: #334155;
  --theme-sidebar-muted: #94a3b8;
  --theme-sidebar-active-bg: #eef2ff;
  --theme-sidebar-active-border: #4f46e5;
  --theme-sidebar-active-text: #3730a3;
  --theme-login-bg: linear-gradient(135deg, #eef2ff 0%, #f8fafc 48%, #e0e7ff 100%);
  --theme-shadow: rgba(15, 23, 42, .08);
}

html[data-theme="aqua"] {
  color-scheme: light;
  --theme-primary: #0891b2;
  --theme-primary-hover: #0e7490;
  --theme-accent: #22d3ee;
  --theme-bg: #ecfeff;
  --theme-surface: #ffffff;
  --theme-surface-alt: #f0fdfa;
  --theme-soft: #cffafe;
  --theme-border: #a5f3fc;
  --theme-border-strong: #67e8f9;
  --theme-text: #164e63;
  --theme-muted: #52727d;
  --theme-sidebar-start: #0e7490;
  --theme-sidebar-end: #155e75;
  --theme-sidebar-text: #ecfeff;
  --theme-sidebar-muted: #a5f3fc;
  --theme-sidebar-active-bg: rgba(255,255,255,.14);
  --theme-sidebar-active-border: #67e8f9;
  --theme-sidebar-active-text: #ffffff;
  --theme-login-bg: linear-gradient(135deg, #cffafe 0%, #ecfeff 45%, #a5f3fc 100%);
  --theme-shadow: rgba(8, 145, 178, .12);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --theme-primary: #a78bfa;
  --theme-primary-hover: #8b5cf6;
  --theme-accent: #c4b5fd;
  --theme-bg: #111827;
  --theme-surface: #1f2937;
  --theme-surface-alt: #273449;
  --theme-soft: #312e81;
  --theme-border: #374151;
  --theme-border-strong: #4b5563;
  --theme-text: #f9fafb;
  --theme-muted: #cbd5e1;
  --theme-sidebar-start: #030712;
  --theme-sidebar-end: #111827;
  --theme-sidebar-text: #f3f4f6;
  --theme-sidebar-muted: #9ca3af;
  --theme-sidebar-active-bg: rgba(167,139,250,.16);
  --theme-sidebar-active-border: #a78bfa;
  --theme-sidebar-active-text: #ffffff;
  --theme-login-bg: linear-gradient(135deg, #030712 0%, #111827 55%, #1f2937 100%);
  --theme-shadow: rgba(0,0,0,.35);
}

html[data-theme="lofi"] {
  color-scheme: light;
  --theme-primary: #111111;
  --theme-primary-hover: #333333;
  --theme-accent: #555555;
  --theme-bg: #f5f5f4;
  --theme-surface: #ffffff;
  --theme-surface-alt: #fafaf9;
  --theme-soft: #e7e5e4;
  --theme-border: #d6d3d1;
  --theme-border-strong: #a8a29e;
  --theme-text: #1c1917;
  --theme-muted: #78716c;
  --theme-sidebar-start: #171717;
  --theme-sidebar-end: #262626;
  --theme-sidebar-text: #fafafa;
  --theme-sidebar-muted: #a3a3a3;
  --theme-sidebar-active-bg: rgba(255,255,255,.10);
  --theme-sidebar-active-border: #ffffff;
  --theme-sidebar-active-text: #ffffff;
  --theme-login-bg: linear-gradient(135deg, #e7e5e4 0%, #fafaf9 52%, #d6d3d1 100%);
  --theme-shadow: rgba(28,25,23,.10);
}

html[data-theme="pastel"] {
  color-scheme: light;
  --theme-primary: #a855f7;
  --theme-primary-hover: #9333ea;
  --theme-accent: #f9a8d4;
  --theme-bg: #fdf4ff;
  --theme-surface: #ffffff;
  --theme-surface-alt: #fff7ed;
  --theme-soft: #fae8ff;
  --theme-border: #f5d0fe;
  --theme-border-strong: #e9d5ff;
  --theme-text: #3b2748;
  --theme-muted: #7c647f;
  --theme-sidebar-start: #f5d0fe;
  --theme-sidebar-end: #ddd6fe;
  --theme-sidebar-text: #4c1d5f;
  --theme-sidebar-muted: #7e608d;
  --theme-sidebar-active-bg: rgba(255,255,255,.55);
  --theme-sidebar-active-border: #a855f7;
  --theme-sidebar-active-text: #6b21a8;
  --theme-login-bg: linear-gradient(135deg, #fae8ff 0%, #fdf4ff 45%, #fce7f3 100%);
  --theme-shadow: rgba(168,85,247,.10);
}

html[data-theme="corporate"] {
  color-scheme: light;
  --theme-primary: #c31a22;
  --theme-primary-hover: #e0333c;
  --theme-primary-dark: #8c0f14;
  --theme-accent: #c5a880;
  --theme-accent-dark: #b09168;
  --theme-bg: #fafaf8;
  --theme-surface: #ffffff;
  --theme-surface-alt: #fcfcfb;
  --theme-soft: #e5d4be;
  --theme-border: #f1f0ec;
  --theme-border-strong: #e5e3db;
  --theme-text: #1f1f1a;
  --theme-muted: #7a776b;
  --theme-sidebar-start: #350204;
  --theme-sidebar-end: #350204;
  --theme-sidebar-text: rgba(255,255,255,.8);
  --theme-sidebar-muted: rgba(255,255,255,.4);
  --theme-sidebar-active-bg: rgba(255,255,255,.04);
  --theme-sidebar-active-border: #c5a880;
  --theme-sidebar-active-text: #ffffff;
  --theme-login-bg: #fafaf8;
  --theme-shadow: rgba(53,2,4,.10);
}

html[data-theme="emerald"] {
  color-scheme: light;
  --theme-primary: #059669;
  --theme-primary-hover: #047857;
  --theme-accent: #34d399;
  --theme-bg: #ecfdf5;
  --theme-surface: #ffffff;
  --theme-surface-alt: #f0fdf4;
  --theme-soft: #d1fae5;
  --theme-border: #a7f3d0;
  --theme-border-strong: #6ee7b7;
  --theme-text: #064e3b;
  --theme-muted: #52766d;
  --theme-sidebar-start: #064e3b;
  --theme-sidebar-end: #065f46;
  --theme-sidebar-text: #ecfdf5;
  --theme-sidebar-muted: #a7f3d0;
  --theme-sidebar-active-bg: rgba(255,255,255,.12);
  --theme-sidebar-active-border: #6ee7b7;
  --theme-sidebar-active-text: #ffffff;
  --theme-login-bg: linear-gradient(135deg, #d1fae5 0%, #ecfdf5 48%, #a7f3d0 100%);
  --theme-shadow: rgba(5,150,105,.12);
}

html[data-theme="night"] {
  color-scheme: dark;
  --theme-primary: #38bdf8;
  --theme-primary-hover: #0ea5e9;
  --theme-accent: #818cf8;
  --theme-bg: #0f172a;
  --theme-surface: #172033;
  --theme-surface-alt: #1e293b;
  --theme-soft: #1e3a5f;
  --theme-border: #334155;
  --theme-border-strong: #475569;
  --theme-text: #e2e8f0;
  --theme-muted: #94a3b8;
  --theme-sidebar-start: #020617;
  --theme-sidebar-end: #0f172a;
  --theme-sidebar-text: #e2e8f0;
  --theme-sidebar-muted: #64748b;
  --theme-sidebar-active-bg: rgba(56,189,248,.14);
  --theme-sidebar-active-border: #38bdf8;
  --theme-sidebar-active-text: #ffffff;
  --theme-login-bg: linear-gradient(135deg, #020617 0%, #0f172a 50%, #172554 100%);
  --theme-shadow: rgba(0,0,0,.38);
}

html[data-theme] {
  --primary-red: var(--theme-primary);
  --primary-red-light: var(--theme-primary-hover);
  --primary-red-dark: var(--theme-primary-dark, var(--theme-primary-hover));
  --accent-gold: var(--theme-accent);
  --accent-gold-dark: var(--theme-accent-dark, var(--theme-primary-hover));
  --accent-gold-light: var(--theme-soft);
  --dark-burgundy: var(--theme-sidebar-start);
  --light-bg: var(--theme-bg);
  --white: #ffffff;
  --neutral-50: var(--theme-surface-alt);
  --neutral-100: var(--theme-bg);
  --neutral-200: var(--theme-border);
  --neutral-300: var(--theme-border-strong);
  --neutral-400: var(--theme-muted);
  --neutral-600: var(--theme-muted);
  --neutral-800: var(--theme-text);
  --neutral-900: var(--theme-text);
  --shadow-sm: 0 2px 8px var(--theme-shadow);
  --shadow-md: 0 10px 28px var(--theme-shadow);
  --shadow-lg: 0 20px 46px var(--theme-shadow);
}

html[data-theme] body {
  background-color: var(--theme-bg);
  color: var(--theme-text);
}

html[data-theme] input,
html[data-theme] select,
html[data-theme] textarea {
  color: var(--theme-text);
}

/* Theme-aware common form controls and buttons */
html[data-theme] .form-control,
html[data-theme] .form-select {
  background-color: var(--theme-surface);
  border-color: var(--theme-border-strong);
  color: var(--theme-text);
}
html[data-theme] .form-control::placeholder,
html[data-theme] textarea::placeholder,
html[data-theme] input::placeholder { color: var(--theme-muted); opacity: .78; }
html[data-theme] .form-label { color: var(--theme-text); }
html[data-theme] .form-control:focus,
html[data-theme] .form-select:focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 18%, transparent);
}
html[data-theme] .btn-primary,
html[data-theme] .btn-gold { color: #ffffff; }
