/* ============================================================
   COTIZADOR EN LÍNEA — configurador (vehículo/plan/crédito/seguro)
   + resumen sticky con cálculo en vivo. Depende de tokens.css.
   Solo se carga en /cotizador-en-linea.
   ============================================================ */

/* Hero compacto (homologado con el de seminuevos) */
.td-hero--sn { min-height: 0; padding-bottom: 28px; }
.td-hero--sn .td-breadcrumb { margin-top: 40px; }
.td-hero--sn .td-hero__subtitle { max-width: 60ch; }

.cz { padding-block: var(--space-6) var(--space-5); }

/* ── Layout: configurador + resumen sticky ── */
.cz__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "config" "summary";
  gap: var(--space-6);
}
.cz__config  { grid-area: config; min-width: 0; }
.cz__summary { grid-area: summary; min-width: 0; }
@media (min-width: 1100px) {
  .cz__layout {
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-areas: "config summary";
    gap: var(--space-6) var(--space-10);
    align-items: start;
  }
  .cz__summary { position: sticky; top: calc(var(--header-height-desktop, 80px) + var(--space-4)); }}

/* ── Bloques del configurador ── */
.cz-block[hidden], .cz-insure[hidden] { display: none; }
.cz-block { margin-bottom: var(--space-8); }
.cz-block__title {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-4);
}
.cz-step {
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-red); color: #fff;
  font-size: var(--text-sm); font-weight: var(--font-weight-bold);
}
.cz-tag {
  font-size: 10px; font-weight: var(--font-weight-bold);
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  border-radius: 999px; padding: 3px 8px;
}

/* ── Modelos: grid de cards con imagen ── */
.cz-models {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: var(--space-2);
}
.cz-model {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  cursor: pointer; text-align: center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}@media (hover: hover){
.cz-model:hover { border-color: var(--text-primary); }}
.cz-model.is-active {
  border-color: var(--color-red);
  box-shadow: 0 0 0 1px var(--color-red);
}
.cz-model img { width: 100%; max-width: 104px; aspect-ratio: 2 / 1; object-fit: contain; }
/* iOS pinta el texto de <button> en azul si no se fija color explícito */
.cz-model, .cz-version, .cz-plan, .cz-insurer, .cz-pill { color: var(--text-primary); -webkit-text-fill-color: currentColor; }
.cz-pill.is-active { color: #fff; -webkit-text-fill-color: #fff; }
.cz-model__name { font-size: var(--text-xs); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-tight); line-height: 1.25; }
.cz-model__price { font-size: 11px; color: var(--text-secondary); }

.cz-years { margin-top: var(--space-4); }

/* ── Versiones: filas con radio ── */
.cz-versions {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-2);
}
.cz-version {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--surface-1); cursor: pointer; text-align: left;
  transition: border-color var(--transition-fast);
}@media (hover: hover){
.cz-version:hover { border-color: var(--text-primary); }}
.cz-version.is-active { border-color: var(--color-red); }
.cz-version__radio {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-default);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.cz-version.is-active .cz-version__radio {
  border-color: var(--color-red);
  box-shadow: inset 0 0 0 4px var(--color-red);
}
.cz-version__name { font-size: var(--text-sm); font-weight: var(--font-weight-medium); }
.cz-version__price { margin-left: auto; font-size: var(--text-sm); font-weight: var(--font-weight-bold); }

/* ── Planes: cards con descripción ── */
.cz-plans { display: flex; flex-direction: column; gap: var(--space-2); }
.cz-plan {
  display: flex; align-items: flex-start; gap: var(--space-3);
  width: 100%; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--surface-1); cursor: pointer; text-align: left;
  transition: border-color var(--transition-fast);
}@media (hover: hover){
.cz-plan:hover { border-color: var(--text-primary); }}
.cz-plan.is-active { border-color: var(--color-red); }
.cz-plan__radio {
  flex: none; width: 18px; height: 18px; border-radius: 50%; margin-top: 2px;
  border: 2px solid var(--border-default);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.cz-plan.is-active .cz-plan__radio {
  border-color: var(--color-red);
  box-shadow: inset 0 0 0 4px var(--color-red);
}
.cz-plan__body { display: flex; flex-direction: column; gap: 2px; }
.cz-plan__name { font-size: var(--text-sm); font-weight: var(--font-weight-bold); }
.cz-plan__desc { font-size: var(--text-xs); color: var(--text-secondary); line-height: var(--leading-normal); }

/* ── Campos de crédito ── */
.cz-field { margin-bottom: var(--space-5); }
.cz-field:last-child { margin-bottom: 0; }
.cz-field__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.cz-field__label { font-size: var(--text-sm); font-weight: var(--font-weight-medium); color: var(--text-primary); display: block; margin-bottom: var(--space-2); }
.cz-field__head .cz-field__label { margin-bottom: 0; }
.cz-field__hint { font-weight: var(--font-weight-regular); color: var(--text-muted); font-size: var(--text-xs); }
.cz-field__out { font-size: var(--text-sm); font-weight: var(--font-weight-bold); }
.cz-field__out span { color: var(--text-muted); font-weight: var(--font-weight-regular); }

/* Slider */
.cz-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 24px; background: none; cursor: pointer; display: block;
}
.cz-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--color-red) var(--fill, 20%), var(--border-default) var(--fill, 20%));
}
.cz-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--border-default); }
.cz-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--color-red); }
.cz-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%; margin-top: -9px;
  background: #fff; border: 2px solid var(--color-red);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.cz-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--color-red);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.cz-range__scale { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

/* Pills (plazo, año, cobertura) */
.cz-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cz-pill {
  padding: 9px 16px;
  border: 1px solid var(--border-default); border-radius: 999px;
  background: var(--surface-1);
  font-size: var(--text-sm); color: var(--text-primary); cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}@media (hover: hover){
.cz-pill:hover { border-color: var(--text-primary); }}
.cz-pill.is-active {
  background: var(--surface-dark-1, #111);
  border-color: var(--surface-dark-1, #111);
  color: #fff;
}
/* Coberturas: pill con sublínea descriptiva */
.cz-pill--cob { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border-radius: var(--radius-md); text-align: left; }
.cz-pill__sub { font-size: 10px; color: var(--text-muted); }
.cz-pill--cob.is-active .cz-pill__sub { color: rgba(255,255,255,.7); }

/* ── Seguro (bloque colapsable opcional) ── */
.cz-insure {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}
.cz-insure .snd-collapse__head { padding: var(--space-4) var(--space-5); }
.cz-insure .cz-block__title--collapse { margin-bottom: 0; font-size: var(--text-md); }
.cz-insure__titlewrap { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-3); min-width: 0; }
.cz-insure__titlewrap .cz-block__title--collapse { line-height: 1.3; }
.cz-insure .snd-collapse__body { padding: 0 var(--space-5) var(--space-5); }
.cz-insure__intro { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-4); }
.cz-insurers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-2);
}
.cz-insurer {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-3);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--surface-1); cursor: pointer; text-align: left;
  transition: border-color var(--transition-fast);
}@media (hover: hover){
.cz-insurer:hover { border-color: var(--text-primary); }}
.cz-insurer.is-active { border-color: var(--color-red); box-shadow: 0 0 0 1px var(--color-red); }
.cz-insurer__name { font-size: var(--text-sm); font-weight: var(--font-weight-bold); }
.cz-insurer__prima { font-size: var(--text-xs); color: var(--text-secondary); }
.cz-insurer__prima span { color: var(--text-muted); }
.cz-insure__remove {
  margin-top: var(--space-4);
  border: 0; background: none; padding: 0; cursor: pointer;
  font-size: var(--text-sm); font-weight: var(--font-weight-medium); color: var(--color-red);
}@media (hover: hover){
.cz-insure__remove:hover { text-decoration: underline; }}

/* ── Colapsable genérico + notas (homologado con seminuevos) ── */
.snd-collapse__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  width: 100%; padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  color: inherit;
}
.snd-collapse__chev { display: grid; place-items: center; color: var(--text-secondary); transition: transform var(--transition-base); flex: none; }
.snd-collapse.is-open .snd-collapse__chev { transform: rotate(180deg); }
.snd-collapse__body { display: none; }
.snd-collapse.is-open > .snd-collapse__body { display: block; }

/* ── Disclaimer final (homologado con .pr-disclaimer de promociones) ── */
.cz-disclaimer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs, 12px);
  line-height: 1.5;
  color: var(--text-tertiary, #999);
}


/* ── Resumen sticky (el "recibo" vivo) ── */
.cz-sum {
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: 0 12px 32px -20px rgba(0,0,0,.25);
}
.cz-sum__head { display: flex; align-items: center; gap: var(--space-3); }
.cz-sum__img { flex: none; width: 96px; aspect-ratio: 2 / 1; object-fit: contain; }
.cz-sum__id { min-width: 0; }
.cz-sum__model { font-size: var(--text-sm); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-tight); }
.cz-sum__version { font-size: var(--text-xs); color: var(--text-secondary); }
.cz-sum__monthly {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: var(--space-3); padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}
.cz-sum__monthly-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.cz-sum__monthly-value {
  font-size: var(--text-2xl, 28px); font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-tight); line-height: 1.1; color: var(--color-red);
}
.cz-sum__monthly-value span { font-size: var(--text-md); color: var(--text-secondary); font-weight: var(--font-weight-regular); }
.cz-sum__monthly-note { font-size: var(--text-xs); color: var(--text-secondary); }
.cz-sum__rows { margin-top: var(--space-3); }
.cz-sum__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4);
  padding: 5px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
}
.cz-sum__row span:first-child { color: var(--text-secondary); }
.cz-sum__row span:last-child { font-weight: var(--font-weight-medium); text-align: right; }
.cz-sum__row--strong span { font-weight: var(--font-weight-bold); color: var(--text-primary); }
.cz-sum__cta { width: 100%; justify-content: center; margin-top: var(--space-3); padding-block: 12px; }
.cz-sum__legal { margin-top: var(--space-2); font-size: 10px; line-height: var(--leading-normal); color: var(--text-muted); }

/* Estado vacío del resumen */
.cz-sum__img--empty { display: block; width: 100%; max-width: 180px; margin: var(--space-2) auto 0; opacity: .5; filter: grayscale(1); }
.cz-sum__empty-title { font-size: var(--text-md); font-weight: var(--font-weight-bold); letter-spacing: var(--tracking-tight); text-align: center; margin-top: var(--space-2); }
.cz-sum__empty-text { font-size: var(--text-sm); color: var(--text-secondary); text-align: center; margin-top: var(--space-1); line-height: var(--leading-normal); }

/* Si aun compacto no cabe (laptops bajas), el panel scrollea por dentro */
@media (min-width: 1100px) {
  .cz-sum { max-height: calc(100vh - var(--header-height-desktop, 80px) - var(--space-4) * 2); overflow-y: auto; }
}

/* ── Barra fija inferior (mobile): mensualidad viva ── */
.cz-bar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: var(--z-sticky, 100);
  align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  background: rgba(10,10,10,.9);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid rgba(255,255,255,.12);
  color: #fff;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 350ms var(--ease-out, ease), opacity 350ms var(--ease-out, ease);
}
.cz-bar.is-visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
.cz-bar__info {
  display: flex; flex-direction: column; min-width: 0;
  position: relative;
  padding: 0 22px 0 0; margin: 0; border: 0; background: none;
  color: inherit; text-align: left; cursor: pointer;
}
.cz-bar__chev {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  color: rgba(255,255,255,.7);
}
.cz-bar__name { font-size: var(--text-xs); color: rgba(255,255,255,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-bar__price { font-size: var(--text-md); font-weight: var(--font-weight-bold); }
.cz-bar__cta { flex: none; }
@media (max-width: 1099px) {
  .cz-bar { display: flex; }}

/* ── Bottom-sheet del resumen (mobile) ── */
.cz-sheet { position: fixed; inset: 0; z-index: var(--z-modal, 1000); }
.cz-sheet[hidden] { display: none; }
.cz-sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(10,10,10,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cz-sheet.is-open .cz-sheet__backdrop { opacity: 1; }
.cz-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--surface-1);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
}
.cz-sheet.is-open .cz-sheet__panel { transform: translateY(0); }
.cz-sheet__body {
  overflow-y: auto;
  padding: var(--space-4) var(--space-5) max(var(--space-5), env(safe-area-inset-bottom));
}
/* Dentro del sheet el resumen no necesita card propia */
.cz-sheet__body .cz-sum { border: 0; box-shadow: none; padding: 0; }

/* ── Animaciones de entrada (mismo lenguaje que el resto del sitio) ── */
@keyframes czRise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}
.cz__summary { animation: czRise 0.7s var(--ease-default, ease) backwards; animation-delay: 0.08s; }
.cz__config  { animation: czRise 0.7s var(--ease-default, ease) backwards; animation-delay: 0.2s; }
@media (prefers-reduced-motion: reduce) {
  .cz__summary, .cz__config { animation: none; }}

/* ── Mobile fino ── */
@media (max-width: 640px) {
  .cz { padding-block: var(--space-5) 96px; }
  .cz-models { grid-template-columns: repeat(2, 1fr); }
  .cz-insurers { grid-template-columns: repeat(2, 1fr); }
  .cz-sum { padding: var(--space-4); }

  /* Card del seguro: 16px por lado. Cerrado 16/16 (centrado); al abrir 24 arriba y 24 al final */
  .cz-insure .snd-collapse__head { padding: 16px; }
  .cz-insure.is-open .snd-collapse__head { padding-top: 24px; }
  .cz-insure .snd-collapse__body { padding: 0 16px 24px; }
  /* Menos espacio entre el card del seguro y el resumen (abierto o cerrado) */
  .cz-insure { margin-bottom: var(--space-4); }
  /* Coberturas: las tres del mismo ancho (una por fila, full width) */
  .cz-pills--cob { display: grid; grid-template-columns: 1fr; }
}