/* =====================================================================
   SDD — Design des pages de statistiques
   (parties.php, partie.php, statistique.php, classement.php)
   S'appuie sur les variables de styles.css (--primary, --dark, ...).
   ===================================================================== */

.stats-page .container { max-width: 1180px; }

/* -------- barre de filtres -------- */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.filters-bar .search-input,
.filters-bar select.search-input {
    margin: 0;
    height: 44px;
    padding: 0 14px;
}
.filters-bar select.search-input { cursor: pointer; }

/* =====================================================================
   TABLEAUX
   ===================================================================== */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--dark-secondary);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
    min-width: 640px;
}
.data-table thead th {
    background: rgba(255, 165, 0, 0.10);
    color: var(--primary);
    text-align: left;
    padding: 13px 16px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text);
    white-space: nowrap;
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: rgba(255, 165, 0, 0.07); }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table .num  { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .strong { font-weight: 700; color: #fff; }
.data-table small { color: var(--text-light); display: block; margin-top: 2px; font-size: 0.8rem; }
.data-table a { color: var(--secondary); text-decoration: none; font-weight: 600; }
.data-table a:hover { text-decoration: underline; }
.data-table .rank-cell { width: 44px; text-align: center; font-weight: 700; color: var(--text-light); }
.data-table tr.me { background: rgba(255, 165, 0, 0.12); }

/* colonne "valeur" mise en avant (classement) */
.data-table td.metric-val { color: var(--primary); font-weight: 800; font-size: 1.05rem; }

/* =====================================================================
   LISTE DES PARTIES  (parties.php)
   ===================================================================== */
.match-list { display: flex; flex-direction: column; gap: 14px; }

.match-row {
    display: grid;
    grid-template-columns: 128px 1fr 220px 150px auto;
    gap: 18px;
    align-items: center;
    padding: 16px 20px;
    background: var(--dark-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.match-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    border-left-color: var(--secondary);
}
.match-row .mr-date { font-size: 0.86rem; color: var(--text-light); line-height: 1.35; }
.match-row .mr-date strong { display: block; color: var(--text); font-size: 0.95rem; }
.match-row .mr-title { font-weight: 700; font-size: 1.05rem; color: #fff; }
.match-row .mr-title small { display: block; color: var(--text-light); font-weight: 400; font-size: 0.82rem; margin-top: 2px; }
.match-row .mr-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.match-row .mr-cta {
    background: var(--primary); color: #000; font-weight: 700;
    padding: 9px 16px; border-radius: 8px; font-size: 0.88rem; white-space: nowrap;
}
.match-row:hover .mr-cta { background: var(--secondary); }

/* barre de score deux factions */
.score-bar { width: 100%; }
.score-bar .sb-track {
    display: flex; height: 26px; border-radius: 6px; overflow: hidden;
    background: rgba(255,255,255,0.06); font-size: 0.8rem; font-weight: 700;
}
.score-bar .sb-seg { display: flex; align-items: center; justify-content: center; min-width: 34px; color: #fff; }
.score-bar .sb-us   { background: linear-gradient(90deg, #2f6fd6, #4a8bef); }
.score-bar .sb-ussr { background: linear-gradient(90deg, #d64a4a, #ef6b6b); }
.score-bar .sb-other{ background: #555; }
.score-bar .sb-labels { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--text-light); margin-top: 4px; }

/* =====================================================================
   CHIPS / BADGES
   ===================================================================== */
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600;
    background: rgba(255, 255, 255, 0.06); color: var(--text);
    white-space: nowrap;
}
.chip.win  { background: rgba(46, 204, 113, 0.18); color: #57e08b; }
.chip.us   { background: rgba(74, 139, 239, 0.18);  color: #7fb0ff; }
.chip.ussr { background: rgba(239, 107, 107, 0.18); color: #ff9a9a; }
.chip.partial { background: rgba(231, 76, 60, 0.18); color: #ff8a7a; }

.ftag { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; white-space: nowrap; }
.ftag.faction-us   { color: #7fb0ff; }
.ftag.faction-ussr { color: #ff9a9a; }

.badge-partial {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700;
    background: rgba(231, 76, 60, 0.18); color: #ff8a7a;
}
.medal { font-size: 1.15rem; }
.mini-link { color: var(--text-light); text-decoration: none; font-size: 0.82rem; }
.mini-link:hover { color: var(--primary); }

/* =====================================================================
   KPI (cartes de stats)
   ===================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.kpi {
    background: var(--dark-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.kpi:hover { border-color: var(--primary); transform: translateY(-2px); }
.kpi .kpi-label {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-light); font-weight: 700;
}
.kpi .kpi-value {
    font-size: 1.9rem; font-weight: 800; color: var(--primary);
    margin-top: 6px; line-height: 1.1; overflow-wrap: anywhere;
}
.kpi .kpi-value.sm { font-size: 1.05rem; line-height: 1.3; }
.kpi .kpi-sub { font-size: 0.78rem; color: var(--text-light); margin-top: 6px; overflow-wrap: anywhere; }
.kpi a { color: inherit; }

/* =====================================================================
   HERO FICHE JOUEUR
   ===================================================================== */
.player-hero {
    display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
    background: linear-gradient(135deg, rgba(255,165,0,0.12), rgba(255,215,0,0.04));
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 24px 28px;
}
.player-hero .ph-avatar {
    width: 76px; height: 76px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem; font-weight: 800; color: #000;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    flex-shrink: 0;
}
.player-hero .ph-name { font-size: 1.8rem; font-weight: 800; color: #fff; line-height: 1.1; }
.player-hero .ph-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.player-hero .ph-headline { margin-left: auto; text-align: right; }
.player-hero .ph-headline .hl-kd { font-size: 2.4rem; font-weight: 800; color: var(--primary); line-height: 1; }
.player-hero .ph-headline .hl-label { font-size: 0.75rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }

.rank-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,165,0,0.18); color: var(--primary);
    font-weight: 800; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem;
}

/* =====================================================================
   ONGLETS (surcharge légère de styles-tabs.css)
   ===================================================================== */
.stats-tabs-section { position: static; padding: 0; background: transparent; border: none; margin: 24px 0 8px; }
.stats-tabs { border-bottom: 1px solid var(--border); }
.tab-btn { padding: 12px 20px; font-size: 0.95rem; }

/* =====================================================================
   ÉTATS
   ===================================================================== */
.state-msg { padding: 40px 20px; text-align: center; color: var(--text-light); }
.state-msg.err { color: #ff8a7a; }
.loading::after { content: " …"; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 900px) {
    .match-row {
        grid-template-columns: 1fr;
        gap: 10px;
        border-left-width: 4px;
    }
    .match-row .mr-cta { justify-self: start; }
    .player-hero .ph-headline { margin-left: 0; text-align: left; width: 100%; }
}
@media (max-width: 600px) {
    .data-table { font-size: 0.86rem; }
    .data-table thead th, .data-table tbody td { padding: 10px 12px; }
    .kpi .kpi-value { font-size: 1.5rem; }
    .player-hero { padding: 18px; gap: 16px; }
    .player-hero .ph-avatar { width: 60px; height: 60px; font-size: 1.5rem; }
    .player-hero .ph-name { font-size: 1.4rem; }
}
