/* Cart Drawer & Free Shipping Progress Bar - Pixie Rebels Streetwear Style */

.cart-drawer-overlay,
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1004;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal, 0.3s ease);
}

.cart-drawer-overlay.active,
.cart-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 430px;
  height: 100%;
  height: calc(var(--app-vh, 1vh) * 100);
  height: -webkit-fill-available;
  height: 100dvh;
  max-height: 100%;
  max-height: calc(var(--app-vh, 1vh) * 100);
  max-height: -webkit-fill-available;
  max-height: 100dvh;
  background: #ffffff;
  z-index: 1005;
  transform: translateX(100%);
  transition: transform var(--transition-smooth, 0.35s cubic-bezier(0.16, 1, 0.3, 1));
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  overflow: hidden;
}

.cart-drawer.active {
  transform: translateX(0);
}

/* 1. Cart Header */
.cart-header {
  padding: 18px 20px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.cart-title-row,
.cart-title-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.cart-title {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #111111;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.cart-count,
#cartTotalCount {
  font-family: inherit;
  font-size: inherit;
  font-weight: 800;
  color: inherit;
}

.cart-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f4f4f5;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #555555;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.cart-close-btn:hover {
  background: #e4e4e7;
  color: #111111;
}

/* 2. Free Shipping Progress Meter */
.free-shipping-section,
.shipping-progress-container {
  padding: 4px 0 2px 0;
}

.shipping-progress-text,
.shipping-text {
  font-size: 0.8rem;
  color: #18181b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  line-height: 1.35;
}

.shipping-progress-text strong,
.shipping-text strong {
  font-weight: 800;
  color: #111111;
}

.shipping-progress-bar-bg,
.progress-bar {
  width: 100%;
  height: 4px;
  background: #e4e4e7;
  border-radius: 999px;
  overflow: hidden;
}

.shipping-progress-bar-fill,
.progress-fill {
  height: 100%;
  width: 0%;
  background: #111111;
  border-radius: 999px;
  transition: width 0.4s ease, background-color 0.3s ease;
}

.shipping-progress-bar-fill.unlocked,
.progress-fill.unlocked {
  background: #10b981;
}

/* 3. Cart Items Body */
.cart-body,
.cart-items {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-sizing: border-box;
}

/* Cart Item Layout (Matching Reference Screenshot) */
.cart-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
  box-sizing: border-box;
}

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

.cart-item-img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 3px;
  background: #18181b;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cart-item-top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.cart-item-designer {
  font-size: 0.72rem;
  font-weight: 700;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cart-item-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: #111111;
  white-space: nowrap;
}

.cart-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #111111;
  line-height: 1.25;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-variant {
  font-size: 0.78rem;
  color: #71717a;
  margin-bottom: 10px;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d4d4d8;
  border-radius: 2px;
  background: #ffffff;
  height: 26px;
  box-sizing: border-box;
}

.qty-btn {
  background: transparent;
  border: none;
  width: 24px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #111111;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.15s ease;
}

.qty-btn:hover {
  background: #f4f4f5;
}

.qty-val {
  min-width: 22px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #111111;
  padding: 0 4px;
}

.cart-item-remove,
.cart-item-remove-link {
  font-size: 0.74rem;
  color: #71717a;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s ease;
}

.cart-item-remove:hover,
.cart-item-remove-link:hover {
  color: #111111;
}

/* 4. Empty Cart State */
.cart-empty,
.cart-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.cart-empty-icon {
  width: 52px;
  height: 52px;
  color: #a1a1aa;
}

.cart-empty-title {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #18181b;
  margin: 0;
}

.cart-empty-text,
.cart-empty-state p {
  font-size: 0.82rem;
  color: #71717a;
  max-width: 260px;
  margin: 0;
}

/* 5. Cart Footer & Checkout */
.cart-footer {
  padding: 14px 20px 18px 20px;
  padding-bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 14px));
  border-top: 1px solid #f0f0f0;
  background: #ffffff;
  box-sizing: border-box;
  flex-shrink: 0;
}

.cart-coupon-box,
.coupon-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e4e4e7;
  padding: 6px 0 8px 0;
  margin-bottom: 14px;
}

.cart-coupon-input,
.coupon-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.82rem;
  color: #111111;
  padding: 2px 0;
}

.cart-coupon-input::placeholder,
.coupon-input::placeholder {
  color: #71717a;
  font-size: 0.8rem;
}

.coupon-btn,
#applyCouponBtn {
  background: transparent;
  border: none;
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #111111;
  cursor: pointer;
  padding: 2px 0 2px 10px;
  text-transform: uppercase;
}

.coupon-btn:hover,
#applyCouponBtn:hover {
  opacity: 0.7;
}

.cart-summary,
.cart-summary-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.cart-summary-row,
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  color: #18181b;
}

.cart-summary-row span:last-child,
.summary-row span:last-child {
  font-weight: 700;
  color: #111111;
}

.cart-summary-row.discount-row,
.summary-row.discount-row {
  color: #ef4444 !important;
}

.cart-summary-row.discount-row span:last-child,
.summary-row.discount-row span:last-child {
  color: #ef4444 !important;
}

.cart-summary-row.total-row,
.summary-row.total-row {
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 800;
  color: #111111;
}

.cart-summary-row.total-row span:last-child,
.summary-row.total-row span:last-child {
  font-size: 1.05rem;
  font-weight: 800;
}

.cart-checkout-btn,
.btn-checkout {
  width: 100%;
  padding: 14px 16px;
  background: #000000;
  color: #ffffff;
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  display: block;
  text-align: center;
  transition: opacity 0.2s ease, transform 0.1s ease;
  box-sizing: border-box;
}

.cart-checkout-btn:hover,
.btn-checkout:hover {
  opacity: 0.9;
}

.cart-checkout-btn:disabled,
.btn-checkout:disabled {
  background: #a1a1aa;
  cursor: not-allowed;
  opacity: 0.6;
}

.cart-guarantee-note,
.cart-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #3f3f46;
  margin-top: 10px;
  text-align: center;
}

/* Mobile & Notch Optimization for iPhone / Android viewports with bottom toolbars */
@media (max-width: 768px) {
  .cart-drawer {
    width: 100% !important;
    max-width: 100% !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 100% !important;
    height: calc(var(--app-vh, 1vh) * 100) !important;
    height: -webkit-fill-available !important;
    height: 100dvh !important;
    max-height: 100% !important;
    max-height: calc(var(--app-vh, 1vh) * 100) !important;
    max-height: -webkit-fill-available !important;
    max-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .cart-header {
    padding: 14px 16px 10px 16px !important;
    flex-shrink: 0 !important;
  }

  .cart-title {
    font-size: 1.15rem !important;
  }

  .shipping-progress-text,
  .shipping-text {
    font-size: 0.74rem !important;
    margin-bottom: 4px !important;
  }

  .shipping-progress-bar-bg,
  .progress-bar {
    height: 3px !important;
  }

  .cart-body,
  .cart-items {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding: 6px 16px !important;
  }

  .cart-item {
    padding: 12px 0 !important;
    gap: 10px !important;
  }

  .cart-item-img {
    width: 64px !important;
    height: 64px !important;
  }

  .cart-item-title {
    font-size: 0.85rem !important;
    margin-bottom: 2px !important;
  }

  .cart-item-variant {
    font-size: 0.72rem !important;
    margin-bottom: 6px !important;
  }

  .cart-item-price {
    font-size: 0.88rem !important;
  }

  .cart-footer {
    flex-shrink: 0 !important;
    padding: 10px 16px !important;
    padding-bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 14px)) !important;
    background: #ffffff !important;
    border-top: 1px solid #eeeeee !important;
  }

  .cart-coupon-box,
  .coupon-section {
    margin-bottom: 8px !important;
    padding: 2px 0 6px 0 !important;
  }

  .cart-coupon-input,
  .coupon-input {
    font-size: 0.78rem !important;
  }

  .coupon-btn,
  #applyCouponBtn {
    font-size: 0.78rem !important;
  }

  .cart-summary,
  .cart-summary-box {
    gap: 3px !important;
    margin-bottom: 10px !important;
  }

  .cart-summary-row,
  .summary-row {
    font-size: 0.8rem !important;
  }

  .cart-summary-row.total-row,
  .summary-row.total-row {
    margin-top: 4px !important;
    font-size: 0.95rem !important;
  }

  .cart-summary-row.total-row span:last-child,
  .summary-row.total-row span:last-child {
    font-size: 1rem !important;
  }

  .cart-checkout-btn,
  .btn-checkout {
    padding: 13px 16px !important;
    font-size: 0.84rem !important;
    letter-spacing: 0.04em !important;
    min-height: 46px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .cart-guarantee-note,
  .cart-badges {
    margin-top: 6px !important;
    font-size: 0.68rem !important;
  }
}

/* Compact screen height fallback (e.g. landscape mode or virtual keyboard) */
@media (max-height: 560px) {
  .cart-drawer {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .cart-body,
  .cart-items {
    flex: 0 0 auto !important;
    overflow-y: visible !important;
    min-height: auto !important;
  }
  .cart-footer {
    flex-shrink: 0 !important;
    position: static !important;
  }
}
