/* ═══════════════════════════════════════════════════════
   CART DRAWER — LABRIEGO
═══════════════════════════════════════════════════════ */

/* Overlay */
#cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
#cart-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Drawer */
#cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: #F8F8F8;
  z-index: 1101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.2);
}
#cart-drawer.open {
  transform: translateX(0);
}

/* ── Header ──────────────────────────────────────────── */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid #E8E8E8;
  flex-shrink: 0;
  background: #fff;
}
.cart-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: #1A1A1A;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
}
.cart-count-pill {
  background: #E8593C;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  line-height: 1;
  transition: transform 0.2s;
}
#cart-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #808080;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
#cart-close:hover {
  background: #F0F0F0;
  color: #1A1A1A;
}

/* ── Body / items ────────────────────────────────────── */
.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px;
}
.cart-body::-webkit-scrollbar { width: 3px; }
.cart-body::-webkit-scrollbar-track { background: transparent; }
.cart-body::-webkit-scrollbar-thumb { background: #D8D8D8; border-radius: 2px; }

/* Empty state */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 14px;
  color: #808080;
  text-align: center;
  padding: 40px 20px;
}
.cart-empty-icon {
  font-size: 52px;
  opacity: 0.25;
  display: block;
}
.cart-empty strong {
  display: block;
  font-size: 15px;
  color: #333;
  font-weight: 700;
  margin-bottom: 4px;
}
.cart-empty p {
  font-size: 13px;
  color: #aaa;
  margin: 0;
}

/* Cart item */
.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid #EFEFEF;
  animation: cartItemIn 0.25s ease;
}
@keyframes cartItemIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.cart-item-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #1a1a1a;
  position: relative;
}
.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cart-item-qty-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 100px;
  background: rgba(10, 10, 10, 0.80);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  letter-spacing: 0;
  pointer-events: none;
  user-select: none;
  box-sizing: border-box;
}

.cart-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding-top: 2px;
}
.cart-item-name {
  font-size: 13px;
  font-weight: 700;
  color: #1A1A1A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
.cart-item-opcion {
  font-size: 11px;
  font-weight: 500;
  color: #555;
  margin: 0;
}
.cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #1A1A1A;
  margin: 8px 0 0;
}

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding-top: 2px;
}
.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #CFCFCF;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  transition: color 0.2s;
}
.cart-item-remove:hover { color: #E8593C; }

/* Qty control */
.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #EFEFEF;
  border-radius: 100px;
  padding: 4px 10px;
}
.qty-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
  font-size: 17px;
  line-height: 1;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity 0.15s;
}
.qty-btn:disabled { opacity: 0.25; cursor: default; }
.qty-btn:not(:disabled):hover { opacity: 0.6; }
.qty-val {
  font-size: 13px;
  font-weight: 700;
  color: #1A1A1A;
  min-width: 14px;
  text-align: center;
}

/* ── Footer ──────────────────────────────────────────── */
.cart-footer {
  padding: 20px 24px 24px;
  border-top: 1px solid #E8E8E8;
  flex-shrink: 0;
  background: #fff;
}
.cart-totals { margin-bottom: 20px; }
.cart-subtotal-row,
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-subtotal-row {
  font-size: 13px;
  color: #999;
  margin-bottom: 8px;
}
.cart-total-row {
  font-size: 18px;
  font-weight: 700;
  color: #1A1A1A;
}
.cart-divider {
  height: 1px;
  background: #EFEFEF;
  margin: 10px 0;
}

.cart-btn-checkout {
  width: 100%;
  background: #1A1A1A;
  color: #fff;
  border: none;
  padding: 15px 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  margin-bottom: 10px;
  transition: background 0.2s, transform 0.15s;
}
.cart-btn-checkout:hover {
  background: #2a2a2a;
  transform: translateY(-1px);
}

.cart-btn-continue {
  width: 100%;
  background: transparent;
  color: #999;
  border: 1px solid #DCDCDC;
  padding: 12px 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 0.2s, color 0.2s;
}
.cart-btn-continue:hover {
  border-color: #1A1A1A;
  color: #1A1A1A;
}

/* ── Toast notification ──────────────────────────────── */
#cart-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1A1A1A;
  color: #fff;
  padding: 11px 22px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  z-index: 1300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
#cart-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Navbar cart badge animation ─────────────────────── */
@keyframes cartBounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.35); }
  65%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.nav-cart.cart-pulse {
  animation: cartBounce 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 480px) {
  #cart-drawer { width: 100vw; }
  .cart-header { padding: 18px 20px; }
  .cart-body { padding: 8px 20px; }
  .cart-footer { padding: 16px 20px 20px; }
}
