/* ── VARIABLES ──────────────────────────────────── */
:root {
    --bg:         #0D1117;
    --surface:    #161C2D;
    --surface-up: #1E2540;
    --border:     #2D3F5C;
    --text:       #E2E8F0;
    --muted:      #8B9CC4;
    --accent:     #3B82F6;
    --accent-lt:  #63B3ED;
    --yellow:     #F6C90E;
    --yellow-lt:  #FFE44D;
    --green:      #10B981;
    --green-lt:   #34D399;
    --red:        #F87171;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ── HEADER ─────────────────────────────────────── */
.site-header {
    flex-shrink: 0;
    background: linear-gradient(180deg, #0D1117 0%, #111827 100%);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-brand { display: flex; align-items: center; gap: 12px; }

.brand-icon {
    width: 40px; height: 40px;
    background: rgba(246,201,14,.1);
    border: 1px solid rgba(246,201,14,.3);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.brand-icon svg { width: 22px; height: 22px; color: var(--yellow); }

.brand-logo { height: 60px; width: auto; flex-shrink: 0; border-radius: 6px; }

.brand-text h1 { font-size: 23px; font-weight: 700; letter-spacing: -.3px; line-height: 1.2; }
.brand-text p  { font-size: 15px; color: var(--muted); }

.header-notice {
    background: rgba(246,201,14,.07);
    border: 1px solid rgba(246,201,14,.22);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 15px;
    color: #E8C50D;
    font-weight: 500;
    white-space: nowrap;
}

/* ── MAIN GRID ──────────────────────────────────── */
.site-main {
    flex: 1; min-height: 0;
    display: grid;
    grid-template-columns: 1fr 487px;
    gap: 20px;
    padding: 20px 32px;
    overflow: visible;
}

/* ── PANNEAU LIENS ──────────────────────────────── */
.links-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    overflow-y: auto;
    padding-right: 4px;
}
.links-panel::-webkit-scrollbar { width: 4px; }
.links-panel::-webkit-scrollbar-track { background: transparent; }
.links-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── COMPOSANT LIENS ────────────────────────────── */
.cat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.cat-head {
    display: flex; align-items: center; gap: 9px;
    padding: 10px 14px;
    background: var(--surface-up);
    border-bottom: 1px solid var(--border);
}

.cat-icon { width: 16px; height: 16px; color: var(--yellow); flex-shrink: 0; }

.cat-title {
    font-size: 19px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--muted);
}

.cat-links { padding: 4px 0; }

.cat-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 17px;
    color: #fff;
    text-decoration: none;
    transition: background 180ms, color 180ms;
    cursor: pointer;
    line-height: 1.4;
}

.cat-link:hover        { background: var(--surface-up); color: var(--accent-lt); }
.cat-link.yellow       { color: #fff; font-weight: 500; }
.cat-link.yellow:hover { color: var(--yellow-lt); background: var(--surface-up); }
.cat-link.green        { color: #fff; font-weight: 500; }
.cat-link.green:hover  { color: var(--green-lt); background: var(--surface-up); }

.adsb-tag {
    display: inline-block;
    background: rgba(99,179,237,.12);
    border: 1px solid rgba(99,179,237,.28);
    border-radius: 4px;
    font-size: 13px; font-weight: 600;
    color: var(--accent-lt);
    padding: 1px 5px; margin-left: 5px;
    vertical-align: middle; letter-spacing: .04em;
}

.link-favicon { width: 16px; height: 16px; flex-shrink: 0; border-radius: 2px; }
svg.link-favicon { color: var(--muted); }

/* ── COMPOSANT WEBCAM (HLS / MediaMTX) ─────────── */
.webcam-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.webcam-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-label {
    font-size: 14px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted);
}

.live-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(16,185,129,.1);
    border: 1px solid rgba(16,185,129,.28);
    border-radius: 20px;
    padding: 2px 9px;
    font-size: 13px; font-weight: 700;
    color: var(--green); letter-spacing: .05em;
}

.live-dot {
    width: 5px; height: 5px;
    background: var(--green);
    border-radius: 50%;
    animation: blink 1.8s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: .2; }
}

.webcam-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 2px;
}

.webcam-item {
    position: relative;
    aspect-ratio: 16/9;
    width: 100%;
    flex-shrink: 0;
}

/* ── Conteneur flux vidéo ───────────────────────── */
.webcam-frame {
    position: relative;
    border: 3px solid var(--yellow);
    border-radius: 10px;
    overflow: hidden;
    height: 100%;
    width: 100%;
    background: #000;
    transition: border-color 200ms, box-shadow 200ms;
}

.webcam-frame:hover {
    border-color: var(--yellow-lt);
    box-shadow: 0 0 18px rgba(246,201,14,.28);
}

/* ── Élément <video> HLS ────────────────────────── */
.webcam-frame video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    background: #000;
}

/* ── Overlay d'état (loading / erreur) ──────────── */
.webcam-frame::before {
    content: attr(data-label);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--muted);
    background: rgba(0,0,0,.6);
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    transition: opacity 300ms;
}

/* État : chargement */
.webcam-frame[data-state="loading"]::before {
    content: "Connexion au flux…";
    opacity: 1;
}

/* État : erreur / reconnexion */
.webcam-frame[data-state="error"]::before {
    content: "Flux indisponible — reconnexion…";
    color: var(--red);
    opacity: 1;
}

/* État : navigateur incompatible */
.webcam-frame[data-state="unsupported"]::before {
    content: "Navigateur incompatible HLS";
    color: var(--red);
    opacity: 1;
}

/* ── Label de caméra ────────────────────────────── */
.webcam-label {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(246,201,14,.35);
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 13px; font-weight: 700;
    color: var(--yellow); letter-spacing: .06em;
    pointer-events: none;
    z-index: 10;
}

/* ── FOOTER ─────────────────────────────────────── */
.site-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding: 9px 32px;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

/* ── RESPONSIVE TABLETTE ────────────────────────── */
@media (max-width: 1100px) and (min-width: 769px) {

    .site-main {
        display: flex;
        flex-direction: column;
        padding: 16px 20px;
        gap: 16px;
    }

    .links-panel {
        overflow-y: visible;
        padding-right: 0;
    }

    .webcam-panel {
        width: 100%;
    }

    .site-header {
        height: auto;
        min-height: 68px;
        padding: 10px 20px;
    }
}

/* ── RESPONSIVE MOBILE ──────────────────────────── */
@media (max-width: 768px) {

    body {
        height: auto;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .site-header {
        height: auto;
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .brand-logo { height: 44px; }

    .brand-text h1 { font-size: 18px; }
    .brand-text p  { font-size: 13px; }

    .header-notice { display: none; }

    .site-main {
        display: flex;
        flex-direction: column;
        padding: 12px 16px;
        overflow: visible;
        gap: 16px;
    }

    .links-panel {
        grid-template-columns: 1fr;
        overflow-y: visible;
        padding-right: 0;
    }

    .cat-link {
        min-height: 44px;
        padding: 10px 14px;
    }

    .webcam-panel {
        width: 100%;
    }

    .webcam-list {
        gap: 16px;
    }

    .cat-title {
        font-size: 15px;
    }

    .site-footer {
        padding: 10px 16px;
        font-size: 12px;
    }
}
