/* ==============================================
   cart.css — Keranjang & Checkout TB Sumber Rejeki
   ============================================== */

/* ─── CART ICON DI NAVBAR ─── */
.nav-cart-btn {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  background: var(--primary); color: white;
  border: none; border-radius: 50px;
  padding: 9px 18px; font-size: 14px; font-weight: 800;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  text-decoration: none;
}
.nav-cart-btn:hover { background: #e55b22; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,107,44,0.35); }
.cart-badge {
  position: absolute; top: -8px; right: -8px;
  background: #FF3A6E; color: white;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
  opacity: 0; transform: scale(0.5);
  transition: all 0.2s;
}
.cart-badge.show { opacity: 1; transform: scale(1); }

/* ─── TOMBOL TAMBAH KE KERANJANG ─── */
.btn-cart {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: white;
  border: none; border-radius: 50px;
  padding: 9px 16px; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  white-space: nowrap;
}
.btn-cart:hover { background: #e55b22; transform: scale(1.04); }
.btn-cart.added {
  background: linear-gradient(135deg, #16A34A, #22C55E) !important;
}
.btn-cart-wa {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(0,191,166,0.1); color: var(--teal);
  border: 1.5px solid var(--teal); border-radius: 50px;
  padding: 9px 14px; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  text-decoration: none;
  white-space: nowrap;
}
.btn-cart-wa:hover { background: var(--teal); color: white; }
.prod-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── PANEL KERANJANG (SLIDE-IN DARI KANAN) ─── */
.cart-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(26,34,56,0.55);
  opacity: 0; visibility: hidden;
  transition: all 0.3s;
  backdrop-filter: blur(4px);
}
.cart-overlay.open { opacity: 1; visibility: visible; }

.cart-panel {
  position: fixed; top: 0; right: -480px; bottom: 0;
  width: 460px; max-width: 100vw;
  z-index: 501;
  background: white;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.18);
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
}
.cart-panel.open { right: 0; }

.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
.cart-header h2 { font-size: 18px; font-weight: 900; color: var(--dark); }
.cart-close {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bg); border: none; cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.cart-close:hover { background: #fce8df; color: var(--primary); }

.cart-items {
  flex: 1; overflow-y: auto; padding: 16px 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.cart-items::-webkit-scrollbar { width: 4px; }
.cart-items::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

.cart-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: var(--mid); padding: 40px;
  text-align: center;
}
.cart-empty-icon { font-size: 52px; opacity: 0.4; }
.cart-empty p { font-size: 15px; font-weight: 700; }
.cart-empty small { font-size: 13px; font-weight: 600; }

.cart-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: 14px;
  background: var(--bg);
  border: 1px solid transparent;
  transition: border-color 0.2s;
}
.cart-item:hover { border-color: rgba(255,107,44,0.2); }
.cart-item-img {
  width: 54px; height: 54px; border-radius: 10px;
  background: white; display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0; overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 800; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { font-size: 13px; font-weight: 700; color: var(--primary); margin-top: 2px; }
.cart-item-sub { font-size: 12px; color: var(--mid); font-weight: 600; }
.cart-item-controls {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.qty-btn {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1.5px solid rgba(0,0,0,0.12); background: white;
  font-size: 15px; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-num { font-size: 14px; font-weight: 900; min-width: 22px; text-align: center; }
.cart-item-del {
  width: 28px; height: 28px; border-radius: 8px;
  border: none; background: rgba(255,58,110,0.08); color: #FF3A6E;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; margin-left: 2px;
}
.cart-item-del:hover { background: #FF3A6E; color: white; }

.cart-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid rgba(0,0,0,0.07);
}
.cart-subtotal {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.cart-subtotal span { font-size: 14px; font-weight: 700; color: var(--mid); }
.cart-subtotal strong { font-size: 20px; font-weight: 900; color: var(--dark); }
.btn-checkout {
  width: 100%; padding: 16px;
  background: linear-gradient(135deg, var(--primary), #FF3A6E);
  color: white; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 900;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-checkout:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,107,44,0.4); }
.btn-clear-cart {
  width: 100%; padding: 10px;
  background: transparent; color: var(--mid);
  border: 1.5px solid rgba(0,0,0,0.1); border-radius: 10px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all 0.2s; font-family: 'Nunito', sans-serif;
  margin-top: 8px;
}
.btn-clear-cart:hover { border-color: #FF3A6E; color: #FF3A6E; }

/* ─── MODAL CHECKOUT ─── */
.checkout-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(26,34,56,0.65);
  opacity: 0; visibility: hidden;
  transition: all 0.3s;
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.checkout-overlay.open { opacity: 1; visibility: visible; }

.checkout-modal {
  background: white; border-radius: 24px;
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
  transform: translateY(24px) scale(0.97);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}
.checkout-modal::-webkit-scrollbar { width: 4px; }
.checkout-modal::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }
.checkout-overlay.open .checkout-modal { transform: translateY(0) scale(1); }

.checkout-head {
  padding: 24px 28px 0;
  display: flex; justify-content: space-between; align-items: center;
}
.checkout-head h2 { font-size: 20px; font-weight: 900; color: var(--dark); }
.checkout-close {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bg); border: none; cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.checkout-close:hover { background: #fce8df; color: var(--primary); }

.checkout-body { padding: 20px 28px 28px; display: flex; flex-direction: column; gap: 18px; }

.checkout-summary {
  background: var(--bg); border-radius: 14px; padding: 16px;
}
.checkout-summary h4 { font-size: 13px; font-weight: 800; color: var(--mid); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.summary-item {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--dark2); padding: 4px 0;
}
.summary-item .si-name { flex: 1; }
.summary-item .si-qty { color: var(--mid); margin: 0 10px; }
.summary-item .si-price { color: var(--primary); font-weight: 800; }
.summary-total {
  border-top: 1.5px solid rgba(0,0,0,0.08); margin-top: 10px; padding-top: 10px;
  display: flex; justify-content: space-between;
  font-size: 16px; font-weight: 900; color: var(--dark);
}
.summary-total span:last-child { color: var(--primary); }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 800; color: var(--dark2); }
.form-group label span.req { color: #FF3A6E; }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 13px 16px;
  border: 1.5px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  font-family: 'Nunito', sans-serif;
  color: var(--dark);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,44,0.12);
}
.form-group textarea { min-height: 80px; resize: vertical; }

.metode-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.metode-opt {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px;
  border: 2px solid rgba(0,0,0,0.08); border-radius: 12px;
  cursor: pointer; transition: all 0.2s;
  background: white;
}
.metode-opt input[type=radio] { display: none; }
.metode-opt:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-pale);
}
.metode-opt-icon { font-size: 22px; }
.metode-opt-label { font-size: 12px; font-weight: 800; color: var(--dark2); text-align: center; }

.btn-submit-order {
  width: 100%; padding: 17px;
  background: linear-gradient(135deg, var(--primary), #FF3A6E);
  color: white; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 900;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-submit-order:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,107,44,0.4); }
.btn-submit-order:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* ─── SUKSES CHECKOUT ─── */
.checkout-success {
  display: none; flex-direction: column; align-items: center;
  text-align: center; padding: 40px 28px 32px; gap: 16px;
}
.checkout-success.show { display: flex; }
.success-icon { font-size: 64px; animation: popIn 0.5s cubic-bezier(0.4,0,0.2,1); }
@keyframes popIn { 0%{transform:scale(0)} 80%{transform:scale(1.12)} 100%{transform:scale(1)} }
.success-kode {
  background: var(--primary-pale);
  color: var(--primary);
  padding: 8px 20px; border-radius: 50px;
  font-size: 14px; font-weight: 900; letter-spacing: 1px;
}
.success-title { font-size: 22px; font-weight: 900; color: var(--dark); }
.success-sub { font-size: 14px; font-weight: 600; color: var(--mid); line-height: 1.6; }
.btn-wa-confirm {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 16px;
  background: #25D366; color: white;
  border: none; border-radius: 14px;
  font-size: 16px; font-weight: 900;
  cursor: pointer; text-decoration: none;
  transition: all 0.2s; font-family: 'Nunito', sans-serif;
}
.btn-wa-confirm:hover { background: #1da851; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,211,102,0.4); }
.btn-lanjut-belanja {
  background: transparent; color: var(--mid);
  border: 1.5px solid rgba(0,0,0,0.1); border-radius: 12px;
  padding: 12px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: 'Nunito', sans-serif;
  transition: all 0.2s; width: 100%;
}
.btn-lanjut-belanja:hover { border-color: var(--primary); color: var(--primary); }

/* ─── TOAST NOTIF ─── */
.toast-wrap {
  position: fixed; bottom: 100px; right: 24px; z-index: 700;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--dark);
  color: white; padding: 14px 18px;
  border-radius: 14px; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateX(120%); opacity: 0;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  pointer-events: auto;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.green { background: linear-gradient(135deg, #16A34A, #22C55E); }
.toast.red   { background: linear-gradient(135deg, #DC2626, #EF4444); }
