/* Composants partagés par l'administration et la boutique :
   boutons en pilule, champs, menus déroulants, interrupteurs, pastilles, messages, squelettes. */

/* Lien d'évitement pour le clavier */
.lien-evitement {
  position: absolute; left: 16px; top: -60px; z-index: 50; padding: 12px 18px; border-radius: var(--r-pilule);
  background: var(--brun); color: var(--blanc); text-decoration: none; font-weight: 600;
  transition: top 160ms var(--ease-out);
}
.lien-evitement:focus { top: 16px; }


/* ——— Squelettes de chargement ——— */
.squelette { border-radius: 20px; background: linear-gradient(90deg, var(--ivoire-fonce) 0%, #F5F0E7 50%, var(--ivoire-fonce) 100%); background-size: 200% 100%; animation: lueur 1.4s ease-in-out infinite; }
.squelette.ligne { height: 88px; }
.squelette.bloc { height: 220px; border-radius: var(--r-carte); }
.squelettes { display: grid; gap: 10px; }
@keyframes lueur { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ——— Boutons en pilule ——— */
.bouton {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: var(--r-pilule);
  background: var(--brun); color: var(--blanc);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(43, 33, 26, .12), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition-property: transform, background-color, box-shadow, color;
  transition-duration: 160ms; transition-timing-function: var(--ease-out);
}
.bouton:active { transform: scale(0.96); }
.bouton .rond {
  display: grid; place-items: center; width: 32px; height: 32px; margin-right: -14px; border-radius: 50%;
  background: rgba(255, 255, 255, .14); transition: transform 220ms var(--ease-out);
}
.bouton .rond .icone { width: 16px; height: 16px; }
.bouton.secondaire { background: var(--blanc); color: var(--brun); box-shadow: inset 0 0 0 1px var(--filet-fort); }
.bouton.secondaire .rond { background: var(--ivoire); }
.bouton.danger { background: var(--terracotta-pale); color: var(--terracotta); box-shadow: none; }
.bouton.fantome { background: transparent; color: var(--brun-doux); box-shadow: none; padding: 0 18px; }
.bouton[aria-busy="true"] { pointer-events: none; color: transparent; }
.bouton[aria-busy="true"] > * { visibility: hidden; }
.bouton[aria-busy="true"]::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: var(--blanc); animation: tourne 700ms linear infinite;
}
.bouton.secondaire[aria-busy="true"]::after { border-color: var(--filet-fort); border-top-color: var(--brun); }
@keyframes tourne { to { transform: rotate(360deg); } }

@media (hover: hover) and (pointer: fine) {
  .bouton:hover { background: #3D3027; box-shadow: 0 6px 18px -6px rgba(43, 33, 26, .45); }
  .bouton:hover .rond { transform: translateX(2px); }
  .bouton.secondaire:hover { background: var(--ivoire); box-shadow: inset 0 0 0 1px var(--filet-fort); }
  .bouton.danger:hover { background: #F7E1D9; box-shadow: none; }
  .bouton.fantome:hover { background: var(--ivoire-fonce); box-shadow: none; }
}


/* ——— Pastilles d'état ——— */
.etat {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: var(--r-pilule); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.etat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.etat.en-ligne { color: var(--sauge-fonce); background: var(--sauge-pale); }
.etat.brouillon { color: var(--brun-doux); background: var(--ivoire-fonce); }
.etat.alerte { color: var(--terracotta); background: var(--terracotta-pale); }


/* ——— Formulaires ——— */
.legende-obligatoire { color: var(--brun-doux); font-size: 14px; margin: 0 0 18px; }
.requis { color: var(--terracotta); font-weight: 700; }
.champs { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.champs .plein { grid-column: 1 / -1; }
.champ { position: relative; min-width: 0; }
.champ > label:not(.case) { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.champ input:not([type="checkbox"]):not([type="file"]), .champ textarea, .select-bouton {
  width: 100%; min-height: 50px; padding: 12px 16px;
  border: 0; border-radius: var(--r-champ); background: var(--ivoire);
  box-shadow: inset 0 0 0 1px var(--filet);
  transition-property: box-shadow, background-color; transition-duration: 180ms; transition-timing-function: ease;
}
.champ textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.champ input::placeholder, .champ textarea::placeholder { color: var(--indice); opacity: 1; }
.champ input:not([type="checkbox"]):focus, .champ textarea:focus, .select-bouton:focus-visible, .select.ouvert .select-bouton {
  outline: none; background: var(--blanc);
  box-shadow: inset 0 0 0 1.5px var(--sauge-fonce), 0 0 0 4px rgba(126, 145, 112, .18);
}
@media (hover: hover) and (pointer: fine) {
  .champ input:not([type="checkbox"]):not(:focus):hover, .champ textarea:not(:focus):hover, .select:not(.ouvert) .select-bouton:hover {
    box-shadow: inset 0 0 0 1px var(--filet-fort);
  }
}
.champ .aide, .aide { font-size: 14px; color: var(--brun-doux); margin: 8px 0 0; }
.champ .erreur { font-size: 14px; color: var(--terracotta); margin: 8px 0 0; font-weight: 500; }
.champ.en-erreur input:not([type="checkbox"]), .champ.en-erreur textarea, .champ.en-erreur .select-bouton {
  background: var(--terracotta-pale); box-shadow: inset 0 0 0 1.5px var(--terracotta);
}

/* Menu déroulant dessiné */
.select { position: relative; }
.select-bouton { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; cursor: pointer; font-weight: 500; }
.select-bouton.vide .select-valeur { color: var(--indice); font-weight: 400; }
.select-valeur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-chevron { color: var(--brun-doux); transition: transform 220ms var(--ease-out); }
.select.ouvert .select-chevron { transform: rotate(180deg); }
.select-liste {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px);
  margin: 0; padding: 6px; list-style: none; max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--blanc); border-radius: 20px; box-shadow: var(--ombre-3), 0 0 0 1px var(--filet);
  opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top center; pointer-events: none; visibility: hidden;
  transition: opacity 150ms ease, transform 150ms var(--ease-out), visibility 0s linear 150ms;
}
.select.vers-le-haut .select-liste { top: auto; bottom: calc(100% + 8px); transform-origin: bottom center; transform: translateY(4px) scale(0.98); }
.select.ouvert .select-liste {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity 180ms ease, transform 220ms var(--ease-out), visibility 0s;
}
.select-liste:focus { outline: none; }
.select-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 14px; cursor: pointer; font-weight: 500;
}
.select-option.vide { color: var(--brun-doux); font-weight: 400; }
.select-option.actif { background: var(--ivoire); }
.select-coche { width: 18px; height: 18px; color: var(--sauge-fonce); opacity: 0; transform: scale(.6); transition: opacity 150ms ease, transform 200ms var(--ease-out); }
.select-option[aria-selected="true"] { font-weight: 600; }
.select-option[aria-selected="true"] .select-coche { opacity: 1; transform: none; }

/* Interrupteurs (à la place des cases à cocher) */
.case { display: flex; gap: 14px; align-items: center; cursor: pointer; padding: 8px 0; min-height: 44px; }
.case input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
  position: relative; width: 46px; height: 28px; border-radius: var(--r-pilule);
  background: var(--sable); transition: background-color 200ms ease;
}
.case input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: var(--r-pilule);
  background: var(--blanc); box-shadow: 0 1px 3px rgba(43, 33, 26, .25);
  transition: transform 240ms var(--ease-out), width 160ms var(--ease-out);
}
.case input[type="checkbox"]:checked { background: var(--sauge-fonce); }
.case input[type="checkbox"]:checked::after { transform: translateX(18px); }
.case input[type="checkbox"]:active::after { width: 26px; }
.case input[type="checkbox"]:checked:active::after { transform: translateX(14px); }
.case span { font-weight: 500; }
.case span small { display: block; color: var(--brun-doux); font-size: 14px; font-weight: 400; }


/* Récapitulatif des erreurs */
.recap-erreurs { border-radius: 20px; background: var(--terracotta-pale); padding: 18px 22px; margin-bottom: 20px; }
.recap-erreurs p { margin: 0 0 8px; font-weight: 600; color: var(--terracotta); }
.recap-erreurs ul { margin: 0; padding-left: 22px; }
.recap-erreurs li { margin: 4px 0; }
.recap-erreurs a { color: var(--brun); }
.recap-erreurs:focus { outline: none; box-shadow: 0 0 0 2px var(--terracotta); }

/* Message de confirmation */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 40;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  background: var(--brun); color: var(--blanc); padding: 12px 22px 12px 12px; border-radius: var(--r-pilule);
  font-weight: 500; box-shadow: var(--ombre-3);
  transform: translate(-50%, 16px) scale(.96); opacity: 0; filter: blur(4px); pointer-events: none;
  transition: transform 240ms var(--ease-out), opacity 200ms ease, filter 200ms ease;
}
.toast .halo { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--sauge); display: grid; place-items: center; }
.toast .halo .icone { width: 16px; height: 16px; color: var(--blanc); stroke-width: 2.2; }
.toast.visible { opacity: 1; transform: translate(-50%, 0) scale(1); filter: none; pointer-events: auto; }
.toast.toast-erreur .halo { background: var(--terracotta); }

