/* Cart drawer — Stitch-inspired right slide-over on Bootstrap #staticBackdrop */

.cart-drawer-modal.modal {
  padding-right: 0 !important;
}

/*
 * products.php sets overflow-x:clip on html|body, which makes html the scroll
 * container — body.modal-open alone does not stop background scroll.
 */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

html.cart-drawer-scroll-lock,
body.cart-drawer-scroll-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
}

body.cart-drawer-scroll-lock {
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
}

.cart-drawer-scroll-lock .cart-drawer-body {
  -webkit-overflow-scrolling: touch;
}

/*
 * Keep the modal shell opaque while open/closing so the panel slide is visible.
 * Bootstrap's default .modal.fade opacity → 0 hides the close slide.
 * Timing still comes from the dialog transform (see cart-drawer-ui.js).
 */
.cart-drawer-modal.modal.fade {
  opacity: 1;
  transition: none;
}

.cart-drawer-modal + .modal-backdrop,
body.modal-open .modal-backdrop {
  background: rgba(15, 23, 42, 0.4);
  transition: opacity 0.3s ease-in-out;
}

@supports ((-webkit-backdrop-filter: blur(4px)) or (backdrop-filter: blur(4px))) {
  body.modal-open .modal-backdrop.show {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
}

/* Beat Bootstrap .modal.fade .modal-dialog { transform: translate(0,-25%) } */
.cart-drawer-modal.modal.fade .modal-dialog.cart-drawer-dialog,
.cart-drawer-modal.modal .modal-dialog.cart-drawer-dialog {
  position: fixed;
  margin: 0;
  top: 0;
  right: 0;
  left: auto;
  width: 100%;
  max-width: 28rem;
  height: 100%;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}

.cart-drawer-modal.modal.fade.show .modal-dialog.cart-drawer-dialog,
.cart-drawer-modal.modal.show .modal-dialog.cart-drawer-dialog {
  transform: translateX(0);
}

.cart-drawer-modal.modal.show.is-closing .modal-dialog.cart-drawer-dialog,
.cart-drawer-modal.modal.fade.show.is-closing .modal-dialog.cart-drawer-dialog {
  transform: translateX(100%);
}

.cart-drawer-panel.modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 0;
  border-radius: 0;
  border-left: 1px solid #f1f5f9;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.cart-drawer-header-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.cart-drawer-header-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cart-drawer-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.cart-drawer-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
}

.cart-drawer-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.cart-drawer-close:hover {
  background: #f1f5f9;
  color: #334155;
}

.cart-drawer-body.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cart-drawer-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cart-drawer-card {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: 1rem;
  background: rgba(248, 250, 252, 0.7);
  border: 1px solid #f1f5f9;
  position: relative;
}

.cart-drawer-card-img {
  width: 5rem;
  height: 5rem;
  border-radius: 0.75rem;
  object-fit: cover;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  flex-shrink: 0;
}

.cart-drawer-card-img.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 0.7rem;
}

.cart-drawer-card-body {
  flex: 1 1 auto;
  min-width: 0;
}

.cart-drawer-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.cart-drawer-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #fee2e2;
  color: #dc2626;
  margin-bottom: 0.25rem;
}

.cart-drawer-card-name {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cart-drawer-remove {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  padding: 0.25rem;
  line-height: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.cart-drawer-remove:hover {
  color: #ef4444;
}

.cart-drawer-card-bottom {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cart-drawer-price {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.cart-drawer-price-current {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.cart-drawer-price-strike {
  font-size: 0.75rem;
  color: #94a3b8;
  text-decoration: line-through;
}

.cart-drawer-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.15rem 0.35rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.cart-drawer-stepper-btn {
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  background: transparent;
  color: #64748b;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.cart-drawer-stepper-btn:hover:not(:disabled) {
  color: #0f172a;
}

.cart-drawer-stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cart-drawer-stepper-val {
  width: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
}

.cart-drawer-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #64748b;
}

.cart-drawer-empty[hidden],
.cart-drawer-breakdown[hidden],
.cart-drawer-simple-total[hidden],
.cart-drawer-trust[hidden],
.cart-drawer-trust.is-hidden {
  display: none !important;
}

.cart-drawer-empty-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.cart-drawer-empty-text {
  margin: 0;
  font-size: 0.875rem;
}

.cart-drawer-breakdown {
  background: rgba(248, 250, 252, 0.6);
  border: 1px solid #f1f5f9;
  border-radius: 1rem;
  padding: 1rem;
}

.cart-drawer-breakdown-title {
  margin: 0 0 0.65rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.cart-drawer-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: #475569;
  margin-bottom: 0.45rem;
}

.cart-drawer-breakdown-row.is-discount {
  color: #059669;
  font-weight: 500;
}

.cart-drawer-breakdown-total {
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.cart-drawer-breakdown-total-value {
  font-size: 1.125rem;
  font-weight: 800;
}

.cart-drawer-simple-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  padding: 0.25rem 0;
}

.cart-drawer-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #64748b;
  padding: 0.25rem 0;
}

.cart-drawer-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.cart-drawer-footer.modal-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #f1f5f9;
  background: #fff;
  flex-shrink: 0;
}

.cart-drawer-checkout-form {
  margin: 0;
  width: 100%;
}

.cart-drawer-checkout-btn {
  width: 100%;
  border: 0;
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  background: #0f172a;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.cart-drawer-checkout-btn:hover {
  filter: brightness(1.05);
}

.cart-drawer-checkout-btn:active {
  transform: scale(0.99);
}

.cart-drawer-continue {
  width: 100%;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem;
  cursor: pointer;
}

.cart-drawer-continue:hover {
  color: #1e293b;
}

/* Screen-reader / scrape-only table for legacy checkout + cart-v2 */
.cart-drawer-compat.show-cart {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 575.98px) {
  .cart-drawer-modal .modal-dialog.cart-drawer-dialog {
    max-width: 100%;
  }
}
