/* ============================================================================
   BOOST HN — Panel lateral del carrito
   ========================================================================= */

.drawer-velo {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.6);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--normal) var(--curva), visibility var(--normal);
  z-index: calc(var(--z-modal) - 1);
}
.drawer-velo.activo { opacity: 1; visibility: visible; }
:root[data-tema="claro"] .drawer-velo { background: rgb(20 20 26 / 0.42); }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(94vw, 420px);
  display: flex;
  flex-direction: column;
  background: var(--fondo);
  border-left: 1px solid var(--borde);
  box-shadow: -18px 0 60px rgb(0 0 0 / 0.5);
  transform: translateX(100%);
  transition: transform var(--normal) var(--curva);
  z-index: var(--z-modal);
  visibility: hidden;
}

.drawer.abierto { transform: none; visibility: visible; }

/* ── Cabecera ─────────────────────────────────────────────────────────────── */
.drawer-cabecera {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--e-3);
  padding: var(--e-5) var(--e-5) var(--e-4);
  border-bottom: 1px solid var(--borde);
  flex-shrink: 0;
}

.drawer-conteo {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 4px;
  color: var(--texto);
}

/* ── Progreso de envío gratis ─────────────────────────────────────────────── */
.drawer-envio {
  padding: var(--e-3) var(--e-5);
  border-bottom: 1px solid var(--borde);
  flex-shrink: 0;
}

.drawer-envio p {
  font-size: var(--t-xs);
  color: var(--texto-suave);
  margin-bottom: 7px;
}
.drawer-envio strong { color: var(--texto); }
.drawer-envio.logrado strong { color: var(--stock); }

.drawer-barra {
  height: 4px;
  border-radius: 99px;
  background: var(--superficie-2);
  overflow: hidden;
}

.drawer-barra span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--rojo), var(--rojo-vivo));
  transition: width var(--lento) var(--curva);
}
.drawer-envio.logrado .drawer-barra span { background: var(--stock); }

/* ── Líneas ───────────────────────────────────────────────────────────────── */
.drawer-cuerpo {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--e-3) var(--e-4);
}

.drawer-cargando { display: grid; place-items: center; padding: var(--e-8) 0; }

.drawer-linea {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: var(--e-3);
  align-items: start;
  padding: var(--e-3) var(--e-2);
  border-radius: var(--radio);
  transition: background-color var(--rapido), opacity var(--normal), transform var(--normal);
  animation: aparecer 0.3s var(--curva);
}
.drawer-linea:hover { background: var(--superficie); }
.drawer-linea.saliendo { opacity: 0; transform: translateX(24px); }

.drawer-linea-img {
  width: 64px;
  height: 64px;
  border-radius: var(--radio-sm);
  background: var(--superficie-2);
  overflow: hidden;
  flex-shrink: 0;
}
.drawer-linea-img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

.drawer-linea-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.drawer-linea-marca {
  font-family: var(--display);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--rojo-vivo);
}

.drawer-linea-titulo {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--texto);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.drawer-linea-titulo:hover { color: var(--rojo-vivo); }

.drawer-variante { font-size: var(--t-xs); color: var(--texto-tenue); }

.drawer-linea-pie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--e-2);
  margin-top: 6px;
}

.drawer-cantidad {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
  overflow: hidden;
}

.drawer-cantidad button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--texto-suave);
  transition: background-color var(--rapido), color var(--rapido);
}
.drawer-cantidad button:hover { background: var(--rojo); color: var(--blanco); }

.drawer-cantidad span {
  min-width: 26px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.drawer-linea-precio {
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--texto);
}

.drawer-quitar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--texto-tenue);
  transition: background-color var(--rapido), color var(--rapido);
}
.drawer-quitar:hover { background: rgb(212 45 48 / 0.15); color: var(--rojo-vivo); }

.drawer-error { padding: var(--e-5); color: var(--texto-suave); font-size: var(--t-sm); text-align: center; }

/* ── Pie ──────────────────────────────────────────────────────────────────── */
.drawer-pie {
  flex-shrink: 0;
  padding: var(--e-4) var(--e-5) var(--e-5);
  border-top: 1px solid var(--borde);
  background: var(--superficie);
}

.drawer-totales { margin-bottom: var(--e-4); }

.drawer-fila {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--e-3);
  font-size: var(--t-sm);
  color: var(--texto-suave);
  padding-block: 3px;
}
.drawer-fila strong { color: var(--texto); font-weight: 600; font-variant-numeric: tabular-nums; }
.drawer-fila-descuento strong { color: var(--stock); }
.drawer-fila-descuento em { font-style: normal; font-size: var(--t-xs); opacity: 0.75; }

.drawer-fila-total {
  margin-top: var(--e-2);
  padding-top: var(--e-3);
  border-top: 1px solid var(--borde);
  font-size: var(--t-base);
}
.drawer-fila-total span { color: var(--texto); font-weight: 600; }
.drawer-fila-total strong {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.drawer-isv {
  font-size: var(--t-xs);
  color: var(--texto-tenue);
  margin-top: 4px;
}

.drawer-acciones { display: flex; flex-direction: column; gap: var(--e-2); }

.drawer-seguir {
  padding: 6px;
  font-size: var(--t-sm);
  color: var(--texto-tenue);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--rapido);
}
.drawer-seguir:hover { color: var(--texto); }

/* ── Vacío ────────────────────────────────────────────────────────────────── */
.drawer-vacio {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--e-3);
  padding: var(--e-6);
}
.drawer-vacio h3 { font-family: var(--display); text-transform: uppercase; font-style: italic; }
.drawer-vacio .btn { margin-top: var(--e-2); }

@media (max-width: 480px) {
  .drawer { width: 100vw; border-left: 0; }
  .drawer-linea { grid-template-columns: 56px 1fr auto; }
  .drawer-linea-img { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-velo, .drawer-barra span { transition-duration: 0.01ms; }
  .drawer-linea { animation: none; }
}
