/* =====================================================================
   MI12 FUN CENTER — components.css
   Briques réutilisables : boutons, pastilles, champs, messages, états.
   Système de formes rappelé : boutons = pilule · cartes = 20 px ·
   champs = 12 px. Aucun autre rayon.
   ===================================================================== */

/* ==================================================================== */
/*  BOUTONS                                                             */
/* ==================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  white-space: nowrap;          /* un libellé de bouton ne va jamais à la ligne */
  border: 1px solid transparent;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t);
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn svg { width: 17px; height: 17px; }

/* Principal : fluo plein, texte sombre — contraste largement AA. */
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-soft); box-shadow: var(--glow); }

/* Secondaire : contour sur fond sombre, jamais transparent sans bordure. */
.btn--ghost { border-color: var(--line-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-ink); }

.btn--sm { padding: 10px 18px; font-size: var(--fs-xs); }
.btn--lg { padding: 17px 34px; font-size: var(--fs-body); }
.btn--block { width: 100%; }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.42;
  pointer-events: none;
}

/* Lien fléché */
.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--text);
  transition: color var(--t-fast), gap var(--t-fast);
}
.link-arrow::after {
  content: "";
  width: 16px; height: 1px;
  background: currentColor;
  transition: width var(--t-fast);
}
.link-arrow:hover { color: var(--accent-ink); gap: 12px; }
.link-arrow:hover::after { width: 22px; }


/* ==================================================================== */
/*  PASTILLES ET ÉTATS                                                  */
/* ==================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.chip svg { width: 15px; height: 15px; color: var(--accent-ink); }
.chip--accent { border-color: var(--accent); color: var(--accent-ink); background: transparent; }

.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.state::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.state.is-open   { color: var(--free); }
.state.is-closed { color: var(--text-dim); }


/* ==================================================================== */
/*  CHAMPS DE FORMULAIRE                                                */
/* ----------------------------------------------------------------
   Étiquette AU-DESSUS du champ, jamais dans le champ.
   Message d'erreur SOUS le champ. Contrastes vérifiés sur fond sombre.
   ==================================================================== */
.field { display: grid; gap: 7px; }

.field label,
.field > .field__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input, .select, .textarea {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--r-field);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-2);
}
.textarea { min-height: 130px; resize: vertical; }

.select {
  appearance: none;
  padding-right: 42px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 21px) calc(50% + 1px), calc(100% - 15px) calc(50% + 1px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.select option { background: var(--surface); color: var(--text); }

.field__help { font-size: var(--fs-xs); color: var(--text-dim); }
.field__error { font-size: var(--fs-xs); color: var(--busy); min-height: 1em; }
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea { border-color: var(--busy); }

/* Cases et boutons radio : la vraie case reste focusable, on la masque
   visuellement seulement. */
.opt {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 15px 18px;
  border-radius: var(--r-field);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.opt:hover { border-color: var(--line-strong); }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt__box {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  flex: none;
  display: grid; place-items: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.opt__box svg { width: 13px; height: 13px; color: var(--on-accent); opacity: 0; }
.opt input:checked ~ .opt__box { background: var(--accent); border-color: var(--accent); }
.opt input:checked ~ .opt__box svg { opacity: 1; }
.opt input:checked ~ .opt__text { color: var(--text); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
.opt input:focus-visible ~ .opt__box { outline: 2px solid var(--accent); outline-offset: 3px; }
.opt__text { color: var(--text-muted); font-size: var(--fs-sm); }
.opt__text strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }


/* ==================================================================== */
/*  MESSAGES                                                            */
/* ==================================================================== */
.notice {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--r-field);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.notice--info  { border-left: 3px solid var(--accent); }
.notice--info svg { color: var(--accent-ink); }
.notice--warn  { border-left: 3px solid var(--soon); }
.notice--warn svg { color: var(--soon); }
.notice--error { border-left: 3px solid var(--busy); }
.notice--error svg { color: var(--busy); }
.notice strong { color: var(--text); }

/* Toasts */
.toast-wrap {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: var(--z-toast);
  display: grid;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 15px 18px;
  border-radius: var(--r-field);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--t), transform var(--t);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast__icon { flex: none; }
.toast__icon svg { width: 19px; height: 19px; }
.toast--success .toast__icon { color: var(--free); }
.toast--error   .toast__icon { color: var(--busy); }
.toast--info    .toast__icon { color: var(--accent-ink); }


/* ==================================================================== */
/*  SQUELETTES DE CHARGEMENT                                            */
/* ----------------------------------------------------------------
   Jamais de rond qui tourne : une forme qui annonce ce qui arrive.
   ==================================================================== */
.skel {
  border-radius: var(--r-field);
  background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface));
  background-size: 200% 100%;
  animation: skel 1.3s ease-in-out infinite;
}
@keyframes skel { to { background-position: -200% 0; } }
.skel--slot { height: 46px; }
.skel--row  { height: 74px; }


/* ==================================================================== */
/*  ÉTAT VIDE                                                           */
/* ==================================================================== */
.empty {
  padding: 46px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  color: var(--text-muted);
}
.empty svg { width: 30px; height: 30px; color: var(--text-dim); margin: 0 auto 14px; }
.empty strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 1.05rem; }


/* ==================================================================== */
/*  EMPLACEMENT PHOTO EN ATTENTE                                        */
/* ----------------------------------------------------------------
   Le client n'a pas encore fourni ses visuels. Chaque <img> pointe vers
   son fichier définitif ; tant qu'il est absent, l'emplacement se
   présente lui-même au lieu d'afficher une image cassée. Le jour où la
   photo arrive dans assets/images/, il n'y a rien à modifier.
   Voir INFOS-COLLECTEES.md § 6.
   ==================================================================== */
.is-todo {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(135deg,
      var(--surface) 0 14px, var(--surface-2) 14px 28px);
  border: 1px dashed var(--line-strong);
}
.is-todo::after {
  content: attr(data-todo);
  max-width: 26ch;
  padding: 18px;
  text-align: center;
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}


/* ==================================================================== */
/*  TIROIR DE NAVIGATION MOBILE                                         */
/* ==================================================================== */
.drawer {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: var(--void);
  padding: 32px var(--gutter) 48px;
  transform: translateY(-12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  z-index: calc(var(--z-header) - 1);
  overflow-y: auto;
}
.drawer.is-open { opacity: 1; transform: none; pointer-events: auto; }
.drawer a {
  display: block;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 1.5rem;
}
.drawer .btn { margin-top: 28px; }
