/* ---------------------------------------------------------------
   Design tokens — change ces variables pour repersonnaliser
   entièrement le dashboard (couleurs, polices, rayons...).
   Les couleurs --team-a / --team-b sont aussi lues en JS
   (app.js) pour dessiner le radar : elles restent donc la
   source de vérité unique pour la palette.
------------------------------------------------------------------ */
:root {
    --bg: #F8F8F8;
    --panel: #2c313f00;
    --panel-border: #232838;
    --text: #232838;
    --muted: #232838;

    --team-a: #8039DF;
    --team-a-fill: #8039DF3e;
    --team-b: #3261cd;
    --team-b-fill: #3261cd3e;

    --grid: #262c3d;
    --grid-strong: #333b52;

    --font-display: "Space Grotesk", sans-serif;
    --font-body: "Inter", sans-serif;
    --font-mono: "Poppins";

    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
}

body {
    position: relative;
    padding: 28px clamp(16px, 4vw, 48px) 64px;
}

/* subtle HUD scanline texture — the one restrained flourish */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255,255,255,0.015) 0px,
            rgba(255,255,255,0.015) 1px,
            transparent 1px,
            transparent 3px
        ),
        radial-gradient(ellipse at top, rgba(94,234,212,0.05), transparent 60%);
}

.topbar, .layout { position: relative; z-index: 1; }

/* ---------- topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

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

.brand-mark {
    font-size: 26px;
    color: var(--team-a);
    line-height: 1;
}

.brand h1 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 0;
}

.tagline {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.updated-at {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    border-radius: 999px;
    padding: 10px 18px;
    border: 1px solid var(--panel-border);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-icon { font-size: 14px; }

.btn-ghost {
    background: transparent;
    color: var(--text);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--team-a); color: var(--team-a); }

.btn-solid {
    background: var(--team-a);
    color: #05201c;
    border-color: var(--team-a);
}
.btn-solid:hover:not(:disabled) { opacity: 0.88; }

/* ---------- layout ---------- */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 20px;
}

.controls {
    grid-column: 1;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-self: start;
}

.chart-panel {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 480px;
}

.table-panel {
    grid-column: 2;
    grid-row: 2;
}

.log-panel {
    grid-column: 1 / -1;
}

@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    .controls, .chart-panel, .table-panel, .log-panel { grid-column: 1; }
    .controls { grid-row: auto; }
}

/* ---------- controls ---------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.field .muted { text-transform: none; letter-spacing: 0; }

select {
    background: #f9F9F9;
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 14px;
}

select:focus-visible,
button:focus-visible {
    outline: 2px solid var(--team-a);
    outline-offset: 2px;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---------- chart ---------- */
/* .radar-frame {
    width: 2311px;
    height: 1080px;
    position: relative;
}

.radar-frame canvas {
    width: 2311px;
    height: 1080px;
} */

.radar-frame {
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: auto; /* ou hidden si tu préfères */
}

#radarCanvas {
    width: 100%;
    max-width: 1200px; /* Taille affichée maximale */
    height: auto;      /* Conserve le ratio */
}

.empty-state {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    max-width: 320px;
    margin: 12px 0 0;
}

/* ---------- table ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 13px;
}

thead th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 11px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
}

tbody td {
    padding: 10px 8px 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

tbody tr:last-child td { border-bottom: none; }

.wr-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wr-bar-track {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--grid);
    overflow: hidden;
}

.wr-bar-fill {
    height: 100%;
    border-radius: 999px;
}

/* ---------- log panel ---------- */
.log-panel h2 {
    font-family: var(--font-display);
    font-size: 14px;
    margin: 0 0 12px;
    color: var(--team-a);
}

#logOutput {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
