/* ═══════════════════════════════════════════════════════
   VaultAIClub — Carrito (drawer + FAB + toast)
   Paleta cálida. Tokens desde globals.css.
   ═══════════════════════════════════════════════════════ */

/* ── Side drawer ───────────────────────────────────────────── */
.cart-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(20, 24, 31, 0.45);
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.cart-overlay.is-open { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 9999;
  width: 380px; max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(20, 24, 31, 0.18);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.cart-drawer.is-open { transform: translateX(0); }

.cart-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.cart-drawer-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.cart-drawer-close {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 1.3rem; padding: 4px 8px; border-radius: 8px; line-height: 1;
}
.cart-drawer-close:hover { background: var(--bg-soft); color: var(--ink); }

.cart-drawer-items { flex: 1; overflow-y: auto; padding: 8px 0; }
.cart-drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.cart-drawer-item:last-child { border-bottom: none; }
.cart-drawer-item-icon {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: 10px;
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; overflow: hidden;
}
.cart-drawer-item-icon img { width: 100%; height: 100%; object-fit: cover; }
.cart-drawer-item-info { flex: 1; min-width: 0; }
.cart-drawer-item-name {
  font-size: 0.9rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-drawer-item-prices {
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px; flex-wrap: wrap;
}
.cart-drawer-item-og-price {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--muted); text-decoration: line-through; opacity: 0.6;
}
.cart-drawer-item-price {
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink);
}
.cart-drawer-savings {
  background: var(--accent-bg);
  border: 1px solid rgba(231, 106, 44, 0.2);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 10px;
  font-size: 0.85rem; font-weight: 700; color: var(--accent-dark);
  text-align: center;
}
.cart-drawer-item-remove {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 0.9rem;
  padding: 4px 6px; border-radius: 6px; flex-shrink: 0;
}
.cart-drawer-item-remove:hover { color: var(--red); background: rgba(230, 57, 70, 0.08); }

.cart-drawer-empty {
  padding: 48px 22px; text-align: center;
  color: var(--muted); font-size: 0.9rem;
}

.cart-drawer-footer {
  border-top: 1px solid var(--line);
  padding: 16px 22px 22px;
}
.cart-drawer-total {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 1.05rem; margin-bottom: 14px; color: var(--ink);
}
.cart-drawer-total-val {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.cart-drawer-checkout {
  display: block; width: 100%; text-align: center;
  padding: 14px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 0.95rem;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s;
  box-shadow: var(--accent-shadow);
}
.cart-drawer-checkout:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(231, 106, 44, 0.3);
}

/* ── Cart FAB ───────────────────────────────────────────────── */
.cart-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9997;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px -8px rgba(231, 106, 44, 0.4);
  transition: transform 0.2s ease;
}
.cart-fab:hover { transform: scale(1.06); }
.cart-fab svg { width: 24px; height: 24px; }
.cart-fab-count {
  position: absolute; top: -3px; right: -3px;
  background: var(--red); color: #fff;
  font-size: 0.7rem; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px; font-family: var(--font-mono);
  transition: transform 0.2s ease;
}
.cart-fab-count.bounce { animation: cartBounce 0.35s ease; }
@keyframes cartBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ── Nav badge ─────────────────────────────────────────────── */
.cart-nav-link { position: relative; display: inline-flex; align-items: center; }
.cart-count-badge {
  position: absolute; top: -4px; right: -6px;
  background: var(--red); color: #fff;
  font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; transition: transform 0.2s ease;
}
.cart-count-badge.bounce { animation: cartBounce 0.35s ease; }

/* ── Toast notification ────────────────────────────────────── */
.cart-toast {
  position: fixed; top: 20px; right: 20px; z-index: 10000;
  background: var(--ink); color: var(--accent);
  font-weight: 600; font-size: 0.9rem;
  padding: 12px 20px; border-radius: 12px;
  box-shadow: 0 8px 28px rgba(20, 24, 31, 0.25);
  transform: translateY(-20px); opacity: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  pointer-events: none;
}
.cart-toast.show { transform: translateY(0); opacity: 1; }

/* ── Checkout page multi-item table ─────────────────────────── */
.carrito-page .cart-items-table { width: 100%; border-collapse: collapse; }
.carrito-page .cart-items-table th,
.carrito-page .cart-items-table td {
  padding: 12px 8px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.carrito-page .cart-items-table tbody tr:last-child td { border-bottom: none; }
.carrito-page .cart-items-table th {
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
}
.carrito-page .cart-item-remove {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 1rem;
  padding: 4px 8px; border-radius: 6px;
}
.carrito-page .cart-item-remove:hover { color: var(--red); background: rgba(230, 57, 70, 0.08); }
.carrito-empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.carrito-empty h2 { margin-bottom: 12px; color: var(--ink); }

@media (max-width: 480px) {
  .cart-drawer { width: 100vw; max-width: 100vw; }
}
