/**
 * FSE Product Filters — styles.
 *
 * Uses CSS custom properties for easy theme integration.
 * No dependencies on JetSmartFilters or Elementor CSS.
 */

/* ───────── Custom properties ───────── */

:root {
	--fse-pf-primary: #c4371b;
	--fse-pf-primary-hover: #a02e16;
	--fse-pf-text: #333;
	--fse-pf-text-muted: #666;
	--fse-pf-border: #e0e0e0;
	--fse-pf-bg: #fff;
	--fse-pf-bg-light: #f8f8f8;
	--fse-pf-radius: 6px;
	--fse-pf-sidebar-width: 280px;
	--fse-pf-gap: 20px;
	--fse-pf-transition: 0.2s ease;
}

/* ───────── Layout ───────── */

.fse-pf-wrap {
	display: grid;
	grid-template-columns: var(--fse-pf-sidebar-width) 1fr;
	gap: var(--fse-pf-gap);
	align-items: start;
	max-width: 1400px;
	margin: 0 auto;
	font-family: inherit;
	color: var(--fse-pf-text);
}

.fse-pf-mobile-toggle {
	display: none;
}

/* ───────── Sidebar ───────── */

.fse-pf-sidebar {
	position: sticky;
	top: 80px;
	max-height: calc(100vh - 100px);
	overflow-y: auto;
	padding: 0 16px 16px 0;
}

.fse-pf-sidebar-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
	padding-bottom: 12px;
	border-bottom: 2px solid var(--fse-pf-border);
}

.fse-pf-sidebar-title {
	font-size: 18px;
	font-weight: 600;
	margin: 0;
}

.fse-pf-clear-all {
	font-size: 13px;
	color: var(--fse-pf-primary);
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: var(--fse-pf-radius);
	transition: background var(--fse-pf-transition);
}

.fse-pf-clear-all:hover {
	background: rgba(196, 55, 27, 0.08);
}

/* ───────── Filter groups ───────── */

.fse-pf-filter-group {
	border: none;
	padding: 0;
	margin: 0 0 8px;
}

.fse-pf-filter-legend {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	padding: 10px 0;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	user-select: none;
	border-bottom: 1px solid var(--fse-pf-border);
}

.fse-pf-filter-legend:hover {
	color: var(--fse-pf-primary);
}

.fse-pf-chevron {
	transition: transform var(--fse-pf-transition);
}

.fse-pf-collapsed .fse-pf-chevron {
	transform: rotate(-90deg);
}

.fse-pf-filter-options {
	padding: 8px 0 4px;
}

.fse-pf-collapsed .fse-pf-filter-options {
	display: none;
}

/* ───────── Term search within filter ───────── */

.fse-pf-term-search {
	width: 100%;
	padding: 6px 10px;
	margin-bottom: 8px;
	font-size: 13px;
	border: 1px solid var(--fse-pf-border);
	border-radius: var(--fse-pf-radius);
	outline: none;
	box-sizing: border-box;
}

.fse-pf-term-search:focus {
	border-color: var(--fse-pf-primary);
	box-shadow: 0 0 0 2px rgba(196, 55, 27, 0.15);
}

/* ───────── Term list ───────── */

.fse-pf-term-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 240px;
	overflow-y: auto;
}

.fse-pf-term-item {
	margin: 0;
	padding: 0;
}

.fse-pf-term-label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 4px;
	font-size: 14px;
	cursor: pointer;
	border-radius: 3px;
	transition: background var(--fse-pf-transition);
}

.fse-pf-term-label:hover {
	background: var(--fse-pf-bg-light);
}

.fse-pf-checkbox {
	width: 16px;
	height: 16px;
	accent-color: var(--fse-pf-primary);
	flex-shrink: 0;
	margin: 0;
}

.fse-pf-term-name {
	flex: 1;
	min-width: 0;
}

.fse-pf-term-count {
	color: var(--fse-pf-text-muted);
	font-size: 12px;
	flex-shrink: 0;
}

/* ───────── Main content ───────── */

.fse-pf-main {
	min-width: 0;
}

/* ───────── Toolbar (sort + count) ───────── */

.fse-pf-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
	flex-wrap: wrap;
	gap: 8px;
}

.fse-pf-result-count {
	font-size: 14px;
	color: var(--fse-pf-text-muted);
	margin: 0;
}

.fse-pf-sort {
	padding: 6px 12px;
	font-size: 14px;
	border: 1px solid var(--fse-pf-border);
	border-radius: var(--fse-pf-radius);
	background: var(--fse-pf-bg);
	cursor: pointer;
}

/* ───────── Active filter pills ───────── */

.fse-pf-active-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 16px;
}

.fse-pf-pill {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 10px;
	font-size: 13px;
	color: var(--fse-pf-primary);
	background: rgba(196, 55, 27, 0.08);
	border: 1px solid rgba(196, 55, 27, 0.2);
	border-radius: 100px;
	cursor: pointer;
	transition: all var(--fse-pf-transition);
}

.fse-pf-pill:hover {
	background: rgba(196, 55, 27, 0.15);
	border-color: var(--fse-pf-primary);
}

.fse-pf-pill svg {
	opacity: 0.6;
}

/* ───────── Product grid ───────── */

.fse-pf-grid {
	display: grid;
	grid-template-columns: repeat(var(--fse-pf-columns, 3), 1fr);
	gap: var(--fse-pf-gap);
	transition: opacity var(--fse-pf-transition);
}

.fse-pf-loading-active {
	opacity: 0.5;
	pointer-events: none;
}

.fse-pf-loading {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	color: var(--fse-pf-text-muted);
	font-size: 15px;
}

.fse-pf-no-results {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
}

.fse-pf-no-results p {
	font-size: 16px;
	color: var(--fse-pf-text-muted);
}

/* ───────── Product card ───────── */

.fse-pf-product-card {
	display: flex;
	flex-direction: column;
	background: var(--fse-pf-bg);
	border: 1px solid var(--fse-pf-border);
	border-radius: var(--fse-pf-radius);
	overflow: hidden;
	transition: box-shadow var(--fse-pf-transition);
}

.fse-pf-product-card:hover {
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.fse-pf-product-link {
	display: block;
	text-decoration: none;
	color: inherit;
	position: relative;
}

.fse-pf-product-image {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	display: block;
}

.fse-pf-badges {
	position: absolute;
	top: 8px;
	left: 8px;
	display: flex;
	gap: 4px;
	z-index: 1;
}

.fse-pf-badge {
	padding: 3px 8px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	border-radius: 3px;
	letter-spacing: 0.5px;
}

.fse-pf-badge-sale {
	background: var(--fse-pf-primary);
	color: #fff;
}

.fse-pf-badge-oos {
	background: #666;
	color: #fff;
}

.fse-pf-product-title {
	font-size: 14px;
	font-weight: 500;
	margin: 0;
	padding: 12px 12px 4px;
	line-height: 1.4;
}

.fse-pf-product-price {
	padding: 0 12px 8px;
	font-size: 15px;
	font-weight: 600;
	color: var(--fse-pf-primary);
}

.fse-pf-product-price del {
	color: var(--fse-pf-text-muted);
	font-weight: 400;
	font-size: 13px;
}

.fse-pf-product-price ins {
	text-decoration: none;
}

.fse-pf-add-to-cart,
.fse-pf-view-product {
	display: block;
	width: calc(100% - 24px);
	margin: auto 12px 12px;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	color: var(--fse-pf-primary);
	background: transparent;
	border: 1.5px solid var(--fse-pf-primary);
	border-radius: var(--fse-pf-radius);
	cursor: pointer;
	transition: all var(--fse-pf-transition);
	box-sizing: border-box;
}

.fse-pf-add-to-cart:hover,
.fse-pf-view-product:hover {
	background: var(--fse-pf-primary);
	color: #fff;
}

.fse-pf-added {
	background: #2e7d32;
	border-color: #2e7d32;
	color: #fff;
}

/* ───────── Pagination ───────── */

.fse-pf-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 4px;
	margin: 24px 0;
}

.fse-pf-page-btn {
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	font-size: 14px;
	border: 1px solid var(--fse-pf-border);
	border-radius: var(--fse-pf-radius);
	background: var(--fse-pf-bg);
	cursor: pointer;
	transition: all var(--fse-pf-transition);
}

.fse-pf-page-btn:hover {
	border-color: var(--fse-pf-primary);
	color: var(--fse-pf-primary);
}

.fse-pf-page-current {
	background: var(--fse-pf-primary);
	color: #fff;
	border-color: var(--fse-pf-primary);
}

.fse-pf-page-dots {
	padding: 0 4px;
	color: var(--fse-pf-text-muted);
}

/* ───────── Mobile responsive ───────── */

@media (max-width: 768px) {
	.fse-pf-wrap {
		grid-template-columns: 1fr;
	}

	.fse-pf-mobile-toggle {
		display: flex;
		align-items: center;
		gap: 8px;
		width: 100%;
		padding: 10px 16px;
		font-size: 15px;
		font-weight: 600;
		border: 1px solid var(--fse-pf-border);
		border-radius: var(--fse-pf-radius);
		background: var(--fse-pf-bg);
		cursor: pointer;
		margin-bottom: 12px;
	}

	.fse-pf-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		width: 85vw;
		max-width: 360px;
		height: 100vh;
		max-height: 100vh;
		background: var(--fse-pf-bg);
		z-index: 9999;
		transform: translateX(-100%);
		transition: transform 0.3s ease;
		padding: 16px;
		box-shadow: none;
		overflow-y: auto;
	}

	.fse-pf-sidebar-open {
		transform: translateX(0);
		box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
	}

	body.fse-pf-sidebar-active::after {
		content: '';
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 9998;
	}

	.fse-pf-grid {
		--fse-pf-columns: 2 !important;
	}

	.fse-pf-active-count {
		margin-left: auto;
		font-weight: 700;
		color: var(--fse-pf-primary);
	}
}

@media (max-width: 480px) {
	.fse-pf-grid {
		--fse-pf-columns: 1 !important;
	}
}

/* ───────── Scrollbar styling for filter lists ───────── */

.fse-pf-term-list::-webkit-scrollbar {
	width: 5px;
}

.fse-pf-term-list::-webkit-scrollbar-track {
	background: transparent;
}

.fse-pf-term-list::-webkit-scrollbar-thumb {
	background: var(--fse-pf-border);
	border-radius: 3px;
}

.fse-pf-term-list::-webkit-scrollbar-thumb:hover {
	background: #bbb;
}
