/*
 * BH Loop Filter – Frontend-Styles
 * Nutzt CSS-Variablen für einfache Anpassung an das jeweilige Theme.
 */

.bh-lf-wrap {
	--bh-lf-accent: #2c5f4f;
	--bh-lf-accent-contrast: #ffffff;
	--bh-lf-bg: #f5f4f1;
	--bh-lf-border: #dcdad4;
	--bh-lf-text: #2b2b28;
	--bh-lf-radius: 999px;
	--bh-lf-gap: 0.5rem;

	margin: 0 0 1.75rem;
}

.bh-lf-group {
	position: relative;
}

.bh-lf-dropdown-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	appearance: none;
	border: 1px solid var(--bh-lf-border);
	background: #fff;
	color: var(--bh-lf-text);
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	padding: 0.45rem 0.8rem;
	border-radius: var(--bh-lf-radius);
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.bh-lf-dropdown-trigger:hover {
	border-color: var(--bh-lf-accent);
}

.bh-lf-dropdown-trigger:focus-visible {
	outline: 2px solid var(--bh-lf-accent);
	outline-offset: 2px;
}

.bh-lf-dropdown-trigger .bh-lf-group-label {
	opacity: 1;
	text-transform: none;
	font-weight: 600;
	font-size: 0.875rem;
}

.bh-lf-dropdown-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.3em;
	height: 1.3em;
	padding: 0 0.3em;
	background: var(--bh-lf-accent);
	color: var(--bh-lf-accent-contrast);
	border-radius: 999px;
	font-size: 0.7rem;
}

.bh-lf-dropdown-icon {
	width: 0.5em;
	height: 0.5em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	margin-top: -3px;
	transition: transform 0.15s ease;
}

.bh-lf-dropdown-trigger[aria-expanded="true"] .bh-lf-dropdown-icon {
	transform: rotate(-135deg);
	margin-top: 3px;
}

.bh-lf-dropdown-panel {
	position: absolute;
	top: calc(100% + 0.4rem);
	left: 0;
	z-index: 20;
	min-width: 220px;
	max-width: 320px;
	max-height: 280px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--bh-lf-border);
	border-radius: 0.6rem;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	padding: 0.5rem;
}

.bh-lf-dropdown-panel[hidden] {
	display: none;
}

.bh-lf-check-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 0.5rem;
	font-size: 0.875rem;
	color: var(--bh-lf-text);
	border-radius: 0.4rem;
	cursor: pointer;
	white-space: nowrap;
}

.bh-lf-check-item:hover {
	background: var(--bh-lf-bg);
}

.bh-lf-check {
	width: 1rem;
	height: 1rem;
	accent-color: var(--bh-lf-accent);
	flex-shrink: 0;
}

@media (max-width: 640px) {
	.bh-lf-dropdown-panel {
		left: auto;
		right: 0;
		max-width: calc(100vw - 2rem);
	}
}

.bh-lf-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	appearance: none;
	border: 1px solid var(--bh-lf-border);
	background: #fff;
	color: var(--bh-lf-text);
	font-size: 0.9rem;
	font-weight: 600;
	padding: 0.55rem 1rem;
	border-radius: 999px;
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.bh-lf-toggle:hover {
	border-color: var(--bh-lf-accent);
}

.bh-lf-toggle:focus-visible {
	outline: 2px solid var(--bh-lf-accent);
	outline-offset: 2px;
}

.bh-lf-toggle-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.4em;
	height: 1.4em;
	padding: 0 0.35em;
	background: var(--bh-lf-accent);
	color: var(--bh-lf-accent-contrast);
	border-radius: 999px;
	font-size: 0.75rem;
}

.bh-lf-toggle-icon {
	width: 0.55em;
	height: 0.55em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s ease;
	margin-top: -2px;
}

.bh-lf-toggle[aria-expanded="true"] .bh-lf-toggle-icon {
	transform: rotate(-135deg);
	margin-top: 2px;
}

.bh-lf-panel {
	margin-top: 0.75rem;
}

.bh-lf-panel[hidden] {
	display: none;
}

.bh-lf-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 1.5rem;
	padding: 0.9rem 1.1rem;
	background: var(--bh-lf-bg);
	border: 1px solid var(--bh-lf-border);
	border-radius: 0.75rem;
}

.bh-lf-group {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: nowrap;
	min-width: 0;
}

.bh-lf-group-label {
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--bh-lf-text);
	opacity: 0.65;
	white-space: nowrap;
}

.bh-lf-pills {
	display: flex;
	gap: var(--bh-lf-gap);
	flex-wrap: nowrap;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 2px;
}

.bh-lf-pills::-webkit-scrollbar {
	display: none;
}

.bh-lf-pill {
	flex: 0 0 auto;
	appearance: none;
	border: 1px solid var(--bh-lf-border);
	background: #fff;
	color: var(--bh-lf-text);
	font-size: 0.875rem;
	line-height: 1.2;
	padding: 0.45rem 0.95rem;
	border-radius: var(--bh-lf-radius);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
	white-space: nowrap;
}

.bh-lf-pill:hover {
	border-color: var(--bh-lf-accent);
}

.bh-lf-pill:active {
	transform: scale(0.97);
}

.bh-lf-pill[aria-pressed="true"] {
	background: var(--bh-lf-accent);
	border-color: var(--bh-lf-accent);
	color: var(--bh-lf-accent-contrast);
}

.bh-lf-pill:focus-visible {
	outline: 2px solid var(--bh-lf-accent);
	outline-offset: 2px;
}

.bh-lf-reset {
	margin-left: auto;
	appearance: none;
	border: none;
	background: none;
	color: var(--bh-lf-accent);
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
	padding: 0.35rem 0.2rem;
	white-space: nowrap;
}

.bh-lf-reset:hover {
	opacity: 0.75;
}

.bh-lf-status {
	margin: 0.5rem 0 0;
	font-size: 0.85rem;
	color: var(--bh-lf-text);
	opacity: 0.75;
	min-height: 1.2em;
}

/* Karten, die der Filter ausblendet, verlassen den Textfluss vollständig (display:none),
   das Ein-/Ausblenden übernimmt direkt das JS per Inline-Style. */

/* Responsive: auf schmalen Bildschirmen Gruppen untereinander, Pills horizontal scrollbar */
@media (max-width: 640px) {
	.bh-lf-bar {
		padding: 0.85rem;
		gap: 0.85rem;
	}

	.bh-lf-group {
		width: 100%;
		flex-wrap: wrap;
	}

	.bh-lf-group-label {
		width: 100%;
	}

	.bh-lf-reset {
		margin-left: 0;
		width: 100%;
		text-align: left;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bh-lf-pill {
		transition: none;
	}
}
