/* ==============================================
   THEME SYSTEM — Cyberpunk first
   Defaults inherited from variables.css.
   Alternate themes kept for user switcher.
   ============================================== */

/* Default / Cyberpunk theme — mirrors variables.css tokens.
   Declared here for alternate theme names that map to default. */
[data-theme="cyberpunk"],
[data-theme="light"],
[data-theme="dark"] {
    --primary: #00f0ff;
    --primary-hover: #22d3ee;
    --primary-light: #7ff9ff;
    --primary-dark: #0891b2;
    --primary-bg: rgba(0, 240, 255, 0.08);

    --secondary: #9bb5d1;
    --secondary-hover: #e0f7ff;

    --success: #39ff14;
    --success-hover: #22c55e;
    --success-bg: rgba(57, 255, 20, 0.08);
    --danger: #ff003c;
    --danger-hover: #dc2626;
    --danger-bg: rgba(255, 0, 60, 0.08);
    --warning: #fcee0a;
    --warning-hover: #eab308;
    --warning-bg: rgba(252, 238, 10, 0.08);
    --info: #00f0ff;
    --info-bg: rgba(0, 240, 255, 0.08);

    --bg-primary: #0a0f1f;
    --bg-secondary: #05060f;
    --bg-tertiary: #12172b;
    --bg-dark: #03040a;

    --text-primary: #e0f7ff;
    --text-secondary: #9bb5d1;
    --text-muted: #5b6b8a;
    --text-inverse: #05060f;

    --border: rgba(0, 240, 255, 0.22);
    --border-hover: #00f0ff;
    --border-focus: var(--primary);

    --card-bg: rgba(10, 15, 31, 0.72);
    --card-border: rgba(0, 240, 255, 0.3);

    --header-bg: rgba(10, 15, 31, 0.85);
    --header-border: rgba(0, 240, 255, 0.3);

    --sidebar-bg: rgba(10, 15, 31, 0.72);
    --sidebar-hover: rgba(0, 240, 255, 0.08);

    --input-bg: rgba(3, 4, 10, 0.72);
    --input-border: rgba(0, 240, 255, 0.3);
    --input-focus-ring: rgba(0, 240, 255, 0.35);

    --theme-indicator: #00f0ff;
}

/* Alternate: OCEAN — deep cyan city */
[data-theme="ocean"] {
    --primary: #22d3ee;
    --primary-hover: #67e8f9;
    --primary-light: #a5f3fc;
    --primary-dark: #0891b2;
    --primary-bg: rgba(34, 211, 238, 0.12);

    --success: #39ff14;
    --danger: #ff003c;
    --warning: #fcee0a;
    --info: #22d3ee;

    --bg-primary: #062235;
    --bg-secondary: #031420;
    --bg-tertiary: #0c3a56;
    --bg-dark: #010a14;

    --text-primary: #e0f7ff;
    --text-secondary: #7dd3fc;
    --text-muted: #475d78;
    --text-inverse: #031420;

    --border: rgba(34, 211, 238, 0.22);
    --border-hover: #22d3ee;

    --card-bg: rgba(6, 34, 53, 0.75);
    --card-border: rgba(34, 211, 238, 0.3);
    --header-bg: rgba(3, 20, 32, 0.88);
    --header-border: rgba(34, 211, 238, 0.3);

    --input-bg: rgba(1, 10, 20, 0.75);
    --input-border: rgba(34, 211, 238, 0.3);
    --input-focus-ring: rgba(34, 211, 238, 0.35);
    --theme-indicator: #22d3ee;
}

/* Alternate: MATRIX (green terminal) */
[data-theme="forest"] {
    --primary: #39ff14;
    --primary-hover: #86efac;
    --primary-light: #bbf7d0;
    --primary-dark: #16a34a;
    --primary-bg: rgba(57, 255, 20, 0.1);

    --success: #39ff14;
    --danger: #ff003c;
    --warning: #fcee0a;
    --info: #00f0ff;

    --bg-primary: #020d0a;
    --bg-secondary: #000503;
    --bg-tertiary: #083521;
    --bg-dark: #000201;

    --text-primary: #dcfce7;
    --text-secondary: #86efac;
    --text-muted: #4a6b55;
    --text-inverse: #020d0a;

    --border: rgba(57, 255, 20, 0.22);
    --border-hover: #39ff14;

    --card-bg: rgba(2, 13, 10, 0.78);
    --card-border: rgba(57, 255, 20, 0.3);
    --header-bg: rgba(0, 5, 3, 0.88);
    --header-border: rgba(57, 255, 20, 0.3);

    --input-bg: rgba(0, 2, 1, 0.75);
    --input-border: rgba(57, 255, 20, 0.3);
    --input-focus-ring: rgba(57, 255, 20, 0.35);
    --theme-indicator: #39ff14;
}

/* Alternate: SUNSET (neon violet/yellow) */
[data-theme="sunset"] {
    --primary: #b24bf3;
    --primary-hover: #c084fc;
    --primary-light: #e9d5ff;
    --primary-dark: #7c3aed;
    --primary-bg: rgba(178, 75, 243, 0.12);

    --success: #39ff14;
    --danger: #ff003c;
    --warning: #fcee0a;
    --info: #00f0ff;

    --bg-primary: #1a0836;
    --bg-secondary: #0a041a;
    --bg-tertiary: #2a1454;
    --bg-dark: #05020d;

    --text-primary: #f3e8ff;
    --text-secondary: #d8b4fe;
    --text-muted: #6b4a8a;
    --text-inverse: #0a041a;

    --border: rgba(178, 75, 243, 0.25);
    --border-hover: #b24bf3;

    --card-bg: rgba(26, 8, 54, 0.78);
    --card-border: rgba(178, 75, 243, 0.35);
    --header-bg: rgba(10, 4, 26, 0.88);
    --header-border: rgba(178, 75, 243, 0.35);

    --input-bg: rgba(5, 2, 13, 0.75);
    --input-border: rgba(178, 75, 243, 0.35);
    --input-focus-ring: rgba(178, 75, 243, 0.4);
    --theme-indicator: #b24bf3;
}

/* ========================
   THEME SWITCHER COMPONENT
   ======================== */
.theme-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.theme-switcher-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border-strong, var(--border));
    border-radius: 0;
    background: var(--bg-glass, rgba(0, 240, 255, 0.05));
    cursor: pointer;
    transition: all var(--transition);
    clip-path: var(--clip-bevel-sm);
    color: var(--primary);
}

.theme-switcher-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--primary);
    box-shadow: var(--glow-cyan-sm);
    color: var(--primary-light);
}

.theme-switcher-btn svg {
    width: 20px;
    height: 20px;
    color: inherit;
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.6));
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + var(--spacing-sm));
    right: 0;
    min-width: 200px;
    padding: var(--spacing-sm);
    background: rgba(10, 15, 31, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-strong, var(--border));
    border-radius: 0;
    box-shadow: var(--shadow-md), var(--glow-cyan-sm);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition);
    clip-path: var(--clip-bevel-sm);
}

.theme-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition);
}

.theme-option:hover {
    background: rgba(0, 240, 255, 0.08);
    color: var(--primary);
    border-color: rgba(0, 240, 255, 0.3);
}

.theme-option.active {
    background: rgba(0, 240, 255, 0.15);
    color: var(--primary);
    border-color: var(--primary);
    text-shadow: var(--glow-cyan-sm);
}

.theme-color-preview {
    display: flex;
    gap: 1px;
    width: 28px;
    height: 16px;
    border-radius: 0;
    overflow: hidden;
    border: 1px solid var(--border-strong, var(--border));
}

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

/* Theme preview swatches */
.theme-option[data-theme="light"] .theme-color-preview span:nth-child(1),
.theme-option[data-theme="cyberpunk"] .theme-color-preview span:nth-child(1) { background: #05060f; }
.theme-option[data-theme="light"] .theme-color-preview span:nth-child(2),
.theme-option[data-theme="cyberpunk"] .theme-color-preview span:nth-child(2) { background: #00f0ff; }
.theme-option[data-theme="light"] .theme-color-preview span:nth-child(3),
.theme-option[data-theme="cyberpunk"] .theme-color-preview span:nth-child(3) { background: #fcee0a; }

.theme-option[data-theme="dark"] .theme-color-preview span:nth-child(1) { background: #05060f; }
.theme-option[data-theme="dark"] .theme-color-preview span:nth-child(2) { background: #00f0ff; }
.theme-option[data-theme="dark"] .theme-color-preview span:nth-child(3) { background: #b24bf3; }

.theme-option[data-theme="ocean"] .theme-color-preview span:nth-child(1) { background: #031420; }
.theme-option[data-theme="ocean"] .theme-color-preview span:nth-child(2) { background: #22d3ee; }
.theme-option[data-theme="ocean"] .theme-color-preview span:nth-child(3) { background: #0c3a56; }

.theme-option[data-theme="forest"] .theme-color-preview span:nth-child(1) { background: #000503; }
.theme-option[data-theme="forest"] .theme-color-preview span:nth-child(2) { background: #39ff14; }
.theme-option[data-theme="forest"] .theme-color-preview span:nth-child(3) { background: #083521; }

.theme-option[data-theme="sunset"] .theme-color-preview span:nth-child(1) { background: #0a041a; }
.theme-option[data-theme="sunset"] .theme-color-preview span:nth-child(2) { background: #b24bf3; }
.theme-option[data-theme="sunset"] .theme-color-preview span:nth-child(3) { background: #fcee0a; }

/* Smooth transition for theme changes */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}
