/* ============ 1. VARIABEL WARNA ============ */
:root {
  --bg: #f7f7f9; --bg-elev: #fff; --bg-soft: #f2f2f5; --bg-footer: #fafafa;
  --text: #1a1a1a; --text-soft: #666; --text-mute: #aaa;
  --border: #eaeaea; --border-soft: #f2f2f2;
  --accent: #ff6b35; --accent-hover: #e85a2a;
  --btn-dark: #1a1a1a; --btn-dark-hv: #ff6b35;
  --wa: #25D366; --wa-hover: #1eb855; --danger: #e74c3c;
  --shadow: 0 12px 28px rgba(0,0,0,.08); --overlay: rgba(0,0,0,.4);
}
[data-theme="dark"] {
  --bg: #0f1115; --bg-elev: #1a1d23; --bg-soft: #23262d; --bg-footer: #14171c;
  --text: #f1f3f5; --text-soft: #a0a6b0; --text-mute: #6a7080;
  --border: #2a2e36; --border-soft: #23262d;
  --accent: #ff8555; --accent-hover: #ff6b35;
  --btn-dark: #f1f3f5; --btn-dark-hv: #ff8555;
  --danger: #ff6b6b; --shadow: 0 12px 28px rgba(0,0,0,.4); --overlay: rgba(0,0,0,.6);
}

/* ============ 2. RESET ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); transition: .3s;
}

/* ============ 3. HEADER ============ */
header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { font-weight: 800; font-size: 20px; color: var(--text); }
.logo em { color: var(--accent); font-style: normal; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ============ 4. TOMBOL VIDEO & TEMA ============ */
.video-btn, .theme-toggle {
  width: 42px; height: 42px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: .2s; position: relative; overflow: hidden;
}
.video-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: scale(1.05); }
.theme-toggle:hover { border-color: var(--accent); transform: scale(1.05); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { position: absolute; transition: .3s; }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }
[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }

/* ============ 5. TOMBOL KERANJANG ============ */
.cart-btn {
  position: relative; background: var(--btn-dark); color: var(--bg-elev);
  border: none; border-radius: 10px; padding: 11px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: .2s;
}
.cart-btn:hover { background: var(--btn-dark-hv); color: #fff; }
.badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ============ 6. HERO ============ */
.hero { padding: 40px 24px 28px; text-align: center; background: var(--bg-elev); }
.hero h1 { font-size: 30px; letter-spacing: -1px; margin-bottom: 8px; }
.hero p { color: var(--text-soft); font-size: 15px; }

/* ============ 7. SEARCH & FILTER ============ */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 24px 80px; }

.search-filter {
  margin-bottom: 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.search-box { position: relative; max-width: 480px; width: 100%; }
.search-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%); font-size: 15px;
  opacity: .6; pointer-events: none;
}
.search-box input {
  width: 100%; padding: 13px 16px 13px 42px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text);
  font-size: 14px; font-family: inherit; transition: .2s;
}
.search-box input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, .15);
}

.kategori-filter {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 4px; scrollbar-width: none;
}
.kategori-filter::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 9px 18px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-soft); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .2s; white-space: nowrap; font-family: inherit;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ============ 8. GRID PRODUK ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.loading { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--text-soft); font-size: 15px; }
.no-result {
  text-align: center; padding: 60px 20px;
  color: var(--text-mute); font-size: 15px;
}

.card {
  background: var(--bg-elev); border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); transition: .25s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.thumb {
  aspect-ratio: 16/9; background: var(--bg-soft); overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 56px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .thumb img { transform: scale(1.06); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.kategori { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--accent); font-weight: 700; }
.nama { font-size: 15px; font-weight: 600; line-height: 1.35; }
.deskripsi {
  font-size: 12.5px; line-height: 1.5; color: var(--text-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.harga-wrap { margin-top: auto; padding-top: 10px; }
.harga-label { font-size: 11px; color: var(--text-mute); margin-bottom: 2px; }
.harga { font-size: 18px; font-weight: 800; }
.harga-range { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn-cart, .btn-buy {
  border: none; border-radius: 10px; padding: 11px 8px;
  font-size: 13.5px; font-weight: 700; cursor: pointer; transition: .2s;
}
.btn-cart { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn-cart:hover { border-color: var(--accent); color: var(--accent); }
.btn-buy { background: var(--accent); color: #fff; }
.btn-buy:hover { background: var(--accent-hover); }

/* ============ 9. DRAWER KERANJANG ============ */
.overlay {
  position: fixed; inset: 0; background: var(--overlay);
  opacity: 0; pointer-events: none; transition: .3s; z-index: 90;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 380px; max-width: 90vw;
  background: var(--bg-elev); z-index: 100;
  transform: translateX(100%); transition: transform .3s;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-head h2 { font-size: 17px; }
.close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-mute); transition: .2s; }
.close:hover { color: var(--accent); }
.items { flex: 1; overflow-y: auto; padding: 16px 20px; }
.empty { text-align: center; color: var(--text-mute); padding: 60px 0; font-size: 14px; }
.item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.item .thumb-sm {
  width: 60px; height: 40px; border-radius: 8px; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; overflow: hidden; flex-shrink: 0;
}
.item .thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.item-info { flex: 1; min-width: 0; }
.item-info .n { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.item-info .p { font-size: 13px; color: var(--text-soft); font-weight: 600; margin-top: 4px; }
.role-tag { display: inline-block; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.qty { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty button {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text); cursor: pointer; font-size: 15px;
}
.qty button:hover { border-color: var(--accent); }
.qty span { font-size: 13px; font-weight: 600; min-width: 18px; text-align: center; }
.hapus { background: none; border: none; color: var(--text-mute); cursor: pointer; font-size: 12px; align-self: flex-start; }
.hapus:hover { color: var(--danger); }
.drawer-foot { padding: 20px; border-top: 1px solid var(--border); background: var(--bg-footer); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.total-row span { font-size: 14px; color: var(--text-soft); }
.total-row strong { font-size: 22px; font-weight: 800; }
.drawer-info { font-size: 12px; color: var(--text-soft); text-align: center; margin-bottom: 12px; line-height: 1.5; }
.checkout {
  width: 100%; background: var(--accent); color: #fff; border: none;
  border-radius: 12px; padding: 15px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: .2s;
}
.checkout:hover { background: var(--accent-hover); }
.checkout:disabled { background: var(--bg-soft); color: var(--text-mute); cursor: not-allowed; }

/* ============ 10. MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay);
  z-index: 150; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-elev); border-radius: 20px; padding: 28px 24px 22px;
  max-width: 440px; width: 100%; transform: scale(.92); transition: transform .25s;
  box-shadow: var(--shadow); text-align: center; border: 1px solid var(--border);
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-icon { font-size: 44px; margin-bottom: 10px; }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-msg { font-size: 14px; line-height: 1.5; color: var(--text-soft); margin-bottom: 22px; }
.modal-sub { font-size: 13px; color: var(--text-mute); margin-bottom: 14px; }
.modal-produk-info {
  display: flex; gap: 12px; align-items: center; text-align: left;
  background: var(--bg-soft); border-radius: 12px; padding: 12px;
  margin-bottom: 14px; border: 1px solid var(--border);
}
.modal-produk-info .thumb-modal {
  width: 72px; height: 48px; border-radius: 8px; background: var(--bg-elev);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; overflow: hidden; flex-shrink: 0;
}
.modal-produk-info .thumb-modal img { width: 100%; height: 100%; object-fit: cover; }
.modal-produk-info .info-text { flex: 1; min-width: 0; }
.modal-produk-info .info-nama { font-size: 14px; font-weight: 700; margin-bottom: 3px; line-height: 1.3; }
.modal-produk-info .info-deskripsi { font-size: 12px; color: var(--text-soft); line-height: 1.45; }

.role-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.role-btn {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-soft); border: 1.5px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 12px 16px;
  font-size: 13.5px; cursor: pointer; transition: .2s; text-align: left;
}
.role-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.role-name { font-weight: 800; letter-spacing: .5px; font-size: 13px; }
.role-price { font-weight: 700; color: var(--text-soft); font-size: 13.5px; }
.role-btn:hover .role-price { color: var(--accent); }

.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-primary, .btn-secondary, .modal-cancel {
  border: none; border-radius: 10px; padding: 12px;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.modal-cancel { width: 100%; background: transparent; color: var(--text-mute); font-size: 13px; padding: 8px; }
.modal-cancel:hover { color: var(--danger); }

/* ============ 11. QR & FORM CHECKOUT ============ */
.checkout-step { text-align: center; }
.qr-img {
  width: 250px; height: 250px; margin: 12px auto;
  display: block; border-radius: 12px; background: #fff; padding: 8px;
}
.total-bayar { font-size: 22px; font-weight: 800; margin: 8px 0 4px; color: var(--accent); }
.expired-info { font-size: 12px; color: var(--text-mute); margin-bottom: 12px; }
.form-group { text-align: left; margin-bottom: 12px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; color: var(--text-soft); }
.form-group input, .form-group textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text); font-size: 14px; font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group input[type="file"] { padding: 8px; font-size: 12px; }

.status-wait { text-align: center; padding: 20px 10px; }
.status-wait .icon { font-size: 56px; margin-bottom: 12px; }
.status-wait h3 { font-size: 20px; margin-bottom: 10px; color: var(--accent); }
.status-wait p { font-size: 14px; color: var(--text-soft); line-height: 1.6; }
.status-wait a { font-weight: 600; text-decoration: none; }

/* ============ 12. MODAL VIDEO ============ */
.video-overlay {
  position: fixed; inset: 0; background: var(--overlay);
  z-index: 180; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: .25s;
}
.video-overlay.open { opacity: 1; pointer-events: auto; }
.video-modal {
  background: var(--bg-elev); border-radius: 20px; overflow: hidden;
  max-width: 720px; width: 100%; transform: scale(.92);
  transition: transform .25s; box-shadow: var(--shadow);
}
.video-overlay.open .video-modal { transform: scale(1); }
.video-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.video-head h3 { font-size: 15px; font-weight: 700; }
.video-close { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--text-mute); }
.video-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; }
.video-wrap video, .video-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: none; object-fit: contain;
}

/* ============ 13. TOAST ============ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 80px);
  background: var(--text); color: var(--bg-elev);
  padding: 12px 22px; border-radius: 30px;
  font-size: 14px; font-weight: 500; z-index: 200;
  opacity: 0; transition: .3s; box-shadow: var(--shadow);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ============ 14. TOMBOL BANTUAN FLOATING ============ */
.help-float {
  position: fixed; top: 80px; left: 20px; z-index: 250;
  touch-action: none; user-select: none;
}
.help-btn {
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #ff6b35, #e85a2a); color: #fff;
  font-size: 24px; cursor: grab;
  box-shadow: 0 6px 20px rgba(255, 107, 53, .45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, box-shadow .2s; position: relative;
}
.help-btn:hover { transform: scale(1.08); box-shadow: 0 8px 26px rgba(255, 107, 53, .6); }
.help-btn:active { cursor: grabbing; transform: scale(.96); }
.help-btn::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid #ff6b35; opacity: .6; animation: pulseHelp 2s infinite;
}
@keyframes pulseHelp {
  0%   { transform: scale(1);   opacity: .6; }
  100% { transform: scale(1.4); opacity: 0;  }
}
.help-menu {
  position: absolute; top: 64px; left: 0;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px;
  min-width: 200px; opacity: 0;
  transform: translateY(-8px) scale(.9);
  pointer-events: none; transition: .25s;
  transform-origin: top left;
}
.help-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.help-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--text);
  font-size: 14px; font-weight: 600;
  transition: .2s; cursor: pointer;
}
.help-item:hover { background: var(--bg-soft); color: var(--accent); }
.help-icon { font-size: 20px; }
.help-label { flex: 1; }

/* ============ 15. RESPONSIVE ============ */
@media (max-width: 480px) {
  .hero h1 { font-size: 24px; }
  .cart-btn { padding: 10px 12px; font-size: 13px; }
  .video-btn, .theme-toggle { width: 38px; height: 38px; font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .help-btn { width: 48px; height: 48px; font-size: 22px; }
  .help-menu { min-width: 180px; }
}