/* Storefront Kita Berkembang — mobile first, tampil seperti aplikasi. */
:root {
	--kb-primary: #e85d2a;
	--kb-bg: #f6f3ef;
	--kb-surface: #ffffff;
	--kb-text: #1f1b16;
	--kb-muted: #6f675e;
	--kb-line: #ebe5dd;
	--kb-ok: #1f8a4c;
	--kb-danger: #c0392b;
	--kb-radius: 16px;
	--kb-wa: #1fa855;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.kb-store {
	margin: 0;
	background: #e9e4dd;
	color: var(--kb-text);
	font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.kb-locked { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.kb-app {
	max-width: 520px;
	min-height: 100vh;
	margin: 0 auto;
	background: var(--kb-bg);
	padding-bottom: 96px;
	position: relative;
}

/* Hero & profil */
.kb-hero {
	height: 150px;
	background: linear-gradient(135deg, var(--kb-primary), color-mix(in srgb, var(--kb-primary) 55%, #000));
	background-size: cover;
	background-position: center;
	position: relative;
}
.kb-hero.has-banner { height: 190px; }
.kb-hero-shade { position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(0,0,0,.25)); }

.kb-profile {
	margin: -44px 16px 0;
	background: var(--kb-surface);
	border-radius: var(--kb-radius);
	padding: 52px 18px 16px;
	text-align: center;
	position: relative;
	box-shadow: 0 6px 24px rgba(0,0,0,.06);
}
.kb-logo {
	width: 76px; height: 76px;
	border-radius: 50%;
	border: 4px solid var(--kb-surface);
	background: var(--kb-primary);
	color: #fff;
	position: absolute; left: 50%; top: -38px; transform: translateX(-50%);
	display: grid; place-items: center;
	overflow: hidden;
	font-size: 30px; font-weight: 700;
}
.kb-logo img { width: 100%; height: 100%; object-fit: cover; }
.kb-profile h1 { margin: 0; font-size: 22px; }
.kb-tagline { margin: 4px 0 0; color: var(--kb-muted); }
.kb-meta { list-style: none; padding: 0; margin: 10px 0 0; color: var(--kb-muted); font-size: 13px; }
.kb-meta li { margin-top: 2px; }

/* Pencarian & kategori */
.kb-sticky {
	position: sticky; top: 0; z-index: 5;
	background: var(--kb-bg);
	padding: 14px 16px 8px;
}
.kb-search {
	width: 100%;
	border: 1px solid var(--kb-line);
	background: var(--kb-surface);
	border-radius: 999px;
	padding: 10px 16px;
	outline: none;
}
.kb-search:focus { border-color: var(--kb-primary); }
.kb-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.kb-chips::-webkit-scrollbar { display: none; }
.kb-chips button {
	flex: none;
	border: 1px solid var(--kb-line);
	background: var(--kb-surface);
	border-radius: 999px;
	padding: 6px 14px;
	cursor: pointer;
	font-size: 13px;
}
.kb-chips button.is-active { background: var(--kb-primary); border-color: var(--kb-primary); color: #fff; }

/* Menu */
.kb-menu { padding: 0 16px; }
.kb-group h2 { font-size: 17px; margin: 18px 0 8px; }
.kb-product {
	display: flex; gap: 12px; justify-content: space-between;
	background: var(--kb-surface);
	border-radius: var(--kb-radius);
	padding: 12px;
	margin-bottom: 10px;
}
.kb-product.is-soldout { opacity: .6; }
.kb-product-info { flex: 1; min-width: 0; }
.kb-product h3 { margin: 2px 0 4px; font-size: 15px; }
.kb-product p { margin: 0 0 8px; color: var(--kb-muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kb-price { font-weight: 700; }
.kb-stock-low { font-weight: 500; font-size: 12px; color: var(--kb-danger); margin-left: 6px; }
.kb-product-media { width: 108px; flex: none; display: flex; flex-direction: column; align-items: center; }
.kb-product-media img, .kb-noimg { width: 108px; height: 108px; border-radius: 12px; object-fit: cover; background: var(--kb-line); }
.kb-noimg { display: grid; place-items: center; font-size: 34px; font-weight: 700; color: var(--kb-muted); }
.kb-add, .kb-qty, .kb-soldout { margin-top: -16px; position: relative; }
.kb-add {
	border: 1px solid var(--kb-primary);
	color: var(--kb-primary);
	background: var(--kb-surface);
	border-radius: 999px;
	padding: 5px 18px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.kb-qty {
	display: inline-flex; align-items: center;
	background: var(--kb-primary); color: #fff;
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.kb-qty button { border: 0; background: transparent; color: #fff; width: 32px; height: 32px; font-size: 18px; cursor: pointer; }
.kb-qty button:disabled { opacity: .4; cursor: not-allowed; }
.kb-qty span { min-width: 22px; text-align: center; font-weight: 700; }
.kb-soldout { background: #555; color: #fff; border-radius: 999px; padding: 4px 14px; font-size: 13px; }
.kb-empty { text-align: center; color: var(--kb-muted); padding: 32px 0; }
.kb-foot { text-align: center; color: var(--kb-muted); font-size: 12px; padding: 24px 16px; }
.kb-foot a { color: inherit; }

/* Bar keranjang */
.kb-cartbar {
	position: fixed; z-index: 10;
	left: 50%; transform: translateX(-50%);
	bottom: max(16px, env(safe-area-inset-bottom));
	width: calc(100% - 32px); max-width: 488px;
	display: flex; align-items: center; gap: 10px;
	background: var(--kb-primary); color: #fff;
	border: 0; border-radius: 999px;
	padding: 14px 20px;
	box-shadow: 0 10px 30px rgba(0,0,0,.2);
	cursor: pointer;
	text-align: left;
}
.kb-cartbar-total { font-weight: 700; }
.kb-cartbar-cta { margin-left: auto; font-weight: 600; }

/* Sheet */
.kb-sheet { position: fixed; inset: 0; z-index: 20; }
.kb-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.kb-sheet-panel {
	position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
	width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
	background: var(--kb-surface);
	border-radius: 20px 20px 0 0;
	padding: 0 18px calc(18px + env(safe-area-inset-bottom));
	animation: kb-up .2s ease-out;
}
@keyframes kb-up { from { transform: translate(-50%, 30px); opacity: .5; } }
.kb-sheet-head { position: sticky; top: 0; background: var(--kb-surface); display: flex; align-items: center; gap: 8px; padding: 16px 0 10px; z-index: 1; }
.kb-sheet-head h2 { margin: 0; font-size: 18px; flex: 1; }
.kb-close, .kb-back { border: 0; background: var(--kb-bg); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; cursor: pointer; }

.kb-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--kb-line); }
.kb-line > div:first-child span { display: block; color: var(--kb-muted); font-size: 13px; }
.kb-line .kb-qty { margin-top: 0; }
.kb-line-sub { grid-column: 1 / -1; text-align: right; font-weight: 600; font-size: 14px; }
.kb-total-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; font-size: 16px; }

form[data-kb-step] label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
form[data-kb-step] input:not([type=radio]):not([type=checkbox]), form[data-kb-step] textarea {
	width: 100%; border: 1px solid var(--kb-line); border-radius: 12px; padding: 10px 12px; background: #fff; outline: none;
}
form[data-kb-step] input:focus, form[data-kb-step] textarea:focus { border-color: var(--kb-primary); }
.kb-hp { position: absolute !important; left: -9999px !important; }
.kb-pay { border: 0; padding: 0; margin: 16px 0 0; }
.kb-pay legend { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.kb-pay label {
	display: flex !important; gap: 10px; align-items: flex-start;
	border: 1px solid var(--kb-line); border-radius: 12px; padding: 12px !important; margin: 0 0 8px !important; cursor: pointer;
}
.kb-pay label:has(input:checked) { border-color: var(--kb-primary); background: color-mix(in srgb, var(--kb-primary) 7%, #fff); }
.kb-pay input { margin-top: 3px; accent-color: var(--kb-primary); }
.kb-pay small { display: block; font-weight: 400; color: var(--kb-muted); }
.kb-note { background: var(--kb-bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: var(--kb-muted); }
.kb-error { color: var(--kb-danger); background: #fdecea; border-radius: 12px; padding: 10px 12px; font-size: 14px; }

.kb-btn {
	display: inline-block; text-align: center; text-decoration: none;
	background: var(--kb-primary); color: #fff;
	border: 0; border-radius: 999px; padding: 14px 20px; font-weight: 700; cursor: pointer;
}
.kb-btn:disabled { opacity: .5; cursor: not-allowed; }
.kb-btn-block { width: 100%; }
.kb-btn-wa { background: var(--kb-wa); }

[data-kb-step="done"] { text-align: center; padding-bottom: 8px; }
.kb-done-icon { width: 64px; height: 64px; margin: 8px auto 10px; border-radius: 50%; background: var(--kb-ok); color: #fff; display: grid; place-items: center; font-size: 32px; }
.kb-done-title { font-size: 16px; }
.kb-qris { background: var(--kb-bg); border-radius: var(--kb-radius); padding: 14px; margin: 10px 0; }
.kb-qris img { margin: 8px auto 0; max-width: 260px; width: 100%; border-radius: 12px; background: #fff; }
.kb-muted { color: var(--kb-muted); font-size: 13px; }

/* Link kembali ke landing */
.kb-home-link {
	position: absolute; z-index: 2; top: 14px; left: 14px;
	background: rgba(0,0,0,.35); color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
	padding: 6px 12px; border-radius: 999px; backdrop-filter: blur(6px);
}

/* Topping */
.kb-has-addons { display: inline-block; font-size: 12px; color: var(--kb-primary); font-weight: 600; margin-bottom: 6px; }
.kb-add:disabled { opacity: .5; cursor: not-allowed; }
.kb-line-addons { display: block; color: var(--kb-muted); font-size: 12.5px; }
.kb-opt-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--kb-line); }
.kb-opt-head img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex: none; }
.kb-opt-head h3 { margin: 0 0 4px; font-size: 17px; }
.kb-opt-head p { margin: 0 0 6px; color: var(--kb-muted); font-size: 13px; }
.kb-opt-list { border: 0; padding: 0; margin: 14px 0 0; }
.kb-opt-list legend { font-weight: 700; margin-bottom: 8px; }
.kb-opt-list legend small { color: var(--kb-muted); font-weight: 400; }
form[data-kb-step] label.kb-opt { display: flex; font-weight: 400; font-size: 15px; margin: 0 0 8px; }
.kb-opt { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--kb-line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; }
.kb-opt:has(input:checked) { border-color: var(--kb-primary); background: color-mix(in srgb, var(--kb-primary) 7%, #fff); }
.kb-opt input { accent-color: var(--kb-primary); width: 18px; height: 18px; margin: 0; }
.kb-opt span { flex: 1; font-weight: 600; }
.kb-opt em { font-style: normal; color: var(--kb-muted); font-size: 13px; }
.kb-opt-foot { display: flex; gap: 12px; align-items: center; position: sticky; bottom: 0; background: var(--kb-surface); padding: 12px 0 4px; }
.kb-opt-foot .kb-qty { margin: 0; }
.kb-opt-foot .kb-qty button { width: 40px; height: 44px; }
.kb-opt-foot .kb-btn { flex: 1; }
.kb-product.is-highlight { box-shadow: 0 0 0 2px var(--kb-primary); }

/* Panel keranjang (hanya desktop) */
.kb-cartpanel { display: none; }

/* ---------- Tablet: grid 2 kolom ---------- */
@media (min-width: 720px) {
	.kb-app { max-width: 820px; }
	.kb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.kb-grid .kb-product { margin: 0; height: 100%; }
	.kb-cartbar { max-width: 520px; }
}

/* ---------- Desktop: menu + keranjang di samping ---------- */
@media (min-width: 1024px) {
	body.kb-store { background: var(--kb-bg); }
	.kb-app { max-width: 1200px; padding: 24px 24px 48px; background: transparent; }
	.kb-hero { height: 220px; border-radius: 24px; overflow: hidden; }
	.kb-hero.has-banner { height: 280px; }
	.kb-profile {
		margin: -56px 32px 0; padding: 20px 24px 20px 136px; text-align: left; min-height: 96px;
		display: flex; flex-direction: column; justify-content: center;
	}
	.kb-logo { left: 24px; top: -28px; transform: none; width: 96px; height: 96px; font-size: 38px; }
	.kb-profile h1 { font-size: 26px; }
	.kb-meta { display: flex; gap: 18px; flex-wrap: wrap; }
	.kb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; margin-top: 8px; }
	.kb-sticky { padding: 18px 0 8px; }
	.kb-menu { padding: 0; }
	.kb-group h2 { font-size: 19px; margin: 22px 0 12px; }
	.kb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
	.kb-product { padding: 14px; border: 1px solid var(--kb-line); transition: box-shadow .15s, transform .15s; }
	.kb-product:hover { box-shadow: 0 10px 30px rgba(0,0,0,.07); transform: translateY(-1px); }
	.kb-product-media { width: 120px; }
	.kb-product-media img, .kb-noimg { width: 120px; height: 120px; }

	.kb-cartpanel {
		display: block; position: sticky; top: 24px; margin-top: 18px;
		background: var(--kb-surface); border: 1px solid var(--kb-line); border-radius: 20px;
		padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.05);
		max-height: calc(100vh - 48px); overflow-y: auto;
	}
	.kb-cartpanel h2 { margin: 0 0 4px; font-size: 18px; }
	.kb-cartpanel .kb-empty { padding: 28px 0; }
	.kb-cartbar { display: none !important; }
	.kb-foot { padding-top: 40px; }

	/* Sheet menjadi modal di tengah */
	.kb-sheet-panel {
		top: 50%; bottom: auto; transform: translate(-50%, -50%);
		border-radius: 24px; max-height: 86vh; padding-bottom: 20px;
		animation: kb-pop .18s ease-out;
	}
	@keyframes kb-pop { from { transform: translate(-50%, -48%); opacity: .4; } }
}
@media (min-width: 1280px) {
	.kb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.kb-grid .kb-product { flex-direction: column-reverse; justify-content: flex-end; }
	.kb-grid .kb-product-media { width: 100%; }
	.kb-grid .kb-product-media img, .kb-grid .kb-noimg { width: 100%; height: auto; aspect-ratio: 4 / 3; }
}

/* Halaman toko tidak aktif & landing platform */
.kb-center { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.kb-center .kb-card-pub { background: #fff; border-radius: 20px; padding: 32px 24px; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.kb-center h1 { font-size: 22px; margin: 12px 0 6px; }
.kb-center p { color: var(--kb-muted); margin: 0; }
.kb-center .kb-emoji { font-size: 44px; }
