/* =======================================================
   CART DRAWER & WISHLIST DRAWER (trượt từ phải)
======================================================== */

/* ----- Overlay ----- */
.cart-drawer-overlay,
.wishlist-drawer-overlay {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 4000;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
}
.cart-drawer-overlay.is-open,
.wishlist-drawer-overlay.is-open {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ----- Drawer chung ----- */
.cart-drawer,
.wishlist-drawer {
  position: fixed !important;
  top: 0 !important;
  right: 0;
  bottom: 0 !important;
  width: 380px !important;
  max-width: 90vw !important;
  height: 100dvh !important;
  background: #fff;
  z-index: 4001;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: -5px 0 15px rgba(0,0,0,0.05);
  display: flex !important;
  flex-direction: column !important;
}
.cart-drawer.is-open,
.wishlist-drawer.is-open {
  transform: translateX(0) !important;
  visibility: visible !important;
}

/* Fallback cho iPhone cũ không hỗ trợ dvh */
@supports (-webkit-touch-callout: none) {
  .cart-drawer,
  .wishlist-drawer {
    height: -webkit-fill-available !important;
  }
}

/* ----- Header drawer ----- */
.cart-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.cart-drawer-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #000;
  margin: 0;
}
.cart-close-btn,
.wishlist-close-btn {
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  color: #000;
  padding: 0 10px;
}
.cart-close-btn:hover,
.wishlist-close-btn:hover { opacity: 0.5; }

/* ----- Body drawer (cuộn được) ----- */
.cart-drawer-body,
.wishlist-drawer .cart-drawer-body {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 20px;
}

.empty-cart-message { text-align: center; margin-top: 50px; }
.empty-cart-message svg { margin-bottom: 15px; }
.empty-cart-message p { color: #666; margin-bottom: 25px; font-size: 14px; }
.continue-shopping-btn {
  display: inline-block;
  padding: 12px 25px;
  background: #000;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 25px;
}
.continue-shopping-btn:hover { opacity: 0.8; }

/* ----- Footer drawer (nút thanh toán dính đáy) ----- */
.cart-drawer-footer {
  flex-shrink: 0 !important;
  padding: 20px;
  border-top: 1px solid #eee;
  background: #fff !important;
  position: relative !important;
  z-index: 10 !important;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.05) !important;
  padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
}
.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.cart-subtotal span { font-size: 13px; font-weight: 700; color: #666; }
.cart-subtotal strong { font-size: 18px; font-weight: 700; color: #000; }
.checkout-btn {
  display: block;
  width: 100%;
  padding: 15px;
  background: #000;
  color: #fff;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
}
.checkout-btn:hover { background: #1768b2; }

/* ----- Mobile ----- */
@media (max-width: 767px) {
  .cart-drawer,
  .wishlist-drawer {
    /* Căn drawer dính ngay top của mobile-bottom-nav (đo bằng JS) */
    top: 0 !important;
    bottom: var(--sobie-bnav-h, 60px) !important;
    height: auto !important;
  }
  .cart-drawer-footer {
    /* Trả lại padding bình thường ở mobile */
    padding-bottom: 20px !important;
  }
}

