/* ═══════════════════════════════════════════════════════
   CART DRAWER — Mobile Only
   Brand: The Dog Line  |  Primary #1e3a8a  |  Accent #f57f17
═══════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────── */
:root {
  --cd-primary: #1e3a8a;
  --cd-primary-lt: #eff6ff;
  --cd-accent: #f57f17;
  --cd-green: #059669;
  --cd-danger: #ef4444;
  --cd-bg: #f8fafc;
  --cd-surface: #ffffff;
  --cd-border: rgba(226, 232, 240, 0.8);
  --cd-text: #0f172a;
  --cd-muted: #64748b;
  --cd-radius-xl: 24px;
  --cd-radius-lg: 16px;
  --cd-radius-md: 12px;
  --cd-radius-sm: 8px;
  --cd-shadow: 0 -8px 40px rgba(15, 23, 42, 0.14);
  --cd-transition: 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  --font-heading: "Plus Jakarta Sans", sans-serif;
  --font-body: "Inter", sans-serif;
}



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

/* ── Drawer panel ────────────────────────────────────── */
#cart-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1300;
  background: var(--cd-surface);
  border-radius: var(--cd-radius-xl) var(--cd-radius-xl) 0 0;
  box-shadow: var(--cd-shadow);
  display: flex;
  flex-direction: column;
  max-height: 92dvh;
  transform: translateY(100%);
  transition: transform var(--cd-transition);
  will-change: transform;
  font-family: var(--font-body);
  color: var(--cd-text);
  /* Safe area for phones with home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#cart-drawer.cd-open {
  transform: translateY(0);
}

/* ── Drag handle ─────────────────────────────────────── */
.cd-handle-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
  flex-shrink: 0;
  cursor: grab;
}
.cd-handle-pill {
  width: 40px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 2px;
}

/* ── Header ──────────────────────────────────────────── */
.cd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--cd-border);
}
.cd-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cd-header-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--cd-radius-sm);
  background: var(--cd-primary-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cd-primary);
}
.cd-header-icon svg {
  width: 18px;
  height: 18px;
}
.cd-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 800;
  color: var(--cd-text);
  letter-spacing: -0.4px;
}
.cd-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--cd-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 100px;
  font-family: var(--font-heading);
}
.cd-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cd-bg);
  border: 1px solid var(--cd-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cd-muted);
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.cd-close-btn:active {
  background: #e2e8f0;
  color: var(--cd-text);
}
.cd-close-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Trust strip ─────────────────────────────────────── */
.cd-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 8px 16px;
  background: linear-gradient(90deg, #f0f9ff, #eff6ff, #f0fdf4);
  border-bottom: 1px solid var(--cd-border);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.cd-trust::-webkit-scrollbar {
  display: none;
}
.cd-trust-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--cd-muted);
}
.cd-trust-item svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.cd-trust-sep {
  width: 1px;
  height: 14px;
  background: #cbd5e1;
  margin: 0 12px;
  flex-shrink: 0;
}
.cd-trust-item--green {
  color: var(--cd-green);
}
.cd-trust-item--blue {
  color: var(--cd-primary);
}

/* ── Scrollable body ─────────────────────────────────── */
.cd-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 8px;
  scrollbar-width: none;
}
.cd-body::-webkit-scrollbar {
  display: none;
}

/* ── Empty state ─────────────────────────────────────── */
.cd-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 32px;
  text-align: center;
  gap: 10px;
}
.cd-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--cd-primary-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.cd-empty-icon svg {
  width: 38px;
  height: 38px;
  color: var(--cd-primary);
}
.cd-empty-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: var(--cd-text);
  letter-spacing: -0.4px;
}
.cd-empty-sub {
  font-size: 14px;
  color: var(--cd-muted);
  line-height: 1.5;
  max-width: 240px;
}
.cd-empty-btn {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cd-primary);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  padding: 13px 28px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.2s,
    background 0.2s;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.25);
}
.cd-empty-btn:active {
  transform: scale(0.97);
}

/* ── Item card ───────────────────────────────────────── */
.cd-item {
  display: flex;
  gap: 12px;
  background: var(--cd-surface);
  border: 1px solid var(--cd-border);
  border-radius: var(--cd-radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    max-height 0.35s ease,
    margin 0.35s ease,
    padding 0.35s ease;
}
.cd-item.cd-removing {
  opacity: 0;
  transform: translateX(60px);
  max-height: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* item image */
.cd-item-img-wrap {
  width: 76px;
  height: 76px;
  border-radius: var(--cd-radius-md);
  background: var(--cd-bg);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--cd-border);
}
.cd-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* item info */
.cd-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cd-item-name {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cd-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* top row: name + save badge */
.cd-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}
.cd-save-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: var(--cd-danger);
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
  font-family: var(--font-heading);
  line-height: 1.6;
}
.cd-item-variant {
  font-size: 11.5px;
  color: var(--cd-muted);
  font-weight: 500;
}
.cd-item-price {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: var(--cd-text);
  margin-top: 2px;
}
.cd-item-price-old {
  font-size: 11.5px;
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 500;
  margin-left: 5px;
}

/* qty stepper */
.cd-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.cd-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--cd-bg);
  border: 1px solid var(--cd-border);
  border-radius: 100px;
  overflow: hidden;
}
.cd-stepper-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--cd-text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.cd-stepper-btn:active {
  background: #e2e8f0;
}
.cd-stepper-btn:disabled {
  color: #cbd5e1;
  cursor: default;
}
.cd-stepper-qty {
  min-width: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cd-text);
  font-family: var(--font-heading);
}

/* remove button */
.cd-remove-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fef2f2;
  border: 1px solid #fecaca;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cd-danger);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.2s,
    transform 0.2s;
}
.cd-remove-btn:active {
  background: #fee2e2;
  transform: scale(0.9);
}
.cd-remove-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Discount section ────────────────────────────────── */
.cd-discount {
  margin: 4px 0 10px;
}
.cd-discount-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--cd-bg);
  border: 1px solid var(--cd-border);
  border-radius: var(--cd-radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--cd-primary);
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
.cd-discount-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
  color: var(--cd-muted);
}
.cd-discount-toggle.open svg {
  transform: rotate(180deg);
}
.cd-discount-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
}
.cd-discount-body.open {
  max-height: 80px;
}
.cd-discount-inner {
  display: flex;
  gap: 8px;
  padding: 10px 0 4px;
}
.cd-disc-input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--cd-border);
  border-radius: var(--cd-radius-md);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--cd-text);
  background: var(--cd-surface);
  outline: none;
  transition: border-color 0.2s;
}
.cd-disc-input:focus {
  border-color: var(--cd-primary);
}
.cd-disc-btn {
  height: 44px;
  padding: 0 18px;
  background: var(--cd-primary);
  color: #fff;
  border: none;
  border-radius: var(--cd-radius-md);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-heading);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.15s;
}
.cd-disc-btn:active {
  transform: scale(0.97);
}

/* ── Sticky footer ───────────────────────────────────── */
.cd-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--cd-border);
  background: var(--cd-surface);
  padding: 14px 20px 12px;
}
.cd-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.cd-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--cd-muted);
}
.cd-total-row span:last-child {
  font-weight: 600;
  color: var(--cd-text);
}
.cd-total-row--grand {
  font-size: 16px;
  font-weight: 800;
  color: var(--cd-text);
  font-family: var(--font-heading);
  border-top: 1px solid var(--cd-border);
  padding-top: 8px;
  margin-top: 4px;
}
.cd-total-row--grand span:last-child {
  color: var(--cd-primary);
}
.cd-total-row--save {
  font-size: 13px;
  font-weight: 600;
  color: var(--cd-green);
}
.cd-total-row--save span:last-child {
  color: var(--cd-green);
  font-weight: 700;
}
.cd-total-divider {
  height: 1px;
  background: var(--cd-border);
  margin: 2px 0;
}
.cd-free-ship {
  font-size: 11px;
  font-weight: 700;
  color: var(--cd-green);
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 100px;
}

/* CTA button */
.cd-checkout-btn {
  width: 100%;
  height: 54px;
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  color: #fff;
  border: none;
  border-radius: var(--cd-radius-lg);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(30, 58, 138, 0.3);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.cd-checkout-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 10px rgba(30, 58, 138, 0.2);
}
.cd-checkout-btn svg {
  width: 18px;
  height: 18px;
}
.cd-checkout-btn--disabled {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
  pointer-events: none;
}

/* Two-button action row (View Cart · Continue Shopping) */
@keyframes cd-action-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.cd-action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  animation: cd-action-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
.cd-action-btn {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--cd-radius-md);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.18s,
    color 0.18s,
    transform 0.15s;
  letter-spacing: -0.1px;
  /* Ripple setup */
  position: relative;
  overflow: hidden;
}
/* Ripple layer */
.cd-action-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition:
    width 0.55s ease,
    height 0.55s ease,
    opacity 0.55s ease;
  pointer-events: none;
}
.cd-action-btn:active::before {
  width: 280px;
  height: 280px;
  opacity: 0.09;
  transition: 0s;
}
.cd-action-btn:active {
  transform: scale(0.97);
}

/* "View Cart" — outlined */
.cd-action-btn--outline {
  background: transparent;
  color: var(--cd-primary);
  border: 1.5px solid rgba(30, 58, 138, 0.3);
}
.cd-action-btn--outline:active {
  background: var(--cd-primary-lt);
}

/* "Continue Shopping" — ghost */
.cd-action-btn--ghost {
  background: var(--cd-bg);
  color: var(--cd-muted);
  border: 1px solid var(--cd-border);
}
.cd-action-btn--ghost:active {
  background: #e9eef5;
}

/* Full-width when View Cart is hidden (empty cart) */
.cd-action-btn--full {
  flex: none;
  width: 100%;
}

/* muted item count inside subtotal label */
.cd-qty-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--cd-muted);
}

/* ── Bounce animation for cart icon ─────────────────── */
@keyframes cd-bounce {
  0%,
  100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.3);
  }
  60% {
    transform: scale(0.9);
  }
}
.cd-badge-bounce {
  animation: cd-bounce 0.4s ease forwards;
}
