/* ============================================================
   DarkZoneDetector — Feuille de style principale
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-bg:       #1a1a2e;
    --color-surface:  #16213e;
    --color-primary:  #0f3460;
    --color-accent:   #e94560;
    --color-text:     #eaeaea;
    --color-muted:    #8892a4;
    --color-border:   #2a3a5c;
    --color-green:    #2ecc71;
    --color-orange:   #f39c12;
    --color-red:      #e74c3c;
    --radius:         8px;
    --shadow:         0 4px 24px rgba(0,0,0,.4);
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    overflow: hidden;
}

/* ── En-tête ───────────────────────────────────────────────── */
header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: 200;
    box-shadow: var(--shadow);
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 22px; }
.logo-text { font-size: 18px; font-weight: 700; color: var(--color-accent); letter-spacing: .5px; }
.header-stats { display: flex; gap: 16px; font-size: 13px; color: var(--color-muted); }
.header-stats span::before { content: '• '; color: var(--color-accent); }

/* ── Publicité ─────────────────────────────────────────────── */
.ad-banner { background: var(--color-surface); border-bottom: 1px solid var(--color-border); text-align: center; }
.ad-top  { position: fixed; top: 52px; left: 0; right: 0; z-index: 190; min-height: 60px; }
.ad-bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 190; min-height: 60px; }

/* ── Panneau de contrôles ──────────────────────────────────── */
.controls-panel {
    position: fixed;
    top: 122px; /* header + pub */
    left: 12px;
    z-index: 100;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
    width: 280px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-label { font-size: 11px; font-weight: 600; text-transform: uppercase;
                 letter-spacing: .8px; color: var(--color-muted); }

/* Chips filtre réseau */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    background: var(--color-primary);
    color: var(--color-text);
    font-size: 12px;
    cursor: pointer;
    transition: all .2s;
}
.chip:hover, .chip.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}
.chip-nocov.active { background: #222; border-color: #555; }

/* Select opérateur / période */
.select-control {
    background: var(--color-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    padding: 7px 10px;
    font-size: 13px;
    width: 100%;
    cursor: pointer;
}
.select-control:focus { outline: 1px solid var(--color-accent); }

/* Boutons action */
.control-actions { flex-direction: row; gap: 8px; }
.btn {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius);
    border: none;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity .2s;
}
.btn:hover { opacity: .85; }
.btn-primary   { background: var(--color-accent); color: #fff; }
.btn-secondary { background: var(--color-primary); color: var(--color-text);
                 border: 1px solid var(--color-border); }

/* Légende */
.legend { display: flex; flex-direction: column; gap: 5px; padding-top: 4px;
          border-top: 1px solid var(--color-border); }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--color-muted); }
.legend-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.3);
    flex-shrink: 0;
}
.dot-black  { background: #1a1a1a; }
.dot-red    { background: var(--color-red); }
.dot-orange { background: var(--color-orange); }
.dot-green  { background: var(--color-green); }

/* ── Carte ─────────────────────────────────────────────────── */
#map {
    position: fixed;
    top: 112px; /* header 52 + pub 60 */
    left: 0; right: 0;
    bottom: 60px; /* pub bas */
}

/* ── Loading ────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.loading-overlay.hidden { display: none; }
.loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 15px; color: var(--color-muted); }

/* ── Compteur ───────────────────────────────────────────────── */
.points-counter {
    position: fixed;
    bottom: 68px;
    right: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    color: var(--color-muted);
    z-index: 100;
}

/* ── Popup info ─────────────────────────────────────────────── */
.info-popup {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    min-width: 260px;
    max-width: 90vw;
    z-index: 300;
    box-shadow: var(--shadow);
}
.info-popup.hidden { display: none; }
.popup-close {
    position: absolute;
    top: 8px; right: 10px;
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 16px;
    cursor: pointer;
}
.popup-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.popup-label { color: var(--color-muted); }
.popup-val { font-weight: 600; }
.popup-sig-0 { color: #888; }
.popup-sig-1 { color: var(--color-red); }
.popup-sig-2 { color: var(--color-orange); }
.popup-sig-3, .popup-sig-4 { color: var(--color-green); }

/* ── Responsive mobile ──────────────────────────────────────── */
@media (max-width: 600px) {
    .controls-panel {
        top: auto;
        bottom: 68px;
        left: 0; right: 0;
        width: 100%;
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 45vh;
    }
    #map { top: 112px; }
    .header-stats { display: none; }
}
