/* ==========================================================================
   DAP DIGITAL - CREATIVE SHOPPING CART & SLIDE-OVER DRAWER (cart.css)
   ========================================================================== */

/* Cart Backdrop Overlay */
.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Slide-Over Drawer Container (Desktop: Right Drawer, Mobile: Bottom Sheet) */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  background: #080C1E;
  color: #FFFFFF;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.6);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .cart-drawer {
  background: #FFFFFF;
  color: #0F172A;
  border-left-color: rgba(0, 0, 0, 0.08);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.15);
}

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

/* Drawer Header */
.cart-drawer-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 22, 56, 0.6);
  backdrop-filter: blur(10px);
}

[data-theme="light"] .cart-drawer-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
  background: rgba(248, 250, 252, 0.9);
}

.cart-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-header-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.05));
  border: 1px solid rgba(249, 115, 22, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #F97316;
}

.cart-drawer-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-count-pill {
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
  background: #F97316;
  padding: 2px 7px;
  border-radius: 9999px;
  display: inline-block;
  vertical-align: middle;
}

.cart-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

[data-theme="light"] .cart-drawer-close {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

.cart-drawer-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #EF4444;
  color: #EF4444;
  transform: rotate(90deg);
}

/* Gamified Reward / Threshold Progress Bar */
.cart-reward-bar-wrap {
  padding: 12px 20px;
  background: rgba(249, 115, 22, 0.05);
  border-bottom: 1px solid rgba(249, 115, 22, 0.15);
}

.cart-reward-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

.cart-reward-text {
  color: #FDBA74;
  display: flex;
  align-items: center;
  gap: 5px;
}

[data-theme="light"] .cart-reward-text {
  color: #C2410C;
}

.cart-reward-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

[data-theme="light"] .cart-reward-track {
  background: rgba(0, 0, 0, 0.08);
}

.cart-reward-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #F97316 0%, #EC4899 50%, #10B981 100%);
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Cart Items Scroll Area */
.cart-items-container {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(249, 115, 22, 0.4) transparent;
}

.cart-items-container::-webkit-scrollbar {
  width: 5px;
}

.cart-items-container::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.3);
  border-radius: 4px;
}

/* Individual Cart Item Card */
.cart-item-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: all 0.2s ease;
  position: relative;
}

[data-theme="light"] .cart-item-card {
  background: #F8FAFC;
  border-color: rgba(0, 0, 0, 0.06);
}

.cart-item-card:hover {
  border-color: rgba(249, 115, 22, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.cart-item-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: #080C1E;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cart-item-thumb svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cart-item-content {
  flex: 1;
  min-width: 0;
}

.cart-item-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.cart-item-name {
  font-size: 13px;
  font-weight: 800;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

.cart-item-remove-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.cart-item-remove-btn:hover {
  color: #EF4444;
}

.cart-item-variant-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #F97316;
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.25);
  padding: 1.5px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
}

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

.cart-item-price-col {
  display: flex;
  flex-direction: column;
}

.cart-item-unit-price {
  font-size: 12.5px;
  font-weight: 800;
  color: #F97316;
}

/* Stepper Quantity Buttons */
.cart-qty-stepper {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

[data-theme="light"] .cart-qty-stepper {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.12);
}

.cart-qty-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cart-qty-btn:hover {
  background: rgba(249, 115, 22, 0.15);
  color: #F97316;
}

.cart-qty-val {
  min-width: 26px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: inherit;
}

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

.cart-empty-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(249, 115, 22, 0.1);
  border: 1px dashed rgba(249, 115, 22, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #F97316;
  margin-bottom: 16px;
}

.cart-empty-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 6px 0;
}

.cart-empty-desc {
  font-size: 12.5px;
  color: #94A3B8;
  max-width: 240px;
  margin: 0 0 20px 0;
  line-height: 1.4;
}

.btn-start-shopping {
  padding: 10px 20px;
  background: linear-gradient(135deg, #F97316, #EA580C);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
  transition: transform 0.15s ease;
}

.btn-start-shopping:active {
  transform: scale(0.97);
}

/* Drawer Footer & Checkout Action */
.cart-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 22, 56, 0.6);
  backdrop-filter: blur(10px);
}

[data-theme="light"] .cart-drawer-footer {
  border-top-color: rgba(0, 0, 0, 0.06);
  background: rgba(248, 250, 252, 0.9);
}

.cart-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
  color: #94A3B8;
}

.cart-summary-row.total {
  font-size: 16px;
  font-weight: 900;
  color: inherit;
  margin-bottom: 14px;
}

.cart-summary-total-amount {
  color: #F97316;
  font-size: 18px;
}

.btn-cart-checkout {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.35);
  transition: all 0.16s ease;
}

.btn-cart-checkout:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(249, 115, 22, 0.45);
}

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

.cart-footer-aux-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
}

.btn-clear-cart {
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  font-size: 11px;
  transition: color 0.15s ease;
}

.btn-clear-cart:hover {
  color: #EF4444;
  text-decoration: underline;
}

.cart-secure-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #10B981;
  font-weight: 600;
}

/* Floating Quick-Cart Button (Global Sticky) */
.floating-cart-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 95;
  height: 48px;
  padding: 0 18px;
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  color: #FFFFFF;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  opacity: 0;
  transform: scale(0.85) translateY(10px);
  pointer-events: none;
}

.floating-cart-btn.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.floating-cart-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px rgba(249, 115, 22, 0.5);
}

.floating-cart-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.floating-cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: #FFFFFF;
  color: #EA580C;
  font-size: 10px;
  font-weight: 900;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.floating-cart-text {
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
}

/* Header Cart Button in Navbar */
.header-cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-ink);
  cursor: pointer;
  transition: all 0.18s ease;
}

.header-cart-btn:hover {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.4);
  color: #F97316;
}

.header-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #F97316;
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 900;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border-radius: 9999px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
}

.header-cart-badge.has-items {
  display: flex;
  animation: cartBadgePop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cartBadgePop {
  0% { transform: scale(0.4); }
  70% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Secondary Button "+ Keranjang" on Product Cards */
.product-actions-split {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.btn-product-cart {
  flex: 0 0 46px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(249, 115, 22, 0.1);
  border: 1.5px solid rgba(249, 115, 22, 0.3);
  color: #F97316;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-product-cart:hover {
  background: #F97316;
  color: #FFFFFF;
  border-color: #F97316;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}

.btn-product-cart:active {
  transform: scale(0.95);
}

/* Cart Checkout Mode in checkout.html */
.cart-checkout-items-list {
  background: var(--color-card-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.cart-checkout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.cart-checkout-title {
  font-size: 13.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-ink);
  margin: 0;
}

/* Mobile Bottom Sheet Adaptation */
@media (max-width: 640px) {
  .cart-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 86vh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    transform: translateY(100%);
  }

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

  .floating-cart-btn {
    bottom: 80px; /* Sit above the sticky checkout bar or tab bar */
    right: 16px;
    height: 44px;
    padding: 0 14px;
  }
}
