/* ===================================================
 * KEREN SNACK — Shopping Cart System Styles
 * =================================================== */

/* --- Cart Page Navbar Styles --- */
body.page-cart .nav {
  background: rgba(253,246,238,0.98) !important;
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border-bottom: 1px solid rgba(30,19,10,0.06);
  box-shadow: 0 2px 20px rgba(30,19,10,0.08);
}
body.page-cart .nav-links a {
  color: var(--ink-soft);
}
body.page-cart .nav-links a:hover {
  color: var(--ink);
}
body.page-cart .nav-toggle span {
  background: var(--ink);
}
body.page-cart .nav-drawer {
  background: rgba(253,246,238,0.98) !important;
  border-top: 1px solid rgba(30,19,10,0.06) !important;
}
body.page-cart .nav-drawer a {
  color: var(--ink-soft) !important;
  border-bottom: 1px solid rgba(30,19,10,0.06) !important;
}
body.page-cart .nav-drawer a:hover {
  color: var(--ink) !important;
}
body.page-cart .nav-drawer .nav-cta {
  background: var(--ink) !important;
  color: #fff !important;
}

/* --- Hide WA float if Floating Cart exists on the page --- */
body:has(.floating-cart) .wa-float {
  display: none !important;
}

/* --- Floating Cart Button --- */
.floating-cart {
  position: fixed;
  bottom: calc(26px + env(safe-area-inset-bottom));
  right: calc(26px + env(safe-area-inset-right));
  background: var(--red);
  color: var(--white);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: none;
  z-index: 99;
  text-decoration: none;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease, background 0.2s;
}

.floating-cart:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  background: var(--red-dark);
  color: var(--white);
}

.floating-cart svg {
  width: 26px;
  height: 26px;
}

.cart-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--ink);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(15%, -15%);
  border: 2px solid var(--white);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-cart.bump .cart-badge {
  animation: bump 0.4s ease-out;
}

@keyframes bump {
  0% { transform: translate(15%, -15%) scale(1); }
  50% { transform: translate(15%, -15%) scale(1.4); }
  100% { transform: translate(15%, -15%) scale(1); }
}

/* --- Cart Page Layout & Styling --- */
.cart-hero-section {
  padding: 130px 0 35px;
  background: var(--cream);
  border-bottom: 1px solid var(--cream-2);
}

.cart-hero-section .wrap > * {
  opacity: 0;
  animation: slideUpFade 0.8s var(--ease) forwards;
}
.cart-hero-section .wrap > *:nth-child(1) { animation-delay: 0.1s; }
.cart-hero-section .wrap > *:nth-child(2) { animation-delay: 0.2s; }
.cart-hero-section .wrap > *:nth-child(3) { animation-delay: 0.3s; }

.cart-title {
  font-family: 'Fraunces', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--red-dark);
  margin-bottom: 10px;
  line-height: 1.2;
}

.cart-main-wrap {
  padding: 40px 24px 80px;
}

.cart-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 900px) {
  .cart-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* Items Container Box */
.cart-items-box {
  background: var(--white);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1.5px solid var(--cream-2);
}

@media (max-width: 480px) {
  .cart-items-box {
    padding: 16px;
  }
}

/* Empty State */
.cart-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-soft);
  opacity: 0;
  animation: slideUpFade 0.6s var(--ease) 0.1s forwards;
}

.cart-empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  color: var(--ink-muted);
  opacity: 0.5;
}

.cart-empty h3 {
  font-family: 'Baloo 2', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.cart-empty p {
  font-size: 14.5px;
  margin-bottom: 24px;
}

.btn-continue-shopping {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--red);
  color: var(--white) !important;
  font-family: 'Baloo 2', sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 30px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(217, 43, 43, 0.3);
  transition: all 0.25s var(--ease);
}

.btn-continue-shopping:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(217, 43, 43, 0.4);
}

@keyframes cartSlideIn {
  0% { opacity: 0; transform: translateX(-30px); }
  100% { opacity: 1; transform: translateX(0); }
}

.cart-item {
  display: flex;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1.5px solid var(--cream);
  gap: 16px;
  opacity: 0;
  animation: cartSlideIn 0.7s var(--ease) forwards;
  will-change: transform, opacity;
}

.cart-item:nth-child(1) { animation-delay: 0.1s; }
.cart-item:nth-child(2) { animation-delay: 0.2s; }
.cart-item:nth-child(3) { animation-delay: 0.3s; }
.cart-item:nth-child(4) { animation-delay: 0.4s; }
.cart-item:nth-child(5) { animation-delay: 0.5s; }
.cart-item:nth-child(6) { animation-delay: 0.6s; }
.cart-item:nth-child(7) { animation-delay: 0.7s; }
.cart-item:nth-child(8) { animation-delay: 0.8s; }
.cart-item:nth-child(n+9) { animation-delay: 0.9s; }

.cart-item:last-child {
  border-bottom: none;
}

@media (max-width: 520px) {
  .cart-item {
    flex-wrap: wrap;
  }
  .cart-item-actions {
    margin-left: auto;
  }
}

.cart-item-img {
  width: 76px;
  height: 76px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--cream);
  padding: 4px;
  border: 1px solid var(--cream-2);
  flex-shrink: 0;
}

.cart-item-details {
  flex: 1;
  min-width: 130px;
}

.cart-item-title {
  font-family: 'Baloo 2', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.3;
}

.cart-item-price {
  font-weight: 700;
  color: var(--red-dark);
  font-size: 14.5px;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--parchment);
  padding: 4px 6px;
  border-radius: 20px;
  border: 1px solid var(--cream-3);
}

.qty-btn {
  background: var(--white);
  border: 1px solid var(--cream-2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease);
}

.qty-btn:hover {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

.qty-input {
  width: 44px;
  text-align: center;
  border: none;
  background: transparent;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  color: var(--ink);
  font-size: 16px;
}

/* Hide default arrows for number input */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-left: 4px;
}

.remove-btn:hover {
  color: var(--red);
  background: rgba(217, 43, 43, 0.1);
}

@keyframes summarySlideUp {
  0% { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Summary Box */
.cart-summary-box {
  background: var(--white);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1.5px solid var(--cream-2);
  position: sticky;
  top: 100px;
  opacity: 0;
  animation: summarySlideUp 0.8s var(--ease) 0.3s forwards;
  will-change: transform, opacity;
}

.cart-summary-heading {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--cream-2);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14.5px;
  color: var(--ink-mid);
}

.summary-divider {
  height: 1px;
  border-top: 1.5px dashed var(--cream-3);
  margin: 16px 0;
}

.summary-line.total {
  font-family: 'Baloo 2', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
}

.total-price {
  color: var(--red-dark);
  font-size: 1.35rem;
}

.checkout-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: #25D366;
  color: var(--white) !important;
  font-family: 'Baloo 2', sans-serif;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  margin-top: 20px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}

.checkout-wa-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  background: #20BD5A;
}

.checkout-wa-btn .wa-logo {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

/* Disabled state — dikontrol via aria-disabled, bukan atribut `disabled`
   (anchor <a> tidak mendukung `disabled` bawaan browser, jadi harus
   eksplisit lewat ARIA + JS. Lihat cart.js). */
.checkout-wa-btn[aria-disabled="true"] {
  background: #D5D5D5 !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
  opacity: 0.7;
  pointer-events: none;
}
.checkout-wa-btn[aria-disabled="true"] .wa-logo {
  filter: grayscale(1);
  opacity: 0.7;
}

.continue-shopping-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: color 0.2s;
}

.continue-shopping-link:hover {
  color: var(--red);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--ink);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Baloo 2', sans-serif;
  font-size: 14px;
  font-weight: 600;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s var(--ease), opacity 0.35s;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  color: #25D366;
  display: flex;
}

/* Product Card Button (+ Keranjang) */
.p-add-to-cart {
  background: var(--ink);
  color: var(--white) !important;
  font-family: 'Baloo 2', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  transition: background 0.25s var(--ease), transform 0.2s;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.p-add-to-cart:hover {
  background: var(--amber);
  color: var(--ink) !important;
  transform: scale(1.04);
}

/* Fix Product Card Footer Overlap on Mobile */
.p-foot {
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 420px) {
  .p-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px 14px;
  }
  .p-foot .p-price {
    text-align: center;
    font-size: 14.5px;
  }
  .p-foot .p-add-to-cart {
    width: 100%;
    padding: 8px 12px;
    justify-content: center;
  }
}

/* UX Improvements for Cart */
.qty-btn-trash {
  color: var(--red) !important;
}
.qty-btn-trash:hover {
  background: rgba(230, 57, 70, 0.1) !important;
}
.qty-btn-trash svg {
  stroke: var(--red) !important;
}

.clear-cart-text-btn {
  background: transparent;
  color: var(--red);
  border: none;
  font-family: 'Baloo 2', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s;
}
.clear-cart-text-btn:hover {
  background: rgba(230, 57, 70, 0.08);
}
/* ===================================================
 * Custom Confirm Modal
 * =================================================== */
.custom-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 45, 30, 0.4); /* --ink with opacity */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.custom-confirm-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.custom-confirm-modal {
  background: var(--white);
  width: 90%;
  max-width: 360px;
  border-radius: 24px;
  padding: 32px 24px 28px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(11, 45, 30, 0.15);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-confirm-overlay.show .custom-confirm-modal {
  transform: translateY(0) scale(1);
}

.custom-confirm-icon {
  width: 60px;
  height: 60px;
  background: rgba(230, 57, 70, 0.1); /* --red light */
  color: var(--red);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.custom-confirm-icon svg {
  width: 32px;
  height: 32px;
}

.custom-confirm-title {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.2;
}

.custom-confirm-desc {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 28px;
  line-height: 1.5;
}

.custom-confirm-actions {
  display: flex;
  gap: 12px;
}

.custom-confirm-btn {
  flex: 1;
  font-family: 'Baloo 2', sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 12px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.custom-confirm-cancel {
  background: var(--cream);
  color: var(--ink-soft);
}

.custom-confirm-cancel:hover {
  background: var(--cream-2);
  color: var(--ink);
}

.custom-confirm-yes {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.custom-confirm-yes:hover {
  background: var(--red-dark);
  box-shadow: 0 6px 16px rgba(230, 57, 70, 0.4);
  transform: translateY(-2px);
}
