/* ═══════════════════════════════════════════════
   WA Conversational Form Pro — Public CSS
   ═══════════════════════════════════════════════ */

/* ——— Link trigger ——— */
.wa-ctc-trigger-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #25D366; color: #fff; border: none;
  padding: 14px 28px; border-radius: 50px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(37,211,102,.35);
  transition: transform .2s, box-shadow .2s;
  font-family: inherit;
}
.wa-ctc-trigger-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,211,102,.4);
  color: #fff; text-decoration: none;
}

/* ——— Wrapper pagina ——— */
.wa-ctc-page-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ——— Header ——— */
#wa-form-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 32px;
}
#wa-form-header svg { flex-shrink: 0; }
.wa-form-title {
  font-size: 22px; font-weight: 700; color: #111; margin: 0;
}
.wa-form-subtitle { font-size: 14px; color: #666; margin: 4px 0 0; }

/* ——— Barra avanzamento ——— */
#wa-progress-wrap { margin-bottom: 24px; }
#wa-progress-bar {
  height: 4px; background: #e8e8e8; border-radius: 4px;
  overflow: hidden; margin-bottom: 8px;
}
#wa-progress-fill {
  height: 100%; background: #25D366;
  border-radius: 4px;
  transition: width .35s ease;
}
#wa-progress-text {
  font-size: 12px; color: #999; text-align: right;
}

/* ——— Soft warning ——— */
#wa-soft-warning {
  background: #fff8e1; border: 1.5px solid #ffe082;
  border-radius: 10px; padding: 12px 16px;
  font-size: 14px; color: #795548; line-height: 1.5;
  margin-bottom: 20px;
}
#wa-soft-warning strong { display: block; margin-bottom: 3px; }

/* ——— Step: campo singolo ——— */
.wa-ctc-field { margin-bottom: 8px; }
.wa-ctc-field label {
  display: block; font-size: 18px; font-weight: 700;
  color: #111; margin-bottom: 14px; line-height: 1.4;
}
.wa-ctc-field.wa-required label::after {
  content: ' *'; color: #e53; font-size: 13px;
}
.wa-ctc-field input,
.wa-ctc-field textarea,
.wa-ctc-field select {
  width: 100%; box-sizing: border-box;
  border: 2px solid #e0e0e0; border-radius: 12px;
  padding: 15px 18px; font-size: 17px; color: #222;
  background: #fafafa;
  transition: border-color .2s, box-shadow .2s;
  outline: none; font-family: inherit; resize: vertical;
  appearance: auto;
}
.wa-ctc-field input:focus,
.wa-ctc-field textarea:focus,
.wa-ctc-field select:focus {
  border-color: #25D366;
  box-shadow: 0 0 0 4px rgba(37,211,102,.12);
  background: #fff;
}
.wa-field-error {
  color: #e53; font-size: 13px; margin-top: 6px; display: none;
}
.wa-ctc-field.has-error input,
.wa-ctc-field.has-error textarea,
.wa-ctc-field.has-error select {
  border-color: #e53;
  box-shadow: 0 0 0 4px rgba(238,85,51,.1);
}
.wa-ctc-field.has-error .wa-field-error { display: block; }

/* ——— Privacy block (ultimo step) ——— */
.wa-ctc-privacy-block {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}
.wa-ctc-privacy-link {
  display: inline-block; font-size: 13px; font-weight: 600;
  color: #25D366; text-decoration: none; margin-bottom: 10px;
}
.wa-ctc-privacy-link:hover { text-decoration: underline; }
.wa-ctc-anon-note { font-size: 12px; color: #999; }
.wa-ctc-gdpr-label {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; color: #555; line-height: 1.5;
  cursor: pointer; font-weight: normal;
}
.wa-ctc-gdpr-label input[type="checkbox"] {
  width: 18px; height: 18px; min-width: 18px; margin-top: 2px;
  cursor: pointer; accent-color: #25D366;
}
.wa-ctc-gdpr-label a { color: #25D366; text-decoration: underline; }

/* ——— Navigazione ——— */
#wa-step-nav {
  display: flex; gap: 12px; margin-top: 24px;
  align-items: center; flex-wrap: wrap;
}
#wa-btn-back {
  background: #f5f5f5; color: #555; border: 1.5px solid #ddd;
  padding: 12px 22px; border-radius: 50px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s;
  font-family: inherit;
}
#wa-btn-back:hover { background: #ebebeb; border-color: #ccc; }
#wa-btn-next {
  flex: 1; background: #111; color: #fff; border: none;
  padding: 14px 24px; border-radius: 50px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center;
  justify-content: center; gap: 6px;
  transition: background .15s, transform .15s;
  font-family: inherit;
}
#wa-btn-next:hover { background: #333; transform: translateY(-1px); }
#wa-btn-send {
  flex: 1; background: linear-gradient(135deg,#25D366,#128C7E);
  color: #fff; border: none;
  padding: 14px 24px; border-radius: 50px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center;
  justify-content: center; gap: 8px;
  box-shadow: 0 6px 20px rgba(37,211,102,.4);
  transition: opacity .2s, transform .15s;
  font-family: inherit;
}
#wa-btn-send:hover { opacity: .92; transform: translateY(-1px); }
#wa-btn-send:active { transform: translateY(0); }

/* ——— Privacy note ——— */
#wa-privacy-note {
  font-size: 12px; color: #bbb; text-align: center;
  margin-top: 14px; display: none;
}

/* ——— Schermata non in target ——— */
#wa-disqualify-screen { text-align: center; padding: 32px 8px; }
#wa-dq-emoji { font-size: 52px; margin-bottom: 16px; }
#wa-dq-title { font-size: 22px; font-weight: 700; color: #111; margin: 0 0 14px; }
#wa-dq-text { color: #666; line-height: 1.65; margin: 0 0 28px; font-size: 16px; }
#wa-dq-back {
  display: inline-block; padding: 12px 32px;
  border: 1.5px solid #ddd; border-radius: 50px;
  background: #fff; font-size: 15px; color: #555;
  text-decoration: none; transition: border-color .15s, color .15s;
}
#wa-dq-back:hover { border-color: #aaa; color: #222; }

/* ——— Radio button (scelta rapida) ——— */
.wa-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.wa-radio-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: #fafafa;
  cursor: pointer;
  font-size: 16px;
  color: #333;
  transition: border-color .15s, background .15s, transform .1s;
  user-select: none;
}
.wa-radio-label:hover {
  border-color: #25D366;
  background: #f0fdf4;
}
.wa-radio-label.wa-radio-selected {
  border-color: #25D366;
  background: #f0fdf4;
  color: #111;
  font-weight: 600;
}
.wa-radio-label input[type="radio"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  accent-color: #25D366;
  cursor: pointer;
}
.wa-radio-label span { flex: 1; }

/* ——— Bottoni schermata disqualify ——— */
#wa-dq-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
#wa-dq-edit-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 50px;
  border: 1.5px solid #ddd; background: #fff;
  font-size: 15px; color: #555; cursor: pointer;
  transition: border-color .15s, color .15s;
  font-family: inherit;
}
#wa-dq-edit-btn:hover { border-color: #aaa; color: #222; }
#wa-dq-custom-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 50px;
  background: #25D366; color: #fff;
  font-size: 15px; font-weight: 600;
  text-decoration: none;
  transition: opacity .15s, transform .15s;
}
#wa-dq-custom-btn:hover { opacity: .9; transform: translateY(-1px); color: #fff; }

/* ——— Schermata conferma invio ——— */
#wa-thankyou-screen { text-align: center; padding: 32px 8px; }
#wa-ty-icon { display: flex; justify-content: center; margin-bottom: 16px; }
#wa-ty-title { font-size: 22px; font-weight: 700; color: #111; margin: 0 0 10px; }
#wa-ty-text { color: #666; line-height: 1.6; margin: 0 0 8px; font-size: 16px; }
#wa-ty-fallback { color: #999; margin: 0 0 24px; }
#wa-ty-fallback a { color: #25D366; font-weight: 600; text-decoration: none; }
#wa-ty-fallback a:hover { text-decoration: underline; }
#wa-ty-actions { display: flex; justify-content: center; }
#wa-ty-again-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 50px;
  border: 1.5px solid #ddd; background: #fff;
  font-size: 15px; color: #555; cursor: pointer;
  transition: border-color .15s, color .15s;
  font-family: inherit;
}
#wa-ty-again-btn:hover { border-color: #aaa; color: #222; }

/* ═══════════════════════════════════════════════
   IMMAGINE PROFILO
   ═══════════════════════════════════════════════ */
#wa-header-icon {
  position: relative;
  flex-shrink: 0;
}
#wa-profile-img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid #e8f5e9;
}
#wa-profile-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
#wa-profile-badge svg { width: 12px; height: 12px; }

/* ═══════════════════════════════════════════════
   HEADER COMPATTO — dal secondo step in poi
   La classe is-first-step viene aggiunta/rimossa
   dal JS in renderStep().
   ═══════════════════════════════════════════════ */
#wa-form-header {
  transition: all .3s ease;
  overflow: hidden;
}

/* Primo step: header completo */
.is-first-step #wa-form-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  opacity: 1;
  max-height: 120px;
}

/* Step successivi: header compatto (solo titolo piccolo) */
#wa-ctc-wrap:not(.is-first-step) #wa-form-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}
#wa-ctc-wrap:not(.is-first-step) #wa-header-icon svg,
#wa-ctc-wrap:not(.is-first-step) #wa-profile-img {
  width: 28px;
  height: 28px;
}
#wa-ctc-wrap:not(.is-first-step) #wa-profile-badge {
  width: 14px;
  height: 14px;
  bottom: -1px;
  right: -1px;
}
#wa-ctc-wrap:not(.is-first-step) #wa-profile-badge svg {
  width: 8px;
  height: 8px;
}
#wa-ctc-wrap:not(.is-first-step) .wa-form-title {
  font-size: 14px;
  font-weight: 600;
  color: #666;
}
#wa-ctc-wrap:not(.is-first-step) .wa-form-subtitle {
  display: none;
}

/* ═══════════════════════════════════════════════
   BOTTONI IN COLONNA SU MOBILE
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
  #wa-step-nav {
    flex-direction: column;
    gap: 10px;
  }
  #wa-btn-back {
    width: 100%;
    justify-content: center;
    order: 2; /* Indietro sotto il bottone principale */
  }
  #wa-btn-next {
    width: 100%;
    order: 1;
  }
  #wa-btn-send {
    width: 100%;
    order: 1;
  }
}

/* ═══════════════════════════════════════════════
   CAMPO ORDER — counter +/- voci ordine
   Mobile-first: layout a colonna su schermi stretti,
   riga su tablet/desktop.
   ═══════════════════════════════════════════════ */

.wa-order-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.wa-order-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  gap: 8px;
}

.wa-order-name {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  min-width: 0;
  word-break: break-word;
}

.wa-order-price {
  font-size: 14px;
  color: #25D366;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 4px;
}

.wa-order-counter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wa-order-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #25D366;
  background: #fff;
  color: #25D366;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  touch-action: manipulation; /* evita doppio-tap zoom su mobile */
}

.wa-order-btn:hover,
.wa-order-btn:active {
  background: #25D366;
  color: #fff;
}

.wa-order-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.wa-order-qty {
  min-width: 24px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.wa-order-total {
  margin-top: 12px;
  padding: 8px 14px;
  background: #e8f8ef;
  border: 1px solid #b2dfcc;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #1a7a40;
  text-align: right;
  min-height: 36px; /* evita layout shift quando appare */
}

/* Layout colonna già di default — nessun override necessario a 360px */
