/* ============================================================
   Reset moderno + estilos globales de base.
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--brand);
  text-decoration: none;
}

h1,
h2,
h3 {
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.01em;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--brand-tint); /* anillo visible en cualquier fondo/tema */
  border-radius: var(--r-sm);
}

/* --- Layout raiz --- */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

/* --- Temporizador del turno (barra fija arriba) --- */
.turno-timer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: 42px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding-inline: var(--sp-4);
  /* Color fijo (no atado a --ink) para que se vea igual de bien en claro y oscuro. */
  background: #1F2635;
  color: #fff;
  border-bottom: 2px solid var(--brand);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}
.turno-timer.is-visible {
  display: flex;
}
.turno-timer__ic {
  display: inline-flex;
}
.turno-timer__ic svg {
  width: 17px;
  height: 17px;
}
.turno-timer__t {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  min-width: 3.5ch;
}
.turno-timer.is-urgente {
  background: var(--brand);
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
  50% { opacity: 0.82; }
}
/* Cuando el timer está visible, empujamos todo hacia abajo y el header
   sticky queda justo debajo de la barra (sin superponerse). */
body.con-timer {
  padding-top: 42px;
}
body.con-timer .app-header {
  top: 42px;
}

/* --- Header --- */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  height: 30px;
  width: auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.header-note {
  font-size: var(--fs-sm);
  color: var(--ink-3);
}
.theme-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: color var(--t), border-color var(--t), background var(--t), transform var(--t-fast);
}
.theme-toggle:hover {
  color: var(--brand);
  border-color: var(--brand);
  transform: rotate(-15deg);
}

/* --- Main --- */
.app-main {
  flex: 1;
  padding-block: var(--sp-5) var(--sp-6);
}

/* --- Ajustes mobile --- */
@media (max-width: 560px) {
  .container {
    padding-inline: var(--sp-4);
  }
  .header-note {
    display: none; /* dejamos solo logo + switch, sin apretar el header */
  }
  .section-title h2 {
    font-size: var(--fs-lg);
  }
  .app-main {
    padding-block: var(--sp-4) var(--sp-5);
  }
  /* CTA siempre a mano: la barra de navegación queda fija abajo. */
  .step-nav {
    position: sticky;
    bottom: 0;
    z-index: 12;
    margin-top: var(--sp-4);
    padding: var(--sp-3) 0 calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    box-shadow: 0 -6px 14px rgba(0, 0, 0, 0.10);
  }
  .step-nav--end {
    min-height: 0;
  }
}
@media (max-width: 440px) {
  /* Segmented de vehículos: ícono arriba del texto para que entren los 3. */
  .segmented {
    gap: var(--sp-2);
  }
  .segmented__btn {
    flex-direction: column;
    gap: var(--sp-1);
    padding: var(--sp-3) var(--sp-2);
    font-size: var(--fs-xs);
  }
  /* Fotos de documentación: una por fila. */
  .uploads-grid {
    grid-template-columns: 1fr;
  }
  /* Turno: opciones sucursal/domicilio apiladas. */
  .radio-cards--2 {
    grid-template-columns: 1fr;
  }
}

/* --- Utilidades --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.fade-in {
  animation: fadeIn var(--t) both;
}

/* Entrada de cada pantalla al navegar entre pasos (fade + slide + zoom sutil). */
.screen-enter {
  animation: screenIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  transform-origin: top center;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(28px) scale(0.975); }
  60% { opacity: 1; }
  to { opacity: 1; transform: none; }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
