/* ==========================================================================
   Cantine Scolaire V5.0 — Baromètre EGalim & Quotas Hebdomadaires (egalim.css)
   Double jauge Bio (>=20%) / SIQO (>=50%), marqueurs seuils et conformité vege.
   ========================================================================== */

/* Bannière principale du baromètre */
.barometre-egalim {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 0.75rem 1.25rem;
  background-color: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-md);
  margin-bottom: 1.5rem;
  box-shadow: var(--ombre-sm);
}

.barometre-titre {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--encre);
}

.jauges-groupe {
  display: flex;
  flex: 1;
  min-width: 320px;
  gap: 2rem;
  align-items: center;
}

/* Bloc d'une jauge individuelle (Bio ou SIQO) */
.jauge-bloc {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.jauge-entete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.jauge-entete .pourcentage {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

/* Conteneur de la barre de progression avec marqueur */
.jauge-container {
  position: relative;
  width: 100%;
  height: 18px;
  background-color: #ECEFF1;
  border-radius: var(--rayon-pill);
  overflow: visible;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Remplissage de la barre */
.jauge-barre {
  height: 100%;
  border-radius: var(--rayon-pill);
  transition: width 0.5s ease-out;
  min-width: 0;
}

.jauge-barre.bio {
  background: linear-gradient(90deg, #4CAF50, var(--bio-vert));
}

.jauge-barre.siqo {
  background: linear-gradient(90deg, #29B6F6, var(--siqo-bleu));
}

/* Marqueur vertical de seuil réglementaire (20% ou 50%) */
.seuil-marqueur {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background-color: #263238;
  z-index: 2;
}

.seuil-marqueur.seuil-20 {
  left: 20%;
}

.seuil-marqueur.seuil-50 {
  left: 50%;
}

.seuil-marqueur::after {
  content: attr(data-seuil);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  color: #37474F;
  white-space: nowrap;
}

/* Badge de conformité hebdomadaire au repas végétarien */
.statut-vege {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--rayon-pill);
  font-size: 0.85rem;
  font-weight: 600;
  background-color: #FFF3E0;
  color: var(--budget-alerte);
  border: 1px solid var(--budget-alerte);
  white-space: nowrap;
}

.statut-vege.conforme {
  background-color: var(--bio-fond);
  color: var(--bio-vert);
  border-color: var(--bio-vert);
}

.statut-vege.non-conforme {
  background-color: #FFEBEE;
  color: var(--budget-depasse);
  border-color: var(--budget-depasse);
}

/* Correctifs de chevauchement : libellé, badge et repère de seuil */
.barometre-titre {
  flex-shrink: 0;
}

.jauges-groupe {
  flex: 2 1 480px;
  min-width: 0;
}

/* Jauges alignées : blocs calés en haut, en-tête d'une seule ligne, légende sous la barre */
.jauges-groupe {
  align-items: flex-start;
}

.jauge-entete {
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.jauge-titre {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jauge-label {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--encre-doux);
}

.badge-statut {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.75rem;
}

.badge-statut.conforme {
  color: var(--bio-vert);
}

.badge-statut.non-conforme {
  color: var(--budget-alerte);
}

.badge-statut.en-attente {
  color: var(--encre-doux);
  font-weight: 400;
}

/* Semaine vide : pas de rouge avant la première saisie */
.statut-vege.en-attente {
  background-color: var(--fond-doux);
  color: var(--encre-doux);
  border-color: var(--bord);
  font-weight: 400;
}

.barometre-egalim {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .jauges-groupe {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    flex-basis: 100%;
  }
}

.barometre-titre {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
}

.barometre-note {
  font-family: var(--police-principale);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--encre-doux);
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

/* Réserve la place de l'étiquette (20 % / 50 %) au-dessus de la barre */
.jauge-container {
  margin-top: 1.1rem;
}
