/* ============================================================
   themes.css — Theme engine for Clear Net Sky / S.O.W.A
   Selectable colour schemes applied via a <body> class.
   The default scheme (Midnight) lives in :root inside main.css;
   the classes below override those custom properties.
   ============================================================ */

/* Smooth cross-fade when switching themes */
body,
.main-header,
.main-footer,
.dashboard-card,
.stat-card,
.modal-content,
.card-header,
.button,
.primary-button,
.secondary-button {
    transition:
        background-color 0.4s ease,
        color 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease;
}

/* ---------- 1. MIDNIGHT (default / dark blue) ---------- */
body.cyber-theme {
    --primary-color: #4c8dff;
    --primary-light: #7fb0ff;
    --primary-dark: #2e6bdf;
    --secondary-color: #38bdf8;
    --secondary-light: #7dd3fc;
    --secondary-dark: #0ea5e9;
    --accent-color: #34d399;

    --text-primary: #f1f5fb;
    --text-secondary: #a6b3c9;
    --text-muted: #64718a;

    --bg-primary: #070a13;
    --bg-secondary: #0c111c;
    --bg-tertiary: #121828;
    --bg-quaternary: #1a2234;

    --border-color: #1e2740;
    --glow: rgba(76, 141, 255, 0.35);
    --grid-color: rgba(76, 141, 255, 0.05);
}

/* ---------- 2. EMERALD (dark green ops) ---------- */
body.matrix-theme {
    --primary-color: #2fd48b;
    --primary-light: #6ee7b7;
    --primary-dark: #0f9d63;
    --secondary-color: #22d3ee;
    --secondary-light: #67e8f9;
    --secondary-dark: #0891b2;
    --accent-color: #a3e635;

    --text-primary: #ecfdf5;
    --text-secondary: #9cbfae;
    --text-muted: #5e7d6c;

    --bg-primary: #05100b;
    --bg-secondary: #081810;
    --bg-tertiary: #0d2318;
    --bg-quaternary: #143324;

    --border-color: #1a3a2a;
    --glow: rgba(47, 212, 139, 0.32);
    --grid-color: rgba(47, 212, 139, 0.05);
}

/* ---------- 3. CRIMSON (dark red alert) ---------- */
body.crimson-theme {
    --primary-color: #f5566f;
    --primary-light: #fb8a9c;
    --primary-dark: #d02a48;
    --secondary-color: #fb923c;
    --secondary-light: #fdba74;
    --secondary-dark: #ea680c;
    --accent-color: #fbbf24;

    --text-primary: #fdf2f4;
    --text-secondary: #c7a2ab;
    --text-muted: #86616a;

    --bg-primary: #100609;
    --bg-secondary: #1a0a0f;
    --bg-tertiary: #251016;
    --bg-quaternary: #351822;

    --border-color: #3e1e2a;
    --glow: rgba(245, 86, 111, 0.32);
    --grid-color: rgba(245, 86, 111, 0.05);
}

/* ---------- 4. DAYLIGHT (clean light) ---------- */
body.light-theme {
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #0284c7;
    --secondary-light: #38bdf8;
    --secondary-dark: #0369a1;
    --accent-color: #059669;

    --text-primary: #0f172a;
    --text-secondary: #46536b;
    --text-muted: #7c899e;

    --bg-primary: #f4f6fb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eaeef6;
    --bg-quaternary: #dde4f0;

    --border-color: #d7deeb;
    --shadow-color: rgba(15, 23, 42, 0.08);
    --glow: rgba(37, 99, 235, 0.2);
    --grid-color: rgba(37, 99, 235, 0.04);
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-lift: 0 16px 40px -16px rgba(15, 23, 42, 0.18);
}

/* Light theme readability tweaks */
body.light-theme #particles-js {
    background: linear-gradient(160deg, #f4f6fb 0%, #e8edf7 100%);
}

body.light-theme ::selection {
    background: var(--primary-light);
    color: #fff;
}

body.light-theme .news-category,
body.light-theme .article-category,
body.light-theme .primary-button {
    color: #ffffff;
}

body.light-theme .news-category {
    background-color: rgba(255, 255, 255, 0.85);
    color: var(--primary-dark);
}

/* Keep the animated grid colour in sync with the active theme */
.cyber-grid {
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
}

/* ---------- Theme picker pop-over ---------- */
.theme-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.4rem;
    display: none;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 180px;
    box-shadow: var(--shadow-lift, 0 12px 30px rgba(0, 0, 0, 0.45));
    z-index: 1500;
    animation: modalFadeIn 0.2s ease-out;
}

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

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.87rem;
    font-weight: 500;
    background: none;
    border: none;
    text-align: left;
    width: 100%;
    transition: all 0.2s ease;
}

.theme-option:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-option.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.theme-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.theme-swatch.cyber   { background: #4c8dff; }
.theme-swatch.matrix  { background: #2fd48b; }
.theme-swatch.crimson { background: #f5566f; }
.theme-swatch.light   { background: #f0f4fa; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }

.theme-switcher { position: relative; }
