/* ============================================================
   RSVP Vittoria & Gabriele — Main Stylesheet
   ============================================================ */

:root {
  --bg:           #DFECFD;
  --card-bg:      #FFFFFF;
  --accent:       #7B9EBF;
  --accent-dark:  #4A6E8A;
  --gold:         #C9A84C;
  --text:         #1A202C;
  --text-light:   #3D4A5C;
  --error:        #C0392B;
  --success:      #27AE60;
  --border:       #D0E0F0;
  --radius:       12px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Lato', sans-serif;
  font-weight: 400;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 16px 60px;
}

/* ── Intestazione pagina ── */
.page-header {
  text-align: center;
  margin-bottom: 32px;
}

.page-header .date-tag {
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
  font-weight: 400;
}

.page-header h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(28px, 6vw, 48px);
  font-weight: 400;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.2;
}

.page-header .subtitle {
  font-size: 15px;
  color: var(--text-light);
  letter-spacing: 1px;
}

/* ── Card form ── */
.card {
  position: relative;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 4px 40px rgba(74, 110, 138, 0.15);
  width: 100%;
  max-width: 540px;
  padding: 48px 44px;
  overflow: hidden;
}

/* Decorazioni botaniche */
.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 130px;
  height: 130px;
  background-image: url('../img/lemon.svg');
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.18;
  pointer-events: none;
}

.card::before {
  top: -20px;
  left: -20px;
  transform: rotate(0deg);
}

.card::after {
  bottom: -20px;
  right: -20px;
  transform: rotate(180deg);
}

/* ── Progress dots ── */
.progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 36px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s ease;
}

.progress-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.progress-dot.done {
  background: var(--gold);
}

/* ── Step containers ── */
.step {
  display: none;
  animation: fadeSlideIn 0.3s ease forwards;
}

.step.active { display: block; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-20px); }
}

/* ── Titoli step ── */
.step-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.3;
}

.step-subtitle {
  font-size: 15px;
  color: var(--text-light);
  margin: 0 0 28px;
  line-height: 1.6;
}

/* Divisore dorato */
.divider {
  width: 40px;
  height: 2px;
  background: var(--gold);
  margin: 12px 0 20px;
  border-radius: 2px;
}

/* ── Campi testo ── */
.field {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #FAFCFF;
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(123, 158, 191, 0.2);
}

input.error, textarea.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.field-error {
  font-size: 13px;
  color: var(--error);
  margin-top: 5px;
  display: none;
}

.field-error.visible { display: block; }

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.char-count {
  text-align: right;
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ── Pill button (Sì/No e scelta ospiti) ── */
.pill-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pill-btn {
  flex: 1;
  min-width: 80px;
  padding: 14px 20px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: #FAFCFF;
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  user-select: none;
}

.pill-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: rgba(123, 158, 191, 0.06);
}

.pill-btn.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 400;
}

/* ── Checkbox custom (intolleranze) ── */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.checkbox-item input[type="checkbox"] {
  display: none;
}

.checkbox-box {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #FAFCFF;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-box {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-box::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.checkbox-label {
  font-size: 16px;
  color: var(--text);
  font-weight: 400;
}

/* Campo "Altro" intolleranze */
#int-altro-field {
  margin-top: 4px;
  margin-left: 32px;
  display: none;
}

#int-altro-field.visible { display: block; }

/* ── Bottoni navigazione ── */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  align-items: center;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-light);
  font-family: 'Lato', sans-serif;
  font-size: 15px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.btn-back:hover { color: var(--accent-dark); }

.btn-next {
  flex: 1;
  padding: 16px 28px;
  background: var(--accent);
  border: none;
  border-radius: 100px;
  color: #fff;
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  position: relative;
}

.btn-next:hover { background: var(--accent-dark); }
.btn-next:active { transform: scale(0.98); }
.btn-next:disabled { background: var(--border); cursor: not-allowed; }

/* Spinner submit */
.btn-next .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.btn-next.loading .btn-label { display: none; }
.btn-next.loading .spinner  { display: block; }

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

/* ── Step 7: Ringraziamento ── */
.thank-you {
  text-align: center;
  padding: 20px 0;
}

.thank-you .checkmark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(39, 174, 96, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 28px;
}

.thank-you h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  margin: 0 0 12px;
  color: var(--text);
}

.thank-you p {
  font-size: 16px;
  color: var(--text-light);
  line-height: 1.7;
  margin: 0;
}

/* ── Alert errore globale ── */
.alert {
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--error);
  margin-bottom: 20px;
  display: none;
}

.alert.visible { display: block; }

/* ── Honeypot ── */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  pointer-events: none;
  tab-index: -1;
}

/* ── Footer pagina ── */
.page-footer {
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  opacity: 0.6;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  body { padding: 20px 0 40px; }
  .card {
    border-radius: 0;
    padding: 32px 24px;
    box-shadow: none;
    min-height: 100vh;
  }
  .page-header { padding: 0 16px; }
  .pill-group { gap: 8px; }
}
