/* ==========================================================================
   MEDICUBE US - CART DRAWER STYLES
   ========================================================================== */

.cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

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

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 440px;
  height: 100%;
  background-color: #ffffff;
  z-index: 2001;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-drawer);
}

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

/* Header */
.cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
}

.cart-drawer__title {
  font-size: 1.125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-drawer__item-count {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.cart-drawer__close {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #121212;
  transition: transform var(--transition-fast);
}

.cart-drawer__close:hover {
  transform: rotate(90deg);
}

.cart-drawer__close svg {
  width: 20px;
  height: 20px;
}

/* Free Shipping Bar */
.free-shipping-bar {
  background-color: #f7f7f7;
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border);
}

.free-shipping-bar__text {
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
}

.free-shipping-bar__text strong {
  color: var(--color-accent-red);
}

.free-shipping-bar__progress-track {
  width: 100%;
  height: 6px;
  background-color: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.free-shipping-bar__progress-fill {
  height: 100%;
  width: 0%;
  background-color: #000000;
  border-radius: 3px;
  transition: width 0.4s ease, background-color 0.3s ease;
}

.free-shipping-bar__progress-fill.unlocked {
  background-color: var(--color-success);
}

/* Cart Body / Items */
.cart-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Empty State */
.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px 20px;
}

.cart-empty-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.25;
}

.cart-empty-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.cart-empty-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  max-width: 280px;
}

/* Cart Items List */
.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item {
  display: flex;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  position: relative;
}

.cart-item__image {
  width: 80px;
  height: 80px;
  border-radius: var(--border-radius-sm);
  background-color: #f7f7f7;
  overflow: hidden;
  flex-shrink: 0;
}

.cart-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item__details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cart-item__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #121212;
  margin-bottom: 4px;
  line-height: 1.3;
}

.cart-item__variant {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.cart-item__price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.cart-item__stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  height: 30px;
}

.cart-item__btn-qty {
  width: 26px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #555555;
  transition: background-color var(--transition-fast);
}

.cart-item__btn-qty:hover {
  background-color: #eeeeee;
  color: #000000;
}

.cart-item__qty-val {
  width: 28px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
}

.cart-item__price {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #000000;
}

.cart-item__remove {
  background: none;
  border: none;
  color: #888888;
  cursor: pointer;
  padding: 4px;
  font-size: 0.75rem;
  text-decoration: underline;
  transition: color var(--transition-fast);
}

.cart-item__remove:hover {
  color: var(--color-accent-red);
}

/* Cart Upsell Slider */
.cart-upsell-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--color-border);
}

.cart-upsell-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.cart-upsell-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--color-bg-light);
  padding: 10px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 8px;
}

.cart-upsell-img {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.cart-upsell-info {
  flex: 1;
}

.cart-upsell-name {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.cart-upsell-price {
  font-size: 0.75rem;
  color: var(--color-sale-red);
  font-weight: 700;
}

.btn-upsell-add {
  padding: 6px 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  background-color: #000000;
  color: #ffffff;
  border-radius: 3px;
  border: none;
  cursor: pointer;
}

/* Footer / Checkout CTA */
.cart-drawer__footer {
  padding: 20px 24px;
  border-top: 1px solid var(--color-border);
  background-color: #ffffff;
}

.cart-drawer__subtotal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cart-drawer__subtotal-label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.cart-drawer__subtotal-value {
  font-size: 1.125rem;
  font-weight: 800;
  color: #000000;
}

.cart-drawer__note {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  text-align: center;
}

.btn-checkout {
  width: 100%;
  height: 48px;
  background-color: #000000;
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: all var(--transition-normal);
}

.btn-checkout:hover {
  background-color: #262626;
  transform: translateY(-1px);
}

.cart-drawer__trust-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
  font-size: 0.6875rem;
  color: var(--color-text-light);
}

.cart-drawer__trust-icons span {
  display: flex;
  align-items: center;
  gap: 4px;
}


/* Responsive Mobile Cart Drawer */
@media (max-width: 480px) {
  .cart-drawer {
    width: 100%;
    max-width: 100vw;
  }
  .cart-drawer__header {
    padding: 14px 16px;
  }
  .free-shipping-bar {
    padding: 12px 16px;
  }
  .cart-drawer__body {
    padding: 16px;
  }
  .cart-item {
    gap: 12px;
    padding-bottom: 12px;
  }
  .cart-item__image {
    width: 68px;
    height: 68px;
  }
  .cart-item__title {
    font-size: 0.8125rem;
  }
  .cart-drawer__footer {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .btn-checkout {
    height: 48px;
    font-size: 0.875rem;
  }
}
