/* ============================================================
   Componentes reutilizables: stepper, botones, cards, pills.
   ============================================================ */

/* --- Stepper de pasos --- */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.stepper__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.stepper__dot {
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  background: var(--surface);
  color: var(--ink-3);
  border: 2px solid var(--line-strong);
  transition: all var(--t);
  flex-shrink: 0;
}

.stepper__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}

.stepper__line {
  width: 28px;
  height: 2px;
  background: var(--line-strong);
  border-radius: var(--r-pill);
  transition: background var(--t);
}

.stepper__item.is-active .stepper__dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.stepper__item.is-active .stepper__label {
  color: var(--ink);
}
.stepper__item.is-done .stepper__dot {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface); /* invierte con el tema: legible en claro y oscuro */
}
.stepper__item.is-done + .stepper__line,
.stepper__item.is-active + .stepper__line {
  background: var(--brand);
}

@media (max-width: 720px) {
  .stepper__label {
    display: none;
  }
  .stepper__line {
    width: 20px;
  }
}

/* --- Badge de modo desarrollo (solo localhost) --- */
.dev-badge {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 200;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  background: #b0002e;
  padding: 4px 8px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-md);
  opacity: 0.75;
  pointer-events: none;
  user-select: none;
}
.dev-mode .stepper__item {
  cursor: pointer;
}

/* --- Botón tipo link (ej. "Comparar planes") --- */
.link-btn {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: var(--sp-1);
}
.link-btn:hover {
  color: var(--brand-strong);
}

/* --- Tabla comparativa de planes (modal) --- */
.compara-wrap {
  overflow-x: auto;
}
.compara {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.compara th,
.compara td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}
.compara thead th {
  color: var(--ink);
  font-weight: 800;
  border-bottom: 2px solid var(--line-strong);
  white-space: nowrap;
}
.compara th:first-child,
.compara td:first-child {
  text-align: left;
  color: var(--ink-2);
  font-weight: 600;
}
.compara__si {
  color: var(--ok);
  font-weight: 800;
  font-size: var(--fs-md);
}
.compara__no {
  color: var(--ink-3);
}
.compara .is-brand {
  color: var(--brand);
  font-weight: 700;
}
/* En celular la tabla se compacta para entrar sin scroll horizontal. */
@media (max-width: 560px) {
  .modal {
    padding: var(--sp-6) var(--sp-3) var(--sp-4); /* menos margen lateral = más ancho útil */
  }
  .compara {
    table-layout: fixed;
  }
  .compara th,
  .compara td {
    padding: 7px 3px;
    font-size: var(--fs-xs);
    word-break: break-word;
  }
  .compara thead th {
    font-size: 0.66rem;
    letter-spacing: -0.01em;
  }
  .compara th:first-child,
  .compara td:first-child {
    width: 38%;
    padding-right: var(--sp-2);
  }
  .compara__si {
    font-size: var(--fs-sm);
  }
}

/* --- Barra de resumen en vivo (pasos intermedios) --- */
#resumen-bar {
  display: none;
}
#resumen-bar.is-on {
  display: block;
  position: sticky;
  top: var(--header-h);
  z-index: 15;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-4);
}
.resumen-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
}
.resumen-bar__item {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.resumen-bar__lbl {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.resumen-bar__val {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink);
}
.resumen-bar__item.is-precio {
  margin-left: auto;
  text-align: right;
}
.resumen-bar__item.is-precio .resumen-bar__val {
  color: var(--brand);
  font-size: var(--fs-md);
}
@media (max-width: 560px) {
  .resumen-bar__inner {
    gap: var(--sp-1) var(--sp-4);
    padding: var(--sp-2) var(--sp-3);
  }
  .resumen-bar__item.is-precio {
    margin-left: auto;
  }
}

/* --- Barra de confianza (pantalla 1) --- */
/* Vive en el <footer> de la app, no dentro de la pantalla 1: queda siempre
   en el mismo lugar y no se corre al aparecer las tarjetas de servicio. */
.app-footer {
  margin-top: var(--sp-6);
  padding: var(--sp-5) 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.trust-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--sp-3) var(--sp-5);
}
.trust-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
}
.trust-item__ic {
  display: inline-flex;
  color: var(--brand);
}
.trust-item__ic svg {
  width: 18px;
  height: 18px;
}

/* --- Pantalla de cierre (post-pago) --- */
.exito {
  text-align: center;
  padding-top: var(--sp-6);
}
.exito__badge {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  animation: badgePop 0.5s cubic-bezier(0.22, 1.4, 0.4, 1) both;
}
.exito__badge.is-ok { background: var(--ok); }
.exito__badge.is-wait { background: #b26a00; }
.exito__badge.is-err { background: var(--danger); }
@keyframes badgePop {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: none; }
}
.exito__title {
  margin-top: var(--sp-4);
  font-size: var(--fs-xl);
}
.exito__lead {
  color: var(--ink-2);
  max-width: 480px;
  margin: var(--sp-3) auto 0;
  line-height: 1.5;
}
/* Tarjeta de resumen dentro de la pantalla de éxito. */
.resumen-card {
  text-align: left;
  max-width: 440px;
  margin: var(--sp-5) auto 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
}
.resumen__titulo {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: var(--sp-2);
}
.resumen__row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--fs-sm);
}
.resumen__label {
  color: var(--ink-3);
  flex-shrink: 0;
}
.resumen__val {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}
.resumen__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 2px solid var(--line-strong);
  font-weight: 700;
}
.resumen__total b {
  font-size: var(--fs-lg);
  color: var(--brand);
}

.exito__pasos {
  list-style: none;
  padding: 0;
  margin: var(--sp-5) auto 0;
  max-width: 440px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.exito__pasos li {
  position: relative;
  padding-left: 30px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  line-height: 1.4;
}
.exito__pasos li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: var(--r-pill);
  background: var(--brand-tint)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b0002e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}

/* --- Titulos de seccion --- */
.section-title {
  text-align: center;
  margin-bottom: var(--sp-4);
}
.section-title p {
  font-size: var(--fs-sm);
}
.section-title h2 {
  font-size: var(--fs-xl);
}
.section-title p {
  color: var(--ink-2);
  margin-top: var(--sp-2);
}
.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-tint);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-pill);
  margin-bottom: var(--sp-3);
}

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-weight: 700;
  font-size: var(--fs-md);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r-pill);
  transition: transform var(--t-fast), box-shadow var(--t), background var(--t),
    opacity var(--t);
}
.btn:active {
  transform: translateY(1px) scale(0.99);
}
.btn--primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover {
  background: var(--brand-strong);
}
.btn--primary:disabled {
  background: var(--line-strong);
  color: var(--ink-3);
  box-shadow: none;
  cursor: not-allowed;
}
.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn--ghost:hover {
  border-color: var(--ink-3);
}
.btn--lg {
  padding: var(--sp-4) var(--sp-7);
  font-size: var(--fs-lg);
}

/* --- Barra de navegacion inferior --- */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}
.step-nav--end {
  justify-content: flex-end;
  min-height: 56px; /* reserva el lugar del botón para que no salte el layout */
}
/* El botón "Siguiente" aparece recién cuando el paso está completo. */
.step-nav--end .btn {
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity var(--t), transform var(--t), background var(--t);
}
.step-nav--end .btn.is-ready {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Botón que aparece con transición cuando el paso se completa
   (sin ocultar a sus vecinos, p. ej. el "Volver"). */
.btn--reveal {
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity var(--t), transform var(--t), background var(--t);
}
.btn--reveal.is-ready {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* --- Segmented control (vehiculos) --- */
.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--sp-3);
  max-width: 560px;
  margin-inline: auto;
  margin-bottom: var(--sp-5);
}

.segmented__btn {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-weight: 600;
  transition: all var(--t);
}
.segmented__btn i {
  font-size: 22px;
  color: var(--ink-3);
  transition: color var(--t), transform var(--t);
}
.segmented__btn:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.segmented__btn:hover i {
  transform: scale(1.08);
}
.segmented__btn.is-selected {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-ink);
  box-shadow: var(--shadow-md);
}
.segmented__btn.is-selected i {
  color: var(--brand);
  transform: scale(1.12);
}

/* --- Cards de planes --- */
/* Sección de planes: oculta hasta elegir vehículo (y tonelada en camión). */
.planes-section {
  display: none;
}
.planes-section.is-visible {
  display: block;
  animation: fadeIn var(--t) both;
}
/* Las cards entran escalonadas (el delay lo pone el JS por índice). */
.planes-section.is-visible .plan {
  animation: planIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes planIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.plans {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: var(--sp-4);
}
.plan {
  flex: 1 1 300px;
  max-width: 340px;
}
@media (max-width: 860px) {
  .plan {
    flex-basis: 100%;
    max-width: 440px;
  }
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  cursor: pointer;
  transition: all var(--t);
  text-align: left;
}
.plan:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.plan.is-selected {
  border-color: var(--brand);
  box-shadow: var(--shadow-lg), 0 0 0 4px var(--brand-tint);
}
.plan.is-selected::after {
  content: "✓";
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.plan__badge {
  position: absolute;
  top: calc(-1 * var(--sp-3));
  left: var(--sp-4);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  /* Todas las etiquetas van con fondo bordo (antes la de STOPCLICK iba en
     negro y solo la de STOPSAT en color). */
  background: var(--brand);
  color: #fff; /* siempre blanco: el fondo de marca es rojo en ambos temas */
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-pill);
}

/* Plan recomendado: realce sutil permanente que no compite con el estado
   seleccionado (que usa borde pleno de marca + sombra). */
.plan--destacado {
  border-color: var(--brand-tint);
  box-shadow: var(--shadow-md);
}
.plan--destacado.is-selected {
  border-color: var(--brand);
}

.plan__name {
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
  /* El nombre va entero en bordo (antes solo la segunda mitad: STOP en negro
     y SAT/CLICK en color). */
  color: var(--brand);
}
.plan__name b {
  color: inherit;
}

.plan__price {
  margin-top: var(--sp-2);
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}
.plan__amount {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.plan__period {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  font-weight: 600;
}
/* Asterisco al lado del precio: remite a la aclaracion del pie. */
.plan__ref {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-3);
  align-self: flex-start;
  line-height: 1;
}

/* Aclaracion al pie de la tarjeta (letra chica). Se renderiza siempre (vacia
   con &nbsp;) y va pegada abajo, para que todas las cards queden parejas. */
.plan__pie {
  margin-top: auto;
  padding-top: var(--sp-3);
  font-size: var(--fs-xs);
  line-height: 1.3;
  color: var(--ink-3);
  min-height: 1.3em;
}

.plan__desc {
  margin-top: var(--sp-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: 1.35;
  /* Dos renglones fijos: descripciones de distinto largo no desalinean las features. */
  min-height: 2.7em;
}

.plan__features {
  list-style: none;
  padding: var(--sp-3) 0 0;
  margin-top: var(--sp-3);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.plan__features li {
  display: flex;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  line-height: 1.3;
}
.plan__features li::before {
  content: "";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: var(--r-pill);
  background: var(--ok-tint)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2312805C' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}

/* --- Modal / pop-up --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 24, 31, 0.5);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  z-index: 100;
  opacity: 0;
  transition: opacity var(--t);
}
.modal-overlay.is-open {
  opacity: 1;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(0.97);
  transition: transform var(--t);
}
.modal-overlay.is-open .modal {
  transform: none;
}
.modal__close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  transition: background var(--t), color var(--t);
}
.modal__close:hover {
  background: var(--bg);
  color: var(--ink);
}
.modal__title {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}
.modal__lead {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}

/* --- Skeleton (carga de precios) --- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--line) 25%,
    var(--surface-2) 37%,
    var(--line) 63%
  );
  background-size: 400% 100%;
  border-radius: var(--r-sm);
  animation: shimmer 1.4s ease infinite;
  color: transparent !important;
}
@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* --- Sticker de beneficio en la tarjeta de plan ---
   Hoy lo usa STOPSAT en moto ("Instalación bonificada"): en moto no hay
   opción de pago mensual, así que se destaca que la instalación no se cobra. */
.plan__sticker {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  align-self: flex-start;
  margin-top: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-pill);
  background: var(--ok-tint);
  color: var(--ok);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.plan__sticker__ic {
  display: inline-flex;
  width: 13px;
  height: 13px;
}
.plan__sticker__ic svg {
  width: 100%;
  height: 100%;
}

/* --- Reseña al pie del modal "Comparación de planes" --- */
.resena {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.resena__item {
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2, var(--surface));
}
.resena__titulo {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--brand);
}
.resena__texto {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--ink-2);
}

/* Paso sin vuelta atrás (Turno): queda un solo botón y va a la derecha.
   A diferencia de .step-nav--end, no lo esconde hasta completar el paso. */
.step-nav--solo {
  justify-content: flex-end;
}

/* --- Casilla del captcha (paso 2) ---
   El widget de Google mide 304px fijos: en pantallas angostas se achica con
   transform (no acepta ancho por CSS) para que no desborde la tarjeta. */
.captcha {
  display: flex;
  justify-content: center;
  margin-top: var(--sp-4);
  min-height: 78px; /* reserva el lugar: el widget entra asincrónico */
}
@media (max-width: 360px) {
  .captcha > div {
    transform: scale(0.85);
    transform-origin: center top;
  }
}
