/* =========================================================
   Zoth Studio — Universal Multi-Theme Architecture
   Themes: Dark (Void), Light (Solar Alabaster), Matrix (Phosphor Green), Gold (Alchemical Amber)
   WCAG AAA compliant text-to-background contrast ratios
   ========================================================= */

/* 1. Base Variables & Fallbacks */
:root {
  --theme-name: "dark";
  color-scheme: dark;

  /* Default Midnight Void */
  --bg: #05060a;
  --bg-2: #0a0c14;
  --bg-3: #121624;
  --panel: rgba(16, 20, 34, 0.85);
  --panel-solid: #101422;
  --surface-card: #161924;
  --surface-elevated: #1e2230;
  --surface-highlight: #262c3e;
  
  --text: #f8fafc;
  --text-primary: #ffffff;
  --text-body: #f1f5f9;
  --text-subhead: #cbd5e1;
  --muted: #94a3b8;
  --muted-dark: #64748b;
  
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(0, 229, 255, 0.45);
  --border-card: rgba(255, 255, 255, 0.1);
  --border-focus: #00e5ff;
  
  --cyan: #00e5ff;
  --cyan-soft: #38bdf8;
  --magenta: #d946ef;
  --violet: #8b5cf6;
  --green: #34d399;
  --gold: #fbbf24;
  --accent: #00e5ff;
  --accent-glow: rgba(0, 229, 255, 0.28);
  
  --input-bg: #0c0e17;
  --input-text: #ffffff;
  --code-bg: #080a12;
  --code-text: #38bdf8;
  --shadow-color: rgba(0, 0, 0, 0.55);
  
  scrollbar-color: rgba(255, 255, 255, 0.25) var(--bg-2);
}

/* 2. Solar Alabaster Light Theme */
[data-theme="light"],
html.theme-light,
body.theme-light {
  --theme-name: "light";
  color-scheme: light;

  --bg: #f8fafc;
  --bg-2: #ffffff;
  --bg-3: #f1f5f9;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-solid: #ffffff;
  --surface-card: #ffffff;
  --surface-elevated: #f1f5f9;
  --surface-highlight: #e2e8f0;
  
  --text: #090d16;
  --text-primary: #040711;
  --text-body: #1e293b;
  --text-subhead: #334155;
  --muted: #475569;
  --muted-dark: #64748b;
  
  --line: rgba(15, 23, 42, 0.14);
  --line-strong: rgba(2, 132, 199, 0.65);
  --border-card: rgba(15, 23, 42, 0.12);
  --border-focus: #0284c7;
  
  --cyan: #0284c7;
  --cyan-soft: #0369a1;
  --magenta: #c026d3;
  --violet: #7c3aed;
  --green: #059669;
  --gold: #d97706;
  --accent: #0284c7;
  --accent-glow: rgba(2, 132, 199, 0.22);
  
  --input-bg: #ffffff;
  --input-text: #090d16;
  --code-bg: #e2e8f0;
  --code-text: #0369a1;
  --shadow-color: rgba(15, 23, 42, 0.12);
  
  scrollbar-color: rgba(15, 23, 42, 0.3) #e2e8f0;
}

/* 3. Cyber Matrix Phosphor Green Theme */
[data-theme="matrix"],
html.theme-matrix,
body.theme-matrix {
  --theme-name: "matrix";
  color-scheme: dark;

  --bg: #020b06;
  --bg-2: #04140b;
  --bg-3: #072113;
  --panel: rgba(4, 20, 11, 0.9);
  --panel-solid: #05190e;
  --surface-card: #062112;
  --surface-elevated: #092c19;
  --surface-highlight: #0d3820;
  
  --text: #ecfdf5;
  --text-primary: #00ff66;
  --text-body: #d1fae5;
  --text-subhead: #a7f3d0;
  --muted: #6ee7b7;
  --muted-dark: #34d399;
  
  --line: rgba(0, 255, 102, 0.22);
  --line-strong: rgba(0, 255, 102, 0.65);
  --border-card: rgba(0, 255, 102, 0.18);
  --border-focus: #00ff66;
  
  --cyan: #00ff66;
  --cyan-soft: #34d399;
  --magenta: #10b981;
  --violet: #059669;
  --green: #00ff66;
  --gold: #fbbf24;
  --accent: #00ff66;
  --accent-glow: rgba(0, 255, 102, 0.35);
  
  --input-bg: #031008;
  --input-text: #ecfdf5;
  --code-bg: #010703;
  --code-text: #00ff66;
  --shadow-color: rgba(0, 255, 102, 0.15);
  
  scrollbar-color: rgba(0, 255, 102, 0.4) #04140b;
}

/* 4. Hermetic Alchemical Gold Theme */
[data-theme="gold"],
html.theme-gold,
body.theme-gold {
  --theme-name: "gold";
  color-scheme: dark;

  --bg: #0c0a09;
  --bg-2: #1c1917;
  --bg-3: #292524;
  --panel: rgba(28, 25, 23, 0.9);
  --panel-solid: #1c1917;
  --surface-card: #231f1c;
  --surface-elevated: #2d2824;
  --surface-highlight: #3c342d;
  
  --text: #fffbeb;
  --text-primary: #fbbf24;
  --text-body: #fef3c7;
  --text-subhead: #fed7aa;
  --muted: #fbbf24;
  --muted-dark: #d97706;
  
  --line: rgba(251, 191, 36, 0.22);
  --line-strong: rgba(251, 191, 36, 0.65);
  --border-card: rgba(251, 191, 36, 0.2);
  --border-focus: #fbbf24;
  
  --cyan: #38bdf8;
  --cyan-soft: #7dd3fc;
  --magenta: #e879f9;
  --violet: #c084fc;
  --green: #34d399;
  --gold: #fbbf24;
  --accent: #fbbf24;
  --accent-glow: rgba(251, 191, 36, 0.35);
  
  --input-bg: #151210;
  --input-text: #fffbeb;
  --code-bg: #080706;
  --code-text: #fde68a;
  --shadow-color: rgba(251, 191, 36, 0.15);
  
  scrollbar-color: rgba(251, 191, 36, 0.4) #1c1917;
}

/* =========================================================
   Universal Element Contrast Rules for All Pages
   ========================================================= */

body {
  background-color: var(--bg) !important;
  color: var(--text-body) !important;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6,
.heading-primary, .title, .brand-title {
  color: var(--text-primary) !important;
}

p, li, dd, dt, label {
  color: var(--text-body);
}

.text-muted, .subtitle, .meta, .caption {
  color: var(--muted) !important;
}

/* Surfaces & Containers */
.card, .panel, .glass, .box, .widget, .drawer, .modal, .sheet, .popup {
  background: var(--panel) !important;
  border-color: var(--border-card) !important;
  color: var(--text-body) !important;
  box-shadow: 0 10px 30px var(--shadow-color);
}

/* Inputs, Textareas, Selects */
input, textarea, select {
  background-color: var(--input-bg) !important;
  color: var(--input-text) !important;
  border: 1px solid var(--line) !important;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus) !important;
  outline: 2px solid var(--border-focus) !important;
}

/* Buttons */
button, .btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

button.primary, .btn-primary, .btn-glow {
  background: var(--accent) !important;
  color: #05060a !important;
  font-weight: 700;
  border: none;
}

[data-theme="light"] button.primary,
[data-theme="light"] .btn-primary,
[data-theme="light"] .btn-glow {
  background: var(--accent) !important;
  color: #ffffff !important;
}

/* Code Blocks */
pre, code, kbd, samp, .terminal-view {
  background-color: var(--code-bg) !important;
  color: var(--code-text) !important;
  border-color: var(--line) !important;
}

/* Tables */
table {
  border-color: var(--line) !important;
}
th {
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
  border-bottom: 2px solid var(--line) !important;
}
td {
  border-bottom: 1px solid var(--line) !important;
}

/* Links */
a {
  color: var(--cyan);
}
a:hover {
  color: var(--gold);
}

/* =========================================================
   Floating & Navbar Theme Switcher Component
   ========================================================= */

.zoth-theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-card);
  padding: 3px 6px;
  border-radius: 999px;
  z-index: 9999;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.zoth-theme-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  outline: none;
}

.zoth-theme-btn:hover {
  color: var(--text-primary);
  background: var(--surface-highlight);
}

.zoth-theme-btn.active {
  background: var(--accent);
  color: #05060a;
  font-weight: 700;
  box-shadow: 0 0 10px var(--accent-glow);
}

[data-theme="light"] .zoth-theme-btn.active {
  color: #ffffff;
}

/* Floating Quick Toggle on Bottom Right */
.zoth-floating-theme-dock {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  align-items: center;
  box-shadow: 0 8px 32px var(--shadow-color);
}
