/**
 * Olanzu — Cart Drawer
 * Slide-out cart panel, sitewide.
 * Global tokens (colors, radius, etc.) → style.css
 */

/* z-index stack: overlay sits just below drawer */
/* --z-overlay: 9998 | --z-drawer: 9999 */

/* ── Overlay ─────────────────────────────────────────────────────────────────── */
.olz-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.olz-drawer-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* ── Drawer panel ───────────────────────────────────────────────────────────── */
.olz-cart-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--olz-gray-50);
  z-index: 9999;
  transform: translateX(100%);
  /* ease-out cubic — feels snappy on open, smooth on close */
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.15);
}
.olz-cart-drawer.is-open { transform: translateX(0); }

/* Prevent body scroll when drawer is open */
body.olz-drawer-open { overflow: hidden !important; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.olz-drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.olz-drawer-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.olz-drawer-title {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--olz-gray-900);
  margin: 0;
}
.olz-drawer-count {
  background: var(--olz-gray-900);
  color: #fff;
  font-size: 0.675rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  display: inline-block;
  line-height: 1.6;
}
.olz-drawer-close {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--olz-gray-100);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--olz-gray-400);
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.olz-drawer-close:hover { color: var(--olz-gray-900); background: var(--olz-gray-200); }
.olz-drawer-close svg   { width: 1.25rem; height: 1.25rem; }

/* ── Free shipping progress — inside footer, above subtotal ─────────────────── */
/* Global track/fill/label styles live in style.css.
   This wrapper sits inside .olz-drawer-footer with a bottom border to separate
   it visually from the subtotal row below. */
.olz-drawer-progress-inline {
  padding-bottom: 0.625rem;
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
  margin-bottom: 0;
}

/* ── Items area (scrollable) ────────────────────────────────────────────────── */
.olz-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--olz-gray-50);
  /* thin custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(209, 211, 212, 0.6) transparent;
  min-height: 0;
}
.olz-drawer-body::-webkit-scrollbar       { width: 4px; }
.olz-drawer-body::-webkit-scrollbar-track { background: transparent; }
.olz-drawer-body::-webkit-scrollbar-thumb { background: rgba(209, 211, 212, 0.6); border-radius: 2px; }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.olz-drawer-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}
.olz-drawer-empty-icon {
  width: 4rem; height: 4rem;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(229, 231, 235, 0.5);
  margin-bottom: 1rem;
  color: var(--olz-gray-300);
}
.olz-drawer-empty-icon svg { width: 2rem; height: 2rem; }
.olz-drawer-empty-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--olz-gray-900);
  margin: 0 0 0.375rem;
}
.olz-drawer-empty-sub {
  font-size: 0.8125rem;
  color: var(--olz-gray-400);
  margin: 0 0 1.25rem;
}
.olz-drawer-shop-btn {
  display: inline-flex;
  align-items: center;
  background: var(--olz-gray-900);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.2s;
}
.olz-drawer-shop-btn:hover { background: var(--olz-red); color: #fff; }

/* ── Items list ─────────────────────────────────────────────────────────────── */
.olz-drawer-items {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Single item row ────────────────────────────────────────────────────────── */
.olz-drawer-item {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--olz-gray-200);
}
.olz-drawer-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ── Item image ─────────────────────────────────────────────────────────────── */
/* Wrapper holds badge + image. No overflow:hidden here so badge isn't clipped. */
.olz-drawer-item-img-wrap {
  position: relative;
  width: 5rem; min-width: 5rem; height: 5rem;
  flex-shrink: 0;
}
.olz-drawer-item-img {
  width: 100%; height: 100%;
  border-radius: var(--radius);
  border: 1px solid rgba(229, 231, 235, 0.6);
  background: #fff;
  overflow: hidden;
}
.olz-drawer-item-img a   { display: block; width: 100%; height: 100%; }
.olz-drawer-item-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  mix-blend-mode: multiply;
  opacity: 0.9;
}

/* Pack badge — anchored to image wrapper corner */
/* font-size: 7px — very small deliberately; badge sits in a 5rem image corner */
.olz-drawer-item-pack-badge {
  position: absolute;
  top: 0; left: 0;
  background: var(--olz-gray-900);
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 6px;
  border-radius: var(--radius) 0 4px 0;
  line-height: 1.4;
  z-index: 2;
  white-space: nowrap;
}

/* ── Item info ──────────────────────────────────────────────────────────────── */
.olz-drawer-item-info {
  flex: 1; min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.olz-drawer-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.olz-drawer-item-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--olz-gray-900);
  margin: 0;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex: 1;
  text-decoration: none;
}
a.olz-drawer-item-name { color: inherit; text-decoration: none; transition: color 0.2s; }
a.olz-drawer-item-name:hover { color: var(--olz-red); }

/* Trash button */
.olz-drawer-remove {
  color: var(--olz-gray-300);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.125rem;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}
.olz-drawer-remove:hover { color: var(--olz-red); background: none; }
.olz-drawer-remove svg   { width: 1rem; height: 1rem; }

/* Variation meta — e.g. "7" x 10" · 40 MIL ALUMINUM" */
.olz-drawer-item-meta {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--olz-gray-400);
  line-height: 1.4;
}

/* ── Bottom row: qty stepper + line price ───────────────────────────────────── */
.olz-drawer-item-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
}
.olz-drawer-item-price {
  font-weight: 800;
  font-size: 0.875rem;
  color: var(--olz-gray-900);
  font-variant-numeric: tabular-nums;
}
.olz-drawer-item-price .woocommerce-Price-amount { font-weight: 800; }

/* ── Qty stepper ────────────────────────────────────────────────────────────── */
.olz-drawer-qty-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--olz-gray-300);
  border-radius: var(--radius);
  background: #fff;
  height: 34px;
  width: 100px;
  overflow: hidden;
  flex-shrink: 0;
}
.olz-drawer-qty-btn {
  width: 30px; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: none;
  cursor: pointer;
  color: var(--olz-gray-700);
  font-size: 16px;
  transition: background 0.15s;
  flex-shrink: 0;
  padding: 0; line-height: 1;
}
.olz-drawer-qty-btn:hover { background: var(--olz-gray-50); }

/* width:0 + flex:1 forces the input to ignore its intrinsic width inside flex */
.olz-drawer-qty-wrap .olz-drawer-qty-val {
  flex: 1;
  height: 100%;
  border: none;
  border-left: 1px solid var(--olz-gray-300);
  border-right: 1px solid var(--olz-gray-300);
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--olz-black);
  background: #fff;
  -moz-appearance: textfield;
  appearance: textfield;
  padding: 0 !important;
  width: 0;
  font-variant-numeric: tabular-nums;
  box-shadow: none !important;
  border-radius: 0 !important;
}
.olz-drawer-qty-val::-webkit-outer-spin-button,
.olz-drawer-qty-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.olz-drawer-qty-val:focus { outline: none; }

/* Fade item while AJAX update is in flight */
.olz-drawer-item.is-removing {
  opacity: 0.3;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.olz-drawer-footer {
  padding: 1rem 1.5rem;
  background: #fff;
  border-top: 1px solid rgba(229, 231, 235, 0.5);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.olz-drawer-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0;
}
.olz-drawer-subtotal > span:first-child {
  display: flex;
  flex-direction: column;
}
.olz-drawer-subtotal-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--olz-gray-900);
  display: block;
  line-height: 1.2;
}
.olz-drawer-subtotal-note {
  font-size: 0.675rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--olz-gray-400);
  display: block;
  margin-top: 0.25rem;
  font-weight: 400;
}
.olz-drawer-subtotal-amount {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--olz-gray-900);
  font-variant-numeric: tabular-nums;
}
.olz-drawer-subtotal-amount .woocommerce-Price-amount { font-weight: 800; font-size: inherit; }

.olz-drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* Secondary CTA — View Cart (compact, understated) */
.olz-drawer-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--olz-gray-50);
  color: var(--olz-gray-900);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: var(--radius);
  padding: 0.625rem 1.25rem;   /* smaller than checkout — secondary action */
  font-weight: 600;
  font-size: 0.8125rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  text-align: center;
}
.olz-drawer-cart-btn:hover {
  background: var(--olz-gray-100);
  border-color: var(--olz-gray-400);
  color: var(--olz-gray-900);
}

/* Primary CTA — Checkout */
.olz-drawer-checkout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--olz-red);
  color: #fff !important;
  border-radius: var(--radius);
  padding: 0.875rem 1.5rem;
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none !important;
  box-shadow: 0 8px 15px -3px rgba(228, 4, 20, 0.25);  /* olz-red at 25% opacity */
  transition: background 0.2s;
  text-align: center;
}
.olz-drawer-checkout-btn:hover { background: var(--olz-red-dark); color: #fff !important; }
.olz-drawer-checkout-btn svg   { width: 1rem; height: 1rem; flex-shrink: 0; }

/* ── Mobile ─────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .olz-cart-drawer { max-width: 100vw; }
}
