/* =====================================================================
   Finahogar — Encuesta (Wizard)
   Layout profesional 2-columnas con branding, navegación por pasos,
   revisión y pantalla de éxito. Tipografía: Fraunces + Inter.
   ===================================================================== */

:root {
  /* Paleta principal (teal Finahogar) */
  --teal-50:  #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;

  /* Neutros */
  --ink-950: #020617;
  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-200: #e2e8f0;
  --ink-100: #f1f5f9;
  --ink-50:  #f8fafc;

  --danger: #dc2626;
  --warn:   #f59e0b;
  --ok:     #059669;

  /* Tipografía */
  --font-serif: 'Fraunces', 'DM Serif Display', Georgia, serif;
  --font-sans:  'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;

  /* Geometría */
  --radius:    16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow:    0 10px 25px -10px rgba(15, 118, 110, .18),
               0 4px 10px -6px rgba(15, 23, 42, .05);
  --shadow-lg: 0 25px 50px -12px rgba(15, 118, 110, .25);
}

/* ---------- Reset básico / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--ink-50);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; color: var(--ink-900); }
p  { margin: 0 0 .8em; }
img, svg { max-width: 100%; display: block; }
button { font-family: inherit; }
.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;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  position: fixed; left: 1rem; top: 1rem;
  width: auto; height: auto; padding: .75rem 1rem;
  background: var(--teal-700); color: #fff;
  border-radius: 8px; z-index: 100;
}

/* ======================================================================
   LAYOUT PRINCIPAL (2 columnas en desktop)
   ====================================================================== */
.app {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}
@media (min-width: 960px) {
  .app {
    grid-template-columns: minmax(320px, 380px) 1fr;
  }
}

/* ======================================================================
   SIDEBAR (marca + pasos + premio)
   ====================================================================== */
.sidebar {
  position: relative;
  padding: 2rem 2rem 2.5rem;
  color: #ecfeff;
  overflow: hidden;
  background:
    radial-gradient(500px 300px at 0% 100%, rgba(20, 184, 166, .35), transparent 60%),
    radial-gradient(500px 300px at 100% 0%, rgba(94, 234, 212, .22), transparent 60%),
    linear-gradient(160deg, #0b3a36 0%, #0f766e 50%, #115e59 100%);
}
@media (min-width: 960px) {
  .sidebar {
    position: sticky; top: 0; height: 100vh;
    padding: 2.5rem 2.25rem;
    display: flex; flex-direction: column;
  }
}
/* Patrón sutil decorativo */
.sidebar::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .5;
  pointer-events: none;
}

.brand {
  display: flex; align-items: center; gap: .75rem;
  position: relative; z-index: 1;
}
.brand img, .brand svg {
  height: 44px;
  width: auto;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 6px 12px;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .35);
  display: block;
}

.sidebar-intro {
  position: relative; z-index: 1;
  margin-top: 2rem;
}
.eyebrow {
  display: inline-block;
  font-size: .72rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase;
  padding: .3rem .65rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  color: #ecfeff;
}
.sidebar-intro h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.55rem, 2.2vw + .8rem, 2.15rem);
  line-height: 1.12;
  color: #ffffff;
  margin: 1rem 0 .6rem;
  letter-spacing: -.02em;
}
.sidebar-intro h1 em {
  font-style: italic;
  color: var(--teal-200);
  font-weight: 500;
}
.sidebar-intro p {
  color: #cffafe;
  font-size: .95rem;
  line-height: 1.55;
  opacity: .95;
}

/* ----- Lista de pasos (escritorio) ----- */
.steps {
  list-style: none;
  margin: 2rem 0 0; padding: 0;
  position: relative; z-index: 1;
  display: none;
}
@media (min-width: 960px) {
  .steps { display: block; }
}
.steps li {
  position: relative;
  display: flex; align-items: center; gap: .85rem;
  padding: .75rem 0;
  color: #99f6e4;
  opacity: .75;
  transition: opacity .2s ease, color .2s ease;
}
.steps li .dot {
  width: 28px; height: 28px; border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700;
  background: rgba(255,255,255,.04);
  flex-shrink: 0;
  transition: all .2s ease;
}
.steps li .label {
  font-size: .92rem;
  font-weight: 500;
}
.steps li.is-active { opacity: 1; color: #fff; }
.steps li.is-active .dot {
  background: #fff; color: var(--teal-700);
  border-color: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.12);
}
.steps li.is-done { opacity: .85; color: var(--teal-200); }
.steps li.is-done .dot {
  background: var(--teal-300); color: var(--teal-900);
  border-color: var(--teal-300);
}
.steps li.is-done .dot::before {
  content: "\2713";
  font-size: .9rem; font-weight: 800;
}
.steps li.is-done .dot span { display: none; }
/* Línea entre pasos */
.steps li + li::before {
  content: "";
  position: absolute; left: 13px; top: -18px; height: 18px;
  width: 2px; background: rgba(255,255,255,.15);
}

/* ----- Tarjeta del premio ----- */
.prize-card {
  position: relative; z-index: 1;
  margin-top: auto;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  padding: 1rem;
  backdrop-filter: blur(6px);
}
.prize-card svg { border-radius: 10px; background: linear-gradient(160deg, #ecfeff, #f0fdfa); }
.prize-card .prize-copy {
  margin-top: .75rem;
  font-size: .82rem;
  color: #d1fae5;
  line-height: 1.45;
}
.prize-card strong { color: #fff; font-weight: 700; }

.trust-row {
  margin-top: 1rem;
  display: flex; flex-wrap: wrap; gap: .45rem;
  position: relative; z-index: 1;
}
.trust-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600;
  padding: .35rem .6rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: #ecfeff;
}

/* ======================================================================
   MAIN / WIZARD
   ====================================================================== */
.main {
  display: flex; flex-direction: column;
  background: #fff;
}
.wizard {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 6rem;
  flex: 1;
}
@media (min-width: 960px) {
  .wizard { padding: 3.5rem 3rem 7rem; }
}

/* Barra de progreso superior (visible sobre todo en móvil) */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ink-200);
  background: #fff;
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand-mini {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-900);
}
.topbar .brand-mini em { color: var(--teal-700); font-style: italic; }
.topbar .progress-num {
  font-size: .82rem;
  color: var(--ink-500);
  font-weight: 600;
}
.topbar .progress-num strong { color: var(--teal-700); font-size: 1rem; }
@media (min-width: 960px) {
  .topbar { display: none; }
}

.progress-bar {
  height: 4px; width: 100%;
  background: var(--ink-200);
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-700));
  width: 0%;
  transition: width .4s ease;
}

/* ----- Paneles de paso ----- */
.step-panel {
  display: none;
  animation: slideIn .35s ease both;
}
.step-panel.is-active { display: block; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .step-panel { animation: none; }
}

.step-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--ink-100);
}
.step-eyebrow {
  display: inline-block;
  font-size: .72rem; font-weight: 700;
  color: var(--teal-700);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: .6rem;
}
.step-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.6rem, 1.3vw + 1.1rem, 2.1rem);
  line-height: 1.15;
  color: var(--ink-900);
  letter-spacing: -0.02em;
}
.step-title em { font-style: italic; color: var(--teal-700); font-weight: 500; }
.step-subtitle {
  margin-top: .5rem;
  color: var(--ink-600);
  font-size: 1rem;
}

/* ----- Campos ----- */
.field { margin-bottom: 1.5rem; }
.field > .label,
.field > legend.label {
  display: block;
  font-weight: 600;
  color: var(--ink-800);
  font-size: .95rem;
  margin-bottom: .65rem;
}
.field.is-required > .label::after,
.field.is-required > legend.label::after {
  content: " *"; color: var(--danger);
}
.field .help {
  font-size: .82rem;
  color: var(--ink-500);
  margin-top: .45rem;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .field-row.cols-2 { grid-template-columns: 1fr 1fr; }
}

/* Inputs de texto / textarea */
.input, .textarea {
  width: 100%;
  padding: .8rem 1rem;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 1rem;
  color: var(--ink-900);
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:hover, .textarea:hover { border-color: var(--teal-300); }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  background: #f8fffd;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, .15);
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

/* Fieldset — sin borde feo por defecto */
.options {
  border: 0; padding: 0; margin: 0;
}

/* Opciones tipo tarjeta */
.option-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: .55rem;
  margin: 0; padding: 0;
}
.option-list.cols-2 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .option-list.cols-2 { grid-template-columns: 1fr 1fr; }
}

.option {
  position: relative;
  display: flex; align-items: center; gap: .8rem;
  padding: .85rem 1rem;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-700);
  font-size: .96rem;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.option:hover {
  border-color: var(--teal-400);
  background: var(--teal-50);
  color: var(--ink-900);
}
.option input[type="radio"],
.option input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--teal-600);
  flex-shrink: 0; cursor: pointer;
}
.option:has(input:checked) {
  border-color: var(--teal-600);
  background: var(--teal-50);
  color: var(--ink-900);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}
.option:focus-within {
  outline: 2px solid var(--teal-600);
  outline-offset: 2px;
}

/* ----- Callout (info) ----- */
.callout {
  background: linear-gradient(180deg, #f0fdfa, #ecfeff);
  border: 1px solid var(--teal-200);
  border-left: 4px solid var(--teal-600);
  padding: 1rem 1.15rem;
  border-radius: 12px;
  color: var(--ink-700);
  font-size: .95rem;
  line-height: 1.55;
}
.callout strong { color: var(--teal-700); }

/* ----- Checkbox de consentimiento ----- */
.consent-option {
  background: var(--ink-50);
  border: 1.5px solid var(--ink-200);
  border-radius: 12px;
  padding: .9rem 1rem;
  align-items: flex-start;
  gap: .75rem;
  line-height: 1.55;
  font-size: .95rem;
  color: var(--ink-700);
  transition: border-color .15s, background .15s;
}
.consent-option:hover {
  border-color: var(--teal-400);
  background: var(--teal-50);
}
.consent-option input[type="checkbox"] {
  margin-top: .2rem;
  flex-shrink: 0;
}
.has-error .consent-option {
  border-color: var(--danger);
  background: #fff5f5;
}

/* ----- Caja asesor ----- */
.contact-box {
  background: linear-gradient(180deg, #eff6ff, #eef2ff);
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 1.15rem;
}
.contact-box .label { color: #1e3a8a; }

/* ----- Navegación del wizard ----- */
.wizard-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--ink-200);
}
.wizard-nav .left { font-size: .82rem; color: var(--ink-500); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  padding: .85rem 1.6rem;
  border-radius: 12px;
  font-weight: 600; font-size: .98rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
}
.btn:focus-visible {
  outline: 3px solid var(--teal-300);
  outline-offset: 3px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--teal-700), var(--teal-600));
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(13, 148, 136, .7);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 14px 26px -12px rgba(13, 148, 136, .8);
}
.btn-primary.is-loading .btn-label::after {
  content: ""; display: inline-block;
  width: 1em; height: 1em; margin-left: .5em;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
  vertical-align: -.18em;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
  background: transparent;
  color: var(--ink-700);
  border-color: var(--ink-200);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--ink-100);
  border-color: var(--ink-300);
}

.btn-big { padding: 1rem 1.8rem; font-size: 1.02rem; }

/* Error inline */
.field-error {
  display: none;
  margin-top: .45rem;
  font-size: .85rem;
  color: var(--danger);
  font-weight: 500;
}
.field.has-error .input,
.field.has-error .textarea { border-color: var(--danger); background: #fef2f2; }
.field.has-error .field-error,
fieldset.field.has-error .field-error { display: block; }
fieldset.field.has-error > .label,
fieldset.field.has-error > legend.label { color: var(--danger); }
fieldset.field.has-error .option { border-color: var(--danger); }
.field.has-error .ts-control { border-color: var(--danger) !important; background: #fef2f2 !important; }

/* ======================================================================
   REVIEW (paso final antes del submit)
   ====================================================================== */
.review-grid {
  display: grid; gap: .7rem;
  margin-bottom: 1.5rem;
}
.review-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem 1rem;
  padding: .85rem 1rem;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
}
.review-item dt {
  font-size: .8rem;
  color: var(--ink-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.review-item dd {
  margin: 0;
  color: var(--ink-900);
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}
.review-item .edit-link {
  grid-column: 2;
  justify-self: end;
  font-size: .75rem;
  color: var(--teal-700);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  background: none; border: 0; padding: 0;
}
.review-item .edit-link:hover { color: var(--teal-900); }
.review-item dd .muted { color: var(--ink-400); font-style: italic; font-weight: 400; }

/* ======================================================================
   ÉXITO (pantalla final)
   ====================================================================== */
.success {
  position: relative;
  text-align: center;
  padding: 3rem 2rem;
  max-width: 640px;
  margin: 0 auto;
  animation: popIn .55s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.success-icon {
  width: 84px; height: 84px; margin: 0 auto 1.25rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 16px 32px -10px rgba(13, 148, 136, .55);
}
.success-icon svg { width: 44px; height: 44px; color: #fff; }

.success h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.75rem, 2vw + 1rem, 2.4rem);
  letter-spacing: -.02em;
}
.success h2 em { color: var(--teal-700); font-style: italic; }

.rifa-ticket {
  display: inline-block;
  margin: 1.5rem auto;
  padding: 1.25rem 2rem;
  background: #fff;
  border: 2px dashed var(--teal-500);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.rifa-ticket .rifa-label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--teal-700);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.rifa-ticket .rifa-num {
  display: block;
  margin-top: .3rem;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 7vw, 4.5rem);
  font-weight: 700;
  color: var(--teal-800);
  letter-spacing: .15em;
  line-height: 1;
}

.success-actions {
  display: flex; flex-wrap: wrap; gap: .65rem; justify-content: center;
  margin-top: 1.75rem;
}

/* Confetti decorativo (puro CSS) */
.confetti {
  pointer-events: none;
  position: absolute; inset: 0;
  overflow: hidden;
}
.confetti i {
  position: absolute; top: -10px;
  width: 8px; height: 12px;
  opacity: .85;
  animation: fall 2.8s ease-in forwards;
}
.confetti i:nth-child(1)  { left: 8%;  background: #fde047; animation-delay:.05s; }
.confetti i:nth-child(2)  { left: 18%; background: #0d9488; animation-delay:.2s;  }
.confetti i:nth-child(3)  { left: 30%; background: #fb7185; animation-delay:.1s;  }
.confetti i:nth-child(4)  { left: 42%; background: #14b8a6; animation-delay:.3s;  }
.confetti i:nth-child(5)  { left: 55%; background: #fcd34d; animation-delay:.15s; }
.confetti i:nth-child(6)  { left: 68%; background: #5eead4; animation-delay:.25s; }
.confetti i:nth-child(7)  { left: 78%; background: #f97316; animation-delay:.05s; }
.confetti i:nth-child(8)  { left: 88%; background: #0d9488; animation-delay:.35s; }
.confetti i:nth-child(9)  { left: 95%; background: #fde047; animation-delay:.22s; }
.confetti i:nth-child(10) { left: 4%;  background: #14b8a6; animation-delay:.3s;  }
@keyframes fall {
  0%   { transform: translateY(-20px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(420px) rotate(540deg); opacity: 0; }
}

/* ======================================================================
   Tom Select — acoplar a la marca
   ====================================================================== */
.ts-wrapper.single .ts-control,
.ts-wrapper.multi  .ts-control {
  border: 1.5px solid var(--ink-200) !important;
  border-radius: var(--radius-sm) !important;
  padding: .6rem .85rem !important;
  min-height: 2.9rem;
  background: #fff;
  font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ts-wrapper.single.focus .ts-control,
.ts-wrapper.multi.focus  .ts-control {
  border-color: var(--teal-600) !important;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, .15) !important;
}
.ts-dropdown .active {
  background: var(--teal-50) !important;
  color: var(--teal-800) !important;
}
.ts-dropdown { border-radius: var(--radius-sm) !important; overflow: hidden; }

/* ======================================================================
   Alerta de error
   ====================================================================== */
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  color: #991b1b;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

/* Util */
.hidden { display: none !important; }

/* Footer mínimo */
.foot {
  text-align: center;
  color: var(--ink-500);
  font-size: .82rem;
  padding: 2rem 1rem 3rem;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
