/*
 * Statistiques : graphiques, répartitions et chiffres clés.
 * Chargé par les trois layouts (admin, membres, espace partenaire) :
 * mêmes composants pour l'onglet admin, « Mes statistiques » et l'espace
 * partenaire. Fichier Sprockets, pas de build Tailwind.
 */

/* Cartes des pages membres et partenaires (côté admin : .admin-show-section) */
.stats-card {
  background: #fff; border: 1px solid #E8DDD4; border-radius: 4px;
  padding: 1.125rem 1.25rem; margin-bottom: 0.875rem;
}
.stats-panel-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: #B94700; margin: 0 0 0.875rem;
}
.stats-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 0.875rem; }
.stats-kpi { background: #fff; border: 1px solid #E8DDD4; border-radius: 4px; padding: 0.875rem 1rem; min-width: 0; }
.stats-kpi.is-primary { background: #00594F; border-color: #00594F; }
.stats-kpi-value { font-family: var(--font-heading, Georgia, serif); font-weight: 800; font-size: 2rem; line-height: 1.1; color: #00594F; margin: 0; }
.stats-kpi-label { font-size: 12px; color: #5a7470; margin: 4px 0 0; line-height: 1.35; }
.stats-kpi.is-primary .stats-kpi-value { color: #FFFBF7; }
.stats-kpi.is-primary .stats-kpi-label { color: rgba(255,251,247,0.8); }
.stats-intro { font-size: var(--fs-small, 14px); color: #5a7470; margin: 0 0 1.25rem; max-width: 70ch; line-height: 1.5; }
.stats-empty { font-size: 13px; color: #888; margin: 0; }

.stats-periods { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 0.75rem; }
.stats-period {
  font-size: 13px; font-weight: 600; text-decoration: none; color: #00594F;
  padding: 6px 14px; border: 1px solid #E8DDD4; border-radius: 999px; background: #fff;
}
.stats-period.is-active { background: #00594F; border-color: #00594F; color: #FFFBF7; }
.stats-note { font-size: 12px; color: #888; margin: 0 0 1.5rem; max-width: 70ch; line-height: 1.5; }
.stats-section-link { font-size: 12px; color: #B94700; text-decoration: none; text-align: right; flex-shrink: 1; min-width: 0; }
.stats-tile .admin-stat-sub { margin-top: 0.375rem; font-size: 12px; line-height: 1.4; }
.stats-two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; }
.stats-two-cols > .stats-panel { margin-bottom: 0.875rem; }
.stats-panel { min-width: 0; }
.stats-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; background: #E6EEF8; color: #1D4E89; margin-left: 6px;
}

/* Colonnes mensuelles (une série) */
.stats-columns { display: flex; align-items: stretch; gap: 6px; height: 160px; }
.stats-column { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.stats-column-plot { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-top: 16px; }
.stats-column-bar {
  display: block; width: 100%; max-width: 28px; background: #00594F;
  border-radius: 4px 4px 0 0; transition: opacity .15s;
}
.stats-column:hover .stats-column-bar { opacity: 0.75; }
.stats-column-value { font-size: 11px; font-weight: 700; color: #00594F; margin-bottom: 3px; min-height: 14px; }
.stats-column-label {
  font-size: 10.5px; color: #888; margin-top: 6px; padding-top: 4px; border-top: 1px solid #E8DDD4;
  width: 100%; text-align: center; white-space: nowrap; overflow: hidden;
}

/* Tableaux de répartition avec barres horizontales */
.stats-breakdown { width: 100%; border-collapse: collapse; font-size: 13px; color: #00594F; }
.stats-breakdown th {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: #888; text-align: left; padding: 0 0 6px;
}
.stats-breakdown td { padding: 6px 0; border-top: 1px solid #F0E8E0; vertical-align: middle; }
.stats-breakdown a { color: #00594F; font-weight: 600; text-decoration: none; }
.stats-breakdown a:hover { color: #B94700; }
.stats-breakdown-label { padding-right: 12px !important; width: 40%; overflow-wrap: anywhere; }
.stats-num { text-align: right !important; white-space: nowrap; padding-left: 12px !important; width: 1%; }
.stats-hbar { display: flex; align-items: center; gap: 8px; }
.stats-hbar-fill { display: block; height: 10px; min-width: 0; background: #00594F; border-radius: 0 4px 4px 0; }
.stats-hbar-value { font-weight: 700; font-size: 12px; white-space: nowrap; }

/* Bloc « Statistiques » des fiches admin */
.stats-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 0.75rem; }
.stats-mini { background: #FFFBF7; border: 1px solid #E8DDD4; border-radius: 4px; padding: 8px 10px; }
.stats-mini-value { font-size: 1.25rem; font-weight: 800; color: #00594F; line-height: 1.2; margin: 0; }
.stats-mini-label { font-size: 11px; color: #888; margin: 2px 0 0; line-height: 1.3; }

/* Compteurs dans les listes admin */
.stats-inline { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12px; color: #00594F; }
.stats-inline strong { font-weight: 800; }

@media (max-width: 768px) {
  .stats-kpis { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stats-kpi-value { font-size: 1.6rem; }
  .stats-two-cols { grid-template-columns: 1fr; gap: 0; }
  .stats-columns { height: 130px; gap: 3px; }
  .stats-column-value { font-size: 10px; }
  .stats-column-label { font-size: 9.5px; }
  .stats-breakdown-label { width: auto; }
}


/* Pages « Mes statistiques » et espace partenaire */
.stats-section-heading {
  font-family: var(--font-heading, Georgia, serif); font-weight: 700; color: #00594F;
  font-size: var(--fs-h4, 1.375rem); margin: 0 0 0.5rem;
}
.stats-row-meta { display: block; font-size: 11.5px; color: #888; font-weight: 400; margin-top: 2px; }
.stats-mini-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stats-subpanel { min-width: 0; padding-top: 0.5rem; }
.stats-subpanel .stats-panel-title { color: #5a7470; font-size: 10.5px; margin-bottom: 0.5rem; }
@media (max-width: 768px) {
  .stats-mini-grid-4 { grid-template-columns: 1fr 1fr; }
}
