/* =====================================================
   cart.css — Carrito de compras
   - Botón flotante blanco/negro inferior derecha + burbuja roja
   - Bandeja lateral (drawer) con lista, control cantidad y total
   - Botón +carrito en tarjeta de producto (meta row)
   ===================================================== */

/* ---------- Botón +carrito en tarjeta ---------- */
.product-meta-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.product-meta-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.product-meta-left h4 {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  row-gap: 0.5rem;
}

.product-meta-left h4 span,
.product h4 span,
.product .sku,
.product .tag {
  white-space: nowrap;
}
.product .tag.package {
  background-color: #f9f5f5;
  border: 1px solid #111;
  border-radius: 0.3rem;
  color: #111;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
}

.add-cart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  padding: 0.5rem 0.5rem;
  background: #111;
  color: #fff;
  border: 1px solid #111;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.add-cart-btn:hover {
  background: #fff;
  color: #111;
  border-color: #111;
}

.add-cart-btn:active {
  transform: scale(0.96);
}

.add-cart-btn .ac-plus {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  margin-right: 1px;
}

.add-cart-btn svg,
.add-cart-btn img {
  width: 1rem;
  height: 1rem;
  display: block;
  flex-shrink: 0;
}

.add-cart-btn img {
  object-fit: contain;
}

.add-cart-btn:hover img {
  filter: invert(1);
}

.add-cart-btn.is-added {
  background: #f02004;
  border-color: #f02004;
  color: #fff;
}

/* ---------- Botón flotante ---------- */
.cart-float-btn {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1001;
  transition: transform 0.2s ease, background 0.2s ease;
}

.cart-float-btn:hover {
  transform: scale(1.06);
  background: #222;
}

.cart-float-btn:active {
  transform: scale(0.97);
}

.cart-float-btn svg,
.cart-float-btn img {
  width: 1.7rem;
  height: 1.7rem;
  display: block;
}

.cart-float-btn .cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #f02004;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: none;
  pointer-events: none;
  letter-spacing: 0;
}

/* ---------- Drawer / Bandeja lateral ---------- */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.32s;
}

.cart-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s linear 0s;
}

.cart-drawer .cart-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.42);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.cart-drawer.is-open .cart-overlay {
  opacity: 1;
}

.cart-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 450px;
  max-width: 100vw;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32,0.72,0,1);
  box-shadow: -8px 0 30px rgba(0,0,0,0.18);
  overflow: hidden;
}

.cart-drawer.is-open .cart-sidebar {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  flex-shrink: 0;
}

.cart-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #111;
  margin: 0;
}

.cart-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cart-close,
.cart-clear {
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  border: 0;
  padding: 0;
  line-height: 1;
}

.cart-close img,
.cart-clear img {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.cart-close img {
  width: 0.9rem;
  height: 0.9rem;
}

.cart-clear img {
  width: 1.2rem;
  height: 1.2rem;
}

.cart-close:hover,
.cart-clear:hover {
  background: #f02004;
}

.cart-close:hover img,
.cart-clear:hover img {
  filter: brightness(0) invert(1);
}

.cart-clear:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.cart-drawer.is-empty .cart-clear {
  opacity: 0.45;
  pointer-events: none;
}

.cart-body {
  background-color: #f9f5f5;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cart-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 1rem 0.5rem 0.5rem;
  background: #fff;
}

.cart-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 0.5rem;
  background: #f9f5f5;
  flex-shrink: 0;
}

.cart-img-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 0.5rem;
  background: #f9f5f5;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

/* Título y color igual que catálogo */
.cart-item-title {
  font-size: 0.88rem;
  font-weight: 400;
  color: #313131;
  line-height: 1.25;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-item-title .name { font-weight: 400; }
.cart-item-title .color { font-weight: 400; color: #313131; }
.cart-item-title .sep { color: #313131; }

/* Compat: viejo nombre */
.cart-item-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: #222;
  line-height: 1.25;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Meta: SKU + SIZE + WEIGHT (como h4 en catálogo) */
.cart-item-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0;
  row-gap: 0.5rem;
}
.cart-item-meta .sku {
  font-size: 0.78rem;
  font-weight: 600;
  color: #f02004;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.cart-item-meta .tag {
  font-size: 0.78rem;
  font-weight: 400;
  color: #808080;
  white-space: nowrap;
}
.cart-item-meta .tag.package {
  background-color: #f9f5f5;
  border: 1px solid #111;
  border-radius: 0.3rem;
  color: #111;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
}
.cart-item-meta span {
  white-space: nowrap;
}
.cart-item-meta span:not(:last-child) {
  padding-right: 0.5rem;
  margin-right: 0.5rem;
  border-right: 1px solid #b3b3b3;
}
.cart-item-meta span.tag.package:not(:last-child) {
  border-right: none;
}
/* compat vieja */
.cart-item-sku {
  font-size: 0.75rem;
  font-weight: 600;
  color: #f02004;
  letter-spacing: 0.02em;
}

.cart-item-price {
  font-size: 0.85rem;
  font-weight: 600;
  color: #111;
}

/* Precios en bandeja — mismo estilo que .product .price */
.cart-item-info .price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.15rem;
}
.cart-item-info .price-new {
  font-size: 0.95rem;
  font-weight: 600;
  color: #313131;
  line-height: 1.2;
}
.cart-item-info .price-old {
  font-size: 0.78rem;
  font-weight: 400;
  color: #808080;
  text-decoration: line-through;
  line-height: 1.2;
}
.cart-item-info .price-discount {
  font-size: 0.78rem;
  font-weight: 400;
  color: #f02004;
  line-height: 1.2;
}
.cart-item-info .price-old-group {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.cart-item-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  background: #f9f5f5;
  border-radius: 0.7rem;
  padding: 0.2rem;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  background: #fff;
  color: #111;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
}

.qty-btn:hover {
  background: #f02004;
  color: #fff;
}

.qty-btn:active {
  transform: scale(0.93);
}

.qty-value {
  min-width: 18px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #111;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}

.cart-empty {
  text-align: center;
  color: #808080;
  font-size: 1rem;
  font-style: italic;
  padding: 2.5rem 1rem;
  display: none;
}

.cart-drawer.is-empty .cart-empty {
  display: block;
}
.cart-drawer.is-empty .cart-items {
  display: none;
}
.cart-drawer.is-empty .cart-footer .cart-total {
  opacity: 0.45;
}

.cart-footer {
  padding: 1rem;
  background: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cart-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 1.2rem;
  font-weight: 500;
  color: #111;
}

.cart-total strong {
  font-size: 1.2rem;
  font-weight: 500;
  color: #111;
  letter-spacing: 0.01em;
}

.cart-discount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
  font-weight: 400;
  color: #111;
}

.cart-discount strong {
  font-size: 0.95rem;
  font-weight: 400;
  color: #111;
  letter-spacing: 0.01em;
}

.cart-discount .discount-percent {
  color: #f02004;
  font-weight: 400;
}

.cart-shipping-suffix {
  color: #808080;
}

.cart-checkout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.95rem 1rem;
  background: #f02004;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 0.6rem;
  border: 1px solid #f02004;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
  text-decoration: none;
}

.cart-checkout-btn:hover {
  background: #111;
  border-color: #111;
  color: #fff;
}

.cart-checkout-btn:active {
  transform: scale(0.98);
}

.cart-drawer.is-empty .cart-checkout-btn {
  opacity: 0.5;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 480px) {
  .cart-float-btn {
    right: 0.85rem;
    bottom: 0.85rem;
    width: 52px;
    height: 52px;
  }
  .cart-sidebar {
    width: 100vw;
    max-width: 100vw;
  }
  .cart-item img {
    width: 56px;
    height: 56px;
  }
  .cart-img-placeholder {
    width: 56px;
    height: 56px;
  }
}
