/* themes.css — Toggleable Multi-Tone Color System
   5 color palettes × 2 modes (dark/light) = 10 total theme combinations
   Each palette has 2 primary tones with 2-3 shades each (6 colors total per palette)
-------------------------------------------------------------- */

/* ============================================================
   BASE LIGHT & DARK MODE FOUNDATIONS
   ============================================================ */

:root[data-mode="dark"] {
  --bg-base: #060606;
  --bg-soft: #0d0d11;
  --bg-card: #1a1a1f;
  --text-primary: #e6e6e6;
  --text-secondary: #b0b0b0;
  --text-muted: #808080;
  --shadow: rgba(0, 0, 0, 0.5);
}

:root[data-mode="light"] {
  --bg-base: #f5f5f5;
  --bg-soft: #ffffff;
  --bg-card: #fafafa;
  --text-primary: #111827;
  --text-secondary: #1f2937;
  --text-muted: #4b5563;
  --shadow: rgba(0, 0, 0, 0.15);
}

/* ============================================================
   PALETTE 1: CYAN/BLUE (Default Neon Theme)
   Primary: Cyan family | Secondary: Blue family
   ============================================================ */

:root[data-theme="cyan"] {
  /* Primary Tone: Cyan */
  --color-primary-1: #00ffff;      /* bright cyan */
  --color-primary-2: #00e6e6;      /* medium cyan */
  --color-primary-3: #00b8b8;      /* deep cyan */
  
  /* Secondary Tone: Blue */
  --color-secondary-1: #0099ff;    /* bright blue */
  --color-secondary-2: #0077cc;    /* medium blue */
  --color-secondary-3: #0055aa;    /* deep blue */
  
  /* Semantic mappings */
  --accent: var(--color-primary-1);
  --accent-2: var(--color-secondary-1);
  --accent-dim: var(--color-primary-3);
  --accent-glow: var(--color-primary-2);
}

/* ============================================================
   PALETTE 2: PURPLE/MAGENTA
   Primary: Purple family | Secondary: Magenta family
   ============================================================ */

:root[data-theme="purple"] {
  /* Primary Tone: Purple */
  --color-primary-1: #bb86fc;      /* bright purple */
  --color-primary-2: #9966dd;      /* medium purple */
  --color-primary-3: #6644aa;      /* deep purple */
  
  /* Secondary Tone: Magenta */
  --color-secondary-1: #ff00ff;    /* bright magenta */
  --color-secondary-2: #dd00dd;    /* medium magenta */
  --color-secondary-3: #aa00aa;    /* deep magenta */
  
  /* Semantic mappings */
  --accent: var(--color-primary-1);
  --accent-2: var(--color-secondary-1);
  --accent-dim: var(--color-primary-3);
  --accent-glow: var(--color-primary-2);
}

/* ============================================================
   PALETTE 3: GREEN/LIME
   Primary: Emerald family | Secondary: Lime family
   ============================================================ */

:root[data-theme="green"] {
  /* Primary Tone: Emerald/Green */
  --color-primary-1: #00ff88;      /* bright emerald */
  --color-primary-2: #00dd77;      /* medium emerald */
  --color-primary-3: #00aa55;      /* deep emerald */
  
  /* Secondary Tone: Lime */
  --color-secondary-1: #88ff00;    /* bright lime */
  --color-secondary-2: #77dd00;    /* medium lime */
  --color-secondary-3: #55aa00;    /* deep lime */
  
  /* Semantic mappings */
  --accent: var(--color-primary-1);
  --accent-2: var(--color-secondary-1);
  --accent-dim: var(--color-primary-3);
  --accent-glow: var(--color-primary-2);
}

/* ============================================================
   PALETTE 4: ORANGE/AMBER
   Primary: Orange family | Secondary: Amber family
   ============================================================ */

:root[data-theme="orange"] {
  /* Primary Tone: Orange */
  --color-primary-1: #ff9933;      /* bright orange */
  --color-primary-2: #ee8822;      /* medium orange */
  --color-primary-3: #cc6611;      /* deep orange */
  
  /* Secondary Tone: Amber/Gold */
  --color-secondary-1: #ffbb33;    /* bright amber */
  --color-secondary-2: #eeaa22;    /* medium amber */
  --color-secondary-3: #cc8811;    /* deep amber */
  
  /* Semantic mappings */
  --accent: var(--color-primary-1);
  --accent-2: var(--color-secondary-1);
  --accent-dim: var(--color-primary-3);
  --accent-glow: var(--color-primary-2);
}

/* ============================================================
   PALETTE 5: RED/PINK
   Primary: Red family | Secondary: Pink family
   ============================================================ */

:root[data-theme="red"] {
  /* Primary Tone: Red */
  --color-primary-1: #ff4466;      /* bright red */
  --color-primary-2: #ee3355;      /* medium red */
  --color-primary-3: #cc2244;      /* deep red */
  
  /* Secondary Tone: Pink */
  --color-secondary-1: #ff66aa;    /* bright pink */
  --color-secondary-2: #ee5599;    /* medium pink */
  --color-secondary-3: #cc4477;    /* deep pink */
  
  /* Semantic mappings */
  --accent: var(--color-primary-1);
  --accent-2: var(--color-secondary-1);
  --accent-dim: var(--color-primary-3);
  --accent-glow: var(--color-primary-2);
}

/* ============================================================
   LIGHT MODE READABILITY OVERRIDES
   Use deeper theme shades so accent text remains legible on light backgrounds.
   ============================================================ */

:root[data-mode="light"] {
  --accent: var(--color-primary-3, #0b4a6f);
  --accent-2: var(--color-secondary-3, #1e3a8a);
  --accent-dim: var(--color-primary-2, #155e75);
  --accent-glow: var(--color-primary-3, #0b4a6f);
}

/* ============================================================
   GLOW EFFECTS (adapt to theme colors)
   ============================================================ */

:root {
  --glow: 0 0 12px var(--accent), 0 0 20px var(--accent-2);
  --glow-strong: 0 0 25px var(--accent), 0 0 40px var(--accent-2);
  --glow-soft: 0 0 8px var(--accent-glow);
}

/* ============================================================
   FX OVERRIDES (use theme variables)
   ============================================================ */

:root {
  --fx-glow-color: var(--accent);
  --fx-p-color: var(--accent);
}

/* ============================================================
   SMOOTH TRANSITIONS ON THEME CHANGE
   ============================================================ */

* {
  transition: background-color 0.3s ease, 
              color 0.3s ease, 
              border-color 0.3s ease,
              box-shadow 0.3s ease;
}

/* Disable transitions during page load */
.no-transition * {
  transition: none !important;
}

/* ============================================================
   THEME SELECTOR UI (Top Right Menu)
   ============================================================ */

.theme-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  gap: 10px;
  align-items: center;
}

.theme-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 2px solid rgba(128, 128, 128, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px var(--shadow);
}

.theme-toggle-btn:hover {
  transform: scale(1.1);
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--shadow), var(--glow-soft);
}

.theme-menu {
  position: absolute;
  top: 54px;
  right: 0;
  background: var(--bg-card);
  border: 2px solid rgba(128, 128, 128, 0.2);
  border-radius: 12px;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  box-shadow: 0 8px 24px var(--shadow);
  backdrop-filter: blur(10px);
}

.theme-menu.show {
  display: flex;
}

.theme-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 8px;
  margin-bottom: 2px;
}

.theme-section:first-child .theme-section-title {
  margin-top: 0;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.theme-option:hover {
  background: rgba(128, 128, 128, 0.1);
}

.theme-option.active {
  border-color: var(--accent);
  background: rgba(128, 128, 128, 0.05);
}

.theme-preview {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(128, 128, 128, 0.3);
}

.theme-preview-half {
  flex: 1;
  height: 100%;
}

.theme-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Theme preview colors for each palette */
.theme-option[data-theme="cyan"] .theme-preview-half:first-child {
  background: #00ffff;
}
.theme-option[data-theme="cyan"] .theme-preview-half:last-child {
  background: #0099ff;
}

.theme-option[data-theme="purple"] .theme-preview-half:first-child {
  background: #bb86fc;
}
.theme-option[data-theme="purple"] .theme-preview-half:last-child {
  background: #ff00ff;
}

.theme-option[data-theme="green"] .theme-preview-half:first-child {
  background: #00ff88;
}
.theme-option[data-theme="green"] .theme-preview-half:last-child {
  background: #88ff00;
}

.theme-option[data-theme="orange"] .theme-preview-half:first-child {
  background: #ff9933;
}
.theme-option[data-theme="orange"] .theme-preview-half:last-child {
  background: #ffbb33;
}

.theme-option[data-theme="red"] .theme-preview-half:first-child {
  background: #ff4466;
}
.theme-option[data-theme="red"] .theme-preview-half:last-child {
  background: #ff66aa;
}

/* Mode toggle (light/dark) */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(128, 128, 128, 0.05);
  border: 2px solid rgba(128, 128, 128, 0.2);
  margin-bottom: 8px;
}

.mode-toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
}

.mode-toggle-switch {
  width: 48px;
  height: 24px;
  background: rgba(128, 128, 128, 0.3);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s ease;
}

.mode-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--bg-soft);
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

:root[data-mode="dark"] .mode-toggle-switch {
  background: var(--accent);
}

:root[data-mode="dark"] .mode-toggle-switch::after {
  transform: translateX(24px);
}

/* Mobile responsive */
@media (max-width: 600px) {
  .theme-selector {
    top: 10px;
    right: 10px;
  }
  
  .theme-menu {
    right: -10px;
  }
}
