/* =====================================================================
   FORM — modulo Contact Form 7 (markup in dev-tools/php/modulo-contatti.php, senza <p>/<br> automatici).
   Dalla schermata Stitch "Contatti": campi Ghiaccio alti 52px, raggio 12px, senza bordo; al focus bianchi con
   bordo Blu MM 2px + alone; etichetta 14px semibold sopra; errori in rosso sotto il campo.
   Vedi design/DESIGN.md › Components › Form.
   ===================================================================== */
.wpcf7 form { display: flex; flex-direction: column; gap: 16px; }
.wpcf7 form > * { margin: 0; }

/* Due campi per riga da 640px */
.mm-form__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 640px) { .mm-form__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.mm-form__field { display: flex; flex-direction: column; gap: 6px; }
.mm-form__label {
  color: var(--wp--preset--color--on-surface);
  font-size: var(--wp--preset--font-size--body-sm);
  font-weight: 600;
  line-height: 1.55;
}
.mm-form__field .wpcf7-form-control-wrap { position: relative; display: block; }

/* Campi */
.mm-form__field :is(input, select, textarea) {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background-color: var(--wp--preset--color--surface-blue);
  color: var(--wp--preset--color--on-surface);
  font-family: var(--wp--preset--font-family--inter);
  font-size: var(--wp--preset--font-size--body-md);
  line-height: 1.6;
  transition: background-color .2s, box-shadow .2s;
}
.mm-form__field :is(input, select) { height: 52px; }
.mm-form__field textarea { min-height: 52px; padding-block: 16px; line-height: 1.5; resize: vertical; } /* 4 righe = 128px */
.mm-form__field :is(input, textarea)::placeholder { color: rgba(74, 91, 112, .5); opacity: 1; }
.mm-form__field :is(input, select, textarea):focus {
  outline: none;
  background-color: var(--wp--preset--color--surface);
  box-shadow: 0 0 0 2px var(--wp--preset--color--primary), 0 0 0 6px rgba(1, 76, 152, .15);
}
/* Tendina: freccia Material al posto di quella del browser */
.mm-form__field select { padding-right: 40px; appearance: none; cursor: pointer; }
.mm-form__field--select .wpcf7-form-control-wrap::after {
  content: "";
  position: absolute;
  top: 16px; /* centrata nei 52px del campo, anche quando sotto compare l'errore */
  right: 14px;
  width: 20px;
  height: 20px;
  background-color: var(--wp--preset--color--on-surface-variant);
  -webkit-mask: var(--mm-ico-chevron) center / contain no-repeat;
  mask: var(--mm-ico-chevron) center / contain no-repeat;
  pointer-events: none;
}

/* Errori: bordo rosso e messaggio sotto il campo */
.mm-form__field .wpcf7-not-valid { box-shadow: 0 0 0 2px var(--wp--preset--color--error); }
.wpcf7 .wpcf7-not-valid-tip {
  margin-top: 6px;
  color: var(--wp--preset--color--error);
  font-size: var(--wp--preset--font-size--body-sm);
  line-height: 1.55;
}

/* Privacy: casella 20px Blu MM + testo 14px */
.mm-form__privacy { padding-top: 4px; }
.mm-form__privacy .wpcf7-list-item { display: block; margin: 0; }
.mm-form__privacy .wpcf7-list-item > label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.mm-form__privacy input[type="checkbox"] {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 4px 0 0;
  accent-color: var(--wp--preset--color--primary);
  cursor: pointer;
}
.mm-form__privacy .wpcf7-list-item-label {
  color: var(--wp--preset--color--on-surface-variant);
  font-size: var(--wp--preset--font-size--body-sm);
  line-height: 1.25;
}
.mm-form__privacy a { color: var(--wp--preset--color--primary); font-weight: 500; text-decoration: underline; }
.mm-form__privacy a:hover { color: var(--wp--preset--color--primary-bright); }

/* Invio: bottone Blu MM con icona "invia" dopo il testo (a tutta larghezza sotto 640px) */
.mm-form__actions { display: flex; align-items: center; padding-top: 4px; }
.wpcf7 .mm-form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 32px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
  cursor: pointer;
  transition: background-color .2s, box-shadow .2s;
}
.wpcf7 .mm-form__submit:hover,
.wpcf7 .mm-form__submit:focus-visible {
  background-color: var(--wp--preset--color--primary-bright);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
}
.mm-form__submit::after {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--mm-ico-send) center / contain no-repeat;
  mask: var(--mm-ico-send) center / contain no-repeat;
}
/* Rotellina di CF7 durante l'invio: sotto 640px dentro il bottone (non lo restringe), poi accanto */
.mm-form__actions { position: relative; }
.mm-form__actions .wpcf7-spinner { position: absolute; top: calc(50% + 2px); right: 16px; margin: -12px 0 0; }
@media (min-width: 640px) {
  .wpcf7 .mm-form__submit { width: auto; }
  .mm-form__actions .wpcf7-spinner { position: static; margin: 0 24px; }
}

/* Esito dell'invio (testo di Contatto › Moduli di contatto › Messaggi) */
.wpcf7 form .wpcf7-response-output {
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background-color: var(--wp--preset--color--emergency-soft);
  color: var(--wp--preset--color--error);
  font-size: var(--wp--preset--font-size--body-sm);
  font-weight: 600;
  line-height: 1.55;
}
.wpcf7 form.sent .wpcf7-response-output {
  background-color: var(--wp--preset--color--surface-blue);
  color: var(--wp--preset--color--primary-deep);
}
