/*====================
Blok 1 — Cart Drawer: mengatur panel keranjang samping dan transisi buka-tutup.
======================*/

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  box-shadow: -12px 0 40px rgba(31, 75, 120, 0.16);
  transform: translateX(105%);
  transition: transform 0.3s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  color: #163b63;
}

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

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid #e5edf6;
}

.drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #163b63;
}

.x-drawer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #dceeff;
  color: #2878c7;
  cursor: pointer;
}

.x-drawer:hover {
  background: #b8d8f5;
}

/*====================
Blok 2 — Cart Items: mengatur kartu produk, harga, subtotal, dan jarak antaritem.
======================*/

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.drawer-items {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 15px;
  margin-bottom: 12px;
  border: 1px solid #e5edf6;
  border-radius: 14px;
  background: #f7fafe;
}

.drawer-item-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 24px;
}

.drawer-item-name {
  color: #163b63;
  font-size: 14px;
  line-height: 1.5;
}

.drawer-item-price {
  color: #64748b;
  font-size: 12px;
}

.drawer-item-subtotal {
  color: #2878c7;
  font-size: 14px;
}

.drawer-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/*====================
Blok 3 — Cart Quantity: mengatur tombol tambah dan kurangi jumlah produk.
======================*/

.drawer-qty-control {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: auto;
}

.drawer-qty-control .prd-btn-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: #dceeff;
  color: #2878c7;
  cursor: pointer;
}

.drawer-qty-control .prd-btn-cart:hover {
  background: #2878c7;
  color: #ffffff;
}

.drawer-qty-control .qty-number {
  min-width: 20px;
  padding: 0;
  color: #163b63;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

/*====================
Blok 4 — Cart Remove: mengatur tombol hapus produk.
======================*/

.trash-drawer {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
}

.trash-drawer:hover {
  background: #fff0ef;
  color: #d93636;
}

.trash-drawer .lucide {
  width: 15px;
  height: 15px;
}

/*====================
Blok 5 — Cart Empty: mengatur tampilan ketika keranjang belum berisi produk.
======================*/

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 16px;
  color: #64748b;
  text-align: center;
}

.cart-empty .lucide {
  width: 38px;
  height: 38px;
  color: #2878c7;
}

.cart-empty p {
  margin: 0;
  color: #163b63;
  font-size: 15px;
  font-weight: 700;
}

.cart-empty span {
  font-size: 12px;
  line-height: 1.6;
}

/*====================
Blok 6 — Cart Summary: mengatur total belanja dan area checkout.
======================*/

.drawer-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  margin: 0;
  border-top: 1px solid #e5edf6;
  color: #64748b;
  font-size: 13px;
}

.drawer-summary strong {
  color: #2878c7;
  font-size: 16px;
  text-align: right;
}

.drawer-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 20px 24px;
  border-top: 1px solid #e5edf6;
}

.checkout-btn {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border: 0;
  border-radius: 30px;
  background: #2878c7;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

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

.checkout-btn span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.checkout-btn .lucide {
  width: 16px;
  height: 16px;
}

/*====================
Blok 7 — Floating Checkout: mengatur tombol keranjang mengambang.
===================*/

.prd-btn-checkout {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 19px;
  border: 0;
  border-radius: 40px;
  background: #2878c7;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 25px rgba(40, 120, 199, 0.25);
  cursor: pointer;
}

.prd-btn-checkout.show {
  display: flex;
}

.prd-btn-checkout:hover {
  background: #163b63;
}

.prd-qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #b8d8f5;
  color: #163b63;
  font-size: 11px;
}

/*====================
Blok 8 — Checkout Icon: mengatur ukuran ikon pada tombol checkout.
======================*/

.checkout-btn .lucide {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* =========================
Blok 8 — PRODUCT VARIANTS
============================ */

.product-variants {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 22px 0;
}

.product-variant-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.product-variant-label {
  margin-bottom: 10px;
  color: #163b63;
  font-size: 14px;
  font-weight: 600;
}

/* VARIANT OPTIONS */

.product-variant-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.product-variant-option {
  min-width: 58px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid #e5edf6;
  border-radius: 8px;
  background: #ffffff;
  color: #163b63;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

/* HOVER */

.product-variant-option:hover {
  border-color: #2878c7;
  color: #2878c7;
}

/* SELECTED */

.product-variant-option.active,
.product-variant-option[aria-pressed="true"] {
  border-color: #2878c7;
  background: #dceeff;
  color: #2878c7;
  font-weight: 600;
  box-shadow: 0 0 0 1px #2878c7;
}

/* FOCUS */

.product-variant-option:focus-visible {
  outline: 2px solid #2878c7;
  outline-offset: 3px;
}

/* DISABLED */

.product-variant-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/*====================
Blok 9 — Cart Responsive: menyesuaikan keranjang untuk layar HP dan tablet.
======================*/

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

  .prd-btn-checkout {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }

  .drawer-header {
    padding: 17px;
  }

  .drawer-body {
    padding: 12px;
  }

  .drawer-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .product-variants {
    gap: 15px;
    margin: 18px 0;
  }

  .product-variant-option {
    min-height: 38px;
    padding: 8px 13px;
    font-size: 12px;
  }
}
