/* ===========================================================================
   ARLUMA · Componentes reutilizables
   Botones, tarjetas, formularios, panel de carrito, chatbot y avisos.
   =========================================================================== */

/* ============================== BOTONES ===================================
   Jerarquía explícita. Un botón tiene que verse como un botón ANTES de que el
   mouse lo toque: sobre un fondo oscuro, un borde a 16 % de opacidad
   sencillamente no se ve, y el usuario no sabe que puede hacer clic.

     primary   relleno rojo sólido      → la acción principal de la pantalla
     ghost     borde marcado + relleno  → acción secundaria, siempre visible
     soft      superficie clara         → acción terciaria dentro de una tarjeta
     danger    rojo claro + icono       → eliminar, vaciar (ver nota abajo)

   Ninguno depende del hover para ser legible.
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  /* Altura mínima cómoda para el dedo, en cualquier dispositivo. */
  min-height: 44px;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-full);
  border: 1.5px solid transparent;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .01em;
  text-align: center;
  transition: transform var(--t-fast), box-shadow var(--t-med),
              background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

/* --- Principal: relleno sólido, máximo contraste ------------------------- */
.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-on-brand);
  box-shadow: 0 6px 20px -8px rgba(var(--brand-rgb), .6);
}
.btn--primary:hover {
  background: var(--brand-soft);
  border-color: var(--brand-soft);
  color: var(--text-on-brand);
  box-shadow: var(--glow-brand);
}

/* --- Secundario: borde bien marcado + relleno translúcido ----------------
   El borde va a 40 % de opacidad, no a 16 %: es la diferencia entre "esto es
   un botón" y "esto es texto suelto". */
.btn--ghost {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .40);
  color: var(--text);
}
.btn--ghost:hover {
  background: rgba(var(--brand-rgb), .14);
  border-color: var(--brand);
  color: var(--brand-soft);
}

/* --- Terciario: superficie claramente más clara que la tarjeta ------------ */
.btn--soft {
  background: var(--ink-500);
  border-color: rgba(255, 255, 255, .22);
  color: var(--text);
}
.btn--soft:hover {
  background: #3f3f4a;
  border-color: rgba(255, 255, 255, .34);
  color: var(--text);
}

/* --- Destructivo ----------------------------------------------------------
   Con el rojo como color de marca, un botón rojo NO significa peligro por sí
   solo. Este usa un rojo más claro y siempre lleva la palabra que dice qué
   hace ("Eliminar", "Vaciar el carrito"): el color acompaña, no informa. */
.btn--danger {
  background: rgba(255, 122, 136, .10);
  border-color: rgba(255, 122, 136, .55);
  color: var(--danger);
}
.btn--danger:hover {
  background: rgba(255, 122, 136, .20);
  border-color: var(--danger);
  color: #ffd9df;
}

.btn--lg { min-height: 52px; padding: var(--sp-4) var(--sp-6); font-size: var(--fs-base); }
.btn--sm { min-height: 36px; padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); }
.btn--block { width: 100%; }

/* En pantallas táctiles ningún control baja de 44 px: es el mínimo con el que
   un dedo acierta sin frustrarse. */
@media (pointer: coarse) {
  .btn--sm { min-height: 44px; padding-inline: var(--sp-5); }
}

.btn:disabled, .btn[aria-disabled='true'] {
  opacity: .45;
  pointer-events: none;
}
.btn.is-loading { pointer-events: none; position: relative; color: transparent !important; }
.btn.is-loading::after {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 17px; height: 17px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--text-on-brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-arrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-weight: 600; font-size: var(--fs-sm);
}
.link-arrow svg { width: 15px; height: 15px; transition: transform var(--t-fast); }
.link-arrow:hover svg { transform: translateX(4px); }

/* ============================== ETIQUETAS ================================= */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .02em;
}
.badge--brand  { background: var(--brand); color: var(--text-on-brand); }
.badge--outline { background: rgba(var(--brand-rgb), .18); color: var(--brand-soft); border: 1px solid rgba(var(--brand-rgb), .35); }
.badge--ghost  { background: rgba(255,255,255,.06); color: var(--text-muted); border: 1px solid var(--line); }
.badge--ok     { background: rgba(52,211,153,.14); color: var(--ok); border: 1px solid rgba(52,211,153,.3); }
.badge--warn   { background: rgba(251,191,36,.14); color: var(--warn); border: 1px solid rgba(251,191,36,.3); }

/* ============================== TARJETAS ================================== */
.card {
  background: var(--ink-750);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

/* --- Tarjeta de producto ---------------------------------------------------- */
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--ink-750);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--t-med), border-color var(--t-med), box-shadow var(--t-med);
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--brand-rgb), .4);
  box-shadow: var(--shadow-lg);
}

.product-card__media {
  position: relative;
  aspect-ratio: 1;
  background: var(--ink-850);
  overflow: hidden;
}
.product-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}
.product-card:hover .product-card__media img { transform: scale(1.06); }

.product-card__flags {
  position: absolute;
  top: var(--sp-3); left: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
  align-items: flex-start;
  z-index: 2;
}

/* Botón de "agregar rápido" que aparece al pasar el mouse. En táctil queda
   siempre visible, porque ahí no existe el hover. */
.product-card__quick {
  position: absolute;
  right: var(--sp-3); bottom: var(--sp-3);
  z-index: 2;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-med), transform var(--t-med);
}
.product-card:hover .product-card__quick,
.product-card:focus-within .product-card__quick { opacity: 1; transform: none; }
@media (hover: none) { .product-card__quick { opacity: 1; transform: none; } }

.product-card__body {
  display: flex; flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  flex: 1;
}
.product-card__cat {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.product-card__name {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.3;
}
.product-card__name a { color: var(--text); }
.product-card__name a:hover { color: var(--brand); }
/* Toda la tarjeta es clicable, sin anidar enlaces dentro de enlaces. */
.product-card__name a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.product-card { position: relative; }

.product-card__short {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card__foot {
  display: flex; align-items: baseline; gap: var(--sp-3);
  margin-top: auto; padding-top: var(--sp-3);
}

.price {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--brand);
}
.price--lg { font-size: var(--fs-2xl); }
.price--old {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  text-decoration: line-through;
  font-weight: 400;
}

/* ====================== SELECTOR DE CATEGORÍAS ============================
   No son filtros: cada uno es un enlace a una página distinta del sitio.
   Por eso se ven como pestañas y no como casillas de filtro.
   ========================================================================= */
.cat-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 46px;
  padding: var(--sp-2) var(--sp-4);
  background: rgba(255, 255, 255, .06);
  border: 1.5px solid rgba(255, 255, 255, .28);
  border-radius: var(--r-full);
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all var(--t-fast);
}
.cat-chip:hover {
  color: var(--brand-soft);
  border-color: var(--brand);
  background: rgba(var(--brand-rgb), .12);
  transform: translateY(-2px);
}
.cat-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-on-brand);
  font-weight: 700;
}
.cat-chip.is-active:hover { transform: none; color: var(--text-on-brand); }

.cat-chip__icon { font-size: 1.05rem; line-height: 1; }
.cat-chip__count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, .28);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-align: center;
}
.cat-chip.is-active .cat-chip__count { background: rgba(0, 0, 0, .22); }

@media (max-width: 560px) {
  .cat-selector { gap: var(--sp-2); }
  .cat-chip { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); }
  /* Nada de recortar el nombre con puntos suspensivos: "Humidificado…" no le
     sirve a nadie. Que el chip ocupe lo que necesite y la fila se parta. */
  .cat-chip__name { white-space: nowrap; }
}

/* ============================= FILTROS ==================================== */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: var(--sp-2) var(--sp-4);
  background: rgba(255, 255, 255, .06);
  border: 1.5px solid rgba(255, 255, 255, .32);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  color: var(--text);
  transition: all var(--t-fast);
}
.chip:hover { color: var(--brand-soft); border-color: var(--brand); background: rgba(var(--brand-rgb), .12); }
.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-on-brand);
  font-weight: 600;
}
@media (pointer: coarse) { .chip { min-height: 44px; } }

/* ============================ FORMULARIOS ================================= */
/* --- Un campo de formulario ------------------------------------------------
   `align-content: start` no es un detalle: es lo que mantiene los campos
   alineados entre sí.

   Los campos van en filas de dos y `.form-grid` los estira a la altura del más
   alto. Sin esta línea, un grid con filas `auto` REPARTE ese alto sobrante
   entre sus filas. Resultado: un campo de dos filas (etiqueta + control)
   separaba las dos con la mitad del sobrante, y el de al lado, que tiene tres
   (etiqueta + control + nota), lo repartía en tres. Los dos inputs quedaban a
   13 px de altura distinta, uno visiblemente más arriba que el otro.

   Con `start`, las filas se apilan desde arriba y el sobrante queda abajo, así
   que el control siempre va pegado a su etiqueta. */
.field {
  display: grid;
  gap: var(--sp-2);
  align-content: start;
}
.field > label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
}
/* --- Nota auxiliar ---------------------------------------------------------
   `.hint` se usa dentro de un campo de formulario Y suelto en la ficha de
   producto, en despachos y en el checkout. Antes sólo estaba definido como
   `.field .hint`, así que fuera de un campo quedaba sin ningún estilo: el
   icono en línea que lleva adentro no tenía tamaño y se estiraba hasta
   ocupar el ancho del contenedor — 546 px de camión en la ficha de producto.
   Ahora la clase existe por sí sola y le pone tope al icono. */
.hint {
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--text-dim);
}
p.hint {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.hint svg { width: 15px; height: 15px; flex-shrink: 0; }
.field .hint { font-size: var(--fs-xs); color: var(--text-dim); }
.field .error { font-size: var(--fs-xs); color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink-600);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--fs-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .15);
}
.input[aria-invalid='true'], .textarea[aria-invalid='true'] { border-color: var(--danger); }
.textarea { min-height: 120px; resize: vertical; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%23a8a0c4' stroke-width='1.6'%3E%3Cpath d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  background-size: 12px;
  padding-right: var(--sp-7);
  cursor: pointer;
}
.select option { background: var(--ink-700); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

/* --- Selector de cantidad ---------------------------------------------------- */
.qty {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, .05);
  border: 1.5px solid rgba(255, 255, 255, .30);
  border-radius: var(--r-full);
  overflow: hidden;
}
.qty button {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  color: var(--text);
  font-size: var(--fs-xl);
  line-height: 1;
  transition: background var(--t-fast), color var(--t-fast);
}
.qty button:hover { background: rgba(var(--brand-rgb), .18); color: var(--brand); }
.qty input {
  width: 46px;
  text-align: center;
  background: none;
  border: none;
  font-weight: 700;
  -moz-appearance: textfield;
}
@media (pointer: coarse) { .qty button { width: 48px; height: 48px; } }
.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* --- Opción tipo radio en tarjeta ------------------------------------------- */
.radio-card {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.radio-card:hover { border-color: var(--text-dim); }
.radio-card:has(input:checked) { border-color: var(--brand); background: rgba(var(--brand-rgb), .07); }
.radio-card input { margin-top: 3px; accent-color: var(--brand); }
.radio-card strong { display: block; font-size: var(--fs-sm); }
.radio-card small { color: var(--text-muted); font-size: var(--fs-xs); }
.radio-card .rc-price { margin-left: auto; font-weight: 700; color: var(--brand); font-size: var(--fs-sm); }

/* ========================= PANEL DEL CARRITO ============================== */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 4, 6, .68);
  backdrop-filter: blur(3px);
  z-index: var(--z-drawer);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-med);
}
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  background: var(--ink-850);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: calc(var(--z-drawer) + 1);
  transform: translateX(100%);
  transition: transform var(--t-med);
}
.drawer.is-open { transform: none; }

.drawer__head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.drawer__head h2 { font-size: var(--fs-xl); }
.drawer__body { flex: 1; overflow-y: auto; padding: var(--sp-5); }
.drawer__foot { padding: var(--sp-5); border-top: 1px solid var(--line); background: var(--ink-800); }

/* --- Línea del carrito ------------------------------------------------------- */
.cart-line { display: flex; gap: var(--sp-3); padding-block: var(--sp-4); border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line__img {
  width: 78px; height: 78px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--ink-900);
}
.cart-line__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-line__info { flex: 1; min-width: 0; display: grid; gap: var(--sp-2); align-content: start; }
.cart-line__name { font-size: var(--fs-sm); font-weight: 600; line-height: 1.35; }
.cart-line__name a { color: var(--text); }
.cart-line__meta { font-size: var(--fs-xs); color: var(--text-muted); }
.cart-line__meta span { display: block; }
.cart-line__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.cart-line__remove { font-size: var(--fs-xs); color: var(--text-dim); }
.cart-line__remove:hover { color: var(--danger); }

/* --- Resumen de totales ------------------------------------------------------ */
.summary { display: grid; gap: var(--sp-3); }
.summary__row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); }
.summary__row span:first-child { color: var(--text-muted); }
.summary__row--total {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
}
.summary__row--total span:first-child { color: var(--text); }
.summary__row--total span:last-child { color: var(--brand); }

/* --- Barra de progreso hacia el despacho gratis ------------------------------ */
/* Una sola línea de texto sobre una barra de 4 px. La versión anterior era un
   bloque con icono y dos renglones que, en el carrito, empujaba los productos
   fuera de la pantalla: el cliente no alcanzaba a ver lo que había agregado. */
.freeship {
  display: grid;
  gap: 5px;
  margin-bottom: var(--sp-3);
}
.freeship p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.freeship p svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--ok); }
.freeship strong { color: var(--brand-soft); font-weight: 700; }
.freeship--ok p { color: var(--ok); }
.freeship--ok strong { color: var(--ok); }
.freeship__bar { height: 4px; border-radius: var(--r-full); background: var(--ink-600); overflow: hidden; }
.freeship__fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--grad-aurora);
  transition: width var(--t-slow);
}

/* ============================ ESTADO VACÍO ================================ */
.empty { text-align: center; padding: var(--sp-8) var(--sp-4); display: grid; gap: var(--sp-4); justify-items: center; }
.empty__icon { font-size: 2.75rem; opacity: .55; }
.empty h3 { font-size: var(--fs-xl); }
.empty p { color: var(--text-muted); max-width: 42ch; }

/* ========================== BARRA DE TOTAL ================================
   Fija abajo, siempre visible mientras haya algo en el carrito. Es lo que
   diferencia un catálogo que sólo muestra de uno con el que se arma un pedido.
   ========================================================================= */
.cart-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: calc(var(--z-chat) - 1);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-top: 1.5px solid rgba(var(--brand-rgb), .35);
  box-shadow: 0 -8px 32px -12px rgba(0, 0, 0, .8);
  animation: cart-bar-in 320ms var(--ease);
  transition: opacity var(--t-med), transform var(--t-med);
}
@keyframes cart-bar-in { from { transform: translateY(100%); } }
.cart-bar[hidden] { display: none; }

.cart-bar__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-block: var(--sp-3);
}

.cart-bar__info {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  margin-left: calc(var(--sp-3) * -1);
  border-radius: var(--r-md);
  color: var(--text);
  transition: background var(--t-fast);
}
.cart-bar__info:hover { background: rgba(255, 255, 255, .07); }
.cart-bar__info svg { width: 24px; height: 24px; color: var(--brand); flex-shrink: 0; }

.cart-bar__texts { display: grid; text-align: left; line-height: 1.2; }
.cart-bar__count { font-size: var(--fs-xs); color: var(--text-muted); }
.cart-bar__total {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--brand);
}

.cart-bar__note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-left: auto;
  text-align: right;
}
.cart-bar__note[hidden] { display: none; }

.cart-bar__cta { flex-shrink: 0; }
.cart-bar__note[hidden] + .cart-bar__cta { margin-left: auto; }

/* Cuando la barra está, el chat sube y las páginas ganan espacio al pie. */
body.has-cart-bar .chat-fab { bottom: calc(var(--sp-5) + 76px); }
body.has-cart-bar .toast-host { bottom: calc(var(--sp-6) + 76px); }
body.has-cart-bar main { padding-bottom: 96px; }

@media (max-width: 700px) {
  .cart-bar__note { display: none; }
  .cart-bar__inner { gap: var(--sp-3); padding-block: var(--sp-2); }
  .cart-bar__cta { margin-left: auto; padding-inline: var(--sp-4); font-size: var(--fs-xs); }
  .cart-bar__total { font-size: var(--fs-lg); }
  body.has-cart-bar .chat-fab { bottom: calc(var(--sp-4) + 72px); }
  body.has-cart-bar main { padding-bottom: 88px; }
}

/* ============================== CHATBOT =================================== */
.chat-fab {
  position: fixed;
  right: var(--sp-5); bottom: var(--sp-5);
  z-index: var(--z-chat);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5) var(--sp-3) var(--sp-3);
  border-radius: var(--r-full);
  background: var(--brand);
  color: var(--text-on-brand);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  box-shadow: 0 10px 32px -10px rgba(var(--brand-rgb), .7);
  transition: transform var(--t-med), box-shadow var(--t-med), opacity var(--t-med);
}
.chat-fab:hover { transform: translateY(-3px); box-shadow: 0 16px 40px -12px rgba(var(--brand-rgb), .85); }
.chat-fab svg { width: 24px; height: 24px; }
.chat-fab.is-hidden { opacity: 0; pointer-events: none; transform: scale(.85); }
@media (max-width: 520px) {
  .chat-fab { right: var(--sp-4); bottom: var(--sp-4); padding: var(--sp-3); }
  .chat-fab span { display: none; }
}

.chat-panel {
  position: fixed;
  right: var(--sp-5); bottom: var(--sp-5);
  z-index: var(--z-chat);
  width: min(calc(100vw - var(--sp-8)), 380px);
  height: min(calc(100dvh - var(--sp-9)), 560px);
  display: flex;
  flex-direction: column;
  background: var(--ink-850);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity var(--t-med), transform var(--t-med);
}
.chat-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 520px) {
  .chat-panel { right: var(--sp-3); left: var(--sp-3); bottom: var(--sp-3); width: auto; height: min(calc(100dvh - var(--sp-6)), 560px); }
}

.chat-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--grad-aurora);
  color: #fff;
}
.chat-head__avatar {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: rgba(0,0,0,.18);
  font-size: 20px;
}
.chat-head strong { display: block; font-family: var(--font-display); font-size: var(--fs-base); }
.chat-head small { font-size: var(--fs-xs); opacity: .78; }
.chat-head button { margin-left: auto; color: #fff; opacity: .7; padding: var(--sp-2); }
.chat-head button:hover { opacity: 1; }
.chat-head svg { width: 18px; height: 18px; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  scrollbar-width: thin;
}

.msg {
  max-width: 84%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  font-size: var(--fs-sm);
  line-height: 1.55;
  animation: msg-in 280ms var(--ease);
}
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }
.msg--bot { align-self: flex-start; background: var(--ink-700); border-bottom-left-radius: 6px; }
.msg--user { align-self: flex-end; background: var(--brand); color: var(--text-on-brand); border-bottom-right-radius: 6px; font-weight: 500; }
.msg a { color: var(--brand); font-weight: 600; text-decoration: underline; }
.msg--user a { color: var(--text-on-brand); }
.msg strong { color: var(--brand); }
.msg--user strong { color: inherit; }
.msg ul { margin: var(--sp-2) 0 0; padding-left: var(--sp-4); }
.msg li { margin-bottom: 2px; }

.msg--typing { display: flex; gap: 4px; padding: var(--sp-4); }
.msg--typing i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing 1.2s infinite;
}
.msg--typing i:nth-child(2) { animation-delay: .18s; }
.msg--typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* Accesos rápidos: UNA sola fila que se desliza en horizontal.
   Con `flex-wrap: wrap` cinco etiquetas ocupaban tres filas y tapaban media
   conversación, que es justo lo que el visitante viene a leer. */
.chat-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sp-2);
  padding: 0 var(--sp-4) var(--sp-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;                 /* Firefox */
  -webkit-overflow-scrolling: touch;
}
.chat-chips::-webkit-scrollbar { display: none; }   /* Chrome y Safari */

.chat-chips button {
  flex: 0 0 auto;                        /* no se comprimen: se deslizan */
  padding: 7px 14px;
  background: rgba(255, 255, 255, .06);
  border: 1.5px solid rgba(255, 255, 255, .24);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transition: all var(--t-fast);
}
.chat-chips button:hover {
  border-color: var(--brand);
  color: var(--brand-soft);
  background: rgba(var(--brand-rgb), .12);
}

/* Un degradado al borde derecho insinúa que hay más para deslizar. */
.chat-chips-wrap { position: relative; }
.chat-chips-wrap::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: var(--sp-3);
  width: 28px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--ink-850));
}

.chat-form {
  display: flex; gap: var(--sp-2);
  padding: var(--sp-3);
  border-top: 1px solid var(--line);
  background: var(--ink-800);
}
.chat-form input {
  flex: 1;
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink-600);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
}
.chat-form input:focus { outline: none; border-color: var(--brand); }
.chat-form button {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--brand);
  color: var(--text-on-brand);
  flex-shrink: 0;
}
.chat-form button:hover { background: var(--brand-soft); }
.chat-form svg { width: 18px; height: 18px; }

/* ============================== AVISOS ==================================== */
.toast-host {
  position: fixed;
  left: 50%; bottom: var(--sp-6);
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--sp-2);
  align-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-full);
  background: var(--ink-700);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--t-med), transform var(--t-med);
}
.toast.is-in { opacity: 1; transform: none; }
.toast--ok    { border-color: rgba(52,211,153,.4); }
.toast--error { border-color: rgba(255, 122, 136, .45); color: var(--danger); }

/* ============================ AVISO DE DEMO =============================== */
.notice {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid rgba(251,191,36,.3);
  background: rgba(251,191,36,.07);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.notice strong { color: var(--warn); display: block; margin-bottom: 2px; }
.notice__icon { font-size: var(--fs-lg); line-height: 1.2; }
.notice--info { border-color: rgba(96, 165, 250, .3); background: rgba(96, 165, 250, .06); }
.notice--info strong { color: var(--info); }


/* Separador entre las dos respuestas de un mensaje con dos preguntas. */
.msg__sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--sp-3) 0;
  opacity: .7;
}


/* --- Con el carrito abierto, nada se le encima ------------------------------
   El botón del chat está en una capa superior a la del panel y le mordía la
   esquina a "Ir a pagar". La barra fija repetía el mismo total. Los dos se
   retiran mientras el panel está abierto y vuelven al cerrarlo. */
body.has-drawer .chat-fab,
body.has-drawer .cart-bar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}
