/* ============================================================
   Renee — Cart Drawer
   assets/css/cart-drawer.css
   This file styles the OLD .cart-drawer component (now unused).
   The active drawer uses .cdr classes in sections/cart-drawer.php.
   This file is kept to avoid 404s but has no effect on the drawer.
   ============================================================ */

/* ── Overlay ──────────────────────────────────────────────── */
.cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ease);
}
.cart-drawer-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Drawer shell ─────────────────────────────────────────── */
.cart-drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  width: min(400px, 100vw);
  background: var(--white);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 48px rgba(28, 25, 23, 0.14);
  transform: translateX(110%);
  transition: transform 360ms var(--ease-out);
  overflow: hidden;
}
[dir="rtl"] .cart-drawer {
  inset-inline-end: auto;
  inset-inline-start: 0;
  box-shadow: 12px 0 48px rgba(28, 25, 23, 0.14);
  transform: translateX(-110%);
}
.cart-drawer.is-open {
  transform: translateX(0);
}
body.drawer-open {
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────── */
.cart-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--white);
}

.cart-drawer-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-en-body);
}
[dir="rtl"] .cart-drawer-title {
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--font-ar-body);
}

.cart-drawer-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  background: var(--ink);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--r-pill);
  font-family: var(--font-en-body);
  line-height: 1;
}

.cart-drawer-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.cart-drawer-close svg { width: 15px; height: 15px; }
.cart-drawer-close:hover {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

/* ── Free-shipping progress ───────────────────────────────── */
.cart-drawer-shipping {
  padding: var(--space-3) var(--space-5) var(--space-3);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.cart-ship-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-block-end: var(--space-2);
}

.cart-ship-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-block-start: 2px;
  color: var(--ink-mute);
  transition: color var(--t-base) var(--ease);
}
.cart-drawer-shipping.is-unlocked .cart-ship-icon {
  color: var(--success);
}

.cart-ship-note {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  margin: 0;
  line-height: 1.5;
}
.cart-ship-note strong {
  color: var(--ink);
  font-weight: 600;
}
.cart-drawer-shipping.is-unlocked .cart-ship-note {
  color: var(--success);
  font-weight: 600;
}

.cart-progress { margin-block-start: var(--space-2); }

.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--line-strong);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 600ms var(--ease-out),
              background 400ms var(--ease);
}
.cart-drawer-shipping.is-unlocked .progress-bar span {
  background: var(--success);
}

/* ── Items scroll area ────────────────────────────────────── */
.cart-drawer-items {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.cart-drawer-items::-webkit-scrollbar { width: 3px; }
.cart-drawer-items::-webkit-scrollbar-track { background: transparent; }
.cart-drawer-items::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 2px;
}

.cart-drawer-loading,
.cart-drawer-error {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  color: var(--ink-mute);
  font-size: var(--fs-sm);
}
.cart-drawer-error { color: var(--danger); }

/* ── Single item ──────────────────────────────────────────── */
.drawer-item {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--line);
  transition: background var(--t-fast) var(--ease);
}
.drawer-item:last-child { border-bottom: none; }
.drawer-item:hover { background: var(--bg-soft); }

.drawer-item-img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--bg-alt);
  display: block;
  flex-shrink: 0;
}
.drawer-item-img--placeholder { background: var(--bg-alt); }

.drawer-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding-block-start: 2px;
}

.drawer-item-name {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
[dir="rtl"] .drawer-item-name {
  font-family: var(--font-ar-body);
  font-weight: 600;
}

.drawer-item-variant {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-item-price {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-en-body);
  margin-block-start: 2px;
}
[dir="rtl"] .drawer-item-price { font-family: var(--font-ar-body); }

.drawer-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  padding-block-start: 2px;
}

/* ── Qty stepper ──────────────────────────────────────────── */
.qty-mini {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--white);
}

.qty-mini-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.qty-mini-btn:hover { background: var(--ink); color: var(--white); }
.qty-mini-btn:active { background: var(--accent); color: var(--white); }

.qty-mini-val {
  min-width: 26px;
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-en-body);
  border-inline: 1px solid var(--line-strong);
  padding-block: 5px;
  line-height: 1;
  user-select: none;
}

/* ── Remove ───────────────────────────────────────────────── */
.drawer-item-remove {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-mute);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.drawer-item-remove:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--white);
}

/* ── Empty state ──────────────────────────────────────────── */
.cart-drawer-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-5);
  text-align: center;
}
.empty-bag-icon {
  width: 52px;
  height: 52px;
  color: var(--line-strong);
}
.cart-drawer-empty p {
  font-size: var(--fs-base);
  color: var(--ink-mute);
  margin: 0;
}
[dir="rtl"] .cart-drawer-empty p { font-family: var(--font-ar-body); }

/* ── Footer ───────────────────────────────────────────────── */
.cart-drawer-footer {
  border-top: 1px solid var(--line);
  padding: var(--space-4) var(--space-5) var(--space-5);
  flex-shrink: 0;
  background: var(--white);
  box-shadow: 0 -4px 20px rgba(28, 25, 23, 0.06);
}

.cart-drawer-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-block-end: var(--space-4);
}

.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--ink);
}
.summary-line.is-muted { color: var(--ink-mute); }
.summary-line.is-total {
  font-size: var(--fs-base);
  font-weight: 700;
  padding-block-start: var(--space-2);
  border-top: 1px solid var(--line);
  margin-block-start: var(--space-1);
}
[dir="rtl"] .summary-line { font-family: var(--font-ar-body); }

.summary-line span:last-child {
  font-family: var(--font-en-body);
  font-weight: 500;
}
[dir="rtl"] .summary-line span:last-child { font-family: var(--font-ar-body); }
.summary-line.is-total span:last-child { font-weight: 700; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .cart-drawer { width: 100vw; }

  .drawer-item {
    grid-template-columns: 60px 1fr auto;
    padding-inline: var(--space-4);
  }
  .drawer-item-img { width: 60px; height: 60px; }

  .cart-drawer-head,
  .cart-drawer-shipping,
  .cart-drawer-footer {
    padding-inline: var(--space-4);
  }
}