/* =========================================================
   RESET & VARIABLES
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-fondo:        #FAFAF7;
  --color-texto:        #1F2933;
  --color-texto-suave:  #6B7280;
  --color-principal:    #4F46E5;
  --color-acento:       #FF7A59;
  --color-tarjeta:      #FFFFFF;
  --color-borde:        #E5E7EB;
  --color-error:        #DC2626;
  --transition-speed:   200ms;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  overflow-y: auto;
  background: var(--color-fondo);
  color: var(--color-texto);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   BARRA DE PROGRESO
   ========================================================= */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 4px;
  background: var(--color-principal);
  width: 0%;
  transition: width 300ms ease-out;
  z-index: 100;
  border-radius: 0 2px 2px 0;
}

/* =========================================================
   CONTENEDOR GENERAL
   ========================================================= */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* =========================================================
   PANTALLAS
   ========================================================= */
.screen {
  position: absolute;
  width: 100%;
  max-width: 480px;
  padding: 24px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px);
  transition: opacity 250ms ease, transform 250ms ease;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
  position: relative;
  min-height: 100dvh;
  justify-content: center;
  padding-top: 48px;
  padding-bottom: 48px;
}


.screen.exit {
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
  .screen, .screen.exit {
    transition: opacity 100ms ease !important;
    transform: none !important;
  }
  #progress-bar { transition: none !important; }
}

/* =========================================================
   BOTÓN VOLVER
   ========================================================= */
.btn-back {
  position: fixed;
  top: 18px; left: 18px;
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--color-texto-suave);
  transition: background 150ms, color 150ms;
  z-index: 10;
}
.btn-back:hover { background: var(--color-borde); color: var(--color-texto); }
.btn-back svg { width: 22px; height: 22px; }

/* =========================================================
   TIPOGRAFÍA
   ========================================================= */
.screen-intro .titulo {
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-texto);
}

.screen-pregunta .pregunta {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-texto);
}

.cuerpo {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-texto-suave);
}

.hint {
  font-size: 13px;
  color: var(--color-texto-suave);
  text-align: center;
  min-height: 18px;
}

/* =========================================================
   TARJETAS DE OPCIÓN
   ========================================================= */
.opciones {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.opcion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--color-borde);
  background: var(--color-tarjeta);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--color-texto);
  text-align: left;
  transition: border-color 150ms, background 150ms, opacity 150ms;
  font-family: inherit;
}

.opcion:hover:not(:disabled) {
  border-color: #D1D5DB;
  background: #F9FAFB;
}

.opcion.seleccionada {
  border-color: var(--color-acento);
  background: rgba(255, 122, 89, 0.08);
}

.opcion:disabled:not(.seleccionada) {
  opacity: 0.4;
  cursor: not-allowed;
}

.opcion .check-icon {
  width: 22px; height: 22px;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0);
  transition: opacity 200ms, transform 200ms;
  color: var(--color-acento);
}

.opcion.seleccionada .check-icon {
  opacity: 1;
  transform: scale(1);
}

/* =========================================================
   BOTÓN PRINCIPAL
   ========================================================= */
.btn-primary {
  height: 52px;
  border-radius: 12px;
  background: var(--color-acento);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: opacity 150ms, transform 100ms;
  letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* =========================================================
   DISCLAIMER
   ========================================================= */
.disclaimer {
  font-size: 12px;
  color: var(--color-texto-suave);
  text-align: center;
  line-height: 1.5;
}

/* =========================================================
   TEXTAREA
   ========================================================= */
.textarea-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.textarea-wrap textarea {
  width: 100%;
  min-height: 52px;
  max-height: 120px;
  resize: vertical;
  border: 1.5px solid var(--color-borde);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  color: var(--color-texto);
  background: var(--color-tarjeta);
  outline: none;
  transition: border-color 150ms;
  line-height: 1.5;
}

.textarea-wrap textarea:focus {
  border-color: var(--color-principal);
}

.contador {
  font-size: 13px;
  color: var(--color-texto-suave);
  text-align: right;
}

/* =========================================================
   INPUT CONTACTO
   ========================================================= */
.input-contacto {
  margin-top: 6px;
  padding: 14px 16px;
  border: 1.5px solid var(--color-borde);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--color-texto);
  background: var(--color-tarjeta);
  width: 100%;
  outline: none;
  transition: border-color 150ms;
}

.input-contacto:focus { border-color: var(--color-principal); }

/* =========================================================
   PANTALLA CIERRE
   ========================================================= */
.screen-cierre {
  text-align: center;
  align-items: center;
}

.check-bounce {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.1);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-principal);
  opacity: 0;
  transform: scale(0);
}

.check-bounce.show {
  animation: bounce-in 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounce-in {
  0%   { opacity: 0; transform: scale(0); }
  60%  { opacity: 1; transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .check-bounce.show {
    animation: none;
    opacity: 1;
    transform: scale(1);
  }
}

.screen-cierre .titulo {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 700;
}

/* =========================================================
   ERROR BANNER
   ========================================================= */
.error-banner {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--color-error);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  display: none;
  gap: 8px;
  align-items: flex-start;
}
.error-banner.visible { display: flex; }

/* =========================================================
   SELECT PROVINCIA
   ========================================================= */
.select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-provincia {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1.5px solid var(--color-borde);
  border-radius: 14px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  color: var(--color-texto);
  background: var(--color-tarjeta);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 20px;
  padding-right: 44px;
  transition: border-color 150ms;
}

.select-provincia:focus {
  border-color: var(--color-principal);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (min-width: 480px) {
  .screen { padding: 32px 40px 40px; }
}
