/* =============================================================
   DOZO Native Cart Drawer — M2
   M1: base drawer, items, qty/remove, subtotal, reward bar, consent, checkout
   M2: upsells (FBT), free gift block, trust badges
   Target: 1:1 with Monster Upsells visual audit (mu-cart-audit-mobile.png)
   Scoped to #dozo-cart-drawer-root to avoid conflicts with MU / Shopify default
   ============================================================= */

/* ----- Reset MU drawer on testovoya ----- */
#monster-cart-wrapper { display: none !important; }

/* Theme base.css hides ALL empty divs (div:empty{display:none}). Force-show our
   intentionally-empty styled boxes: overlay backdrop, reward-bar fill, spinner. */
#dozo-cart-overlay,
#dozo-cart-drawer-root .dz-reward-bar__fill,
#dozo-cart-drawer-root .dz-spinner { display: block; }

/* ----- Overlay ----- */
#dozo-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#dozo-cart-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ----- Drawer panel ----- */
#dozo-cart-drawer-root {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;          /* mobile: full screen */
  max-width: 100vw;
  background: #ffffff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  font-family: "chillax", "Outfit", sans-serif;
}

#dozo-cart-drawer-root.is-open {
  transform: translateX(0);
}

@media screen and (min-width: 768px) {
  #dozo-cart-drawer-root {
    width: 400px;
  }
}

/* ----- Header ----- */
.dz-cart__header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.dz-cart__title {
  font-size: 15.4px;
  font-weight: 700;
  color: #000000;
  margin: 0;
  letter-spacing: 0.01em;
}

.dz-cart__close {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  color: #333;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dz-cart__close:hover { color: #000; }

/* ----- Reward / Goal bar ----- */
.dz-reward-bar {
  padding: 10px 16px 0;
  flex-shrink: 0;
}

.dz-reward-bar__text {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 8px;
  min-height: 18px;
}

.dz-reward-bar__text .dz-tier-emoji {
  margin-right: 4px;
}

.dz-reward-bar__track {
  position: relative;
  height: 8px;
  background: #eceef5;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}

.dz-reward-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #4D008C 0%, #9B59F8 100%);
  border-radius: 5px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.dz-reward-bar__markers {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.dz-reward-bar__marker {
  font-size: 10.5px;
  color: #9aa0b5;
  font-weight: 600;
  flex: 1;
}

.dz-reward-bar__marker:first-child  { text-align: left; }
.dz-reward-bar__marker:nth-child(2) { text-align: center; }
.dz-reward-bar__marker:last-child   { text-align: right; }

.dz-reward-bar__marker.is-unlocked {
  color: #4D008C;
  font-weight: 700;
}

.dz-reward-bar__marker .dz-reward-check {
  color: #22a447;
  font-weight: 800;
}

/* ----- Scrollable body ----- */
.dz-cart__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ----- Empty state ----- */
.dz-cart__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: #666;
}

.dz-cart__empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.dz-cart__empty-text {
  font-size: 14px;
  font-weight: 500;
  color: #888;
}

/* ----- Line items list ----- */
.dz-cart__items {
  padding: 12px 16px 0;
}

/* ----- Single line item ----- */
.dz-cart-item {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  align-items: start;
}

.dz-cart-item:last-child {
  border-bottom: none;
}

.dz-cart-item__image-wrap {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #f5f5f5;
}

.dz-cart-item__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dz-cart-item__details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dz-cart-item__title {
  font-size: 12.5px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  /* allow wrapping */
  word-break: break-word;
}

.dz-cart-item__variant {
  font-size: 11px;
  color: #666;
  font-weight: 500;
}

.dz-cart-item__selling-plan {
  font-size: 10.5px;
  color: #4D008C;
  font-weight: 500;
}

.dz-cart-item__price-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.dz-cart-item__price {
  font-size: 13px;
  font-weight: 700;
  color: #111;
}

.dz-cart-item__compare {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
  font-weight: 400;
}

.dz-cart-item__free {
  font-size: 14px;
  font-weight: 700;
  color: #22a447;
}

.dz-cart-item__save-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  color: #4D008C;
  background: #eef1fe;
  border: 1px solid #d4ddfc;
  border-radius: 6px;
  padding: 3px 8px;
  margin: 3px 0 1px;
  line-height: 1.25;
}

.dz-cart-item__save-badge .dz-save-icon { flex-shrink: 0; }

/* BOGO / tier promo note — shown on the product's first line (set by the cart-adjust wrapper) */
.dz-cart-item__promo-note {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  color: #0f7a34;
  background: #e7f8ee;
  border: 1px solid #bfe9cf;
  border-radius: 6px;
  padding: 3px 8px;
  margin: 3px 0 1px;
  line-height: 1.25;
}

/* qty stepper + trash col */
.dz-cart-item__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.dz-cart-item__trash {
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.dz-cart-item__trash:hover { color: #e53;  }

.dz-qty-stepper {
  display: flex;
  align-items: center;
  border: 1.5px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  height: 28px;
}

.dz-qty-stepper__btn {
  width: 26px;
  height: 26px;
  background: #f5f5f5;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.dz-qty-stepper__btn:hover { background: #e8e8e8; }
.dz-qty-stepper__btn:disabled {
  color: #ccc;
  cursor: not-allowed;
}

.dz-qty-stepper__count {
  min-width: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #111;
  padding: 0 4px;
  user-select: none;
}

/* Loading state for item row */
.dz-cart-item.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ----- Footer (fixed at bottom of drawer) ----- */
.dz-cart__footer {
  padding: 12px 16px 16px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  background: #fff;
}

/* ----- Savings row (shown only when discounted) ----- */
.dz-savings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.dz-savings-row__label,
.dz-savings-row__amount {
  font-size: 14px;
  font-weight: 700;
  color: #4D008C;
}

/* ----- Subtotal row ----- */
.dz-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.dz-subtotal__label {
  font-size: 16px;
  font-weight: 700;
  color: #111;
}

.dz-subtotal__amount {
  font-size: 19px;
  font-weight: 700;
  color: #111;
}

/* ----- Consent checkbox ----- */
.dz-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.dz-consent__checkbox {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #4D008C;
}

.dz-consent__label {
  font-size: 12px;
  color: #444;
  line-height: 1.4;
  cursor: pointer;
}

.dz-consent__label a {
  color: #4D008C;
  text-decoration: none;
  font-weight: 600;
}

.dz-consent__label a:hover { text-decoration: underline; }

/* ----- Shipping line (short, right under CTA) ----- */
.dz-ship-line {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #22a447;
}

.dz-ship-line svg { flex-shrink: 0; }

/* ----- Distributor checkout note ----- */
.dz-distributor-note {
  margin: 10px auto 0;
  display: block;
  max-width: 300px;
  font-size: 11.5px;
  font-weight: 500;
  color: #6b7280;
  text-align: center;
  line-height: 1.4;
}
.dz-distributor-note svg { display: inline-block; vertical-align: -1px; margin-right: 3px; color: #6b7280; }
.dz-distributor-note strong { font-weight: 700; color: #4d008c; }

/* ----- Header cart count ----- */
#dozo-cart-title-count { color: #9aa0b5; font-weight: 600; }

/* ----- Checkout button ----- */
.dz-checkout-btn {
  display: block;
  width: 100%;
  background: #4D008C;
  color: #ffffff;
  border: none;
  border-radius: 2.5px;
  height: 46px;
  font-size: 18.2px;
  font-weight: 700;
  font-family: "chillax", "Outfit", sans-serif;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, opacity 0.15s;
  text-align: center;
}

.dz-checkout-btn:hover:not(:disabled) {
  background: #4860d8;
}

.dz-checkout-btn:disabled {
  background: #a0aef0;
  cursor: not-allowed;
  opacity: 0.75;
}

.dz-checkout-btn.is-processing {
  opacity: 0.8;
  cursor: not-allowed;
}

/* ----- Trust line ----- */
.dz-trust-line {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: #555;
  font-weight: 500;
}

.dz-trust-line .dz-star {
  color: #f5a623;
}

/* ----- Loading spinner overlay on drawer (initial fetch) ----- */
.dz-cart__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.dz-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: #4D008C;
  border-radius: 50%;
  animation: dz-spin 0.7s linear infinite;
}

@keyframes dz-spin {
  to { transform: rotate(360deg); }
}

/* ----- Cart icon bubble update ----- */
#cart-icon-bubble .cart-count-bubble {
  transition: transform 0.2s ease;
}

/* ----- Error toast ----- */
.dz-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #e53;
  color: #fff;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
}

.dz-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =====================================================================
   M2 NEW STYLES
   ===================================================================== */

/* ----- Gift item badge (shown in line items for free gift) ----- */
.dz-cart-item.is-gift {
  background: #f8fff8;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 4px;
}

/* ----- Kill Monster Upsells overlay (belt-and-suspenders) ----- */
[class*="monster_upsell_overlay"],[class*="monster-upsell-overlay"],#monster-cart-wrapper{display:none!important;visibility:hidden!important;}

.dz-cart-item__gift-badge {
  display: inline-block;
  background: #22c55e;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
  text-transform: uppercase;
}

/* static qty chip on gift lines (no stepper there) */
.dz-gift-qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 34px;
  padding: 0 8px;
  border: 1.5px solid #22c55e;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #22a447;
  user-select: none;
}

/* ----- Gift teaser block ----- */
#dozo-gift-block {
  margin: 8px 16px;
  border: 1.5px solid #e8e8e8;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
}

.dz-gift-teaser__header {
  font-size: 11.5px;
  font-weight: 600;
  color: #444;
  margin-bottom: 8px;
}

.dz-gift-teaser__card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dz-gift-teaser__img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
}

.dz-gift-teaser__img-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  background: #e8e8e8;
  flex-shrink: 0;
}

.dz-gift-teaser__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dz-gift-teaser__label {
  font-size: 12px;
  font-weight: 600;
  color: #222;
}

.dz-gift-teaser__price {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dz-gift-teaser__compare {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
}

.dz-gift-teaser__free {
  font-size: 13px;
  font-weight: 700;
  color: #22c55e;
}

/* ----- Upsell (FBT) section ----- */
#dozo-upsell-section {
  margin: 8px 0 0;
  border-top: 1px solid #f0f0f0;
  padding: 10px 16px 0;
}

.dz-upsell__heading {
  font-size: 13.5px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 10px 0;
  text-align: center;
  background: #e8ecfb;
  border-radius: 8px;
  padding: 9px 12px;
}

.dz-upsell__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
}

.dz-upsell-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 10px;
  background: #fafafa;
  border: 1.5px solid #f0f0f0;
  border-radius: 8px;
  padding: 8px;
}

.dz-upsell-card--loading {
  height: 80px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: dz-shimmer 1.2s ease infinite;
  border: none;
}

@keyframes dz-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.dz-upsell-card__img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: #eee;
}

.dz-upsell-card__img-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  background: #e8e8e8;
}

.dz-upsell-card__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dz-upsell-card__title {
  font-size: 11.5px;
  font-weight: 600;
  color: #111;
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dz-upsell-card__price-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.dz-upsell-card__compare {
  font-size: 11px;
  color: #999;
  text-decoration: line-through;
}

.dz-upsell-card__price {
  font-size: 12.5px;
  font-weight: 700;
  color: #111;
}

.dz-upsell-card__details {
  font-size: 11px;
  color: #4D008C;
  text-decoration: underline;
  font-weight: 500;
  margin-top: 3px;
  display: inline-block;
}

.dz-upsell-card__add-btn {
  background: #fff;
  color: #4D008C;
  border: 1.5px solid #4D008C;
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  font-family: "chillax", "Outfit", sans-serif;
  flex-shrink: 0;
}

.dz-upsell-card__add-btn:hover { background: #4D008C; color: #fff; }
.dz-upsell-card__add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- Payment / trust badge cards (footer bottom) ----- */
#dozo-trust-section {
  margin-top: 14px;
}

.dz-trust-badges {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
}

.dz-trust-badge {
  flex: 1;
  max-width: 82px;
  min-height: 46px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  background: #fff;
}

.dz-trust-badge--brand {
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.02em;
}

.dz-trust-badge__label {
  font-size: 8.5px;
  color: #555;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}
