/**
 * Linke Filterspalte + mobiles Bottom Sheet (includes/filterspalte.php).
 *
 * Baut auf archive-filters.css auf (Optionen, Chips, Facettenblöcke) und
 * regelt hier NUR: das zweispaltige Layout ab 1024 px, die Spalten-Karte,
 * das Bottom Sheet darunter, den fixierten Filter-Knopf, den Vorlieben-Block
 * und die ausgegrauten Null-Treffer-Optionen.
 *
 * Grid-Falle: die Inhaltsspalte braucht min-width:0, sonst sprengt das
 * Produktraster das Grid (responsive-pflicht-Memory).
 */

/* --- Grundzustand (mobil zuerst): einspaltig, Spalte ist das Sheet ------- */

.zwcl-fs {
	display: block;
}

.zwcl-fs__inhalt {
	min-width: 0;
}

/* --- Ausgegraute Optionen (0 Treffer im aktuellen Kontext) --------------- */

.zwcl-opt.is-disabled {
	opacity: 0.42;
	pointer-events: none;
	cursor: default;
}

/* --- Vorlieben-Block (nur Club) ------------------------------------------ */

.zwcl-fs-vorlieben {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem 1rem;
	margin: 0.4rem 0 1rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--zcf-border, #E3DCCF);
	border-radius: var(--radius-lg, 18px);
	background: var(--zcf-sand, #F6F1E7);
}

.zwcl-fs-vorlieben__text {
	margin: 0;
	flex: 1 1 24ch;
	min-width: 0; /* Flex-Falle: langer Text darf den Block nicht sprengen. */
	font-size: 0.96rem;
	color: var(--zcf-ink, #1E252D);
}

.zwcl-fs-vorlieben__knopf {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 18px;
	border: 1px solid #202630;
	border-radius: 6px;
	background: #202630;
	color: #FFFFFF;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.zwcl-fs-vorlieben__knopf:hover,
.zwcl-fs-vorlieben__knopf:focus-visible {
	background: #3C4652;
	border-color: #3C4652;
	color: #FFFFFF;
}

.zwcl-fs-vorlieben__nebenknopf {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	border: 1px solid var(--zcf-camel, #AE8B5F);
	border-radius: 6px;
	color: var(--zcf-ink, #3C4043);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

/* In der Spalte kompakt und gestapelt. */
.zwcl-fs__spalte .zwcl-fs-vorlieben {
	flex-direction: column;
	align-items: stretch;
	margin: 0 0 0.8rem;
	padding: 0.75rem 0.85rem;
}

.zwcl-fs__spalte .zwcl-fs-vorlieben__knopf {
	justify-content: center;
	white-space: normal;
	text-align: center;
}

/* --- Chip-Zeile über der Liste ------------------------------------------- */

.zwcl-fs__chips {
	margin: 0 0 1rem;
}

/* --- Spalten-Karte (gemeinsame Innen-Optik für Desktop UND Sheet) -------- */

.zwcl-fs__spalte {
	background: var(--zcf-cream, #FCFAF5);
}

.zwcl-fs__facetten .zwcl-filters__presets {
	margin: 0 0 0.8rem;
}

/* Facettenblöcke in der Spalte immer gestapelt: Titel oben, Optionen darunter
   (überschreibt die Zeilen-Anordnung der alten Leiste ab 768 px). */
.zwcl-fs__spalte .zwcl-facetblock {
	display: block;
	padding: 0.5rem 0;
	border-top: 1px solid var(--zcf-border, #E3DCCF);
}

.zwcl-fs__spalte .zwcl-facetblock:first-of-type {
	border-top: 0;
}

.zwcl-fs__spalte .zwcl-facetblock__title {
	flex: none;
	padding: 0.3rem 0;
}

.zwcl-fs__spalte .zwcl-facetblock__options {
	margin: 0.35rem 0 0.2rem;
}

/* --- Mobiler Öffner „Filter (n)" ----------------------------------------- */

.zwcl-fs-knopf {
	position: fixed;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	z-index: 1090;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 48px;
	padding: 0 22px;
	border: 0;
	border-radius: var(--radius-pill, 999px);
	background: #202630;
	color: #FFFFFF;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	box-shadow: 0 6px 18px rgba(30, 37, 45, 0.35);
	cursor: pointer;
}

/* --- Bottom Sheet (< 1024 px) -------------------------------------------- */

.zwcl-fs-deckel {
	position: fixed;
	inset: 0;
	z-index: 1095;
	background: rgba(30, 37, 45, 0.45);
}

.zwcl-fs-deckel[hidden] {
	display: none;
}

@media (max-width: 1023.98px) {
	.zwcl-fs__spalte {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 1100;
		max-height: 84vh;
		max-height: 84dvh;
		display: flex;
		flex-direction: column;
		border-radius: var(--radius-lg, 18px) var(--radius-lg, 18px) 0 0;
		background: #FFFFFF;
		box-shadow: 0 -8px 30px rgba(30, 37, 45, 0.25);
		/*
		 * Geschlossen = sofort weg (keine Transition am Grundzustand): sonst
		 * animiert schon der Wechsel der Fensterbreite über den Breakpoint
		 * das Sheet einmal quer durchs Bild. Nur das ÖFFNEN gleitet.
		 */
		transform: translateY(105%);
		visibility: hidden;
	}

	body.zwcl-fs-offen .zwcl-fs__spalte {
		transform: none;
		visibility: visible;
		transition: transform 0.25s ease;
	}

	/* Hintergrund einfrieren, solange das Sheet offen ist. */
	body.zwcl-fs-offen {
		overflow: hidden;
	}

	.zwcl-fs__kopf {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1rem;
		padding: 0.9rem 1rem 0.7rem;
		border-bottom: 1px solid var(--zcf-border, #E3DCCF);
	}

	.zwcl-fs__kopf-titel {
		font-weight: 700;
		font-size: 1.05rem;
		color: var(--zcf-ink, #1E252D);
	}

	.zwcl-fs__zu {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		border: 0;
		border-radius: 50%;
		background: var(--zcf-sand, #F6F1E7);
		color: var(--zcf-ink, #1E252D);
		font-size: 1.5rem;
		line-height: 1;
		cursor: pointer;
	}

	.zwcl-fs__spalte > .zwcl-fs-vorlieben,
	.zwcl-fs__facetten {
		padding: 0.8rem 1rem;
	}

	.zwcl-fs__spalte > .zwcl-fs-vorlieben {
		margin: 0.8rem 1rem 0;
	}

	.zwcl-fs__facetten {
		flex: 1 1 auto;
		min-height: 0;
		overflow: auto;
		-webkit-overflow-scrolling: touch;
	}

	.zwcl-fs__fuss {
		padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
		border-top: 1px solid var(--zcf-border, #E3DCCF);
		background: #FFFFFF;
	}

	.zwcl-fs__anzeigen {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: 50px;
		border: 0;
		border-radius: 8px;
		background: #202630;
		color: #FFFFFF;
		font-family: inherit;
		font-size: 1.02rem;
		font-weight: 700;
		cursor: pointer;
	}
}

/* --- Desktop ab 1024 px: offene Spalte links ----------------------------- */

@media (min-width: 1024px) {
	.zwcl-fs {
		display: grid;
		grid-template-columns: 270px minmax(0, 1fr);
		gap: 2rem;
		align-items: start;
	}

	.zwcl-fs--leer {
		grid-template-columns: 270px minmax(0, 1fr);
	}

	.zwcl-fs__spalte {
		position: sticky;
		top: 16px;
		max-height: calc(100vh - 32px);
		overflow: auto;
		padding: 0.9rem 1rem;
		border: 1px solid var(--zcf-border, #E3DCCF);
		border-radius: var(--radius-lg, 18px);
	}

	/* Sheet-Bedienelemente sind Desktop-fremd. */
	.zwcl-fs-knopf,
	.zwcl-fs-deckel,
	.zwcl-fs__kopf,
	.zwcl-fs__fuss {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.zwcl-fs__spalte {
		transition: none;
	}
}
