/* ==========================================================================
   WooCommerce Filter by Attributes — Frontend Styles
   ========================================================================== */

/* ── Wrapper ──────────────────────────────────────────────────────────── */
.wfba-filters-wrapper {
	margin: 0 0 2em;
	font-size: .9375em;
}

/* ── Active filters bar ───────────────────────────────────────────────── */
.wfba-active-filters {
	background: #f7f7f7;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	padding: .75em 1em;
	margin-bottom: 1.25em;
}

.wfba-active-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: .5em;
}

.wfba-active-title {
	font-weight: 600;
	font-size: .85em;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #555;
}

.wfba-clear-all {
	font-size: .8em;
	color: #e74c3c;
	text-decoration: underline;
	white-space: nowrap;
}
.wfba-clear-all:hover {
	color: #c0392b;
}

.wfba-active-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: .4em;
}

.wfba-active-item {
	display: inline-flex;
	align-items: center;
	gap: .3em;
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 30px;
	padding: .2em .6em .2em .8em;
	font-size: .82em;
	line-height: 1.6;
}

.wfba-active-attr {
	color: #888;
}

.wfba-active-val {
	font-weight: 600;
	color: #333;
}

.wfba-remove-filter {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.4em;
	height: 1.4em;
	background: #ddd;
	border-radius: 50%;
	color: #555;
	font-size: 1em;
	line-height: 1;
	text-decoration: none;
	transition: background .15s, color .15s;
}
.wfba-remove-filter:hover {
	background: #e74c3c;
	color: #fff;
}

/* ── Filter section ───────────────────────────────────────────────────── */
.wfba-filter-section {
	border-bottom: 1px solid #e8e8e8;
	padding-bottom: .75em;
	margin-bottom: .75em;
}
.wfba-filter-section:last-child {
	border-bottom: none;
	margin-bottom: 0;
}

/* ── Title / toggle button ────────────────────────────────────────────── */
.wfba-filter-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: none;
	border: none;
	padding: .5em 0;
	font-size: 1em;
	font-weight: 600;
	color: #333;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
}
.wfba-filter-title:not(.wfba-toggle) {
	cursor: default;
	pointer-events: none;
}

/* ── Toggle icon ──────────────────────────────────────────────────────── */
.wfba-toggle-icon {
	display: inline-block;
	width: 1em;
	height: 1em;
	flex-shrink: 0;
	position: relative;
	transition: transform .2s;
}
.wfba-toggle-icon::before,
.wfba-toggle-icon::after {
	content: '';
	position: absolute;
	background: currentColor;
	border-radius: 2px;
	transition: transform .2s, opacity .2s;
}
.wfba-toggle-icon::before { /* horizontal bar */
	top: 50%; left: 0; right: 0; height: 2px;
	transform: translateY(-50%);
}
.wfba-toggle-icon::after { /* vertical bar */
	left: 50%; top: 0; bottom: 0; width: 2px;
	transform: translateX(-50%);
}
/* When expanded, hide the vertical bar (making it a minus) */
.wfba-collapsible:not(.wfba-collapsed) .wfba-toggle-icon::after {
	opacity: 0;
	transform: translateX(-50%) rotate(90deg);
}

/* ── Collapsible content ──────────────────────────────────────────────── */
.wfba-filter-content {
	overflow: hidden;
	transition: max-height .25s ease;
	max-height: 9999px; /* open */
}
.wfba-collapsed .wfba-filter-content {
	max-height: 0;
}

/* ── Checkbox list ────────────────────────────────────────────────────── */
.wfba-checkbox-list {
	list-style: none;
	margin: .25em 0 0;
	padding: 0;
}

.wfba-checkbox-item {
	margin: 0 0 .3em;
}

.wfba-filter-link {
	display: flex;
	align-items: center;
	gap: .5em;
	text-decoration: none;
	color: #444;
	padding: .15em 0;
	border-radius: 3px;
	transition: color .15s;
}
.wfba-filter-link:hover {
	color: #000;
}

/* Custom checkbox box */
.wfba-checkbox {
	flex-shrink: 0;
	display: inline-block;
	width: 1.1em;
	height: 1.1em;
	border: 2px solid #bbb;
	border-radius: 3px;
	background: #fff;
	transition: background .15s, border-color .15s;
	position: relative;
}
.wfba-checkbox.wfba-checked {
	background: #96588a; /* WooCommerce purple — can be overridden */
	border-color: #96588a;
}
.wfba-checkbox.wfba-checked::after {
	content: '';
	position: absolute;
	left: .15em; top: .05em;
	width: .55em; height: .3em;
	border-left: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: rotate(-45deg);
}

.wfba-term-name {
	flex: 1;
	line-height: 1.4;
}

.wfba-term-count {
	color: #aaa;
	font-size: .85em;
}

/* Active item highlight */
.wfba-checkbox-item.wfba-active .wfba-filter-link {
	color: #333;
	font-weight: 600;
}

/* Zero-count items */
.wfba-checkbox-item.wfba-zero-count .wfba-filter-link {
	color: #bbb;
	pointer-events: none;
}
.wfba-checkbox-item.wfba-zero-count .wfba-checkbox {
	border-color: #ddd;
	background: #f9f9f9;
}

/* ── Dropdown ─────────────────────────────────────────────────────────── */
.wfba-dropdown {
	display: block;
	width: 100%;
	margin-top: .35em;
	padding: .5em .75em;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fff;
	font-size: .9375em;
	font-family: inherit;
	color: #333;
	cursor: pointer;
	appearance: auto;
}
.wfba-dropdown:focus {
	outline: 2px solid #96588a;
	outline-offset: 2px;
}

/* ── Loading overlay (AJAX) ───────────────────────────────────────────── */
.wfba-loading {
	position: relative;
	pointer-events: none;
}
.wfba-loading::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,.65);
	z-index: 9;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media ( max-width: 768px ) {
	.wfba-filters-wrapper {
		margin-bottom: 1.5em;
	}
	.wfba-active-list {
		gap: .35em;
	}
}
