/* ======================================================
   DRONE OPS — core.css
   Variables CSS, Reset, Structure globale, Body, Grid
   ====================================================== */

/* --- THÈME SOMBRE (défaut) --- */
:root {
    --bg: #0b111a;
    --panel: #16202c;
    --panel-alt: #1a2d44;
    --accent: #0ea5e9;
    --accent-soft: rgba(14, 165, 233, 0.15);
    --ok: #22c55e;
    --warning: #facc15;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.08);
    --border-soft: rgba(255, 255, 255, 0.04);
    --text: #eef3f8;
    --muted: #8db4cc;
    --radius: 10px;
    --font-mono: "JetBrains Mono", monospace;
    --header-h: 60px;
    --toolbar-h: 60px;
    --footer-h: 40px;
    /* Fond panels & blocs */
    --panel-header-bg: rgba(0, 0, 0, 0.25);
    --analysis-block-bg: rgba(0, 0, 0, 0.15);
    --footer-bg: #070b11;
    --metric-bg: rgba(255, 255, 255, 0.03);
    --input-bg: rgba(15, 27, 42, 0.85);
    --input-bg-solid: #0f1b2a;
    --suggestions-bg: rgba(13, 22, 35, 0.97);
    --dropdown-bg: rgba(2, 9, 18, 0.96);
    --grid-color: rgba(14, 165, 233, 0.03);
    --shadow-panel: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-dropdown: 0 10px 40px rgba(0, 0, 0, 0.7);
    --card-bg: rgba(0, 0, 0, 0.2);
    --card-border: rgba(255, 255, 255, 0.05);
    --metric-bg: rgba(255, 255, 255, 0.03);
    --metric-hover: rgba(14, 165, 233, 0.05);
    --value-color: #ffffff;
    --panel-header-bg: rgba(0, 0, 0, 0.25);
    /* Système de couleurs header (fond sombre) */
    --header-grad-top: #1a2d44;
    --header-grad-bottom: #0b111a;
    --header-border: rgba(255, 255, 255, 0.08);
    --header-text: #ffffff;
    --header-subtext-color: rgba(255, 255, 255, 0.42);
    --header-clocks-color: rgba(255, 255, 255, 0.58);
    --header-sep-color: rgba(255, 255, 255, 0.28);
    --header-btn-bg: rgba(255, 255, 255, 0.07);
    --header-btn-border: rgba(255, 255, 255, 0.18);
    --header-btn-color: rgba(255, 255, 255, 0.78);
    --header-btn-hover-bg: rgba(255, 255, 255, 0.14);
    --header-btn-hover-color: #ffffff;
    --header-hbtn-bg: rgba(14, 165, 233, 0.15);
    --header-hbtn-border: rgba(14, 165, 233, 0.4);
    --header-hbtn-color: #7dd3f8;
    --header-toggle-bg: rgba(255, 255, 255, 0.06);
    --header-toggle-border: rgba(255, 255, 255, 0.18);
    --header-toggle-inactive: rgba(255, 255, 255, 0.36);
    --header-toggle-active-bg: rgba(255, 255, 255, 0.17);
    --header-toggle-active-color: #ffffff;
}

/* --- THÈME CLAIR — Aviation Daylight --- */
[data-theme="light"] {
    --bg: #d4e9f7;
    --panel: #f0f7fd;
    --panel-alt: #daeef9;
    --accent: #0369a1;
    --accent-soft: rgba(3, 105, 161, 0.09);
    --ok: #16a34a;
    --warning: #b45309;
    --danger: #c41e1e;
    --border: rgba(0, 50, 120, 0.14);
    --border-soft: rgba(0, 50, 120, 0.07);
    --text: #08172b;
    --muted: #3d6080;
    --panel-header-bg: rgba(0, 50, 120, 0.06);
    --analysis-block-bg: rgba(0, 50, 120, 0.04);
    --footer-bg: #0f3464;
    --metric-bg: rgba(0, 50, 120, 0.04);
    --input-bg: rgba(208, 230, 248, 0.9);
    --input-bg-solid: #daeef9;
    --suggestions-bg: rgba(240, 247, 253, 0.99);
    --dropdown-bg: rgba(240, 247, 253, 0.99);
    --grid-color: rgba(0, 80, 160, 0.045);
    --shadow-panel: 0 4px 20px rgba(0, 40, 100, 0.1);
    --shadow-dropdown: 0 10px 40px rgba(0, 30, 80, 0.18);
    --card-bg: rgba(0, 50, 120, 0.05);
    --card-border: rgba(0, 50, 120, 0.1);
    --metric-bg: rgba(0, 50, 120, 0.05);
    --metric-hover: rgba(3, 105, 161, 0.06);
    --value-color: #08172b;
    --panel-header-bg: rgba(0, 50, 120, 0.07);
    /* Système de couleurs header (fond clair) */
    --header-grad-top: #eaf3fc;
    --header-grad-bottom: #d4ecfa;
    --header-border: rgba(0, 80, 160, 0.14);
    --header-text: #08172b;
    --header-subtext-color: rgba(8, 23, 43, 0.48);
    --header-clocks-color: rgba(8, 23, 43, 0.62);
    --header-sep-color: rgba(8, 23, 43, 0.22);
    --header-btn-bg: rgba(3, 105, 161, 0.07);
    --header-btn-border: rgba(3, 105, 161, 0.24);
    --header-btn-color: #0369a1;
    --header-btn-hover-bg: rgba(3, 105, 161, 0.15);
    --header-btn-hover-color: #024e79;
    --header-hbtn-bg: rgba(3, 105, 161, 0.1);
    --header-hbtn-border: rgba(3, 105, 161, 0.35);
    --header-hbtn-color: #0369a1;
    --header-toggle-bg: rgba(3, 105, 161, 0.06);
    --header-toggle-border: rgba(3, 105, 161, 0.22);
    --header-toggle-inactive: rgba(3, 105, 161, 0.4);
    --header-toggle-active-bg: rgba(3, 105, 161, 0.14);
    --header-toggle-active-color: #0369a1;
}

/* Fallback CSS pur (sans JS) — préférence OS */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg: #d4e9f7;
        --panel: #f0f7fd;
        --panel-alt: #daeef9;
        --accent: #0369a1;
        --accent-soft: rgba(3, 105, 161, 0.09);
        --ok: #16a34a;
        --warning: #b45309;
        --danger: #c41e1e;
        --border: rgba(0, 50, 120, 0.14);
        --border-soft: rgba(0, 50, 120, 0.07);
        --text: #08172b;
        --muted: #3d6080;
        --panel-header-bg: rgba(0, 50, 120, 0.06);
        --analysis-block-bg: rgba(0, 50, 120, 0.04);
        --footer-bg: #0f3464;
        --metric-bg: rgba(0, 50, 120, 0.04);
        --input-bg: rgba(208, 230, 248, 0.9);
        --input-bg-solid: #daeef9;
        --suggestions-bg: rgba(240, 247, 253, 0.99);
        --dropdown-bg: rgba(240, 247, 253, 0.99);
        --grid-color: rgba(0, 80, 160, 0.045);
        --shadow-panel: 0 4px 20px rgba(0, 40, 100, 0.1);
        --shadow-dropdown: 0 10px 40px rgba(0, 30, 80, 0.18);
        --card-bg: rgba(0, 50, 120, 0.05);
        --card-border: rgba(0, 50, 120, 0.1);
        --metric-bg: rgba(0, 50, 120, 0.05);
        --metric-hover: rgba(3, 105, 161, 0.06);
        --value-color: #08172b;
        --panel-header-bg: rgba(0, 50, 120, 0.07);
        --header-grad-top: #eaf3fc;
        --header-grad-bottom: #d4ecfa;
        --header-border: rgba(0, 80, 160, 0.14);
        --header-text: #08172b;
        --header-subtext-color: rgba(8, 23, 43, 0.48);
        --header-clocks-color: rgba(8, 23, 43, 0.62);
        --header-sep-color: rgba(8, 23, 43, 0.22);
        --header-btn-bg: rgba(3, 105, 161, 0.07);
        --header-btn-border: rgba(3, 105, 161, 0.24);
        --header-btn-color: #0369a1;
        --header-btn-hover-bg: rgba(3, 105, 161, 0.15);
        --header-btn-hover-color: #024e79;
        --header-hbtn-bg: rgba(3, 105, 161, 0.1);
        --header-hbtn-border: rgba(3, 105, 161, 0.35);
        --header-hbtn-color: #0369a1;
        --header-toggle-bg: rgba(3, 105, 161, 0.06);
        --header-toggle-border: rgba(3, 105, 161, 0.22);
        --header-toggle-inactive: rgba(3, 105, 161, 0.4);
        --header-toggle-active-bg: rgba(3, 105, 161, 0.14);
        --header-toggle-active-color: #0369a1;
    }
}

/* --- RESET --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- STRUCTURE GLOBALE --- */
html,
body {
    height: 100%;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 14px;
    transition: background 0.25s ease, color 0.25s ease;
}

/* --- GRILLE DE FOND (effet tactical) --- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* --- ANIMATIONS GLOBALES --- */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

@keyframes pulse-ok {
    0%, 100% { box-shadow: 0 0 8px var(--ok); }
    50%       { box-shadow: 0 0 16px var(--ok); }
}
