/* ════════════════════════════════════════════════════════════════════════
   cart-drawer.css — premium slide-out / bottom-sheet shopping cart.
   Shared on the shopping pages (store.html, product.html). Self-contained:
   does not depend on style.css / store.css / shop.css.
   ════════════════════════════════════════════════════════════════════════ */
.cart-drawer {
  --cd-ink: #0c0c0c;
  --cd-accent: #1f44c2;
  --cd-green: #1f7a44;
  --cd-line: #ececec;
  --cd-soft: #f6f6f4;
  position: fixed; inset: 0; z-index: 2000;
  visibility: hidden; pointer-events: none;
  font-family: 'Poppins', system-ui, sans-serif;
}
.cart-drawer.is-open { visibility: visible; pointer-events: auto; }

/* Dim + blur the page behind */
.cart-drawer__overlay {
  position: absolute; inset: 0;
  background: rgba(10, 12, 18, .5);
  opacity: 0; transition: opacity .45s ease;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.cart-drawer.is-open .cart-drawer__overlay { opacity: 1; }

/* Sliding panel (desktop: right-side drawer) */
.cart-drawer__panel {
  position: absolute; top: 0; right: 0; height: 100%;
  width: 444px; max-width: 92vw;
  background: #fff; display: flex; flex-direction: column;
  box-shadow: -28px 0 70px rgba(0, 0, 0, .22);
  transform: translateX(100%);
  transition: transform .5s cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}
.cart-drawer.is-open .cart-drawer__panel { transform: translateX(0); }

/* Drag handle — only meaningful on the mobile bottom sheet */
.cart-drawer__grab { display: none; }

/* ── Head ─────────────────────────────────────────────────────────────── */
.cart-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 28px 18px;
}
.cart-drawer__heading { display: flex; align-items: center; gap: 12px; }
.cart-drawer__title { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.01em; color: var(--cd-ink); }
.cart-drawer__chip {
  display: inline-grid; place-items: center;
  min-width: 24px; height: 24px; padding: 0 7px;
  background: var(--cd-accent); color: #fff;
  font-size: 12px; font-weight: 700; border-radius: 999px; line-height: 1;
}
.cart-drawer__close {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: none; border: none; cursor: pointer; color: #111; font-size: 22px;
  border-radius: 50%; transition: background .2s ease, transform .3s ease;
}
.cart-drawer__close:hover { background: var(--cd-soft); transform: rotate(90deg); }

/* Column labels */
.cart-drawer__cols {
  display: flex; justify-content: space-between;
  padding: 0 28px 14px;
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #a2a2a2;
  border-bottom: 1px solid var(--cd-line);
}

/* ── Body (scroll) ────────────────────────────────────────────────────── */
.cart-drawer__body { flex: 1; overflow-y: auto; padding: 4px 28px; overscroll-behavior: contain; }
.cart-drawer__body::-webkit-scrollbar { width: 6px; }
.cart-drawer__body::-webkit-scrollbar-thumb { background: #dcd9d3; border-radius: 3px; }

/* ── Line item ────────────────────────────────────────────────────────── */
.cart-line {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 16px;
  padding: 22px 0; border-bottom: 1px solid #f1f0ed; align-items: start;
  animation: cartLineIn .4s ease both;
}
@keyframes cartLineIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cart-line--out { opacity: 0; transform: translateX(48px); transition: opacity .24s ease, transform .24s ease; }

/* Just-added pulse */
.cart-line--added { animation: cartAdded 1.3s ease; }
@keyframes cartAdded {
  0%   { background: rgba(31, 68, 194, .14); box-shadow: inset 3px 0 0 var(--cd-accent); }
  100% { background: transparent; box-shadow: inset 3px 0 0 transparent; }
}

.cart-line__media {
  position: relative;
  width: 88px; height: 100px; background: var(--cd-soft); border-radius: 10px; overflow: hidden;
  display: grid; place-items: center;
}
.cart-line__media img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.cart-line__tag {
  position: absolute; top: 6px; left: 6px;
  background: var(--cd-accent); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px;
}

.cart-line__info { min-width: 0; }
.cart-line__brand { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--cd-accent); }
.cart-line__name {
  margin: 3px 0 5px; font-size: 13.5px; font-weight: 700; line-height: 1.3; color: #111;
  text-transform: uppercase; letter-spacing: .01em;
}
.cart-line__name a { color: inherit; text-decoration: none; }
.cart-line__name a:hover { color: var(--cd-accent); }
.cart-line__unit { font-size: 13px; color: #8a8a8a; }
.cart-line__unit s { color: #c2c2c2; margin-left: 4px; }

/* Qty stepper (pill) + trash */
.cart-line__qty { display: inline-flex; align-items: center; margin-top: 14px; }
.cart-line__stepper {
  display: inline-flex; align-items: center;
  border: 1px solid #dcdcdc; border-radius: 999px; overflow: hidden;
}
.cart-line__stepper button {
  width: 34px; height: 34px; background: none; border: none; cursor: pointer;
  font-size: 16px; color: #333; display: grid; place-items: center;
  transition: background .15s ease, color .15s ease;
}
.cart-line__stepper button:hover { background: var(--cd-ink); color: #fff; }
.cart-line__qtyval { min-width: 34px; text-align: center; font-size: 14px; font-weight: 600; color: #111; }
.cart-line__remove {
  width: 34px; height: 34px; margin-left: 8px; background: none; border: none; cursor: pointer;
  color: #b3b3b3; font-size: 15px; border-radius: 50%; transition: color .2s ease, background .2s ease;
}
.cart-line__remove:hover { color: #d23030; background: #fbeaea; }

.cart-line__total { font-size: 14px; font-weight: 700; color: #111; white-space: nowrap; text-align: right; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.cart-empty { text-align: center; padding: 64px 26px; }
.cart-empty__ico {
  display: inline-grid; place-items: center; width: 84px; height: 84px; margin-bottom: 22px;
  background: var(--cd-soft); border-radius: 50%; color: #c7c3bb; font-size: 32px;
}
.cart-empty__title { font-size: 18px; font-weight: 700; color: #1a1a1a; margin: 0 0 8px; }
.cart-empty__sub { font-size: 13.5px; line-height: 1.6; color: #8a8a8a; margin: 0 auto 26px; max-width: 260px; }
.cart-empty__cta {
  display: inline-block; padding: 14px 30px; background: var(--cd-ink); color: #fff;
  text-decoration: none; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 10px; transition: background .2s ease, transform .15s ease;
}
.cart-empty__cta:hover { background: #1f1f1f; transform: translateY(-2px); }

/* ── Foot ─────────────────────────────────────────────────────────────── */
.cart-drawer__foot {
  padding: 18px 28px calc(24px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--cd-line);
  background: #fff;
}

/* Free-shipping progress */
.cart-ship { margin-bottom: 16px; }
.cart-ship__label { margin: 0 0 9px; font-size: 12.5px; color: #555; line-height: 1.4; }
.cart-ship__label strong { color: var(--cd-ink); }
.cart-ship__label b { font-weight: 600; }
.cart-ship__track { height: 7px; background: #ededed; border-radius: 999px; overflow: hidden; }
.cart-ship__fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #3a64e0, var(--cd-accent));
  border-radius: 999px; transition: width .55s cubic-bezier(.22,.61,.36,1);
}
.cart-ship.is-complete .cart-ship__label { color: var(--cd-green); font-weight: 600; }
.cart-ship.is-complete .cart-ship__fill { background: linear-gradient(90deg, #28a35a, var(--cd-green)); }

/* Savings chip */
.cart-drawer__savings {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding: 7px 12px; background: rgba(31, 122, 68, .1); color: var(--cd-green);
  font-size: 12.5px; font-weight: 600; border-radius: 8px;
}

.cart-drawer__totalrow { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.cart-drawer__totalrow span { font-size: 15px; font-weight: 600; color: #444; }
.cart-drawer__totalrow strong { font-size: 23px; font-weight: 700; color: var(--cd-ink); letter-spacing: -.01em; }
.cart-drawer__note { margin: 0 0 16px; font-size: 12px; line-height: 1.6; color: #9a9a9a; }
.cart-drawer__note a { color: #555; text-underline-offset: 2px; }

.cart-drawer__checkout {
  position: relative; overflow: hidden;
  width: 100%; padding: 17px; border: none; cursor: pointer; border-radius: 12px;
  background: linear-gradient(120deg, #141414, #000);
  color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
  transition: transform .15s ease, box-shadow .2s ease;
}
.cart-drawer__checkout::after { /* sheen sweep on hover */
  content: ''; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  transform: skewX(-18deg); transition: left .6s ease;
}
.cart-drawer__checkout:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(0, 0, 0, .28); }
.cart-drawer__checkout:hover::after { left: 130%; }
.cart-drawer__checkout:active { transform: translateY(0) scale(.99); }
.cart-drawer__checkout-arrow { transition: transform .2s ease; }
.cart-drawer__checkout:hover .cart-drawer__checkout-arrow { transform: translateX(4px); }
.cart-drawer__checkout:disabled { background: #cfccc7; box-shadow: none; cursor: not-allowed; transform: none; }
.cart-drawer__checkout:disabled::after { display: none; }

/* Trust row */
.cart-trust {
  list-style: none; display: flex; justify-content: space-between; gap: 8px;
  margin: 16px 0 0; padding: 0;
}
.cart-trust li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 500; color: #8a8a8a;
}
.cart-trust i { color: var(--cd-accent); font-size: 12px; }

/* ── Fly-to-cart clone ────────────────────────────────────────────────── */
.cart-fly {
  z-index: 4000; pointer-events: none;
  object-fit: contain; background: #fff; border-radius: 14px; padding: 6px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
  transition: transform .8s cubic-bezier(.5, -0.25, .3, 1), opacity .8s ease;
}

/* While the cart drawer or checkout is open, tuck the floating WhatsApp
   away so the panel stays clean (it sits above everything otherwise). */
body.cart-open .floating-whatsapp {
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: scale(.4) translateY(18px);
}

/* Robust body scroll lock while a cart surface is open (driven by cart-drawer.js).
   position:fixed is the only reliable way to stop iOS Safari from scrolling the
   page behind the sheet; the inline `top` set by the JS preserves scroll position. */
body.cart-scroll-locked {
  position: fixed;
  left: 0; right: 0; width: 100%;
  overflow: hidden;
}

/* ── Badge bump (header cart count) ───────────────────────────────────── */
@keyframes cartBump { 0% { transform: scale(1); } 30% { transform: scale(1.6); } 60% { transform: scale(.85); } 100% { transform: scale(1); } }
.cart-badge.bump, .iconlink__badge.bump, [data-cart-count].bump { animation: cartBump .5s ease; }

/* ════════════════════════════════════════════════════════════════════════
   Mobile bottom sheet (≤ 560px) — slides up from the bottom, rounded top,
   drag handle, swipe-to-dismiss handled in JS.
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 560px) {
  .cart-drawer__panel {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%; max-width: 100%; height: auto;
    max-height: 92vh;   /* fallback for browsers without dvh */
    max-height: 90dvh;  /* dynamic viewport → excludes the mobile browser bar */
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .3);
    transform: translateY(100%);
    transition: transform .5s cubic-bezier(.22, .61, .36, 1);
  }
  .cart-drawer.is-open .cart-drawer__panel { transform: translateY(0); }

  .cart-drawer__grab {
    display: block; width: 44px; height: 5px; margin: 10px auto 2px;
    background: #d8d5cf; border-radius: 999px; cursor: grab;
  }
  .cart-drawer__head { padding: 8px 20px 14px; }
  .cart-drawer__title { font-size: 21px; }
  .cart-drawer__cols, .cart-drawer__body, .cart-drawer__foot { padding-left: 20px; padding-right: 20px; }
  .cart-line { grid-template-columns: 76px 1fr auto; gap: 13px; padding: 18px 0; }
  .cart-line__media { width: 76px; height: 88px; }
  .cart-trust li { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .cart-drawer__overlay, .cart-drawer__panel, .cart-ship__fill,
  .cart-line, .cart-fly, .cart-drawer__checkout, .cart-drawer__checkout::after { transition: none !important; animation: none !important; }
}

/* ════════════════════════════════════════════════════════════════════════
   Checkout modal — cash-on-delivery order form (opens from "Commander…").
   ════════════════════════════════════════════════════════════════════════ */
.checkout {
  position: fixed; inset: 0; z-index: 2300;
  visibility: hidden; pointer-events: none;
  font-family: 'Poppins', system-ui, sans-serif;
}
.checkout.is-open { visibility: visible; pointer-events: auto; }
.checkout__overlay {
  position: absolute; inset: 0; background: rgba(10, 12, 18, .55);
  opacity: 0; transition: opacity .35s ease;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.checkout.is-open .checkout__overlay { opacity: 1; }

.checkout__card {
  position: absolute; top: 50%; left: 50%;
  width: min(520px, calc(100vw - 32px)); max-height: min(92vh, 880px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 22px;
  box-shadow: 0 40px 110px rgba(0, 0, 0, .42);
  transform: translate(-50%, -47%) scale(.97); opacity: 0;
  transition: transform .42s cubic-bezier(.22, .61, .36, 1), opacity .35s ease;
}
.checkout.is-open .checkout__card { transform: translate(-50%, -50%) scale(1); opacity: 1; }

/* Head */
.checkout__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 22px; border-bottom: 1px solid #ececec;
}
.checkout__heading { display: flex; align-items: center; gap: 13px; }
.checkout__ico {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px;
  background: linear-gradient(135deg, #2a55de, #1f44c2); color: #fff; font-size: 17px;
  box-shadow: 0 8px 18px rgba(31, 68, 194, .32);
}
.checkout__title { margin: 0; font-size: 17px; font-weight: 700; color: #0c0c0c; }
.checkout__sub { margin: 2px 0 0; font-size: 12px; color: #8a8a8a; }
.checkout__close {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: none; background: none; cursor: pointer; font-size: 20px; color: #111;
  border-radius: 50%; transition: background .2s ease, transform .3s ease;
}
.checkout__close:hover { background: #f3f2ef; transform: rotate(90deg); }

/* Body */
.checkout__body { flex: 1; overflow-y: auto; padding: 20px 22px 8px; overscroll-behavior: contain; }
.checkout__body::-webkit-scrollbar { width: 6px; }
.checkout__body::-webkit-scrollbar-thumb { background: #dcd9d3; border-radius: 3px; }
.co-sec { margin-bottom: 22px; }
.co-sec__title {
  margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #6b6b6b;
}

/* Delivery radio cards */
.co-ship {
  position: relative; display: flex; align-items: center; gap: 13px;
  padding: 14px 15px; margin-bottom: 10px;
  border: 1.5px solid #e6e4df; border-radius: 14px; cursor: pointer;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.co-ship:hover { border-color: #c9c6c0; }
.co-ship.is-selected { border-color: #1f44c2; background: rgba(31, 68, 194, .045); box-shadow: 0 0 0 3px rgba(31, 68, 194, .08); }
.co-ship input { position: absolute; opacity: 0; width: 0; height: 0; }
.co-ship__dot {
  width: 20px; height: 20px; border: 2px solid #c9c6c0; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; transition: border-color .2s ease;
}
.co-ship.is-selected .co-ship__dot { border-color: #1f44c2; }
.co-ship.is-selected .co-ship__dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #1f44c2; }
.co-ship__txt { display: flex; flex-direction: column; line-height: 1.3; }
.co-ship__txt strong { font-size: 14px; color: #1a1a1a; }
.co-ship__txt small { font-size: 12px; color: #8a8a8a; }
.co-ship__price { margin-left: auto; font-size: 13.5px; font-weight: 700; color: #0c0c0c; white-space: nowrap; }

/* Fields */
.co-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.co-field { display: flex; flex-direction: column; min-width: 0; }
.co-field--full { grid-column: 1 / -1; }
.co-label { font-size: 12.5px; font-weight: 600; color: #444; margin-bottom: 7px; }
.co-label i { color: #e0395a; font-style: normal; }
.co-label span { color: #aaa; font-weight: 400; }
.co-input {
  display: flex; align-items: center; gap: 10px; padding: 0 13px;
  border: 1.5px solid #e3e1dc; border-radius: 11px; background: #fbfbfa;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.co-input i { color: #a2a09b; font-size: 14px; flex-shrink: 0; transition: color .2s ease; }
.co-input input { flex: 1; min-width: 0; border: none; background: none; outline: none; font: inherit; font-size: 14px; color: #111; padding: 13px 0; }
.co-input:focus-within { border-color: #1f44c2; background: #fff; box-shadow: 0 0 0 4px rgba(31, 68, 194, .1); }
.co-input:focus-within i { color: #1f44c2; }
.co-input.is-invalid { border-color: #e0395a; background: #fdf3f5; }
.co-input.is-invalid i { color: #e0395a; }
.co-err { margin: 5px 2px 0; font-size: 11.5px; color: #e0395a; }
.co-textarea {
  width: 100%; border: 1.5px solid #e3e1dc; border-radius: 11px; background: #fbfbfa;
  font: inherit; font-size: 14px; color: #111; padding: 12px 13px; resize: vertical;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.co-textarea:focus { outline: none; border-color: #1f44c2; background: #fff; box-shadow: 0 0 0 4px rgba(31, 68, 194, .1); }

/* Foot: summary + submit */
.checkout__foot { padding: 16px 22px calc(18px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid #ececec; background: #fff; }
.co-summary { margin-bottom: 14px; }
.co-summary__row { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; color: #555; padding: 4px 0; }
.co-summary__row--total { margin-top: 6px; padding-top: 12px; border-top: 1px dashed #e2e0db; }
.co-summary__row--total span { font-size: 15px; font-weight: 600; color: #333; }
.co-summary__row--total strong { font-size: 21px; font-weight: 700; color: #0c0c0c; }
.co-submit {
  position: relative; overflow: hidden;
  width: 100%; padding: 16px; border: none; border-radius: 13px; cursor: pointer;
  background: linear-gradient(120deg, #141414, #000); color: #fff;
  font: inherit; font-size: 13.5px; font-weight: 700; letter-spacing: .05em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22); transition: transform .15s ease, box-shadow .2s ease;
}
.co-submit:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(0, 0, 0, .28); }
.co-submit:active { transform: translateY(0) scale(.99); }
.co-trust { margin: 12px 0 0; text-align: center; font-size: 11.5px; color: #9a9a9a; display: flex; align-items: center; justify-content: center; gap: 7px; }
.co-trust i { color: #1f7a44; }

/* Success state (replaces the card content) */
.checkout__success { display: none; flex-direction: column; align-items: center; text-align: center; padding: 52px 30px; }
.checkout__card.is-success .checkout__head,
.checkout__card.is-success .checkout__body,
.checkout__card.is-success .checkout__foot { display: none; }
.checkout__card.is-success .checkout__success { display: flex; }
.checkout__success-ico {
  width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(31, 122, 68, .12); color: #1f7a44; font-size: 34px; margin-bottom: 22px;
  animation: coPop .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes coPop { from { transform: scale(0); } to { transform: scale(1); } }
.checkout__success-title { margin: 0 0 8px; font-size: 22px; font-weight: 700; color: #0c0c0c; }
.checkout__success-order { margin: 0 0 14px; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: #1f44c2; text-transform: uppercase; min-height: 14px; }
.checkout__success-text { margin: 0 0 26px; font-size: 14px; line-height: 1.7; color: #666; }
.co-continue {
  padding: 14px 30px; border: none; border-radius: 11px; background: #0c0c0c; color: #fff;
  font: inherit; font-size: 13px; font-weight: 600; letter-spacing: .05em; cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}
.co-continue:hover { background: #1f1f1f; transform: translateY(-2px); }

/* Mobile: full-width bottom sheet */
@media (max-width: 560px) {
  .checkout__card {
    top: auto; bottom: 0; left: 0;
    width: 100%; max-width: 100%;
    max-height: 94vh;   /* fallback for browsers without dvh */
    max-height: 92dvh;  /* dynamic viewport → excludes the mobile browser bar */
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
  }
  .checkout.is-open .checkout__card { transform: translateY(0); }
  .co-grid { grid-template-columns: 1fr; }
  .checkout__head { padding: 18px; }
  .checkout__body { padding: 18px 18px 6px; }
  .checkout__foot { padding: 14px 18px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .checkout__title { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .checkout__overlay, .checkout__card, .co-ship, .co-input, .co-submit, .co-continue, .checkout__success-ico { transition: none !important; animation: none !important; }
}
