/* =============================================================================
   Composants : verre, boutons, champs, pastilles, listes, feuille, toast
   ============================================================================= */

/* --- Boutons ------------------------------------------------------------- */
button,
.bouton {
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background-color var(--transition), color var(--transition),
    box-shadow var(--transition), transform var(--transition), opacity var(--transition);
}

button:disabled {
  cursor: not-allowed;
}

.bouton {
  min-height: 48px;
  padding: 0 var(--space-xl);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  border: 0;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.bouton:active:not(:disabled) {
  transform: scale(0.98);
}

.bouton--principal {
  color: var(--color-on-accent);
  background: var(--color-accent);
  box-shadow: var(--shadow-accent);
}

.bouton--principal:hover {
  color: var(--color-on-accent);
  background: var(--color-accent-strong);
}

.bouton--secondaire {
  color: var(--color-text);
  background: var(--glass-bg-strong);
  border: 1px solid var(--color-border);
  font-weight: 600;
}

.bouton--secondaire:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.bouton--doux {
  color: var(--color-accent-strong);
  background: var(--color-accent-soft);
}

.bouton--doux:hover {
  color: var(--color-accent-strong);
  background: var(--color-accent-dim);
}

.bouton--danger {
  color: var(--color-danger-strong);
  background: var(--color-danger-soft);
}

.bouton--danger:hover {
  color: var(--color-danger-strong);
  background: var(--color-danger-soft);
  box-shadow: inset 0 0 0 1px var(--color-danger);
}

.bouton--fantome {
  color: var(--color-text);
  background: transparent;
  font-weight: 600;
}

.bouton--lien {
  min-height: 44px;
  padding: 0 var(--space-xs);
  color: var(--color-accent);
  background: transparent;
  font-weight: 600;
}

.bouton--petit {
  min-height: 36px;
  padding: 0 var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
}

.bouton--plein {
  width: 100%;
}

.bouton:disabled,
.bouton[aria-disabled="true"] {
  color: var(--color-text-muted);
  background: var(--color-fill);
  box-shadow: none;
  border-color: transparent;
}

.bouton-icone {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  color: var(--color-text);
  background: var(--glass-bg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.bouton-icone:hover {
  color: var(--color-accent);
  background: var(--glass-bg-strong);
}

.bouton-icone--sobre {
  border: 0;
  box-shadow: none;
  background: transparent;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.bouton-icone--sobre:hover {
  background: var(--color-fill);
}

.bouton-icone--danger {
  color: var(--color-danger-strong);
}

.retour {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  align-self: flex-start;
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
}

/* --- Verre --------------------------------------------------------------- */
.verre {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--shadow-md);
}

.verre--fort {
  background: var(--glass-bg-strong);
  box-shadow: var(--glass-highlight), var(--shadow-lg);
}

.verre--pale {
  background: var(--glass-bg-faint);
  box-shadow: none;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .verre,
  .verre--fort,
  .verre--pale {
    background: var(--glass-fallback);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .verre,
  .verre--fort,
  .verre--pale {
    background: var(--glass-fallback);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.carte {
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.carte--large {
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
}

.carte__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.carte__titre {
  font-size: 1.0625rem;
  font-weight: 700;
}

.carte__lien {
  color: var(--color-text);
  text-decoration: none;
}

.carte__lien:hover {
  color: var(--color-accent);
}

.carte__sous {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.carte--eteinte .carte__titre {
  color: var(--color-text-soft);
}

/* --- Champs -------------------------------------------------------------- */
.champ {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.champ__etiquette {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-soft);
}

.champ__aide {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

input,
select {
  font: inherit;
}

.champ__saisie {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--glass-bg-strong);
  border: 1px solid var(--color-border);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.champ__saisie--code {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Champ à icône et étiquette intégrée (page de connexion) */
.champ--integre .champ__etiquette {
  position: absolute;
  left: 44px;
  top: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  pointer-events: none;
}

.champ--integre > .icon {
  position: absolute;
  left: 14px;
  top: 18px;
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.champ--integre .champ__saisie {
  min-height: 54px;
  padding: 18px 14px 0 44px;
  border-radius: var(--radius-md);
  background: var(--glass-fallback);
}

.champ--integre .champ__saisie--oeil {
  padding-right: 52px;
}

.champ__oeil {
  position: absolute;
  right: 5px;
  top: 5px;
}

/* Interrupteur (case à cocher habillée) */
.reglage {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.reglage__texte {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reglage__titre {
  font-size: var(--text-base);
  font-weight: 600;
}

.reglage__aide {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.interrupteur {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 52px;
  height: 32px;
  flex: none;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
  cursor: pointer;
  transition: background-color var(--transition);
}

.interrupteur::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--spring);
}

.interrupteur:checked {
  background: var(--color-accent);
}

.interrupteur:checked::after {
  transform: translateX(20px);
}

/* Compteur − / + */
.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs);
  border-radius: 14px;
  background: var(--color-fill);
}

.stepper button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  font-weight: 600;
  background: var(--color-surface);
}

.stepper input {
  width: 48px;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  text-align: center;
  font-weight: 800;
  font-size: 1.0625rem;
  background: transparent;
  -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- Contrôle segmenté ---------------------------------------------------- */
.segment {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  padding: var(--space-xs);
  border-radius: var(--radius-md);
  background: var(--color-fill);
}

.segment__option {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text-muted);
  background: transparent;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.segment__option:hover {
  color: var(--color-text);
}

.segment__option[aria-selected="true"],
.segment__option[aria-current="page"] {
  font-weight: 700;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

/* --- Pastilles ------------------------------------------------------------ */
.pastille {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
  color: var(--color-neutral);
  background: var(--color-neutral-soft);
}

.pastille .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.8;
}

.pastille--accent {
  color: var(--color-accent-strong);
  background: var(--color-accent-soft);
}

.pastille--succes {
  color: var(--color-success);
  background: var(--color-success-soft);
}

.pastille--danger {
  color: var(--color-danger-strong);
  background: var(--color-danger-soft);
}

.pastille--attente {
  color: var(--color-warning);
  background: var(--color-warning-soft);
}

.pastille--encre {
  color: var(--color-on-accent);
  background: var(--color-text);
}

.point-direct {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.point-direct--ferme {
  background: var(--color-text-muted);
  box-shadow: none;
}

/* --- Équipes -------------------------------------------------------------- */
.logo-equipe {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

.logo-equipe img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.logo-equipe--sm {
  width: 32px;
  height: 32px;
  font-size: 10px;
}

.logo-equipe--md {
  width: 36px;
  height: 36px;
  font-size: 11px;
}

.logo-equipe--lg {
  width: 72px;
  height: 72px;
  font-size: 22px;
  box-shadow: inset 0 0 0 1px var(--color-border), var(--shadow-md);
}

.logo-equipe--inconnu {
  font-size: 22px;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  box-shadow: inset 0 0 0 2px var(--color-accent-dim);
}

/* Non-affiliation à la LNH : connexion et Profil. */
.mention-legale {
  font-size: var(--text-xs);
  line-height: 1.45;
  text-align: center;
  color: var(--color-text-muted);
}

/* --- Listes groupées ------------------------------------------------------ */
.liste {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.liste__ligne {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 56px;
  padding: var(--space-md) var(--space-lg);
  color: var(--color-text);
  text-decoration: none;
}

.liste__ligne + .liste__ligne {
  border-top: 1px solid var(--color-hairline);
}

a.liste__ligne:hover,
button.liste__ligne:hover {
  color: var(--color-text);
  background: var(--glass-bg-faint);
}

button.liste__ligne {
  width: 100%;
  border: 0;
  text-align: left;
  background: transparent;
}

.liste__texte {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.liste__titre {
  font-size: var(--text-base);
  font-weight: 700;
}

.liste__sous {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liste__chevron {
  color: var(--color-text-muted);
}

.liste__ligne--eteinte .liste__titre {
  color: var(--color-text-soft);
  font-weight: 600;
}

.titre-section {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin: var(--space-sm) var(--space-xs) 0;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.titre-section__note {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-accent-strong);
  background: var(--color-accent-soft);
}

.avatar--eteint {
  color: var(--color-text-muted);
  background: var(--color-fill);
}

.avatar--grand {
  width: 60px;
  height: 60px;
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--color-on-accent);
  background: var(--color-accent);
  box-shadow: var(--shadow-accent);
}

/* --- Statistiques ---------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.stat {
  padding: 14px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat__valeur {
  font-size: 1.75rem;
  font-weight: 800;
  font-stretch: var(--stretch-chiffre);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat__valeur--accent {
  color: var(--color-accent);
}

.stat__valeur--danger {
  color: var(--color-danger);
}

.stat__libelle {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

/* --- Bandeaux et états ----------------------------------------------------- */
.bandeau {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-md) 14px;
  border-radius: 18px;
  font-size: var(--text-md);
  line-height: 1.4;
  color: var(--color-text-soft);
}

.bandeau .icon {
  width: 18px;
  height: 18px;
}

.bandeau--danger {
  color: var(--color-danger-strong);
  background: var(--color-danger-soft);
}

.bandeau--attente {
  color: var(--color-warning);
  background: var(--color-warning-soft);
}

.etat {
  padding: var(--space-3xl) var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  text-align: center;
}

.etat__icone {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}

.etat__icone .icon {
  width: 38px;
  height: 38px;
  stroke-width: 2.4;
}

.etat__icone--danger {
  color: var(--color-danger);
}

.etat__surtitre {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-accent);
}

.etat__surtitre--danger {
  color: var(--color-danger-strong);
}

.etat__texte {
  max-width: 34ch;
  font-size: var(--text-base);
  color: var(--color-text-soft);
}

.squelette {
  border-radius: var(--radius-lg);
  background: var(--glass-bg-faint);
  border: 1px solid var(--glass-border);
  animation: pulsation 1.4s ease-in-out infinite;
}

.squelette--ligne {
  height: 14px;
  width: 40%;
  border-radius: 8px;
  background: var(--color-fill);
  border: 0;
}

.squelette--titre {
  height: 34px;
  width: 60%;
  border-radius: 12px;
  background: var(--color-fill);
  border: 0;
}

@keyframes pulsation {
  50% {
    opacity: 0.55;
  }
}

.roue {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  border: 3px solid var(--color-accent-soft);
  border-top-color: var(--color-accent);
  animation: tourne 0.9s linear infinite;
}

@keyframes tourne {
  to {
    transform: rotate(360deg);
  }
}

/* --- Toast ------------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 60;
  width: min(420px, calc(100% - 32px));
  padding: 14px var(--space-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 18px;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-on-accent);
  background: var(--color-toast);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, 0);
  transition: opacity var(--spring), transform var(--spring);
}

.toast .icon {
  color: var(--color-toast-icon);
  stroke-width: 3;
}

.toast--erreur .icon {
  color: var(--color-danger-soft);
}

.toast--cache {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
}

/* --- Feuille du bas (modale) -------------------------------------------------- */
.voile {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--color-scrim);
  animation: apparait var(--spring);
}

.feuille {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 10px var(--space-xl) calc(var(--space-3xl) + env(safe-area-inset-bottom));
  border-radius: 32px 32px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--glass-fallback);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), var(--shadow-lg);
  animation: monte var(--spring);
}

.feuille__poignee {
  width: 40px;
  height: 5px;
  margin: 0 auto var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
}

.feuille__centre {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  text-align: center;
}

.feuille__titre {
  font-size: 1.375rem;
  font-weight: 800;
}

.feuille__texte {
  font-size: var(--text-md);
  color: var(--color-text-soft);
}

.feuille__note {
  padding: var(--space-md) 14px;
  border-radius: var(--radius-md);
  font-size: var(--text-md);
  line-height: 1.45;
  text-align: center;
  color: var(--color-text-soft);
  background: var(--color-fill);
}

.feuille__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

@keyframes apparait {
  from {
    opacity: 0;
  }
}

@keyframes monte {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

@media (min-width: 960px) {
  .voile {
    align-items: center;
  }

  .feuille {
    border-radius: 32px;
    padding-bottom: var(--space-2xl);
  }
}
