/*
 * Percorso guidato — wizard.
 *
 * Tutto lo stile del percorso vive qui: il widget Elementor espone solo testi.
 * I valori arrivano dal design "Percorso Guidato" (Claude Design, progetto
 * Compound): non cambiarli a mano senza aggiornare anche quello.
 *
 * Il font è dichiarato ma non caricato dal plugin: se il tema serve Montserrat
 * viene usato, altrimenti si scende sul font di sistema.
 */

.wcpw-wizard,
.wcpw-wizard__notice,
.wcpw-wizard__modal {
  --wcpw-testo: #23201c;
  --wcpw-testo-soft: #6f675c;
  --wcpw-testo-beige: #55503f;
  --wcpw-occhiello: #8a7357;
  --wcpw-spento: #a79e90;

  --wcpw-verde: #6e8b4b;
  --wcpw-verde-scuro: #3f5227;
  --wcpw-verde-hover: #55703a;
  --wcpw-verde-tenue: #eef2e6;

  --wcpw-superficie: #fff;
  --wcpw-superficie-soft: #f4f1ec;
  --wcpw-selezione: #fafbf6;

  --wcpw-bordo: #e8e1d6;
  --wcpw-bordo-forte: #c4bcaf;
  --wcpw-tratteggio: #dcd2c4;
  --wcpw-divisore: #efeae1;
  --wcpw-separatore: #d8cfc2;

  --wcpw-avviso-bg: #fbf3e6;
  --wcpw-avviso-bordo: #e9d6a8;
  --wcpw-avviso-testo: #7a5c1e;

  --wcpw-font: "Montserrat", "Arial", "Helvetica", sans-serif;
}

.wcpw-wizard {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  /* L'offset in alto tiene il contenuto sotto la header sovrapposta del tema.
	   Se il widget sta a metà pagina, sovrascrivi --wcpw-offset-top a 0. */
  padding: var(--wcpw-offset-top, 180px) 48px 88px;
  color: var(--wcpw-testo);
  font-family: var(--wcpw-font);
  -webkit-font-smoothing: antialiased;
}

.wcpw-wizard *,
.wcpw-wizard *::before,
.wcpw-wizard *::after {
  box-sizing: border-box;
}

/* I bottoni e gli step sono flex: senza questo l'attributo hidden non basta. */
.wcpw-wizard [hidden] {
  display: none !important;
}

/* Intestazione */

.wcpw-wizard__intro {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 760px;
}

.wcpw-wizard__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--wcpw-occhiello);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wcpw-wizard__eyebrow-sep {
  color: var(--wcpw-separatore);
}

.wcpw-wizard__title {
  margin: 0;
  color: var(--wcpw-testo);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: pretty;
}

.wcpw-wizard__lead {
  margin: 0;
  color: var(--wcpw-testo-soft);
  font-size: 16px;
  line-height: 1.6;
  text-wrap: pretty;
}

/* Barra dei passi */

.wcpw-wizard__progress {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  padding: 20px 22px;
  border: 1px solid var(--wcpw-bordo);
  border-radius: 16px;
  background: var(--wcpw-superficie);
  list-style: none;
}

.wcpw-wizard__progress-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.wcpw-wizard__progress-item:not(:last-child)::after {
  content: "";
  flex: none;
  width: 44px;
  height: 1px;
  background: var(--wcpw-tratteggio);
}

.wcpw-wizard__progress-mark {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--wcpw-bordo);
  border-radius: 50%;
  background: var(--wcpw-superficie-soft);
  color: var(--wcpw-occhiello);
  font-size: 13px;
  font-weight: 700;
}

.wcpw-wizard__progress-item.is-active .wcpw-wizard__progress-mark {
  border-color: var(--wcpw-verde-scuro);
  background: var(--wcpw-verde-scuro);
  color: #fff;
}

.wcpw-wizard__progress-item.is-done .wcpw-wizard__progress-mark {
  border-color: var(--wcpw-verde);
  background: var(--wcpw-verde-tenue);
  color: var(--wcpw-verde-scuro);
  font-size: 0;
}

.wcpw-wizard__progress-item.is-done .wcpw-wizard__progress-mark::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.wcpw-wizard__progress-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.wcpw-wizard__progress-n {
  color: var(--wcpw-occhiello);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wcpw-wizard__progress-label {
  color: var(--wcpw-spento);
  font-size: 13.5px;
  font-weight: 700;
}

.wcpw-wizard__progress-item.is-active .wcpw-wizard__progress-label {
  color: var(--wcpw-testo);
}

.wcpw-wizard__progress-item.is-done .wcpw-wizard__progress-label {
  color: var(--wcpw-testo-beige);
}

/* Pannello domanda */

.wcpw-wizard__panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--wcpw-bordo);
  border-radius: 18px;
  background: var(--wcpw-superficie);
  overflow: hidden;
}

.wcpw-wizard__step-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 30px 22px;
  border-bottom: 1px solid var(--wcpw-divisore);
}

.wcpw-wizard__step-title {
  margin: 0;
  color: var(--wcpw-testo);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.wcpw-wizard__step-sub {
  margin: 0;
  max-width: 760px;
  color: var(--wcpw-testo-soft);
  font-size: 14.5px;
  line-height: 1.6;
  text-wrap: pretty;
}

/* Opzioni */

.wcpw-wizard__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  padding: 26px 30px;
}

.wcpw-wizard__option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 16px;
  border: 1.5px solid var(--wcpw-bordo);
  border-radius: 13px;
  background: var(--wcpw-superficie);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.wcpw-wizard__option:hover {
  border-color: var(--wcpw-bordo-forte);
}

/*
 * L'opzione "tutte le tipologie" (.wcpw-wizard__option--tutti) non ha regole
 * proprie: sta nella griglia come le altre, stessa larghezza. La classe resta
 * nel markup come gancio, ma se le si dà grid-column: 1 / -1 torna a occupare
 * la riga intera — scelta scartata.
 */

.wcpw-wizard__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.wcpw-wizard__box {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--wcpw-bordo-forte);
  border-radius: 6px;
  background: var(--wcpw-superficie);
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.wcpw-wizard__box::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  opacity: 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.wcpw-wizard__input:checked + .wcpw-wizard__box,
.wcpw-wizard__input:indeterminate + .wcpw-wizard__box {
  border-color: var(--wcpw-verde-scuro);
  background: var(--wcpw-verde-scuro);
}

.wcpw-wizard__input:checked + .wcpw-wizard__box::after {
  opacity: 1;
}

/* Stato intermedio del toggle "tutte le tipologie": trattino, non spunta. */
.wcpw-wizard__input:indeterminate + .wcpw-wizard__box::after {
  width: 9px;
  height: 0;
  border-width: 0 0 2px;
  opacity: 1;
  transform: none;
}

.wcpw-wizard__option:has(.wcpw-wizard__input:checked) {
  border-color: var(--wcpw-verde);
  background: var(--wcpw-selezione);
}

.wcpw-wizard__input:focus-visible + .wcpw-wizard__box {
  outline: 2px solid var(--wcpw-verde-scuro);
  outline-offset: 2px;
}

.wcpw-wizard__option-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.wcpw-wizard__option-label {
  color: var(--wcpw-testo);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
  text-wrap: pretty;
}

.wcpw-wizard__option-desc {
  color: var(--wcpw-testo-soft);
  font-size: 12px;
  line-height: 1.45;
}

/* Conteggio dinamico e opzioni senza combinazioni possibili */

.wcpw-wizard__option-count {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 21px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--wcpw-superficie-soft);
  color: var(--wcpw-testo-beige);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.wcpw-wizard__option:has(.wcpw-wizard__input:checked)
  .wcpw-wizard__option-count {
  background: var(--wcpw-verde-tenue);
  color: var(--wcpw-verde-scuro);
}

/* Versione leggibile dagli screen reader del numero nel badge. */
.wcpw-wizard__option-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wcpw-wizard__option-vuoto {
  color: var(--wcpw-spento);
  font-size: 11.5px;
  font-style: italic;
  line-height: 1.45;
}

.wcpw-wizard__option.is-disabled {
  border-color: var(--wcpw-divisore);
  background: var(--wcpw-superficie-soft);
  cursor: not-allowed;
}

.wcpw-wizard__option.is-disabled:hover {
  border-color: var(--wcpw-divisore);
}

.wcpw-wizard__option.is-disabled .wcpw-wizard__box {
  border-color: var(--wcpw-bordo);
  background: transparent;
}

.wcpw-wizard__option.is-disabled .wcpw-wizard__option-label,
.wcpw-wizard__option.is-disabled .wcpw-wizard__option-desc {
  color: var(--wcpw-spento);
}

/* Step senza nessuna opzione percorribile: tassonomie compilate a metà. */
.wcpw-wizard__step-empty {
  margin: 0 30px 26px;
  padding: 14px 18px;
  border: 1px solid var(--wcpw-avviso-bordo);
  border-radius: 12px;
  background: var(--wcpw-avviso-bg);
  color: var(--wcpw-avviso-testo);
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}

/* Errori REST: stessa nota ambra del design. */

.wcpw-wizard__error {
  margin: 0 30px 6px;
  padding: 16px 20px;
  border: 1px solid var(--wcpw-avviso-bordo);
  border-radius: 14px;
  background: var(--wcpw-avviso-bg);
  color: var(--wcpw-avviso-testo);
  font-size: 13.5px;
  line-height: 1.6;
  text-wrap: pretty;
}

/* Navigazione */

.wcpw-wizard__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 30px 26px;
  border-top: 1px solid var(--wcpw-divisore);
}

.wcpw-wizard__footer-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.wcpw-wizard__footer-side--end {
  justify-content: flex-end;
}

.wcpw-wizard__hint {
  margin: 0;
  color: var(--wcpw-occhiello);
  font-size: 13px;
}

.wcpw-wizard__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.wcpw-wizard__btn--primary {
  background: var(--wcpw-verde);
  color: #fff;
}

.wcpw-wizard__btn--primary:hover {
  background: var(--wcpw-verde-hover);
}

.wcpw-wizard__btn--ghost {
  padding: 0 20px;
  border: 1.5px solid var(--wcpw-bordo);
  background: var(--wcpw-superficie);
  color: var(--wcpw-testo-beige);
  letter-spacing: normal;
}

.wcpw-wizard__btn--ghost:hover {
  border-color: var(--wcpw-bordo-forte);
  background: var(--wcpw-superficie);
}

.wcpw-wizard__btn:focus-visible {
  outline: 2px solid var(--wcpw-verde-scuro);
  outline-offset: 2px;
}

.wcpw-wizard__btn--primary[disabled] {
  background: var(--wcpw-bordo-forte);
  cursor: not-allowed;
}

.wcpw-wizard__icon {
  flex: none;
}

.wcpw-wizard.is-loading .wcpw-wizard__submit {
  cursor: progress;
}

/* Avviso in editor quando le tassonomie sono ancora vuote. */

.wcpw-wizard__notice {
  padding: 64px 24px;
  border: 1px dashed var(--wcpw-tratteggio);
  border-radius: 18px;
  background: var(--wcpw-superficie);
  color: var(--wcpw-testo-soft);
  font-family: var(--wcpw-font);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
  text-wrap: pretty;
}

/*
 * Avviso di azzeramento delle risposte.
 *
 * Vive in <body> (ce lo sposta wizard.js), quindi non eredita niente dal
 * wizard: i token sono ridichiarati in testa al file e box-sizing, font e
 * z-index vanno messi qui. Lo z-index sta sopra la header sovrapposta del tema.
 */

.wcpw-wizard__modal {
  position: fixed;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  inset: 0;
  font-family: var(--wcpw-font);
}

/* Lo sfondo non deve scorrere sotto al modale. */
body.wcpw-modal-open {
  overflow: hidden;
}

.wcpw-wizard__modal[hidden] {
  display: none !important;
}

.wcpw-wizard__modal *,
.wcpw-wizard__modal *::before,
.wcpw-wizard__modal *::after {
  box-sizing: border-box;
}

.wcpw-wizard__modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 32, 28, 0.55);
}

.wcpw-wizard__modal-box {
  position: relative;
  width: 100%;
  max-width: 540px;
  padding: 28px 30px 24px;
  border-radius: 18px;
  background: var(--wcpw-superficie);
  box-shadow: 0 24px 60px rgba(35, 32, 28, 0.28);
}

.wcpw-wizard__modal-title {
  margin: 0 0 10px;
  color: var(--wcpw-testo);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
  text-wrap: balance;
}

.wcpw-wizard__modal-text {
  margin: 0 0 24px;
  color: var(--wcpw-testo-soft);
  font-size: 14px;
  line-height: 1.6;
  text-wrap: pretty;
}

.wcpw-wizard__modal-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 1024px) {
  .wcpw-wizard {
    padding-right: 32px;
    padding-bottom: 72px;
    padding-left: 32px;
  }

  .wcpw-wizard__title {
    font-size: 36px;
  }
}

@media (max-width: 768px) {
  .wcpw-wizard {
    gap: 24px;
    padding-right: 24px;
    padding-bottom: 64px;
    padding-left: 24px;
  }

  .wcpw-wizard__title {
    font-size: 32px;
  }

  .wcpw-wizard__lead {
    font-size: 15px;
  }

  .wcpw-wizard__progress-item:not(:last-child)::after {
    width: 20px;
  }

  .wcpw-wizard__step-head {
    padding: 22px 20px 18px;
  }

  .wcpw-wizard__step-title {
    font-size: 22px;
  }

  .wcpw-wizard__options {
    padding: 20px;
  }

  .wcpw-wizard__error {
    margin-inline: 20px;
  }

  .wcpw-wizard__footer {
    padding: 18px 20px 22px;
  }
}

@media (max-width: 640px) {
  .wcpw-wizard {
    padding-right: 16px;
    padding-bottom: 56px;
    padding-left: 16px;
  }

  .wcpw-wizard__options {
    grid-template-columns: 1fr;
  }

  .wcpw-wizard__footer-side {
    width: 100%;
  }

  .wcpw-wizard__footer-side--end .wcpw-wizard__btn {
    flex: 1;
    justify-content: center;
  }

  .wcpw-wizard__modal {
    padding: 16px;
  }

  .wcpw-wizard__modal-box {
    padding: 24px 20px 20px;
  }

  /* Sotto i 640px i due bottoni si impilano, centrati. */
  .wcpw-wizard__modal-actions {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  /*
   * In colonna l'altezza non va distribuita (niente flex: 1): serve invece un
   * bersaglio di tocco garantito. .wcpw-wizard__btn ha height: 50px fisso, che
   * renderebbe inerte il min-height e farebbe sbordare un'etichetta su due
   * righe: qui l'altezza si libera e il padding tiene il testo dentro.
   */
  .wcpw-wizard__modal-actions .wcpw-wizard__btn {
    height: auto;
    min-height: 48px;
    padding-block: 12px;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wcpw-wizard *,
  .wcpw-wizard__modal * {
    transition: none !important;
  }
}
