/* rapisarda-block — Fluent Forms vestito come i campi del mockup (.campo, .segmenti, .spunta, .allega, .passo di tema.css).
   I moduli escono con theme="ffs_inherit_theme": niente pelle «ff-default» né styler di Fluent.
   Ogni regola parte da .fluentform.ff-inherit-theme-style ed è più specifica di quelle di Fluent (fino a 0,4,1 per il
   pulsante del modulo 3), così vince in qualunque ordine arrivino i fogli. Si carica solo dove c'è un modulo. */

.fluentform.ff-inherit-theme-style {
  --fluentform-primary: var(--wp--preset--color--inchiostro);
  --fluentform-secondary: var(--wp--preset--color--secondario);
  --fluentform-danger: var(--wp--preset--color--bordeaux);
  --fluentform-border-radius: var(--wp--custom--raggio--campo);
  color: var(--wp--preset--color--inchiostro);
}

/* ---------- Griglia dei campi ---------- */

.fluentform.ff-inherit-theme-style .ff-t-container { gap: 16px; }
/* Colonne uguali come nella griglia del mockup: Fluent scrive le larghezze nello style della cella. */
.fluentform.ff-inherit-theme-style .ff-t-container > .ff-t-cell { flex-grow: 1; flex-basis: 0 !important; min-width: 0; }
.fluentform.ff-inherit-theme-style .ff-el-group { margin-bottom: 22px; }
.fluentform.ff-inherit-theme-style .ff-t-container .ff-el-group:last-child { margin-bottom: 22px; }

/* ---------- Etichette ---------- */

/* Fluent arriva a 0,4,0 sulle etichette (.ff-el-form-left .ff-t-container .ff-el-input--label): qui 0,5,0. */
.fluentform.ff-inherit-theme-style .frm-fluent-form .ff-el-group .ff-el-input--label { display: block; float: none; inline-size: auto; margin-bottom: 8px; padding: 0; text-align: start; }
/* …e sposta di 180 px il campo dei gruppi con l'etichetta a lato (i Sì/No): qui il campo sta sotto l'etichetta. */
.fluentform.ff-inherit-theme-style .frm-fluent-form .ff-el-group .ff-el-input--content { margin-left: 0; }
.fluentform.ff-inherit-theme-style .ff-el-input--label label { font-size: 0.9375rem; font-weight: 700; letter-spacing: -0.005em; }
.fluentform.ff-inherit-theme-style .ff-el-input--label.ff-el-is-required.asterisk-right label::after {
  content: "obbligatorio"; margin-left: 8px; font-weight: 400; color: var(--wp--preset--color--secondario);
}

/* ---------- Campi ---------- */

.fluentform.ff-inherit-theme-style .ff-el-form-control:where(:not([type="checkbox"], [type="radio"], [type="file"])) {
  inline-size: 100%; min-height: 52px; padding: 0 16px; margin: 0;
  border: 0; border-radius: var(--wp--custom--raggio--campo); background: var(--wp--preset--color--fondo); color: var(--wp--preset--color--inchiostro);
  box-shadow: inset 0 0 0 1px var(--wp--preset--color--linea);
  font: 400 1.0625rem/1.4 var(--wp--preset--font-family--atkinson);
  transition: box-shadow 0.2s, background-color 0.2s;
}
.sezione--bianca .fluentform.ff-inherit-theme-style .ff-el-form-control:where(:not([type="checkbox"], [type="radio"], [type="file"])) { background: var(--wp--preset--color--bianco); }
.fluentform.ff-inherit-theme-style textarea.ff-el-form-control { min-height: 140px; padding: 14px 16px; resize: vertical; }
.fluentform.ff-inherit-theme-style .ff-el-form-control::placeholder { color: var(--wp--preset--color--secondario); opacity: 1; }
.fluentform.ff-inherit-theme-style .ff-el-form-control:hover { box-shadow: inset 0 0 0 1px rgb(var(--wp--custom--rgb--inchiostro) / 0.28); }
.fluentform.ff-inherit-theme-style .ff-el-form-control:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--wp--preset--color--inchiostro), 0 0 0 4px rgb(var(--wp--custom--rgb--inchiostro) / 0.16); }

/* La tendina col segno «giù» del mockup (.campo__scelta) */
.fluentform.ff-inherit-theme-style .ff-el-input--content:has(> select.ff-el-form-control) { position: relative; }
.fluentform.ff-inherit-theme-style select.ff-el-form-control { appearance: none; padding-right: 48px; cursor: pointer; }
.fluentform.ff-inherit-theme-style .ff-el-input--content:has(> select.ff-el-form-control)::after {
  content: ""; position: absolute; right: 16px; top: 50%; translate: 0 -50%; inline-size: 1.2em; block-size: 1.2em; pointer-events: none;
  background: var(--wp--preset--color--secondario);
  -webkit-mask: url(../icone/giu.svg) center / contain no-repeat; mask: url(../icone/giu.svg) center / contain no-repeat;
}

.fluentform.ff-inherit-theme-style :is(.iti--allow-dropdown, .iti--separate-dial-code) .ff-el-form-control { padding-left: 52px; }
/* Il telefono: la bandierina di intl-tel-input senza il grigio di Fluent */
.fluentform.ff-inherit-theme-style :is(.iti__selected-flag, .iti__selected-country) { background: transparent; border-radius: var(--wp--custom--raggio--campo) 0 0 var(--wp--custom--raggio--campo); }

/* ---------- Errori: bordo bordeaux da 2 px e il messaggio sotto ---------- */

.fluentform.ff-inherit-theme-style .ff-el-is-error .ff-el-form-control:where(:not([type="checkbox"], [type="radio"], [type="file"])) { box-shadow: inset 0 0 0 2px var(--wp--preset--color--bordeaux); }
.fluentform.ff-inherit-theme-style .ff-el-is-error .error { margin-top: 8px; color: var(--wp--preset--color--bordeaux); font-size: 0.9375rem; font-weight: 600; }
.fluentform.ff-inherit-theme-style .ff-el-is-error .ff-el-form-check-input { outline: 2px solid var(--wp--preset--color--bordeaux); outline-offset: 1px; }
.fluentform.ff-inherit-theme-style .ff-el-tc ~ .error { padding-left: 34px; }
.fluentform.ff-inherit-theme-style .ff-el-is-error .ff-el-form-check-label,
.fluentform.ff-inherit-theme-style .ff-el-is-error .ff-el-form-check-label a { color: inherit; }

/* ---------- Consenso al trattamento (.campo--spunta) ---------- */

.fluentform.ff-inherit-theme-style .ff-el-tc { display: block; }
.fluentform.ff-inherit-theme-style .ff-el-tc label.ff_tc_label { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: start; cursor: pointer; }
/* Fluent mette padding-top: 8px !important sulla casella: lo tolgo allo stesso modo. */
.fluentform.ff-inherit-theme-style .ff-el-tc label.ff_tc_label > span { display: block; inline-size: auto; padding-top: 0 !important; }
.fluentform.ff-inherit-theme-style .ff-el-tc label.ff_tc_label > div { display: block; font-size: 1rem; line-height: 1.45; color: var(--wp--preset--color--secondario); }
.fluentform.ff-inherit-theme-style .ff-el-tc:has(.ff_gdpr_field) label.ff_tc_label > div::after { content: "obbligatorio"; margin-left: 8px; }
.fluentform.ff-inherit-theme-style .ff-el-tc label.ff_tc_label > .ff_t_c a { color: var(--wp--preset--color--inchiostro); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.fluentform.ff-inherit-theme-style .ff-el-form-check-input { inline-size: 22px; block-size: 22px; margin: 2px 0 0; accent-color: var(--wp--preset--color--inchiostro); position: static; vertical-align: top; }

/* ---------- Sì/No (.segmenti): le radio nascoste, le etichette fanno i segmenti ---------- */

.fluentform.ff-inherit-theme-style .ff-el-group:has(.ff-el-form-check-radio) .ff-el-input--content {
  display: inline-flex; padding: 3px; border-radius: var(--wp--custom--raggio--campo); background: var(--wp--preset--color--grigio);
}
.fluentform.ff-inherit-theme-style .ff-el-group:has(.ff-el-form-check-radio) .ff-el-form-check { margin: 0; }
.fluentform.ff-inherit-theme-style .ff-el-group:has(.ff-el-form-check-radio) .ff-el-form-check-label { position: relative; display: block; cursor: pointer; }
.fluentform.ff-inherit-theme-style .ff-el-form-check-radio { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fluentform.ff-inherit-theme-style .ff-el-form-check-radio + span {
  display: grid; place-items: center; min-width: 72px; min-height: 44px; padding: 0 18px;
  border-radius: var(--wp--custom--raggio--segmento); font-weight: 600; transition: background-color 0.2s, box-shadow 0.2s;
}
.fluentform.ff-inherit-theme-style .ff-el-form-check-radio:checked + span { background: var(--wp--preset--color--bianco); box-shadow: var(--wp--preset--shadow--segmento); }
.fluentform.ff-inherit-theme-style .ff-el-form-check-radio:focus-visible + span { outline: 3px solid var(--wp--preset--color--inchiostro); outline-offset: 2px; }

/* ---------- Spunte multiple (.spunta) ---------- */

.fluentform.ff-inherit-theme-style .ff-el-group:has(.ff-el-form-check-checkbox) .ff-el-form-check { margin: 0; }
.fluentform.ff-inherit-theme-style .ff-el-group:has(.ff-el-form-check-checkbox) .ff-el-form-check-label {
  display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 1.0625rem; cursor: pointer;
}
.fluentform.ff-inherit-theme-style .ff-el-form-check-checkbox { margin: 0; }

/* ---------- Allegati (.allega) ---------- */

.fluentform.ff-inherit-theme-style .ff_upload_btn.ff-btn {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 18px;
  border: 0; border-radius: var(--wp--custom--raggio--campo); background: var(--wp--preset--color--fondo); color: var(--wp--preset--color--inchiostro);
  box-shadow: inset 0 0 0 1px var(--wp--preset--color--linea); font-weight: 600; cursor: pointer;
}
.fluentform.ff-inherit-theme-style .ff_upload_btn.ff-btn::before {
  content: ""; inline-size: 1.2em; block-size: 1.2em; flex: none; background: currentColor;
  -webkit-mask: url(../icone/allegato.svg) center / contain no-repeat; mask: url(../icone/allegato.svg) center / contain no-repeat;
}
.fluentform.ff-inherit-theme-style .ff_upload_btn.ff-btn:hover { background: var(--wp--preset--color--fondo); box-shadow: inset 0 0 0 1px rgb(var(--wp--custom--rgb--inchiostro) / 0.28); }
.fluentform.ff-inherit-theme-style .ff_upload_btn.ff-btn:focus-visible { background: var(--wp--preset--color--fondo); outline: 3px solid var(--wp--preset--color--inchiostro); outline-offset: 3px; }

/* ---------- Passi (.passo): titolo, frase, conto ---------- */

.fluentform.ff-inherit-theme-style .ff-el-section-break { margin-bottom: 26px; }
.fluentform.ff-inherit-theme-style .ff-el-section-break .ff-el-section-title { margin: 0; padding: 0; font-size: var(--wp--preset--font-size--h-3); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.fluentform.ff-inherit-theme-style .ff-section_break_desk p { margin: 8px 0 0; color: var(--wp--preset--color--secondario); }
.fluentform.ff-inherit-theme-style .ff-el-section-break hr { display: none; }
/* Le tappe le disegna tema.js accanto al modulo, dai titoli di Fluent: l'elenco di Fluent resta per il suo script. */
.fluentform.ff-inherit-theme-style .ff-step-titles { display: none; }
/* L'anello di fuoco (4 px) non si taglia contro l'overflow del contenitore dei passi */
.fluentform.ff-inherit-theme-style .ff-step-container { margin-inline: -4px; }
.fluentform.ff-inherit-theme-style .fluentform-step { padding: 4px; }
.fluentform.ff-inherit-theme-style .ff-step-body { margin-bottom: 0; }

/* ---------- Pulsanti: le pillole del tema ---------- */

.fluentform.ff-inherit-theme-style .ff-btn:not(.ff_upload_btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 0; min-height: 50px; padding: 0 24px; margin: 0;
  border: 0; border-radius: var(--wp--custom--raggio--pillola);
  background: var(--wp--preset--color--inchiostro); color: var(--wp--preset--color--bianco);
  font: 600 1.0625rem/1 var(--wp--preset--font-family--atkinson); letter-spacing: -0.01em;
  white-space: nowrap; cursor: pointer;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.25s var(--wp--custom--uscita);
}
.fluentform.ff-inherit-theme-style .ff-btn:not(.ff_upload_btn):hover { background: var(--wp--preset--color--inchiostro-chiaro); color: var(--wp--preset--color--bianco); min-width: 0; }
.fluentform.ff-inherit-theme-style .ff-btn:not(.ff_upload_btn):active { transform: scale(0.97); }
.fluentform.ff-inherit-theme-style .ff-btn:not(.ff_upload_btn):focus-visible { outline: 3px solid var(--wp--preset--color--inchiostro); outline-offset: 2px; }
/* «Precedente»: la pillola grigia */
.fluentform.ff-inherit-theme-style .ff-btn.ff-btn-prev { background: var(--wp--preset--color--grigio); color: var(--wp--preset--color--inchiostro); }
.fluentform.ff-inherit-theme-style .ff-btn.ff-btn-prev:hover { background: var(--wp--preset--color--grigio-scuro); color: var(--wp--preset--color--inchiostro); }
/* «Invia la richiesta gratuita» porta alla consulenza: è l'unica bordeaux (DESIGN.md, la regola della Sola Consulenza).
   Il preventivo resta blu notte. */
.fluentform_wrapper_1.ff-inherit-theme-style .ff-btn.ff-btn-submit { background: var(--wp--preset--color--bordeaux); }
.fluentform_wrapper_1.ff-inherit-theme-style .ff-btn.ff-btn-submit:hover { background: var(--wp--preset--color--bordeaux-scuro); }

/* L'invio (.modulo__invio, 28 px sopra) e la navigazione fra i passi (.passo__azioni, 32 px): tolto il margine dei campi. */
.fluentform.ff-inherit-theme-style .ff_submit_btn_wrapper { margin: 6px 0 0; text-align: start; }
.fluentform.ff-inherit-theme-style .step-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 10px; }
.fluentform.ff-inherit-theme-style .step-nav > :only-child { margin-left: auto; }
.fluentform.ff-inherit-theme-style .ff-step-t-container.ff-inner_submit_container { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.fluentform.ff-inherit-theme-style .ff-inner_submit_container .ff-t-cell { inline-size: auto; }
.fluentform.ff-inherit-theme-style .ff-inner_submit_container .step-nav { margin-top: 0; }
.fluentform.ff-inherit-theme-style .ff-inner_submit_container .ff-el-group { margin: 0; }
/* Il pulsante d'invio del preventivo è un campo dell'ultimo passo, sopra «Precedente»: torna sulla sua riga,
   a destra, come «Successivo» negli altri passi. */
@media (min-width: 641px) {
  .fluentform.ff-inherit-theme-style .fluentform-step:has(.ff_submit_btn_wrapper_custom) { position: relative; }
  .fluentform.ff-inherit-theme-style .fluentform-step .ff-el-group.ff_submit_btn_wrapper_custom { position: absolute; right: 4px; bottom: 4px; margin: 0; }
}

/* ---------- Esito ---------- */

.fluentform.ff-inherit-theme-style .ff-message-success { margin-top: 0; padding: 0; border: 0; box-shadow: none; font-size: 1.0625rem; }
.fluentform.ff-inherit-theme-style .ff-errors-in-stack .error { color: var(--wp--preset--color--bordeaux); font-weight: 600; }

@media (max-width: 640px) {
  .fluentform.ff-inherit-theme-style .ff-t-container { flex-direction: column; gap: 0; }
  .fluentform.ff-inherit-theme-style .ff-btn:not(.ff_upload_btn) { flex: 1 1 100%; inline-size: 100%; white-space: normal; text-align: center; line-height: 1.25; padding: 12px 16px; }
  .fluentform.ff-inherit-theme-style .step-nav > :only-child { margin-left: 0; }
  .fluentform.ff-inherit-theme-style .ff-inner_submit_container .ff-t-cell { inline-size: 100%; }
  .fluentform.ff-inherit-theme-style .ff-el-group:has(.ff-el-form-check-radio) .ff-el-input--content { display: flex; }
  .fluentform.ff-inherit-theme-style .ff-el-group:has(.ff-el-form-check-radio) .ff-el-form-check { flex: 1 1 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fluentform.ff-inherit-theme-style .ff-btn { transition: none; }
  .fluentform.ff-inherit-theme-style .ff-btn:active { transform: none; }
}
