/* ═══════════════════════════════════════════════════════════════
   THEME SYSTEM — Multi-Theme Support
   ═══════════════════════════════════════════════════════════════ */

/* ── Tailwind bridge tokens ──────────────────────────────────────
   The Tailwind config in index.html references these variables so that
   utility-styled screens (payroll wizard, employee cards, mobile nav)
   follow the active theme too. *-rgb values are space-separated triplets
   because Tailwind injects its own alpha: rgb(var(--x-rgb) / 0.4).
   Defaults (no theme class yet / classic) = the original gold identity. */
body {
  --tw-accent: #d4af37;
  --tw-accent-rgb: 212 175 55;
  --tw-accent-2: #e9c349;
  --tw-accent-dark: #8a6d1a;
  --tw-accent-soft-rgb: 226 198 128;
  --tw-navy: #0a0e1a;
  --tw-navy-rgb: 2 6 23;
}

/* Noir is monochrome — a white accent is invisible on white cards, so the
   Tailwind accent maps to near-black instead of --accent. */
.theme-noir {
  --tw-accent: #171717;
  --tw-accent-rgb: 23 23 23;
  --tw-accent-2: #404040;
  --tw-accent-dark: #000000;
  --tw-accent-soft-rgb: 115 115 115;
  --tw-navy: #000000;
  --tw-navy-rgb: 0 0 0;
}

.theme-light {
  --tw-accent: #2563eb;
  --tw-accent-rgb: 37 99 235;
  --tw-accent-2: #60a5fa;
  --tw-accent-dark: #1e40af;
  --tw-accent-soft-rgb: 147 197 253;
  --tw-navy: #0f172a;
  --tw-navy-rgb: 15 23 42;
}

.theme-atlas {
  --tw-accent: #0d9488;
  --tw-accent-rgb: 13 148 136;
  --tw-accent-2: #2dd4bf;
  --tw-accent-dark: #0f766e;
  --tw-accent-soft-rgb: 94 234 212;
  --tw-navy: #111827;
  --tw-navy-rgb: 17 24 39;
}

.theme-pearl {
  --tw-accent: #6366f1;
  --tw-accent-rgb: 99 102 241;
  --tw-accent-2: #a5b4fc;
  --tw-accent-dark: #4338ca;
  --tw-accent-soft-rgb: 165 180 252;
  --tw-navy: #1e293b;
  --tw-navy-rgb: 30 41 59;
}

.theme-classic {
  --tw-accent: #c5a059;
  --tw-accent-rgb: 197 160 89;
  --tw-accent-2: #e8c97e;
  --tw-accent-dark: #8a6d1a;
  --tw-accent-soft-rgb: 226 198 128;
  --tw-navy: #171717;
  --tw-navy-rgb: 23 23 23;
}

/* 1. Noir Theme (Black & White Minimal) */
.theme-noir {
  --primary: #000000;
  --primary-2: #1a1a1a;
  --primary-3: #333333;
  --accent: #ffffff;
  --accent-2: #e5e5e5;
  --accent-soft: rgba(255, 255, 255, 0.1);
  
  --bg: #ffffff;
  --bg-2: #f5f5f5;
  --sidebar-bg: #000000;
  --card-bg: #ffffff;
  --border: #d4d4d4;
  --border-2: #e5e5e5;
  
  --text-1: #000000;
  --text-2: #333333;
  --text-3: #666666;
  --text-inv: #ffffff;
  --sidebar-text: #ffffff;
}

.theme-noir .nav-link:hover,
.theme-noir .nav-link.active {
    background: #ffffff;
    color: #000000;
}

/* Accessibility: Noir's accent is white, which makes the global
   :focus-visible outline and the --sh-glow focus ring invisible on white
   surfaces. Use near-black for both so keyboard focus stays visible. */
.theme-noir :focus-visible {
    outline-color: #171717;
}

.theme-noir {
    --sh-glow: 0 0 0 3px rgba(23, 23, 23, 0.18);
}

/* 2. Light Theme (Clean Blue) */
.theme-light {
  --primary: #2563eb;
  --primary-2: #3b82f6;
  --primary-3: #60a5fa;
  --accent: #2563eb;
  --accent-2: #bfdbfe;
  --accent-soft: #eff6ff;
  
  --bg: #f8fafc;
  --bg-2: #f1f5f9;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-2: #f1f5f9;
  
  --text-1: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --sidebar-text: #0f172a;
}

.theme-light .sidebar {
    border-right: 1px solid var(--border);
}
.theme-light .nav-link { color: var(--text-2); }
.theme-light .nav-link.active { background: #eff6ff; color: #2563eb; }
.theme-light .nav-section-label { color: #94a3b8; }

/* 3. Atlas Theme (Navy & Teal) */
.theme-atlas {
  --primary: #0f172a;
  --primary-2: #1e293b;
  --primary-3: #334155;
  --accent: #0d9488;
  --accent-2: #2dd4bf;
  --accent-soft: rgba(13, 148, 136, 0.12);
  
  --bg: #fdfbf7; /* Ivory-ish */
  --bg-2: #f3f4f6;
  --sidebar-bg: #111827;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --border-2: #f3f4f6;
  
  --text-1: #111827;
  --text-2: #374151;
  --text-3: #6b7280;
  --sidebar-text: #ffffff;
}

/* 4. Pearl Theme (Platinum & Slate) */
.theme-pearl {
  --primary: #475569;
  --primary-2: #64748b;
  --primary-3: #94a3b8;
  --accent: #6366f1;
  --accent-2: #a5b4fc;
  --accent-soft: #f5f3ff;
  
  --bg: #f1f5f9; /* Platinum */
  --bg-2: #e2e8f0;
  --sidebar-bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #cbd5e1;
  --border-2: #e2e8f0;
  
  --text-1: #1e293b;
  --text-2: #334155;
  --text-3: #64748b;
  --sidebar-text: #1e293b;
}

.theme-pearl .sidebar { border-right: 1px solid var(--border); }
.theme-pearl .nav-link { color: var(--text-2); }
.theme-pearl .nav-link.active { background: #f1f5f9; color: var(--primary); }

/* 5. Classic Theme (Gold & Elite) */
.theme-classic {
  --primary: #171717;
  --primary-2: #262626;
  --primary-3: #404040;
  --accent: #c5a059;
  --accent-2: #e8c97e;
  --accent-soft: rgba(197, 160, 89, 0.15);
  
  --bg: #f5f5f5;
  --bg-2: #e5e5e5;
  --sidebar-bg: #171717;
  --card-bg: #ffffff;
  --border: #e0e0e0;
  --border-2: #f0f0f0;
  
  --text-1: #171717;
  --text-2: #404040;
  --text-3: #737373;
  --text-inv: #fafafa;
  --sidebar-text: #ffffff;
}

/* Theme Switcher Styles */
.theme-card {
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--sh-sm);
}

.theme-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.theme-card.active { border-color: var(--accent); box-shadow: var(--sh-glow); }

.theme-preview {
    height: 60px;
    border-radius: 8px;
    display: flex;
    overflow: hidden;
    border: 1px solid var(--border);
}

.theme-preview-sidebar { width: 25%; height: 100%; }
.theme-preview-main { flex: 1; height: 100%; display: flex; flex-direction: column; padding: 6px; gap: 4px; }
.theme-preview-box { height: 10px; border-radius: 2px; width: 60%; }

.theme-name { font-weight: 700; font-size: var(--fs-md); color: var(--text-1); }
.theme-desc { font-size: var(--fs-xs); color: var(--text-3); }
