/* ============================================================
   Toko Online — storefront (orange theme, mobile-first)
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --accent: #EA580C;
  --accent-2: #FB923C;
  --accent-deep: #C2410C;
  --grad: linear-gradient(135deg, #FB923C 0%, #EA580C 100%);
  --ink: #3A1E08;
  --mut: #92653F;
  --bg: #FFF8F0;
  --card: rgba(255,255,255,.78);
  --line: rgba(234,88,12,.14);
  --radius: 16px;
  --shadow: 0 10px 30px rgba(194, 65, 12, .10);
  --shadow-lg: 0 24px 60px rgba(154, 52, 18, .22);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 88% -12%, rgba(251,146,60,.28), transparent 60%),
    radial-gradient(760px 460px at -12% 22%, rgba(255,221,186,.85), transparent 55%),
    radial-gradient(680px 520px at 50% 112%, rgba(254,205,158,.5), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  background: rgba(255, 250, 244, .82);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--grad);
  box-shadow: 0 6px 14px rgba(234,88,12,.35);
  display: grid; place-items: center; color: #fff; font-size: 20px;
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-btn {
  position: relative; border: none;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--grad); color: #fff;
  font-weight: 700; font-size: 14px;
  padding: 10px 16px; border-radius: 999px;
  box-shadow: 0 8px 18px rgba(234,88,12,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.cart-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(234,88,12,.42); }
.cart-btn svg { width: 18px; height: 18px; }
.cart-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 21px; height: 21px; padding: 0 5px;
  border-radius: 999px; background: #1F2937; color: #fff;
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
  border: 2px solid #FFFAF4;
  transform: scale(0); transition: transform .18s ease;
}
.cart-badge.show { transform: scale(1); }

/* ---------- hero ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 26px 18px 70px; }
.hero {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 34px 26px;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 40px;
}
.hero::after {
  content: "🛍️"; position: absolute; right: -8px; bottom: -26px;
  font-size: 130px; opacity: .10; transform: rotate(-8deg); pointer-events: none;
}
.hero h1 { font-size: clamp(22px, 4vw, 34px); font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.hero p { color: var(--mut); max-width: 520px; font-size: 15px; }
.hero .steps {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px;
}
.hero .step {
  font-size: 12.5px; font-weight: 600; color: var(--accent-deep);
  background: #FFF1E6; border: 1px solid #FFD9BC;
  padding: 7px 13px; border-radius: 999px;
}

/* ---------- product grid ---------- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.section-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.section-head .count { color: var(--mut); font-size: 13px; font-weight: 600; }
.grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
@media (min-width: 768px) and (max-width: 1023px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 24px; } }

.pcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(154,52,18,.07);
  display: flex; flex-direction: column;
  transition: transform .16s ease, box-shadow .16s ease;
  backdrop-filter: blur(10px);
}
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pimg { position: relative; aspect-ratio: 1 / 1; background: #FFF1E2; overflow: hidden; }
.pimg img { width: 100%; height: 100%; object-fit: cover; }
.pimg .ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 46px; opacity: .8; }
.stock-badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.92); color: #EA580C;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.stock-badge.out { background: #FEE2E2; color: #B91C1C; }
.pbody { display: flex; flex-direction: column; gap: 10px; padding: 14px; flex: 1; }
.pbody h3 { font-size: 14.5px; font-weight: 700; line-height: 1.35; min-height: 2.6em; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: auto; }
.price { font-size: 16px; font-weight: 800; color: var(--accent-deep); white-space: nowrap; }
.stock { font-size: 11.5px; color: var(--mut); font-weight: 600; white-space: nowrap; }
.add {
  border: none; width: 100%;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 13.5px;
  padding: 10px 12px; border-radius: 12px;
  box-shadow: 0 6px 14px rgba(234,88,12,.28);
  transition: filter .15s ease, transform .1s ease;
}
.add:hover { filter: brightness(1.06); }
.add:active { transform: scale(.98); }
.add:disabled { background: #E7E0D8; color: #A89A8B; box-shadow: none; cursor: not-allowed; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  background: rgba(255,250,244,.7);
  text-align: center; padding: 18px; color: var(--mut); font-size: 12.5px;
}
footer a { font-weight: 600; color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- cart drawer ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(60, 30, 10, .42);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(430px, 100vw);
  background: #FFFBF6;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(105%);
  transition: transform .26s cubic-bezier(.32,.72,.28,1);
}
.drawer.show { transform: none; }
@media (max-width: 640px) { .drawer { width: 100vw; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { font-size: 17px; font-weight: 800; }
.icon-btn {
  border: none; background: #FFF0E3; color: var(--accent-deep);
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-size: 17px;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.empty-cart { text-align: center; color: var(--mut); padding: 44px 0; font-size: 14px; }
.empty-cart .big { font-size: 46px; display: block; margin-bottom: 8px; }
.cart-item {
  display: flex; gap: 12px; padding: 12px 4px;
  border-bottom: 1px dashed #F2DCC9;
}
.cart-item img, .cart-item .thumb-ph {
  width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none;
}
.cart-item .thumb-ph { background: #FFF1E2; display: grid; place-items: center; font-size: 26px; }
.ci-main { flex: 1; min-width: 0; }
.ci-name { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.ci-price { font-size: 12.5px; color: var(--accent-deep); font-weight: 700; margin-top: 2px; }
.ci-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.qty { display: inline-flex; align-items: center; gap: 2px; background: #FFF1E6; border-radius: 10px; padding: 3px; }
.qty button {
  width: 26px; height: 26px; border: none; border-radius: 8px;
  background: #fff; color: var(--accent-deep); font-weight: 800; font-size: 15px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.qty button:disabled { opacity: .4; cursor: not-allowed; }
.qty span { min-width: 26px; text-align: center; font-weight: 800; font-size: 13px; }
.ci-sub { font-size: 13px; font-weight: 800; color: var(--accent-deep); }
.ci-rm { border: none; background: none; color: #C9B8A6; font-size: 17px; line-height: 1; padding: 4px; }
.ci-rm:hover { color: #DC2626; }

.drawer-foot { border-top: 1px solid var(--line); padding: 14px 18px; background: #FFF8F0; }
.sum-line { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 16px; margin-bottom: 12px; }
.sum-line .v { color: var(--accent-deep); font-size: 20px; }
.btn-wa {
  width: 100%; border: none; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(135deg, #25D366, #128C7E); color: #fff;
  font-weight: 800; font-size: 15px; padding: 14px 16px; border-radius: 14px;
  box-shadow: 0 8px 20px rgba(18,140,126,.35);
  transition: filter .15s ease;
}
.btn-wa:hover { filter: brightness(1.05); }
.btn-wa svg { width: 20px; height: 20px; }

/* ---------- checkout modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 110;
  display: none; align-items: center; justify-content: center; padding: 18px;
  background: rgba(60,30,10,.5); backdrop-filter: blur(4px);
}
.modal.show { display: flex; }
.modal-card {
  background: #FFFBF6; border-radius: 20px;
  width: min(480px, 100%); max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); padding: 22px;
}
.modal-card h3 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.modal-card .sub { color: var(--mut); font-size: 13px; margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 5px; color: var(--ink); }
.field input, .field textarea {
  width: 100%; border: 1.5px solid #F0DCC6; background: #fff;
  border-radius: 12px; padding: 11px 13px; font-size: 14.5px; color: var(--ink);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(251,146,60,.18); }
.field textarea { resize: vertical; min-height: 64px; }
.ck-summary { background: #FFF3E8; border: 1px solid #FFDFC4; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; max-height: 150px; overflow-y: auto; }
.ck-summary .row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 0; color: #7C4A1E; }
.ck-summary .row b { font-weight: 800; color: var(--accent-deep); }
.ck-err { display: none; background: #FEE2E2; color: #B91C1C; font-size: 13px; font-weight: 600; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.ck-err.show { display: block; }
.ck-actions { display: flex; gap: 10px; }
.btn-ghost {
  flex: 1; border: 1.5px solid #F0DCC6; background: #fff; color: var(--mut);
  font-weight: 700; font-size: 14px; padding: 13px; border-radius: 14px;
}
.btn-wa { flex: 2.4; padding: 13px 14px; }
.btn-wa:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200;
  transform: translate(-50%, 20px);
  background: #1F2937; color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* floating cart button (mobile convenience) — sits above the CS button */
.fab {
  position: fixed; right: 16px; bottom: 90px; z-index: 60;
  border: none; width: 56px; height: 56px; border-radius: 18px;
  background: var(--grad); color: #fff;
  display: none; place-items: center;
  box-shadow: 0 12px 26px rgba(234,88,12,.45);
}
.fab.show { display: grid; }
.fab svg { width: 24px; height: 24px; }
.fab .cart-badge { top: -4px; right: -4px; }

/* floating CS WhatsApp button (bottom right, always visible on storefront) */
.cs-wa {
  position: fixed; right: 16px; bottom: 16px; z-index: 45;
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, #25D366, #128C7E); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(18,140,126,.42);
  transition: transform .16s ease, box-shadow .16s ease;
}
.cs-wa:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(18,140,126,.5); }
.cs-wa:active { transform: scale(.96); }
.cs-wa svg { width: 30px; height: 30px; }
@media (max-width: 899px) {
  .cs-wa { width: 54px; height: 54px; }
  .cs-wa svg { width: 28px; height: 28px; }
  .fab { bottom: 88px; }
}

@media (min-width: 900px) { .fab { display: none !important; } }
