/* ============================================================
   recesso.css — Stili del componente recesso online
   Tutti i selettori sono prefissati con .recesso- o #recesso-
   Non sovrascrive selettori globali (body, input, button, .container)
   ============================================================ */

/* ---- Modal — container principale ---- */
.recesso-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Nasconde il modal quando ha l'attributo hidden */
.recesso-modal[hidden] {
  display: none !important;
}

/* ---- Overlay (sfondo semitrasparente, click per chiudere) ---- */
.recesso-modal__overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

#recesso-btn-preview{width: auto!important;padding: 3px 20px;}
#recesso-form{text-align: left;}
#recesso-title-form{font-size: 25px;margin-bottom:13px;text-align: left;padding-left:3px;font-weight: bold;}

/* ---- Dialog box ---- */
.recesso-modal__dialog {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: 6px;
  padding: 40px 50px;
  width: 90%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}

/* ---- Pulsante di chiusura ---- */
.recesso-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: 1px solid transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 9px;
  color: #555;
  border-radius: 4px;
  font-family: inherit;
}
.recesso-modal__close:hover,
.recesso-modal__close:focus {
  background-color: #f0f0f0;
  border-color: #aaa;
  color: #000;
  outline: none;
}
.recesso-modal__close:focus-visible {
  outline: 2px solid #005fcc;
  outline-offset: 2px;
}

/* ---- Heading dentro il dialog ---- */
.recesso-modal__dialog h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1.25rem;
  padding-right: 36px; /* spazio per il pulsante chiusura */
}

/* ---- Step (schermata) ---- */
.recesso-step[hidden] {
  display: none !important;
}

/* ---- Honeypot (deve essere invisibile) ---- */
.recesso-honeypot {
  display: none;
}

/* ---- Campi del form ---- */
.recesso-form__field {
  margin-bottom: 16px;
}

.recesso-form__field label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 0.95rem;
}

#recesso-modal-desc{margin-bottom:30px;}

.recesso-form__field_disabled input,
.recesso-form__field_disabled textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #aaa;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  background-color: #fff;
  color: #222;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.recesso-form__field input:focus,
.recesso-form__field textarea:focus {
  outline: none;
  border-color: #005fcc;
  box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.2);
}

/* Stato di errore per il campo */
.recesso-form__field input[aria-invalid="true"],
.recesso-form__field textarea[aria-invalid="true"] {
  border-color: #c00;
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.15);
}

/* ---- Messaggi di errore per campo ---- */
.recesso-form__error {
  display: block;
  color: #c00;
  font-size: 0.875rem;
  margin-top: 5px;
  min-height: 1.2em;
}

.recesso-form__error:empty {
  display: none;
}

/* ---- Hint sotto il campo ---- */
.recesso-form__hint {
  font-size: 0.85rem;
  color: #555;
  margin: 4px 0 2px;
}

/* ---- Area privacy ---- */
.recesso-form__privacy {
  margin: 14px 0;
  font-size: 0.88rem;
  color: #555;
}
.recesso-form__privacy a {
  color: inherit;
  text-decoration: underline;
}
.recesso-form__privacy a:hover,
.recesso-form__privacy a:focus {
  color: #005fcc;
}

/* ---- Azioni (pulsanti) ---- */
.recesso-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  align-items: center;
}

/* ---- Pulsante secondario (neutro, non dipende da classi del sito) ---- */
.recesso-btn-secondary {
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #bbb;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.recesso-btn-secondary:hover {
  background-color: #e0e0e0;
  border-color: #999;
}
.recesso-btn-secondary:focus-visible {
  outline: 2px solid #005fcc;
  outline-offset: 2px;
}
.recesso-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Riepilogo (Step 2) ---- */
.recesso-summary {
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 16px;
  margin: 14px 0;
}

.recesso-summary__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recesso-summary__list > div {
  display: grid;
  grid-template-columns: 42% 58%;
  gap: 0 8px;
  padding: 7px 0;
  border-bottom: 1px solid #eee;
}

.recesso-summary__list > div:last-child {
  border-bottom: none;
}

.recesso-summary__list dt {
  font-weight: 600;
  font-size: 0.875rem;
  color: #555;
  margin: 0;
  align-self: start;
}

.recesso-summary__list dd {
  margin: 0;
  word-break: break-word;
  font-size: 0.95rem;
}

/* ---- Ricevuta (Step 3) ---- */
.recesso-receipt {
  background: #f0faf0;
  border: 1px solid #8bc;
  border-radius: 4px;
  padding: 16px;
  margin: 14px 0;
}

.recesso-receipt__summary {
  background: #fff;
  margin-top: 12px;
}

/* ---- Errore generale ---- */
.recesso-error-general {
  background: #fff0f0;
  border: 1px solid #c00;
  border-radius: 4px;
  padding: 12px 16px;
  color: #c00;
  margin-top: 16px;
  font-size: 0.95rem;
}
.recesso-error-general[hidden] {
  display: none !important;
}

/* ---- Indicatore di caricamento ---- */
.recesso-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  color: #555;
  font-size: 0.95rem;
}
.recesso-loading[hidden] {
  display: none !important;
}

.recesso-loading__spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  border-top-color: #555;
  border-radius: 50%;
  flex-shrink: 0;
  animation: recesso-spin 0.75s linear infinite;
}

@keyframes recesso-spin {
  to { transform: rotate(360deg); }
}

/* ---- Screen reader only ---- */
.recesso-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Responsive (mobile) ---- */
@media (max-width: 480px) {
  .recesso-modal__dialog {
    width: 95%;
    padding: 20px 14px 18px;
    max-height: 95vh;
  }

  .recesso-summary__list > div {
    grid-template-columns: 1fr;
  }

  .recesso-form__actions {
    flex-direction: column;
  }

  .recesso-form__actions > * {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }
}

/* ---- Preferenza riduzione animazioni ---- */
@media (prefers-reduced-motion: reduce) {
  .recesso-form__field input,
  .recesso-form__field textarea,
  .recesso-modal__close {
    transition: none;
  }

  .recesso-loading__spinner {
    animation: none;
    border-color: #555;
    border-top-color: #555;
  }
}

/* ---- Pagina fallback standalone (recesso/index.php) ---- */

.recesso-fb__container {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 20px 60px;
  box-sizing: border-box;
}

.recesso-fb__container h1 {
  font-size: 1.4rem;
  margin-top: 0;
  margin-bottom: 16px;
}
