/*
  formulaire.css — le strict nécessaire pour les formulaires et la prise
  de rendez-vous des sites AIMzé. Le style des champs (bordures, polices,
  espacements) reste à la charge de chaque site.

  Couleurs réglables par le site, par exemple dans son style.css :
    :root { --af-erreur: #b42318; --af-ok: #1f6f43; --af-encre: #15171c; --af-accent: #f03a2e; }
*/

/* Champ piège anti-robot : hors de l'écran, jamais visible ni atteignable. */
.af-miel {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Message d'erreur placé sous le champ concerné. */
.af-erreur {
  margin: 0.35em 0 0;
  color: var(--af-erreur, #b42318);
  font-size: 0.9em;
  line-height: 1.35;
}
.af-erreur[hidden] { display: none; }

/* Champ en erreur : un repère qui ne dépend pas que de la couleur (bordure épaisse). */
.af-form [aria-invalid="true"] {
  border-color: var(--af-erreur, #b42318) !important;
  box-shadow: 0 0 0 1px var(--af-erreur, #b42318);
}

/* Ligne d'état sous le formulaire (envoi, envoyé, erreur). */
.af-etat {
  margin: 0.75em 0 0;
  min-height: 1.4em;
  line-height: 1.4;
}
.af-etat:empty { min-height: 0; margin: 0; }
.af-etat:focus:not(:focus-visible) { outline: none; }
.af-etat[data-etat="envoi"] { color: inherit; opacity: 0.75; }
.af-etat[data-etat="envoye"] { color: var(--af-ok, #1f6f43); font-weight: 600; }
.af-etat[data-etat="erreur"] { color: var(--af-erreur, #b42318); }

/* Bouton pendant l'envoi. */
.af-form button[aria-busy="true"] { cursor: progress; }
.af-form button:disabled { opacity: 0.7; }

/* Encadré de repli « écrire par courriel ». */
.af-repli {
  margin-top: 1em;
  padding: 1em 1.1em;
  border: 1px solid currentColor;
  border-left-width: 4px;
  border-radius: 4px;
  line-height: 1.45;
}
.af-repli p { margin: 0 0 0.6em; }
.af-repli__titre { font-weight: 600; }
.af-repli__actions { display: flex; flex-wrap: wrap; gap: 0.6em; align-items: center; }
.af-repli__courriel,
.af-repli__copier {
  display: inline-block;
  padding: 0.55em 0.95em;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.af-repli__courriel {
  background: var(--af-encre, #15171c);
  border-color: var(--af-encre, #15171c);
  color: #fff;
}
.af-repli__adresse { font-size: 0.9em; opacity: 0.8; word-break: break-all; }
.af-repli__texte {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.5em;
  font: inherit;
  font-size: 0.9em;
}
.af-repli summary { cursor: pointer; }

/* ---------- Prise de rendez-vous (rendez-vous.js) ---------- */

.af-rdv__intro { margin: 0 0 0.8em; }
.af-rdv__panneau {
  margin-top: 1em;
  border: 1px solid currentColor;
  border-radius: 4px;
  overflow: hidden;
}
.af-rdv__panneau[hidden] { display: none; }
.af-rdv__barre {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em 1em;
  align-items: center;
  justify-content: space-between;
  padding: 0.6em 0.8em;
  border-bottom: 1px solid currentColor;
  font-size: 0.92em;
}
.af-rdv__barre a { color: inherit; }
.af-rdv__fermer {
  padding: 0.35em 0.8em;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.af-rdv__cadre {
  display: block;
  width: 100%;
  height: var(--af-rdv-hauteur, 680px);
  border: 0;
  background: #fff;
}
.af-rdv__attente { margin: 0; padding: 0.6em 0.8em; font-size: 0.9em; opacity: 0.75; }
.af-rdv__attente[hidden] { display: none; }

.af-rdv__creneau {
  margin: 0 0 1em;
  padding: 0.8em 0.9em 0.4em;
  border: 1px solid currentColor;
  border-radius: 4px;
}
.af-rdv__creneau legend { padding: 0 0.3em; font-weight: 600; }
.af-rdv__ligne { display: flex; flex-wrap: wrap; gap: 0.8em; }
.af-rdv__ligne > * { flex: 1 1 10em; }

@media (max-width: 480px) {
  .af-rdv__cadre { height: var(--af-rdv-hauteur-mobile, 80svh); }
}

@media (prefers-reduced-motion: no-preference) {
  .af-etat, .af-erreur { transition: color 0.2s; }
}
