/* ============================================================
   CART.CSS — Side Drawer & Backdrop
   ============================================================ */

/* ── Backdrop ─────────────────────────────────────────────── */
#cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-smooth);
}

#cart-backdrop.cart-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Drawer ───────────────────────────────────────────────── */
#cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--bg-surface);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease-smooth);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}

#cart-drawer.cart-open { transform: translateX(0); }

/* ── Drawer Header ────────────────────────────────────────── */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.cart-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.cart-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.cart-header-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

#cart-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  transition: all var(--duration-fast);
}

#cart-close:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}

/* ── Cart Body ────────────────────────────────────────────── */
.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-xl);
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

/* ── Empty State ──────────────────────────────────────────── */
.cart-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-4xl) 0;
  gap: var(--space-md);
  height: 100%;
  justify-content: center;
}

.cart-empty-icon {
  font-size: 4rem;
  opacity: 0.3;
}

.cart-empty-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-secondary);
}

.cart-empty-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 200px;
}

/* ── Cart Items List ──────────────────────────────────────── */
.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cart-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast);
  position: relative;
  animation: card-enter 0.3s var(--ease-smooth) both;
}

.cart-item:hover { border-color: rgba(124,58,237,0.2); }

.cart-item-img {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-cat {
  font-size: 0.72rem;
  color: var(--primary-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

/* ── Quantity Control ─────────────────────────────────────── */
.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-muted);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-secondary);
  transition: all var(--duration-fast);
  line-height: 1;
}

.qty-btn:hover {
  background: rgba(124,58,237,0.2);
  color: var(--primary-light);
}

.qty-value {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* ── Item Price & Remove ──────────────────────────────────── */
.cart-item-price {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.cart-item-remove {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--duration-fast);
}

.cart-item-remove:hover {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
}

/* ── Cart Footer ──────────────────────────────────────────── */
.cart-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid rgba(255,255,255,0.06);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.cart-subtotal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.cart-subtotal-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.cart-subtotal-value {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.cart-savings {
  font-size: 0.8rem;
  color: var(--success);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.cart-savings::before { content: '💰'; }

#btn-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  transition: all var(--duration-normal) var(--ease-smooth);
  box-shadow: var(--shadow-purple);
  min-height: 52px;
  position: relative;
  overflow: hidden;
}

#btn-checkout::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.12), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

#btn-checkout:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(124,58,237,0.5);
}

#btn-checkout:hover::after { transform: translateX(100%); }

.cart-guarantee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  #cart-drawer { width: 100vw; }
  .cart-header, .cart-body, .cart-footer { padding-left: var(--space-lg); padding-right: var(--space-lg); }
}
