/* ============================================================
   CART.CSS — Khajurbhai Singtel Cart Drawer
   ============================================================ */

/* ---- Cart Drawer ---- */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100dvh;
  background: var(--bg-surface);
  z-index: 8001;
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.15);
}
.cart-drawer.open {
  transform: translateX(0);
}

/* Header */
.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.cart-drawer-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-drawer-title svg {
  width: 20px;
  height: 20px;
  stroke: var(--brand-red);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
}
.cart-count-badge {
  background: var(--brand-red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
}
.cart-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--duration-fast) var(--ease);
}
.cart-close:hover { background: var(--border-color); }
.cart-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Body — scrollable items */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cart-drawer-body::-webkit-scrollbar { width: 4px; }
.cart-drawer-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

/* Empty state */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 40px 0;
  gap: 16px;
  min-height: 300px;
}
.cart-empty svg {
  width: 64px;
  height: 64px;
  stroke: var(--border-strong);
  fill: none;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cart-empty h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}
.cart-empty p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Cart Item */
.cart-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  animation: itemIn 0.25s var(--ease-bounce) both;
}
@keyframes itemIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.cart-item-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
}
.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cart-item-name {
  font-family: var(--font-body);
  font-size: 14px;
  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-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-red);
}
.cart-item-original {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Qty controls */
.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: fit-content;
  overflow: hidden;
}
.qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-2);
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  transition: background var(--duration-fast) var(--ease);
  line-height: 1;
}
.qty-btn:hover { background: var(--border-color); }
.qty-btn:active { background: var(--border-strong); }
.qty-display {
  width: 36px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-remove {
  position: absolute;
  top: 16px;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease);
}
.cart-item-remove:hover {
  background: #FEE2E2;
  color: var(--error);
}
.cart-item-remove svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Footer */
.cart-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-2);
  flex-shrink: 0;
}
.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.cart-subtotal span {
  font-size: 14px;
  color: var(--text-secondary);
}
.cart-subtotal .amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-display);
}
.cart-delivery-note {
  font-size: 12px;
  color: var(--success);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cart-delivery-note::before {
  content: '✓';
  font-weight: 700;
}
.cart-checkout-btn {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-md);
}
.cart-view-btn {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 14px;
  margin-top: 10px;
  border-radius: var(--radius-md);
}

/* Loading spinner inside cart */
.cart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.cart-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Removing animation */
.cart-item.removing {
  animation: itemOut 0.25s var(--ease) forwards;
}
@keyframes itemOut {
  from { opacity: 1; transform: translateX(0); max-height: 120px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(30px); max-height: 0; padding: 0; border: none; }
}
/* ═══════════════════════════════════════════════════════════════
   Cart variant additions — append these to your cart.css
═══════════════════════════════════════════════════════════════ */

/* Variant subtitle (e.g. "5 Liter") shown below product title */
.cart-item-variant {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-color, #3d6df8);
  background: var(--accent-bg, #eef2fe);
  border-radius: 4px;
  padding: 1px 7px;
  margin-top: 2px;
  margin-bottom: 1px;
  letter-spacing: 0.2px;
}

/* Variant pill container inside each cart item */
.cart-item-variants {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 6px 0 2px;
  min-height: 0;   /* collapses when empty while variants load */
}

/* Individual variant pill */
.cart-variant-pill {
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--border-color, #e3e8f0);
  background: var(--surface-color, #fff);
  color: var(--text-secondary, #6b7a99);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  white-space: nowrap;
}

.cart-variant-pill:hover {
  border-color: var(--accent-color, #3d6df8);
  background: var(--accent-bg, #eef2fe);
  color: var(--accent-color, #3d6df8);
}

/* Active (currently selected) variant */
.cart-variant-pill--active {
  border-color: var(--accent-color, #3d6df8);
  background: var(--accent-bg, #eef2fe);
  color: var(--accent-color, #3d6df8);
  cursor: default;
}

/* Out-of-stock variant */
.cart-variant-pill--oos {
  opacity: 0.38;
  text-decoration: line-through;
  cursor: not-allowed;
}