/* ╔════════════════════════════════════════════════════════════════════╗
   ║  TravFriends — Onboarding Wizard v5.4 (stile Velio)                 ║
   ║                                                                      ║
   ║  Design ascetico: bianco/nero/grigio + un solo accento lime.        ║
   ║  Tipografia editoriale Inter Black per i titoli.                    ║
   ║  Step navigabili con dots, animazioni soft.                         ║
   ╚════════════════════════════════════════════════════════════════════*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;900&display=swap');

:root {
  --wz-bg:       #F7F7F5;   /* avorio caldo (non bianco brutale) */
  --wz-card:     #FFFFFF;
  --wz-ink:      #0F0F0F;   /* nero pieno */
  --wz-ink-2:    #2A2A28;
  --wz-mute:     #6B6B68;
  --wz-mute-2:   #9B9B95;
  --wz-line:     #E5E5E0;
  --wz-line-2:   #D0D0C8;
  --wz-lime:     #B3E84A;   /* signature CTA */
  --wz-lime-d:   #95C53A;
  --wz-error:    #DC2626;
  --wz-soft-tint:#EEEEE8;
}

html.tf-dark {
  --wz-bg:    #0A0A0A;
  --wz-card:  #161614;
  --wz-ink:   #F5F5F0;
  --wz-ink-2: #E0E0DA;
  --wz-mute:  #9B9B95;
  --wz-mute-2:#6B6B68;
  --wz-line:  #2A2A26;
  --wz-line-2:#3A3A36;
  --wz-soft-tint:#1C1C1A;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.tfw-body {
  background: var(--wz-bg);
  color: var(--wz-ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ──────────────────────────────────────────────
   Shell wizard
   ────────────────────────────────────────────── */
.tfw-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 22px 0;
}

.tfw-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.tfw-back {
  width: 38px; height: 38px;
  background: var(--wz-card);
  border: 1px solid var(--wz-line);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.12s ease, background 0.15s ease;
  color: var(--wz-ink);
}
.tfw-back:hover { background: var(--wz-soft-tint); }
.tfw-back:active { transform: scale(0.94); }
.tfw-back svg { width: 18px; height: 18px; }
.tfw-back:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

/* Dots progress */
.tfw-dots {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.tfw-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--wz-line-2);
  transition: background 0.25s ease, transform 0.2s ease;
}
.tfw-dot.done { background: var(--wz-ink); }
.tfw-dot.current {
  background: var(--wz-lime);
  transform: scale(1.25);
}

.tfw-skip {
  font-size: 0.84rem; color: var(--wz-mute);
  font-weight: 500;
  background: transparent; border: none; cursor: pointer;
  padding: 6px 10px;
}
.tfw-skip:hover { color: var(--wz-ink); }

/* ──────────────────────────────────────────────
   Body step
   ────────────────────────────────────────────── */
.tfw-body {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 8px 0 24px;
}

.tfw-illustration {
  width: 84px; height: 84px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; line-height: 1;
  user-select: none;
}

.tfw-title {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: clamp(1.7rem, 5.5vw, 2.1rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--wz-ink);
  text-align: center;
  margin-bottom: 10px;
  max-width: 340px;
  margin-left: auto; margin-right: auto;
}

.tfw-sub {
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--wz-mute);
  text-align: center;
  margin-bottom: 28px;
  max-width: 320px;
  margin-left: auto; margin-right: auto;
}

.tfw-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ──────────────────────────────────────────────
   Input field (email / password / nome / age)
   ────────────────────────────────────────────── */
.tfw-field {
  margin-bottom: 16px;
}
.tfw-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--wz-mute);
  margin-bottom: 8px;
  display: block;
}
.tfw-input {
  width: 100%;
  background: var(--wz-soft-tint);
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 16px 18px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--wz-ink);
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.tfw-input:focus {
  border-color: var(--wz-ink);
  background: var(--wz-card);
}
.tfw-input::placeholder { color: var(--wz-mute-2); }
.tfw-input.has-error { border-color: var(--wz-error); }

/* Phone composite */
.tfw-phone-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  background: var(--wz-soft-tint);
  border-radius: 14px;
  padding: 4px 4px 4px 14px;
}
.tfw-phone-row .flag {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.94rem; font-weight: 500;
  color: var(--wz-ink);
  padding: 12px 0;
}
.tfw-phone-row .flag .ic {
  width: 22px; height: 16px; border-radius: 3px;
  background: linear-gradient(to right, #008C45 33%, #fff 33% 66%, #CD212A 66%);
  flex-shrink: 0;
}
.tfw-phone-row input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: inherit; font-size: 1rem; color: var(--wz-ink);
  padding: 12px 8px;
}

/* Social proof badge */
.tfw-social-proof {
  display: flex; align-items: center; gap: 10px;
  background: var(--wz-card);
  border: 1px solid var(--wz-line);
  border-radius: 100px;
  padding: 7px 12px;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--wz-mute);
  font-weight: 500;
  line-height: 1.4;
}
.tfw-social-proof .av-stack { display: flex; }
.tfw-social-proof .av-stack .av {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--wz-card);
  background-size: cover; background-position: center;
  margin-left: -6px;
}
.tfw-social-proof .av-stack .av:first-child { margin-left: 0; }
.tfw-social-proof b { color: var(--wz-ink); font-weight: 700; }

/* ──────────────────────────────────────────────
   Chips (interessi multi-select)
   ────────────────────────────────────────────── */
.tfw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.tfw-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--wz-card);
  border: 1px solid var(--wz-line);
  border-radius: 100px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--wz-ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.tfw-chip:hover { border-color: var(--wz-line-2); }
.tfw-chip:active { transform: scale(0.96); }
.tfw-chip.on {
  background: var(--wz-lime);
  border-color: var(--wz-lime);
  color: var(--wz-ink);
  font-weight: 700;
}
.tfw-chip .ic { font-size: 1rem; line-height: 1; }

.tfw-count-hint {
  text-align: center;
  font-size: 0.82rem;
  color: var(--wz-mute);
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tfw-count-hint .ic {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--wz-mute-2);
}

/* ──────────────────────────────────────────────
   Destination cards (bucket list)
   ────────────────────────────────────────────── */
.tfw-dest-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}
.tfw-dest-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--wz-card);
  border: 1px solid var(--wz-line);
  border-radius: 100px;
  padding: 6px 14px 6px 8px;
  font-size: 0.86rem; font-weight: 500;
  color: var(--wz-ink);
}
.tfw-dest-pill .flag {
  width: 20px; height: 14px; border-radius: 3px;
  background-size: cover; background-position: center;
  flex-shrink: 0;
}
.tfw-dest-pill .x {
  width: 18px; height: 18px;
  background: var(--wz-soft-tint);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--wz-mute);
  font-size: 0.74rem;
  border: none;
  margin-left: 4px;
}

.tfw-add-dest {
  width: 100%;
  background: transparent;
  border: 1.5px dashed var(--wz-line-2);
  border-radius: 16px;
  padding: 16px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--wz-ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-bottom: 18px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.tfw-add-dest:hover {
  background: var(--wz-soft-tint);
  border-color: var(--wz-ink);
}
.tfw-add-dest svg { width: 16px; height: 16px; }

.tfw-might-like-h {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin: 14px 0 12px;
  color: var(--wz-ink);
}

.tfw-dest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tfw-dest-card {
  position: relative;
  aspect-ratio: 16/11;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background-size: cover; background-position: center;
  background-color: var(--wz-soft-tint);
  transition: transform 0.18s ease;
}
.tfw-dest-card:hover { transform: scale(1.02); }
.tfw-dest-card:active { transform: scale(0.98); }
.tfw-dest-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.55) 100%);
}
.tfw-dest-card .name {
  position: absolute; left: 12px; bottom: 10px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.94rem;
  z-index: 1;
  letter-spacing: -0.01em;
}
.tfw-dest-card .flag-dot {
  position: absolute; top: 8px; right: 8px;
  width: 20px; height: 20px; border-radius: 50%;
  background-size: cover; background-position: center;
  border: 2px solid #fff;
  z-index: 1;
}
.tfw-dest-card.selected {
  outline: 3px solid var(--wz-lime);
  outline-offset: -3px;
}
.tfw-dest-card.selected::before {
  content: '';
  position: absolute; top: 8px; left: 8px;
  width: 24px; height: 24px;
  background: var(--wz-lime);
  border-radius: 50%;
  z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%230F0F0F' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px;
}

/* ──────────────────────────────────────────────
   Photo dual cards (group size, travel style)
   ────────────────────────────────────────────── */
.tfw-photo-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tfw-photo-card {
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.2s ease;
}
.tfw-photo-card .ph {
  width: 100%;
  aspect-ratio: 4/5;
  border-radius: 14px;
  background-size: cover; background-position: center;
  background-color: var(--wz-soft-tint);
  margin-bottom: 8px;
  filter: saturate(0.4);
  transition: filter 0.2s ease;
}
.tfw-photo-card .lbl {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--wz-mute);
  line-height: 1.35;
}
.tfw-photo-card:hover .ph { filter: saturate(0.6); }
.tfw-photo-card.on .ph {
  filter: saturate(1);
  outline: 3px solid var(--wz-lime);
  outline-offset: -3px;
}
.tfw-photo-card.on .lbl { color: var(--wz-ink); font-weight: 700; }
.tfw-photo-card:active { transform: scale(0.98); }

/* ──────────────────────────────────────────────
   Welcome step
   ────────────────────────────────────────────── */
.tfw-welcome {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 40px 0;
}
.tfw-welcome .big {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 7vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--wz-ink);
  margin: 16px 0 12px;
}
.tfw-welcome .sub {
  font-size: 1rem;
  color: var(--wz-mute);
  line-height: 1.55;
  max-width: 280px;
  margin: 0 auto 28px;
}

/* ──────────────────────────────────────────────
   CTA primario (sticky bottom)
   ────────────────────────────────────────────── */
.tfw-cta-wrap {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, var(--wz-bg) 30%);
  padding: 20px 0 calc(20px + env(safe-area-inset-bottom, 0px));
  margin-top: auto;
}
.tfw-cta {
  width: 100%;
  background: var(--wz-lime);
  color: var(--wz-ink);
  border: none;
  border-radius: 100px;
  padding: 18px 0;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.04rem;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, transform 0.1s ease;
}
.tfw-cta:hover { background: var(--wz-lime-d); }
.tfw-cta:active { transform: scale(0.97); }
.tfw-cta:disabled {
  background: var(--wz-line);
  color: var(--wz-mute);
  cursor: not-allowed;
  pointer-events: none;
}

.tfw-cta-sub {
  text-align: center;
  font-size: 0.78rem;
  color: var(--wz-mute);
  margin-top: 12px;
  line-height: 1.4;
}
.tfw-cta-sub a { color: var(--wz-ink); font-weight: 600; text-decoration: none; }

/* ──────────────────────────────────────────────
   Errore toast
   ────────────────────────────────────────────── */
.tfw-error-toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
  background: #FFE4E4;
  color: var(--wz-error);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  z-index: 100;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.tfw-error-toast.show {
  opacity: 1; transform: translateY(0);
}

/* ──────────────────────────────────────────────
   Step transitions
   ────────────────────────────────────────────── */
.tfw-step {
  animation: tfwFadeIn 0.32s cubic-bezier(.22,1,.36,1) both;
}
@keyframes tfwFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .tfw-step, .tfw-dest-card, .tfw-photo-card, .tfw-chip { animation: none !important; transition: none !important; }
}
