/* ============================================
   TABLEAU STATISTIQUES
   ============================================ */

.tableau_stats_container {
  overflow-x: auto;
  margin: var(--espacement-moyen) 0;
}

.tableau_stats {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--taille-texte-petit);
}

.tableau_stats th,
.tableau_stats td {
  padding: 12px 15px;
  text-align: center;
  border: 1px solid #bbb;
}

.tableau_stats th {
  background-color: var(--couleur-theme);
  color: var(--texte-blanc);
  font-weight: 600;
}

.tableau_stats tbody tr:nth-child(odd) {
  background-color: #fafafa;
}

.tableau_stats tbody tr:nth-child(even) {
  background-color: #ffffff;
}


/* Première colonne alignée à gauche */
.tableau_stats td:first-child {
  text-align: left;
  font-weight: 500;
}

/* Ligne Total (dernière ligne de données) */
.tableau_stats tbody tr.stats_total_row {
  background-color: color-mix(in srgb, var(--couleur-theme) 12%, white) !important;
  font-weight: 600;
}

/* Total général AUTO (ligne indépendante après les tableaux) */
.stats_total_general {
  background-color: color-mix(in srgb, var(--couleur-theme) 15%, white);
  border: 2px solid var(--couleur-theme);
  border-radius: 8px;
  padding: 15px 20px;
  margin-top: var(--espacement-moyen);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.stats_total_general_titre {
  font-weight: 700;
  color: var(--couleur-theme);
  font-size: 16px;
}

.stats_total_general_valeurs {
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
  align-items: baseline;
}

.stats_total_general_item {
  text-align: center;
  min-width: 80px;
}

.stats_total_general_label {
  font-size: 12px;
  color: var(--texte-secondaire);
  display: block;
}

.stats_total_general_valeur {
  font-size: 18px;
  font-weight: 700;
  color: var(--texte-titre);
}

.stats_total_general_taux {
  font-size: 18px;
  font-weight: 700;
  color: var(--couleur-theme);
}

@media (max-width: 480px) {
  .stats_total_general {
    flex-direction: column;
    text-align: center;
  }

  .stats_total_general_valeurs {
    justify-content: center;
  }
}

/* ============================================
   LIGNES DE SECTION (Plateau, Circulation)
   ============================================ */

.tableau_stats .stats_section_row {
  background-color: #f0f0f0 !important;
}

.tableau_stats .stats_section_row td {
  text-align: center;
  font-weight: 600;
  color: var(--texte-titre);
  padding: 10px 15px;
}

/* Ligne "Aucune donnée" dans un tableau */
.tableau_stats .stats_no_data_row {
  background-color: #f9f9f9 !important;
}

.tableau_stats .stats_no_data_row td {
  font-style: italic;
  color: #888;
  text-align: center;
}

/* Note sous le tableau */
.tableau_stats_note {
  font-size: 13px;
  font-style: italic;
  color: #666;
  margin-top: var(--espacement-petit);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
  .tableau_stats th,
  .tableau_stats td {
    padding: 8px 6px;
    font-size: 13px;
  }
}

/* ============================================
   NAVIGATION PAR ANNÉE
   ============================================ */

.stats_annee_nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.stats_annee_actuelle {
  font-size: 18px;
  font-weight: 600;
  color: var(--texte-titre);
  min-width: 130px;
  text-align: center;
}

/* Animation de chargement */
.tableau_stats_container {
  transition: opacity 0.2s ease;
}

.tableau_stats_container.loading {
  opacity: 0.6;
  pointer-events: none;
}

.tableau_stats tbody {
  transition: opacity 0.15s ease;
}

@media (max-width: 480px) {
  .stats_annee_nav {
    gap: 10px;
  }

  .stats_annee_actuelle {
    font-size: 16px;
    min-width: 110px;
  }
}

/* ============================================
   TABLEAU AVEC TITRE (ex: Permis B, AAC)
   ============================================ */

.stats_tableau_titre {
  font-size: 18px;
  font-weight: 600;
  color: var(--texte-titre);
  margin-bottom: var(--espacement-petit);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--couleur-theme);
}

/* ============================================
   MESSAGE AUCUNE DONNÉE
   ============================================ */

.stats_aucune_donnee {
  background-color: #f5f5f5;
  border: 1px dashed #ccc;
  border-radius: 6px;
  padding: var(--espacement-moyen);
  text-align: center;
  color: #666;
  font-style: italic;
}

/* Section CODE : la moyenne d'heures n'a pas d'objet pour une épreuve théorique.
   La colonne est masquée ici plutôt que retirée du HTML, car le JS régénère
   les lignes avec le même nombre de cellules pour toutes les sections. */
.stats_section_code .tableau_stats th:nth-child(5),
.stats_section_code .tableau_stats td:nth-child(5) {
  display: none;
}

@media (max-width: 480px) {
  .stats_tableau_titre {
    font-size: 15px;
  }
}
