/**
 * LBM — Drawer de carrito.
 *
 * z-index: el techo del sitio es 999991 (.lbm-mnav, nav móvil).
 * El overlay va a 999994 y el panel a 999995 para quedar por encima
 * de todo sin entrar en la guerra de los 2147483647.
 */

.lbm-cart__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Overlay ---------- */
.lbm-cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 999994;
  background: rgba(38, 46, 50, .55);
  opacity: 0;
  transition: opacity .22s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.lbm-cart-overlay.is-open { opacity: 1; }

/* ---------- Panel ---------- */
.lbm-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 999995;
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw);
  background: #fff;
  box-shadow: -8px 0 32px rgba(0, 0, 0, .18);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
.lbm-cart-drawer.is-open { transform: translateX(0); }

/* Sin animación para quien la haya desactivado en el sistema. */
@media (prefers-reduced-motion: reduce) {
  .lbm-cart-drawer,
  .lbm-cart-overlay { transition: none; }
}

/* ---------- Cabecera ---------- */
.lbm-cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #e8eaeb;
  flex: 0 0 auto;
}
.lbm-cart__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: #445055;
}
.lbm-cart__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #445055;
  cursor: pointer;
  transition: background .15s ease;
}
.lbm-cart__close:hover { background: #f2f4f5; }
.lbm-cart__close:focus-visible {
  outline: 2px solid #445055;
  outline-offset: 2px;
}

/* ---------- Barra de envío gratis ---------- */
.lbm-cart__shipbar {
  padding: 12px 20px;
  border-bottom: 1px solid #e8eaeb;
  flex: 0 0 auto;
  font-size: 13px;
  color: #445055;
}
.lbm-cart__shipbar-text { margin: 0 0 8px; }
.lbm-cart__shipbar-text strong { color: #2d7a3e; }
.lbm-cart__shipbar-track {
  height: 6px;
  border-radius: 3px;
  background: #e8eaeb;
  overflow: hidden;
}
.lbm-cart__shipbar-fill {
  height: 100%;
  border-radius: 3px;
  background: #2d7a3e;
  transition: width .3s ease;
}
.lbm-cart__shipbar.is-free .lbm-cart__shipbar-fill { background: #2d7a3e; }

/* ---------- Cuerpo ---------- */
.lbm-cart__body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 20px;
}
.lbm-cart__body[aria-busy="true"] { opacity: .55; pointer-events: none; }

/* Lista del mini-cart de WooCommerce dentro del drawer. */
.lbm-cart__body ul.woocommerce-mini-cart {
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Estructura real de la línea (comprobada en el navegador), 4 hijos:
     a.remove  →  a (contiene <img> + título)  →  span.quantity  →  div.lbm-cart__qty
   La foto se saca con posición absoluta y el resto se apila a su derecha. */
.lbm-cart__body li.woocommerce-mini-cart-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  grid-template-areas:
    "titulo quitar"
    "precio precio"
    "cant   cant";
  column-gap: 10px;
  row-gap: 3px;
  align-items: center;
  /* !important: WooCommerce y Divi imponen su propio padding en el mini-cart
     y sin esto el hueco de la foto queda en 0 y la imagen tapa el título. */
  padding: 10px 0 10px 68px !important;   /* 68px = hueco para la foto */
  min-height: 76px;
  border-bottom: 1px solid #f0f2f3;
  margin: 0;
}

/* Enlace del producto: título. Su imagen se posiciona aparte. */
.lbm-cart__body li.woocommerce-mini-cart-item > a:not(.remove) {
  grid-area: titulo;
  display: block;
  min-width: 0;
  align-self: start;
}
.lbm-cart__body li.woocommerce-mini-cart-item img {
  position: absolute;
  left: 0;
  top: 10px;
  width: 56px !important;
  height: 56px;
  object-fit: contain;
  border-radius: 6px;
  margin: 0 !important;
  float: none !important;
}
.lbm-cart__body li.woocommerce-mini-cart-item > a.remove {
  grid-area: quitar;
  justify-self: end;
  align-self: start;
}
/* "2 × 36,95 €" que imprime WooCommerce */
.lbm-cart__body li.woocommerce-mini-cart-item > .quantity {
  grid-area: precio;
  min-width: 0;
}
/* Nuestro selector de cantidad, hermano de los anteriores */
.lbm-cart__body li.woocommerce-mini-cart-item > .lbm-cart__qty {
  grid-area: cant;
  justify-self: start;
}
.lbm-cart__body li.woocommerce-mini-cart-item a:not(.remove) {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: #445055;
  text-decoration: none;
  /* Un nombre largo empujaba la linea a 3-4 renglones y se veian menos
     productos de un vistazo, que es justo lo que se queria evitar. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lbm-cart__body .quantity {
  font-size: 12.5px;
  color: #6b7679;
  line-height: 1.5;
}

/* Botón de quitar: lo sacamos de la esquina de WooCommerce. */
.lbm-cart__body a.remove,
.lbm-cart__body a.remove_from_cart_button {
  position: static !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  line-height: 1;
  color: #9aa4a7 !important;
  background: transparent !important;
  border-radius: 50%;
  text-decoration: none;
}
/* El enlace lleva ahora un SVG de papelera; sin esto hereda el tamano de
   fuente gigante que WooCommerce pone para la "x". */
.lbm-cart__body a.remove svg {
  display: block;
  width: 18px;
  height: 18px;
}
.lbm-cart__body a.remove:hover {
  color: #c0392b !important;
  background: #fdf0ee !important;
}

/* Selector de cantidad (lo inyecta el JS). */
.lbm-cart__qty {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid #d8dcdd;
  border-radius: 6px;
  overflow: hidden;
  margin: 0;
  flex: 0 0 auto;      /* que la rejilla no lo comprima */
  width: auto;
  min-width: 82px;
}
.lbm-cart__qty button {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: #fff;
  color: #445055;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.lbm-cart__qty button:hover:not(:disabled) { background: #f2f4f5; }
.lbm-cart__qty button:disabled { opacity: .4; cursor: not-allowed; }
.lbm-cart__qty button:focus-visible {
  outline: 2px solid #445055;
  outline-offset: -2px;
}
.lbm-cart__qty-value {
  min-width: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #445055;
}

/* Cesta vacía. */
.lbm-cart__body .woocommerce-mini-cart__empty-message {
  padding: 40px 0;
  text-align: center;
  color: #6b7679;
  font-size: 14px;
}

/* WooCommerce imprime aquí su propio total; lo ocultamos porque
   ya lo pintamos nosotros en el pie con más contexto. */
.lbm-cart__body .woocommerce-mini-cart__total,
.lbm-cart__body .woocommerce-mini-cart__buttons { display: none; }

/* ---------- Pie ---------- */
.lbm-cart__foot {
  flex: 0 0 auto;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e8eaeb;
  background: #fff;
}
.lbm-cart__totals {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}
.lbm-cart__totals-label {
  font-size: 14px;
  color: #6b7679;
}
.lbm-cart__totals-value {
  font-size: 20px;
  font-weight: 700;
  color: #445055;
}
.lbm-cart__note {
  margin: 0 0 12px;
  font-size: 12px;
  color: #8b9498;
}
.lbm-cart__checkout {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  box-sizing: border-box;
  background: #ef7d00;
  color: #fff;
  margin-bottom: 10px;
  transition: background .15s ease;
}
.lbm-cart__checkout:hover,
.lbm-cart__checkout:focus { background: #d97000; color: #fff; }

.lbm-cart__checkout:focus-visible {
  outline: 2px solid #445055;
  outline-offset: 2px;
}

/* ---------- Sellos de confianza ----------
   Sustituyen al enlace "Ver la cesta": el mismo hueco, pero diciendo algo
   util. El carrito completo sigue accesible desde el menu. */
.lbm-cart__trust {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding-top: 4px;
}
.lbm-cart__trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #6b7679;
  white-space: nowrap;
}
.lbm-cart__trust-item svg { flex: 0 0 auto; color: #2d7a3e; }

/* ---------- Precio oficial y ahorro ---------- */
.lbm-cart__precio { display: inline-flex; align-items: baseline; gap: 6px; }
.lbm-cart__precio-antes {
  font-size: 12px;
  color: #9aa4a7;
  text-decoration: line-through;
}
.lbm-cart__precio-ahora { font-weight: 700; color: #445055; }
.lbm-cart__ahorro {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #eaf5ed;
  color: #2d7a3e;
  font-size: 11.5px;
  font-weight: 700;
}

/* ---------- Completa tu pedido ---------- */
.lbm-cart__xsell {
  flex: 0 0 auto;
  padding: 14px 20px 4px;
  border-top: 1px solid #e8eaeb;
}
/* Sin sugerencias no debe quedar ni el borde suelto. */
.lbm-cart__xsell.is-empty { display: none; }

.lbm-cart__xsell-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #445055;
}
/* Carrusel horizontal: en un panel de 420px no caben en rejilla sin
   encogerlos hasta lo ilegible. */
.lbm-cart__xsell-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-bottom: 10px;
}
.lbm-cart__xsell-card {
  flex: 0 0 132px;
  width: 132px;
  scroll-snap-align: start;
  border: 1px solid #e8eaeb;
  border-radius: 8px;
  padding: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lbm-cart__xsell-link {
  display: block;
  text-decoration: none;
  color: #445055;
}
.lbm-cart__xsell-card img {
  display: block;
  width: 100%;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
  margin: 0 0 6px;
}
.lbm-cart__xsell-name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.lbm-cart__xsell-price {
  font-size: 13px;
  font-weight: 700;
  color: #445055;
  margin-top: auto;
}
.lbm-cart__xsell-price del { font-weight: 400; color: #9aa4a7; font-size: 11px; }
.lbm-cart__xsell-price ins { text-decoration: none; }
.lbm-cart__xsell-add {
  width: 100%;
  padding: 7px 4px;
  border: 1px solid #445055;
  border-radius: 6px;
  background: #fff;
  color: #445055;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.lbm-cart__xsell-add:hover:not(:disabled) { background: #445055; color: #fff; }
.lbm-cart__xsell-add:disabled { opacity: .55; cursor: default; }
.lbm-cart__xsell-add:focus-visible {
  outline: 2px solid #445055;
  outline-offset: 2px;
}

/* Con la cesta vacia no hay nada que completar. */
.lbm-cart-drawer.is-empty .lbm-cart__xsell { display: none; }

/* Con la cesta vacía no tiene sentido ofrecer pagar. */
.lbm-cart-drawer.is-empty .lbm-cart__foot { display: none; }

/* ---------- Aviso de error ---------- */
.lbm-cart__error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fdf0ee;
  color: #c0392b;
  font-size: 13px;
}

/* ---------- Icono de cesta en la barra móvil ----------
   En escritorio no se pinta: ahí ya está a.lbm-head__cart dentro de
   .lbm-head__links. Sólo aparece en el mismo punto de corte (980px) en el que
   lbm-header.css oculta ese bloque entero. */
.lbm-cart__mobile-icon { display: none; }

@media (max-width: 980px) {
  .lbm-cart__mobile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 42px;
    height: 42px;
    margin-left: auto;
    margin-right: 4px;
    color: inherit;          /* hereda el color de la barra */
    text-decoration: none;
    flex: 0 0 auto;
  }
  .lbm-cart__mobile-icon svg { width: 24px; height: 24px; }

  .lbm-cart__mobile-count {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef7d00;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
  }
  /* Con la cesta vacía el globo sobra: distrae sin informar. */
  .lbm-cart__mobile-count:not(.has-items) { display: none; }

  /* El burger llevaba el margen automático; ahora lo lleva la cesta. */
  .lbm-head__bar .lbm-burger { margin-left: 0; }
}

/* ---------- Bloqueo del scroll de fondo ---------- */
html.lbm-cart-open,
html.lbm-cart-open body {
  overflow: hidden;
}

/* ---------- Móvil ---------- */
@media (max-width: 480px) {
  .lbm-cart-drawer { width: 100vw; }
  .lbm-cart__head { padding: 14px 16px; }
  .lbm-cart__body { padding: 4px 16px; }
  .lbm-cart__foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
}
