/* Accordéon de formulaire (js/app/form-accordion.js, partials/_form_accordion.php).
 * Fichier simple, sans Tailwind : aucune recompilation nécessaire. Mobile first, propriétés logiques (RTL). */

.fa-sec {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: .75rem;
  margin-bottom: .75rem;
  scroll-margin-top: 5.5rem; /* laisse la place à la barre de navigation du dashboard */
}
.fa-sec.fa-open { border-color: var(--brand); }

/* Titre cliquable : icône | titre + résumé | chevron. Zone de toucher d'au moins 52 px. */
.fa-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: .75rem;
  width: 100%;
  min-height: 3.25rem;
  padding: .625rem .75rem;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: .75rem;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.fa-head:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fa-icon { font-size: 1.25rem; line-height: 1; }
.fa-title { display: block; font-size: 1rem; font-weight: 600; }
.fa-summary {
  display: block;
  overflow: hidden;
  font-size: .75rem;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fa-summary--error { color: var(--danger); font-weight: 600; }
.fa-chevron {
  width: .6rem;
  height: .6rem;
  margin-inline-end: .25rem;
  border-inline-end: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.fa-open .fa-chevron { transform: rotate(-135deg); }

.fa-panel { padding: 0 .75rem .75rem; }
.fa-next { display: flex; justify-content: flex-end; margin-top: 1rem; }

/* Barre d'actions collée en bas de l'écran : « Annuler » et « Enregistrer » toujours à portée du pouce. */
.fa-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: .75rem;
  margin: 1rem -.75rem -.75rem;
  padding: .75rem .75rem calc(.75rem + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--line);
}
.fa-actions > * { flex: 1 1 0; }
.fa-actions > .fa-actions-main { flex: 2 1 0; }

/* En-tête compact d'une carte repliable (éditeur de cartes) : libellé + résumé. */
.fa-block-head {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.5rem;
  padding: .25rem 0;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.fa-block-head:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: .375rem; }

@media (min-width: 40rem) {
  .fa-sec { margin-bottom: 1rem; }
  .fa-head { padding: .75rem 1.25rem; }
  .fa-panel { padding: 0 1.25rem 1.25rem; }
  .fa-actions {
    margin: 1.5rem -2rem -2rem;
    padding: .875rem 2rem calc(.875rem + env(safe-area-inset-bottom, 0px));
    justify-content: flex-end;
  }
  .fa-actions > *,
  .fa-actions > .fa-actions-main { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .fa-chevron { transition: none; }
}

/* Flèche du bouton « Suivant » : retournée quand le formulaire est écrit de droite à gauche (dir="rtl" sur le conteneur). */
.fa-arrow { display: inline-block; }
[dir="rtl"] .fa-arrow { transform: scaleX(-1); }

/* Alerte flottante : styles « fe-… » déplacés dans css/main.css (utilisés aussi par les pages serveur : partials/_flash_alert.php). */

/* Sous-bloc repliable à l'intérieur d'une section (horaires d'ouverture : le bloc entier, puis chaque jour).
 * Les règles de chevron sont écrites avec « > » : le chevron d'un sous-bloc ne suit que l'état de SON bloc,
 * pas celui de la section qui le contient (« .fa-open .fa-chevron » s'applique à tous les descendants). */
.fa-sub-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: .75rem;
  width: 100%;
  min-height: 3rem;
  padding: .5rem .75rem;
  margin: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: .75rem;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.fa-sub-head:focus-visible, .fa-day-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fa-sub-open > .fa-sub-head { border-color: var(--brand); }
.fa-sub-title { display: block; font-size: .9375rem; font-weight: 600; }
.fa-sub-panel { padding: .75rem .25rem 0; }

.fa-day-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 3rem; padding: 0 .75rem; }
.fa-day-toggle {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: .625rem;
  min-width: 0;
  min-height: 3rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: .75rem;
  cursor: pointer;
}
.fa-day-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fa-day-panel { padding: 0 .75rem .75rem; }

.fa-sub-open > .fa-sub-head .fa-chevron,
.fa-sub-open > .fa-day-head .fa-chevron { transform: rotate(-135deg); }
.fa-sub:not(.fa-sub-open) > .fa-sub-head .fa-chevron,
.fa-sub:not(.fa-sub-open) > .fa-day-head .fa-chevron { transform: rotate(45deg); }
