/* ==============================
   Baijia Product Filter + Filtered List
   ============================== */

/* --- Filter wrapper (desktop: static sidebar) --- */
.bjpf-filter-wrap {
	background: #fff;
	font-size: 14px;
}

.bjpf-sidebar-header {
	display: none;
}

.bjpf-sidebar-overlay {
	display: none;
}

/* === Accordion === */
.bjpf-section {
	border-bottom: 1px solid #e8e8e8;
}

.bjpf-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 0;
	cursor: pointer;
	user-select: none;
}

.bjpf-section-title {
	font-size: 15px;
	font-weight: 700;
	color: #222;
}

.bjpf-arrow {
	width: 10px;
	height: 10px;
	border-right: 2px solid #555;
	border-bottom: 2px solid #555;
	transform: rotate(45deg);
	transition: transform 0.25s ease;
	flex-shrink: 0;
}

.bjpf-section.is-open .bjpf-arrow {
	transform: rotate(-135deg);
}

.bjpf-section-body {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease, padding 0.3s ease;
	padding: 0;
}

.bjpf-section.is-open .bjpf-section-body {
	max-height: 800px;
	padding-bottom: 16px;
}

/* === Category tree === */
.bjpf-cat-tree,
.bjpf-attr-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bjpf-cat-item {
	margin-bottom: 2px;
}

.bjpf-attr-item {
	margin-bottom: 6px;
}

.bjpf-cat-row {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 0;
}

.bjpf-cat-link {
	flex: 1;
	font-size: 14px;
	color: #333;
	text-decoration: none;
	transition: color 0.2s;
}

.bjpf-cat-link:hover {
	color: #000;
}

.bjpf-cat-toggle {
	width: 20px;
	height: 20px;
	cursor: pointer;
	position: relative;
	flex-shrink: 0;
}

.bjpf-cat-toggle::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 7px;
	height: 7px;
	border-right: 2px solid #777;
	border-bottom: 2px solid #777;
	transform: translate(-50%, -60%) rotate(45deg);
	transition: transform 0.25s ease;
}

.bjpf-cat-item.is-expanded > .bjpf-cat-row .bjpf-cat-toggle::after {
	transform: translate(-50%, -40%) rotate(-135deg);
}

/* Children: collapsed by default */
.bjpf-cat-children {
	list-style: none;
	margin: 0;
	padding-left: 20px;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
}

.bjpf-cat-item.is-expanded > .bjpf-cat-children {
	max-height: 500px;
}

/* === Checkbox label === */
.bjpf-checkbox-label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	padding: 4px 0;
	line-height: 1.3;
}

.bjpf-checkbox {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.bjpf-check-box {
	width: 18px;
	height: 18px;
	border: 2px solid #bbb;
	border-radius: 3px;
	flex-shrink: 0;
	position: relative;
	transition: border-color 0.2s, background 0.2s;
}

.bjpf-checkbox:checked + .bjpf-check-box {
	background: #222;
	border-color: #222;
}

.bjpf-checkbox:checked + .bjpf-check-box::after {
	content: '';
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.bjpf-check-text {
	font-size: 14px;
	color: #333;
	flex: 1;
}

.bjpf-term-count {
	font-size: 12px;
	color: #999;
}

/* === Price slider === */
.bjpf-price-display {
	font-size: 14px;
	font-weight: 600;
	color: #222;
	margin-bottom: 14px;
}

.bjpf-range-wrap {
	position: relative;
	height: 30px;
}

.bjpf-range-track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 4px;
	background: #ddd;
	border-radius: 2px;
	transform: translateY(-50%);
}

.bjpf-range-fill {
	position: absolute;
	top: 50%;
	height: 4px;
	background: #222;
	border-radius: 2px;
	transform: translateY(-50%);
}

.bjpf-range {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	pointer-events: none;
	margin: 0;
}

.bjpf-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	background: #222;
	border: 2px solid #fff;
	border-radius: 50%;
	cursor: pointer;
	pointer-events: auto;
	box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.bjpf-range::-moz-range-thumb {
	width: 18px;
	height: 18px;
	background: #222;
	border: 2px solid #fff;
	border-radius: 50%;
	cursor: pointer;
	pointer-events: auto;
	box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* === Mobile filter toggle button === */
.bjpf-filter-toggle {
	display: none;
}

/* === Result bar === */
.bjpf-result-bar {
	padding: 0 0 16px;
}

.bjpf-result-count {
	font-size: 13px;
	color: #777;
}

/* === Products container === */
.bjpf-products-container {
	position: relative;
}

.bjpf-no-results {
	text-align: center;
	padding: 60px 20px;
	color: #888;
	font-size: 15px;
	grid-column: 1 / -1;
}

/* === Loading overlay === */
.bjpf-loading-overlay {
	display: none;
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,0.7);
	z-index: 10;
	align-items: center;
	justify-content: center;
}

.bjpf-products-container.is-loading .bjpf-loading-overlay {
	display: flex;
}

.bjpf-spinner {
	width: 30px;
	height: 30px;
	border: 3px solid #ddd;
	border-top-color: #222;
	border-radius: 50%;
	animation: bjpfSpin 0.6s linear infinite;
}

@keyframes bjpfSpin {
	to { transform: rotate(360deg); }
}

/* === Pagination === */
.bjpf-pagination {
	text-align: center;
	padding: 24px 0;
}

.bjpf-page-numbers {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.bjpf-page-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	font-size: 14px;
	font-weight: 600;
	color: #555;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.bjpf-page-link:hover {
	background: #f5f5f5;
	border-color: #bbb;
	color: #222;
}

.bjpf-page-link.is-active {
	background: #222;
	color: #fff;
	border-color: #222;
	cursor: default;
}

.bjpf-page-dots {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	height: 36px;
	font-size: 14px;
	color: #999;
}

.bjpf-prev,
.bjpf-next {
	font-size: 18px;
}

/* ===============================
   Mobile: sidebar slide-in
   =============================== */
@media (max-width: 767px) {
	.bjpf-filter-toggle {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		padding: 8px 16px;
		background: #222;
		color: #fff;
		font-size: 13px;
		font-weight: 600;
		border-radius: 3px;
		cursor: pointer;
		margin-bottom: 12px;
	}

	.bjpf-filter-toggle svg {
		flex-shrink: 0;
	}

	/* Overlay */
	.bjpf-sidebar-overlay {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0,0,0,0.45);
		z-index: 9998;
	}

	.bjpf-sidebar-overlay.is-visible {
		display: block;
	}

	/* Sidebar */
	.bjpf-filter-wrap {
		position: fixed;
		top: 0;
		left: 0;
		width: 300px;
		max-width: 85vw;
		height: 100%;
		z-index: 9999;
		background: #fff;
		overflow-y: auto;
		transform: translateX(-100%);
		transition: transform 0.3s ease;
		padding: 0 20px 20px;
		box-sizing: border-box;
	}

	.bjpf-filter-wrap.is-open {
		transform: translateX(0);
	}

	.bjpf-sidebar-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 16px 0;
		border-bottom: 1px solid #e8e8e8;
		margin-bottom: 4px;
		position: sticky;
		top: 0;
		background: #fff;
		z-index: 1;
	}

	.bjpf-sidebar-title {
		font-size: 16px;
		font-weight: 700;
		color: #222;
	}

	.bjpf-sidebar-close {
		font-size: 24px;
		color: #555;
		cursor: pointer;
		line-height: 1;
		padding: 0 4px;
	}

	.bjpf-sidebar-close:hover {
		color: #000;
	}
}
