/* ==========================================================================
   SBH Product Archive — grid layout wrapper
   Style kartu produk (.sbh-product-grid__*) sudah ada di frontend.css,
   TIDAK didefinisikan ulang di sini. File ini HANYA untuk wrapper/grid
   layout milik widget ini (namespace .sbh-product-archive*).
   ========================================================================== */

.sbh-product-archive {
	width: 100%;
}

.sbh-product-archive__grid {
	display: grid;
	grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	gap: 16px;
}

.sbh-product-archive__placeholder,
.sbh-product-archive__empty {
	padding: 40px 20px;
	text-align: center;
	color: #666666;
	font-size: 14px;
}

/* ==========================================================================
   Sidebar layout (desktop) — Tahap D1a
   ========================================================================== */

.sbh-product-archive__body {
	display: grid;
	grid-template-columns: 280px 1fr;
	gap: 24px;
	align-items: start;
}

.sbh-product-archive__sidebar {
	display: flex;
	flex-direction: column;
	gap: 24px;
	width: 280px;
}

.sbh-product-archive__main {
	position: relative;
	min-width: 0;
}

.sbh-product-archive__mobile-bar {
	display: none;
}

@media ( max-width: 767px ) {
	.sbh-product-archive__body {
		grid-template-columns: 1fr;
	}

	.sbh-product-archive__sidebar {
		display: none;
	}

	.sbh-product-archive__mobile-bar {
		display: flex;
		flex-direction: column;
		margin-bottom: 16px;
	}
}

/* ---- Toolbar desktop (Split Category tabs + Sort dropdown) — Tahap D1c ---- */

.sbh-product-archive__toolbar {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	margin-bottom: 16px;
}

@media ( max-width: 767px ) {
	/* Ditaruh SETELAH rule desktop di atas (bukan di dalam media query
	   sidebar/mobile-bar sebelumnya) — spesifisitas sama-sama 1 class,
	   jadi urutan sumber yang menentukan siapa menang di cascade. Kalau
	   rule ini ditaruh SEBELUM rule desktop, rule desktop unconditional
	   di atas akan menang di mobile juga (bug yang lagi difix). */
	.sbh-product-archive__toolbar {
		display: none;
	}
}

.sbh-product-archive__category-tabs {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	gap: 6px;
	padding-bottom: 4px;
	flex: 1 1 auto;
	scrollbar-width: none;
}

.sbh-product-archive__category-tabs::-webkit-scrollbar {
	display: none;
}

.sbh-product-archive__cat-tab {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
	padding: 6px 14px;
	border: 1px solid #e5e5e5;
	border-radius: 20px;
	background: #ffffff;
	color: #333333;
	font-size: 13px;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sbh-product-archive__cat-tab:hover {
	border-color: #aaaaaa;
}

.sbh-product-archive__cat-tab.is-active {
	background: #222222;
	border-color: #222222;
	color: #ffffff;
}

.sbh-product-archive__cat-tab-count {
	font-size: 11px;
	opacity: 0.75;
}

/* ---- Sort dropdown desktop ---- */

.sbh-product-archive__sort-dropdown {
	position: relative;
	flex-shrink: 0;
}

.sbh-product-archive .sbh-product-archive__sort-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 1px solid #d0d0d0;
	border-radius: 6px;
	background: #ffffff;
	color: #333333;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
	padding: 4px;
}

.sbh-product-archive .sbh-product-archive__sort-btn:hover,
.sbh-product-archive .sbh-product-archive__sort-btn[aria-expanded="true"] {
	background: #f5f5f5;
	border-color: #aaaaaa;
}

.sbh-product-archive .sbh-product-archive__sort-btn svg {
	width: 18px;
	height: 18px;
}

.sbh-product-archive__sort-panel {
	position: absolute;
	top: calc( 100% + 6px );
	right: 0;
	z-index: 500;
	min-width: 210px;
	background: #ffffff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.12 );
}

.sbh-product-archive .sbh-product-archive__sort-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 10px 16px;
	border: 0;
	background: transparent;
	color: #333333;
	font-size: 14px;
	text-align: left;
	cursor: pointer;
	transition: background 0.1s;
}

.sbh-product-archive .sbh-product-archive__sort-item:hover,
.sbh-product-archive .sbh-product-archive__sort-item:focus {
	background: #f5f5f5;
	outline: none;
}

.sbh-product-archive__sort-item-check {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: 0;
}

.sbh-product-archive .sbh-product-archive__sort-item.is-active .sbh-product-archive__sort-item-check {
	opacity: 1;
}

/* ---- Search ---- */

.sbh-product-archive__search {
	margin-bottom: 0;
}

.sbh-product-archive__search-input {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	font-size: 14px;
	background: #fafafa;
	box-sizing: border-box;
}

.sbh-product-archive__search-input:focus {
	outline: 2px solid #222222;
	outline-offset: -1px;
	background: #ffffff;
}

/* ---- Filter group ---- */

.sbh-product-archive__filter-group-title {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.sbh-product-archive__filter-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sbh-product-archive__divider {
	height: 1px;
	background-color: #e8e8e8;
	flex-shrink: 0;
}

/* ---- Checkbox & radio (Tipe Produk / Ketersediaan / Harga) ---- */

.sbh-product-archive__checkbox,
.sbh-product-archive__radio {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: 14px;
}

.sbh-product-archive__checkbox input,
.sbh-product-archive__radio input {
	flex-shrink: 0;
	cursor: pointer;
}

.sbh-product-archive__checkbox-count {
	color: #888888;
	font-size: 12px;
}

/* ---- Kategori (link + dot dekoratif, bukan input asli) ---- */

.sbh-product-archive__radio-dot {
	display: inline-block;
	flex-shrink: 0;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 1.5px solid #bbbbbb;
	background: #ffffff;
	box-sizing: border-box;
}

.sbh-product-archive__radio--active .sbh-product-archive__radio-dot {
	border-color: #222222;
	background: #222222;
	box-shadow: inset 0 0 0 2px #ffffff;
}

.sbh-product-archive__radio-count {
	color: #888888;
	font-size: 12px;
}

a.sbh-product-archive__radio {
	text-decoration: none;
	color: inherit;
}

a.sbh-product-archive__radio:hover .sbh-product-archive__radio-label {
	text-decoration: underline;
}

/* ---- Show more/less kategori (native <details>) ---- */

.sbh-product-archive__cat-more {
	margin-top: 8px;
}

.sbh-product-archive__cat-more-toggle {
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: #222222;
	list-style: none;
}

.sbh-product-archive__cat-more-toggle::-webkit-details-marker {
	display: none;
}

.sbh-product-archive__cat-more-list {
	margin-top: 8px;
}

/* ---- Color swatches ---- */

.sbh-product-archive__filter-list--swatches {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 10px;
}

.sbh-product-archive__swatch {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	cursor: pointer;
	font-size: 11px;
	text-align: center;
}

.sbh-product-archive__swatch input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 0;
	height: 0;
}

.sbh-product-archive__swatch-bullet {
	position: relative;
	display: block;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 2px solid transparent;
	box-shadow: 0 0 0 1px #cccccc;
	transition: box-shadow 0.15s, border-color 0.15s;
}

.sbh-product-archive__swatch input:checked + .sbh-product-archive__swatch-bullet {
	border-color: #222222;
	box-shadow: 0 0 0 2px #222222;
}

.sbh-product-archive__swatch-tooltip {
	position: absolute;
	bottom: calc( 100% + 6px );
	left: 50%;
	transform: translateX( -50% );
	background-color: #333333;
	color: #ffffff;
	font-size: 11px;
	line-height: 1.3;
	padding: 3px 7px;
	border-radius: 4px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0.15s ease;
	z-index: 10;
}

.sbh-product-archive__swatch-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX( -50% );
	border: 4px solid transparent;
	border-top-color: #333333;
}

.sbh-product-archive__swatch:hover .sbh-product-archive__swatch-tooltip {
	opacity: 1;
	visibility: visible;
}

/* ---- Size chips ---- */

.sbh-product-archive__filter-list--chips {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 8px;
}

.sbh-product-archive__chip {
	display: inline-flex;
	cursor: pointer;
}

.sbh-product-archive__chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 0;
	height: 0;
}

.sbh-product-archive__chip-label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px 12px;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 500;
	background: #ffffff;
	color: #333333;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sbh-product-archive__chip input:checked + .sbh-product-archive__chip-label {
	background: #222222;
	border-color: #222222;
	color: #ffffff;
}

/* ==========================================================================
   Mobile bar (search + Filter/Sort trigger + chip kategori) — Tahap D1b
   ========================================================================== */

.sbh-product-archive__mobile-row1 {
	display: flex;
	align-items: stretch;
	gap: 8px;
	margin-bottom: 12px;
}

.sbh-product-archive__mobile-row1 .sbh-product-archive__mobile-search-input {
	flex: 1 1 70%;
	min-width: 0;
	margin-bottom: 0;
}

.sbh-product-archive .sbh-product-archive__filter-trigger,
.sbh-product-archive .sbh-product-archive__sort-trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex: 0 0 auto;
	padding: 0 14px;
	border: 1px solid #d0d0d0;
	border-radius: 6px;
	background: #ffffff;
	color: #222222;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

/* Default control value = icon-only, jadi label teks sembunyi tanpa perlu user pilih apapun di editor. */
.sbh-product-archive-trigger-style-icon-only .sbh-product-archive__trigger-label {
	display: none;
}

.sbh-product-archive .sbh-product-archive__filter-trigger svg,
.sbh-product-archive .sbh-product-archive__sort-trigger svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.sbh-product-archive__mobile-cats {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	gap: 8px;
	padding-bottom: 4px;
	scrollbar-width: none;
}

.sbh-product-archive__mobile-cats::-webkit-scrollbar {
	display: none;
}

.sbh-product-archive__cat-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
	white-space: nowrap;
	padding: 6px 14px;
	border: 1px solid #e5e5e5;
	border-radius: 20px;
	background: #ffffff;
	color: #333333;
	font-size: 13px;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sbh-product-archive__cat-chip:hover {
	border-color: #aaaaaa;
}

.sbh-product-archive__cat-chip.is-active {
	background: #222222;
	border-color: #222222;
	color: #ffffff;
}

.sbh-product-archive__cat-chip-count {
	font-size: 11px;
	opacity: 0.75;
}

/* ==========================================================================
   Bottom sheet — Filter & Sort (mobile) — Tahap D1b
   ========================================================================== */

.sbh-product-archive__filter-sheet,
.sbh-product-archive__sort-sheet {
	display: none;
}

@media ( max-width: 767px ) {

	.sbh-product-archive__filter-sheet,
	.sbh-product-archive__sort-sheet {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 99999;
		visibility: hidden;
		pointer-events: none;
	}

	.sbh-product-archive__filter-sheet.is-open,
	.sbh-product-archive__sort-sheet.is-open {
		visibility: visible;
		pointer-events: auto;
	}

	.sbh-product-archive__sheet-backdrop {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		padding: 0;
		border: 0;
		background: rgba( 0, 0, 0, 0.42 );
		opacity: 0;
		transition: opacity 0.22s ease;
	}

	.sbh-product-archive__filter-sheet.is-open .sbh-product-archive__sheet-backdrop,
	.sbh-product-archive__sort-sheet.is-open .sbh-product-archive__sheet-backdrop {
		opacity: 1;
	}

	.sbh-product-archive__sheet-panel {
		position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		overflow: auto;
		border-radius: 8px 8px 0 0;
		background: #ffffff;
		color: #222222;
		transform: translateY( 100% );
		transition: transform 0.25s ease;
		padding-bottom: env( safe-area-inset-bottom, 0 );
	}

	.sbh-product-archive__sort-sheet .sbh-product-archive__sheet-panel {
		height: min( 55vh, 480px );
		max-height: calc( 100vh - 72px );
	}

	.sbh-product-archive__filter-sheet .sbh-product-archive__sheet-panel {
		display: flex;
		flex-direction: column;
		height: min( 80vh, 640px );
		max-height: calc( 100vh - 48px );
		overflow: hidden;
	}

	.sbh-product-archive__filter-sheet.is-open .sbh-product-archive__sheet-panel,
	.sbh-product-archive__sort-sheet.is-open .sbh-product-archive__sheet-panel {
		transform: translateY( 0 );
	}

	.sbh-product-archive__sheet-header {
		position: sticky;
		top: 0;
		z-index: 1;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 16px 18px;
		border-bottom: 1px solid #e5e5e5;
		background: #ffffff;
		flex-shrink: 0;
	}

	.sbh-product-archive__sheet-header h3 {
		margin: 0;
		font-size: 17px;
		line-height: 1.4;
	}

	.sbh-product-archive .sbh-product-archive__sheet-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		padding: 0;
		border: 0;
		background: transparent;
		color: #222222;
		cursor: pointer;
	}

	.sbh-product-archive .sbh-product-archive__sheet-close svg {
		width: 22px;
		height: 22px;
	}

	.sbh-product-archive__sort-options {
		padding: 4px 18px 18px;
		overflow-y: auto;
	}

	.sbh-product-archive .sbh-product-archive__sort-option {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 13px 0;
		border: 0;
		border-bottom: 1px solid #eeeeee;
		background: transparent;
		color: #222222;
		font: inherit;
		text-align: left;
		cursor: pointer;
	}

	.sbh-product-archive__sort-check {
		width: 20px;
		height: 20px;
		fill: none;
		stroke: currentColor;
		stroke-width: 2;
		stroke-linecap: round;
		stroke-linejoin: round;
		opacity: 0;
	}

	.sbh-product-archive .sbh-product-archive__sort-option.is-active {
		font-weight: 600;
	}

	.sbh-product-archive .sbh-product-archive__sort-option.is-active .sbh-product-archive__sort-check {
		opacity: 1;
	}

	.sbh-product-archive__filter-body {
		flex: 1 1 auto;
		overflow-y: auto;
		padding: 4px 18px 12px;
		-webkit-overflow-scrolling: touch;
	}

	.sbh-product-archive__filter-body .sbh-product-archive__filter-group {
		padding: 14px 0;
	}

	.sbh-product-archive__filter-body .sbh-product-archive__divider {
		margin: 0;
	}

	.sbh-product-archive__filter-footer {
		flex-shrink: 0;
		display: flex;
		gap: 12px;
		padding: 14px 18px;
		border-top: 1px solid #e5e5e5;
		background: #ffffff;
	}

	.sbh-product-archive .sbh-product-archive__filter-footer button {
		flex: 1 1 0;
		padding: 12px 16px;
		border-radius: 6px;
		font: inherit;
		font-size: 15px;
		font-weight: 600;
		line-height: 1.3;
		cursor: pointer;
		transition: opacity 0.15s ease;
	}

	.sbh-product-archive .sbh-product-archive__filter-footer button:hover {
		opacity: 0.85;
	}

	.sbh-product-archive .sbh-product-archive__filter-sheet-reset {
		border: 1.5px solid #bbbbbb;
		background: transparent;
		color: #333333;
	}

	.sbh-product-archive .sbh-product-archive__filter-sheet-apply {
		border: 0;
		background: #222222;
		color: #ffffff;
	}
}

body.sbh-archive-sheet-open {
	overflow: hidden;
}

/* ==========================================================================
   Infinite scroll sentinel — Tahap D3b
   ========================================================================== */

.sbh-product-archive__load-sentinel {
	height: 1px;
	margin-top: 24px;
}

.sbh-product-archive__load-sentinel.is-loading {
	height: auto;
	padding: 16px 0;
	text-align: center;
	color: #666666;
	font-size: 13px;
}

.sbh-product-archive__load-sentinel.is-loading::after {
	content: 'Memuat...';
}
