/*
 * ADLP Studio Legale - Contact Forms
 * Poppins-based, brand ADLP (red #B32B0C, cream #F0E6D3, body #1A1A1A)
 * Version 1.0 - 20 April 2026
 */

.adlp-form-wrap {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1A1A1A;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 0;
  box-sizing: border-box;
}

.adlp-form-wrap *,
.adlp-form-wrap *::before,
.adlp-form-wrap *::after {
  box-sizing: border-box;
  font-family: inherit;
}

/* ---------- Form intro (titolo/sotto titolo) ---------- */
.adlp-form-intro {
  margin-bottom: 28px;
}
.adlp-eyebrow {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #B32B0C;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 6px;
}
.adlp-form-intro h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 28px;
  font-weight: 500;
  color: #111;
  margin: 0 0 8px;
  line-height: 1.2;
}
.adlp-form-intro p {
  font-size: 15px;
  color: #555;
  line-height: 1.6;
  margin: 0;
}

/* ---------- Alert di errore ---------- */
.adlp-alert {
  padding: 14px 18px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}
.adlp-alert-error {
  background: #FEF2F2;
  border-left: 3px solid #B32B0C;
  color: #7A1B08;
}

/* ---------- Form base ---------- */
.adlp-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.adlp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adlp-field-row {
  display: grid;
  gap: 14px;
}
.adlp-field-row-2 {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 560px) {
  .adlp-field-row-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Labels ---------- */
.adlp-field label {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  letter-spacing: 0.2px;
}
.adlp-field label .req {
  color: #B32B0C;
  font-weight: 600;
  margin-left: 2px;
}
.adlp-field label .hint {
  color: #888;
  font-size: 11px;
  font-weight: 400;
  margin-left: 4px;
}

.adlp-field-note {
  font-size: 12px;
  color: #888;
  margin: 4px 0 0;
  line-height: 1.5;
}

/* ---------- Input / textarea / select ---------- */
.adlp-form input[type="text"],
.adlp-form input[type="email"],
.adlp-form input[type="tel"],
.adlp-form input[type="date"],
.adlp-form textarea,
.adlp-form select {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  color: #1A1A1A;
  background: #fff;
  border: 1px solid #D9D9D9;
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}

.adlp-form input[type="text"]:hover,
.adlp-form input[type="email"]:hover,
.adlp-form input[type="tel"]:hover,
.adlp-form textarea:hover,
.adlp-form select:hover {
  border-color: #B0B0B0;
}

.adlp-form input[type="text"]:focus,
.adlp-form input[type="email"]:focus,
.adlp-form input[type="tel"]:focus,
.adlp-form input[type="date"]:focus,
.adlp-form textarea:focus,
.adlp-form select:focus {
  outline: none;
  border-color: #B32B0C;
  box-shadow: 0 0 0 3px rgba(179, 43, 12, 0.1);
}

.adlp-form textarea {
  resize: vertical;
  min-height: 100px;
  font-family: 'Poppins', sans-serif;
}

.adlp-form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.adlp-form-wrap input,
.adlp-form-wrap textarea,
.adlp-form-wrap select {
  text-transform: none;
  letter-spacing: normal;
}

.adlp-form-wrap input::placeholder,
.adlp-form-wrap textarea::placeholder {
  color: #A8A8A8;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  opacity: 1;
}

/* ---------- Radio e checkbox (custom) ---------- */
.adlp-radio-group,
.adlp-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.adlp-radio-group.adlp-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.adlp-radio-group.adlp-radio-compact {
  gap: 6px;
}
@media (max-width: 560px) {
  .adlp-radio-group.adlp-radio-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.adlp-radio,
.adlp-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #E0E0E0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  color: #333;
  transition: background 0.12s, border-color 0.12s;
  flex: 1 1 auto;
  min-width: 0;
}
.adlp-radio:hover,
.adlp-check:hover {
  border-color: #B32B0C;
  background: #FEF9F7;
}
.adlp-radio input[type="radio"],
.adlp-check input[type="checkbox"] {
  margin: 2px 0 0;
  accent-color: #B32B0C;
  flex-shrink: 0;
}
.adlp-radio input[type="radio"]:checked ~ span,
.adlp-check input[type="checkbox"]:checked ~ span {
  color: #1A1A1A;
  font-weight: 500;
}
.adlp-radio:has(input:checked),
.adlp-check:has(input:checked) {
  border-color: #B32B0C;
  background: #FEF2F0;
}

.adlp-radio small {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  font-weight: 400;
}

/* ---------- Checkbox list verticale (multi-select copertura) ---------- */
.adlp-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

/* ---------- Privacy checkbox ---------- */
.adlp-privacy {
  margin-top: 8px;
}
.adlp-privacy .adlp-check {
  border: none;
  padding: 8px 0;
  background: transparent;
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}
.adlp-privacy .adlp-check:hover {
  background: transparent;
  border: none;
}
.adlp-privacy a {
  color: #B32B0C;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Details/summary per sezioni opzionali ---------- */
.adlp-details-group {
  margin-top: 4px;
  border-top: 1px solid #ECECEC;
  padding-top: 16px;
}
.adlp-details-group summary {
  cursor: pointer;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 500;
  color: #B32B0C;
  letter-spacing: 0.2px;
  list-style: none;
  outline: none;
  position: relative;
  padding-left: 22px;
  user-select: none;
}
.adlp-details-group summary::-webkit-details-marker {
  display: none;
}
.adlp-details-group summary::before {
  content: '+';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #B32B0C;
  transition: transform 0.2s;
}
.adlp-details-group[open] summary::before {
  content: '−';
}
.adlp-details-group summary .hint {
  color: #888;
  font-weight: 400;
  font-size: 12px;
  margin-left: 6px;
}
.adlp-details-group[open] > *:not(summary) {
  margin-top: 16px;
}
.adlp-details-group > .adlp-field,
.adlp-details-group > .adlp-field-row {
  margin-top: 14px;
}

/* ---------- Conditional fields (scadenze sì → data scadenza) ---------- */
.adlp-conditional {
  display: none;
}
.adlp-conditional.adlp-visible {
  display: flex;
}

/* ---------- Turnstile ---------- */
.adlp-turnstile {
  margin: 8px 0 4px;
}
.adlp-turnstile .cf-turnstile {
  display: block;
  min-height: 65px;
}

/* ---------- Submit ---------- */
.adlp-submit-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.adlp-form-wrap .adlp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  letter-spacing: 0.3px;
  text-transform: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  text-decoration: none;
}
.adlp-form-wrap .adlp-btn-primary {
  background: #B32B0C;
  color: #ffffff;
}
.adlp-form-wrap .adlp-btn-primary:hover {
  background: #8F2209;
  color: #ffffff;
}
.adlp-form-wrap .adlp-btn-primary:active {
  transform: scale(0.98);
}
.adlp-form-wrap .adlp-btn-primary:disabled {
  background: #CCCCCC;
  color: #ffffff;
  cursor: not-allowed;
  opacity: 0.7;
}

.adlp-reply-hint {
  font-size: 12px;
  color: #888;
  margin: 0;
  font-weight: 400;
}

/* ---------- Honeypot (invisible to humans) ---------- */
.adlp-honeypot {
  position: absolute;
  left: -9999px;
  top: -9999px;
  visibility: hidden;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Error state pagina (form-level) ---------- */
.adlp-form-error {
  padding: 14px 18px;
  background: #FEF2F2;
  color: #7A1B08;
  border-left: 3px solid #B32B0C;
  border-radius: 4px;
  font-size: 14px;
}

/* ---------- Touch targets su mobile (accessibility) ---------- */
@media (max-width: 560px) {
  .adlp-form input,
  .adlp-form textarea,
  .adlp-form select,
  .adlp-btn {
    font-size: 16px; /* evita zoom iOS su focus */
  }
  .adlp-form input,
  .adlp-form select {
    padding: 12px 14px;
  }
  .adlp-form-intro h2 {
    font-size: 22px;
  }
  .adlp-radio,
  .adlp-check {
    padding: 12px 14px; /* touch target più grande */
  }
}

/* ---------- Dark mode safety (se theme applica dark mode) ---------- */
@media (prefers-color-scheme: dark) {
  /* Il form resta sempre in versione chiara per coerenza di brand */
  /* Non cambiamo nulla, ADLP forms sono sempre light theme */
}
