/* ==========================================================================
   stats.css
   Styles du module Statistiques (admin)
   Pages : stats/stats.php, stats/stats_defis.php, stats/stats_defis_user.php
   ========================================================================== */

/* --------------------------------------------------------------------------
   Lien retour (espacement en haut de page stats)
   -------------------------------------------------------------------------- */
.stats-retour {
    margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   Titres
   -------------------------------------------------------------------------- */
.stats-title {
    font-family: 'Delius', Arial, sans-serif;
    color: #2e7d32;
    font-size: 2em;
    text-align: center;
    margin-bottom: 30px;
}

/* --------------------------------------------------------------------------
   Bloc d'indicateur
   -------------------------------------------------------------------------- */
.stats-bloc {
    background: #fff;
    border: 1px solid #d0d7c8;
    border-left: 6px solid #2e7d32;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.stats-bloc h3 {
    margin: 0 0 10px 0;
    color: #2e7d32;
    font-size: 1.1em;
}

.stats-grand {
    font-size: 2.2em;
    font-weight: bold;
    color: #1b5e20;
    line-height: 1.1;
}

/* Variante inline : nombre mis en valeur à côté d'un titre (même ligne) */
.stats-grand-inline {
    font-size: 1.4em;
    font-weight: bold;
    color: #1b5e20;
    margin-left: 6px;
}

.stats-unite {
    font-size: 0.7em;
    color: #555;
    font-weight: normal;
}

.stats-detail {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
}
.stats-detail p {
    margin: 4px 0;
    font-size: 0.95em;
}

.stats-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 6px;
}
.tag-max { background: #2e7d32; color: #fff; }
.tag-min { background: #c62828; color: #fff; }

/* --------------------------------------------------------------------------
   Petits paragraphes d'info / état vide
   -------------------------------------------------------------------------- */
.stats-info {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
}
.stats-info--top0 {
    margin-top: 0;
}

.stats-empty {
    text-align: center;
    color: #555;
}
.stats-empty--spaced {
    margin-top: 10px;
}

/* Détail PLUS/MOINS */
.stats-detail-periode {
    margin-left: 46px;
    color: #555;
}
.stats-detail-row-moins {
    margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Tableau de classement
   -------------------------------------------------------------------------- */

/* Wrapper scrollable verticalement : limite la hauteur visible à ~8 lignes,
   au-delà l'utilisateur descend dans le tableau via la barre de défilement. */
.table-classement-scroll {
    max-height: 350px;
    overflow-y: auto;
    margin-top: 10px;
    border: 1px solid #e2e2e2;
}
/* En-tête du tableau collante lors du scroll vertical */
.table-classement-scroll .table-classement thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.table-classement {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
/* Largeurs des colonnes (Rang, Utilisateur, Participations, Total, Actions) */
.table-classement th:nth-child(1) { width: 60px; }
.table-classement th:nth-child(3),
.table-classement th:nth-child(4) { width: 110px; text-align: center; }
.table-classement th:nth-child(5) { width: 170px; text-align: center; }

/* Cellules */
.table-classement td:nth-child(1) {
    text-align: center;
    font-weight: bold;
    color: #2e7d32;
}
.table-classement td:nth-child(3),
.table-classement td:nth-child(5) {
    text-align: center;
}
.table-classement td:nth-child(4) {
    text-align: center;
    font-weight: bold;
}

/* Annotation (identifiant) à côté du nom */
.table-classement .user-id-aside {
    color: #888;
    font-size: 0.85em;
}

/* Bouton "Voir les chargements" — version mini */
.table-classement .btn-voir {
    padding: 3px 8px;
    font-size: 0.85em;
}
.table-classement th,
.table-classement td {
    padding: 6px 10px;
    border-bottom: 1px solid #e2e2e2;
    font-size: 0.95em;
}
.table-classement thead th {
    background: #f1f7ef;
    color: #2e7d32;
    border-bottom: 2px solid #2e7d32;
    text-align: left;
}
.table-classement tbody tr:nth-child(odd) {
    background: #fafafa;
}
.table-classement tbody tr:hover {
    background: #f1f7ef;
}

/* Mise en évidence de la ligne ciblée par une ancre #user-... :
   au retour depuis stats_defis_user.php, l'utilisateur visualisé
   apparaît sur fond doré avec un encadrement plus marqué. */
.table-classement tbody tr:target,
.table-classement tbody tr.is-highlight {
    background: #fff8c4 !important;
    box-shadow: inset 4px 0 0 #f1c40f;
    transition: background 0.6s ease;
}

/* --------------------------------------------------------------------------
   Page "chargements d'un utilisateur"
   -------------------------------------------------------------------------- */
.user-title {
    font-family: 'Delius', Arial, sans-serif;
    color: #2e7d32;
    font-size: 1.8em;
    text-align: center;
    margin-bottom: 10px;
}
.user-resume {
    background: #f1f7ef;
    border: 1px solid #2e7d32;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 24px;
    text-align: center;
    font-size: 1.05em;
}
.user-resume b {
    color: #1b5e20;
    font-size: 1.2em;
}

.defi-bloc {
    background: #fff;
    border: 1px solid #d0d7c8;
    border-left: 6px solid #2e7d32;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 18px;
}
.defi-bloc h3 {
    margin: 0 0 4px 0;
    color: #2e7d32;
}
/* --------------------------------------------------------------------------
   Tableau des résultats d'un utilisateur (stats_defis_user.php)
   3 colonnes : Titre du défi · Date · Classement
   -------------------------------------------------------------------------- */
.table-user-defis {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.table-user-defis th,
.table-user-defis td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e2e2;
    font-size: 0.95em;
    text-align: left;
}
.table-user-defis thead th {
    background: #f1f7ef;
    color: #2e7d32;
    border-bottom: 2px solid #2e7d32;
}
.table-user-defis tbody tr:nth-child(odd) {
    background: #fafafa;
}
.table-user-defis tbody tr:hover {
    background: #f1f7ef;
}
/* Colonnes : Titre élastique, Date et Classement plus étroites */
.table-user-defis th:nth-child(2),
.table-user-defis td:nth-child(2),
.table-user-defis th:nth-child(3),
.table-user-defis td:nth-child(3) {
    width: 140px;
    text-align: center;
}

/* ==========================================================================
   Journal CAPVO (affiche dans actualites.php)
   Tableau scrollable limite a ~10 lignes visibles + colonnes serrees.
   ========================================================================== */
.journal-capvo-scroll {
    max-height: 320px;       /* ~10 lignes a 32px */
    overflow-y: auto;
    border: 2px solid #2e7d32;
    border-radius: 6px;
    margin-top: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    background: #fff;
}
.journal-capvo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}
.journal-capvo-table thead th {
    position: sticky;
    top: 0;
    background: #f1f7ef;
    color: #2e7d32;
    border-bottom: 2px solid #2e7d32;
    padding: 6px 8px;
    text-align: left;
    z-index: 1;
}
/* En-tetes cliquables pour le tri */
.journal-capvo-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    padding-right: 22px;
    position: sticky;
    top: 0;
}
.journal-capvo-table thead th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    color: #9e9e9e;
    font-size: 0.85em;
}
.journal-capvo-table thead th.sortable.sort-asc::after {
    content: '▲';
    color: #2e7d32;
}
.journal-capvo-table thead th.sortable.sort-desc::after {
    content: '▼';
    color: #2e7d32;
}
.journal-capvo-table thead th.sortable:hover {
    background: #e6f1e0;
}
.journal-capvo-table tbody td {
    padding: 5px 8px;
    border-bottom: 1px solid #e2e2e2;
    vertical-align: top;
}
.journal-capvo-table tbody tr:nth-child(odd) {
    background: #fafafa;
}
.journal-capvo-table tbody tr:hover {
    background: #f1f7ef;
}
/* Mise en valeur des lignes concernant l'utilisateur connecte */
.journal-capvo-table tbody tr.journal-mine td {
    font-weight: bold;
}
/* Largeurs des colonnes pour eviter qu'une seule prenne tout l'espace */
.journal-capvo-table th.col-date,
.journal-capvo-table td.col-date {
    width: 130px;
    white-space: nowrap;
}
.journal-capvo-table th.col-action,
.journal-capvo-table td.col-action {
    width: 110px;
}
.journal-capvo-table th.col-user,
.journal-capvo-table td.col-user {
    width: 150px;
}
.journal-capvo-table th.col-vis,
.journal-capvo-table td.col-vis {
    width: 80px;
}
/* Empty state */
.journal-capvo-empty {
    padding: 14px;
    color: #777;
    text-align: center;
    font-style: italic;
}
/* Adaptation mobile : on serre encore les colonnes et on autorise un scroll
   horizontal si necessaire */
@media (max-width: 600px) {
    .journal-capvo-table {
        font-size: 0.82em;
    }
    .journal-capvo-table th.col-date,
    .journal-capvo-table td.col-date {
        width: 100px;
    }
    .journal-capvo-table th.col-action,
    .journal-capvo-table td.col-action {
        width: 80px;
    }
    .journal-capvo-table th.col-user,
    .journal-capvo-table td.col-user {
        width: 100px;
    }
}
