/* sun concept Content Filter – frontend styles.
   Inputs/selects/buttons are styled by UIkit (uk-input/uk-select/uk-button…);
   this file adds the layout variants, chips, loading + fade animation. */

.scf-filter {
	--scf-gap: 1rem;
}

/* ---- Controls container & layouts ---------------------------------- */

.scf-controls,
.scf-advanced {
	display: flex;
	gap: var( --scf-gap );
}

.scf-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.scf-field-label {
	font-size: 0.8rem;
	font-weight: 600;
}

/* Horizontal: a CSS grid so every field has an equal column width and a lone
   field in the last row keeps its column width (instead of stretching 100%).
   --scf-columns is set inline when a fixed column count is configured;
   otherwise the grid auto-fills as many ~220px columns as fit. */
.scf-layout-horizontal .scf-controls,
.scf-layout-horizontal .scf-advanced {
	display: grid;
	grid-template-columns: repeat( var( --scf-columns, auto-fill ), minmax( 200px, 1fr ) );
	gap: var( --scf-gap );
	align-items: end;
}

/* A full-width field (e.g. the search box) spans the whole row; the remaining
   fields then distribute across the columns below it. */
.scf-layout-horizontal .scf-field--full {
	grid-column: 1 / -1;
}

@media ( max-width: 640px ) {
	.scf-layout-horizontal .scf-controls,
	.scf-layout-horizontal .scf-advanced {
		grid-template-columns: 1fr;
	}
}

/* Vertical & sidebar: fields stacked. */
.scf-layout-vertical .scf-controls,
.scf-layout-vertical .scf-advanced,
.scf-layout-sidebar .scf-controls,
.scf-layout-sidebar .scf-advanced {
	flex-direction: column;
	align-items: stretch;
}

.scf-layout-vertical .scf-field,
.scf-layout-sidebar .scf-field {
	width: 100%;
}

/* Sidebar: compact spacing for narrow columns. */
.scf-layout-sidebar {
	--scf-gap: 0.75rem;
	font-size: 0.95em;
}

.scf-layout-sidebar .scf-checklist {
	max-height: 10rem;
}

/* ---- "All filters" toggle (button + JS-collapsed panel) ------------ */

.scf-toolbar {
	display: flex;
	align-items: center;
	gap: var( --scf-gap );
	margin-top: var( --scf-gap );
}

.scf-toolbar--split {
	justify-content: space-between;
}

.scf-toolbar .scf-actions {
	margin-top: 0;
}

.scf-toggle {
	display: none; /* shown only when JS is active */
	align-items: center;
	gap: 0.3rem;
	cursor: pointer;
	font-weight: 600;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
}

.scf-js .scf-toggle {
	display: inline-flex;
}

.scf-toggle-icon {
	transition: transform 0.2s ease;
}

/* Expanded → arrow points up. */
.scf-js:not( .scf-collapsed ) .scf-toggle-icon {
	transform: rotate( 180deg );
}

.scf-advanced {
	margin-top: var( --scf-gap );
}

/* Without JS the advanced fields stay visible; JS collapses them. */
.scf-js.scf-collapsed .scf-advanced {
	display: none;
}

/* ---- Search field -------------------------------------------------- */

.scf-search-wrap {
	display: block;
	width: 100%;
}

.scf-search-wrap .scf-search-input {
	width: 100%;
}

/* ---- Actions (Filtern / Zurücksetzen) + positions ------------------ */

.scf-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin-top: var( --scf-gap );
}

/* More breathing room between the buttons in the horizontal layout. */
.scf-layout-horizontal .scf-actions {
	gap: 1rem;
}

/* Optional: full-width buttons (great for the vertical / sidebar layout). */
.scf-buttons-full .scf-actions {
	flex-direction: column;
	align-items: stretch;
	gap: 0.5rem;
}

.scf-buttons-full .scf-actions .uk-button {
	width: 100%;
}

/* Default: below the filters. Horizontal defaults to right-aligned. */
.scf-layout-horizontal.scf-actions-below_right .scf-actions {
	justify-content: flex-end;
}

.scf-layout-horizontal.scf-actions-below_left .scf-actions {
	justify-content: flex-start;
}

/* Position "next to the search field": search spans all but the last column,
   the buttons occupy the last column of the first row. */
.scf-layout-horizontal.scf-actions-search_row .scf-field--full {
	grid-column: 1 / -2;
	grid-row: 1;
}

.scf-actions--cell {
	grid-column: -2 / -1;
	grid-row: 1;
	margin-top: 0;
	align-self: center;
	justify-content: flex-end;
}

@media ( max-width: 640px ) {
	.scf-layout-horizontal.scf-actions-search_row .scf-field--full,
	.scf-actions--cell {
		grid-column: 1 / -1;
		grid-row: auto;
	}
	.scf-actions--cell {
		margin-top: var( --scf-gap );
	}
}

/* In live mode (JS active) the submit button is redundant. */
.scf-js.scf-mode-live .scf-submit {
	display: none;
}

/* ---- Checkbox lists ------------------------------------------------ */

.scf-checklist {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	max-height: 12rem;
	overflow: auto;
	padding-right: 0.25rem;
}

.scf-check {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.9rem;
	cursor: pointer;
	margin: 0;
}

/* ---- Result bar (count + chips) ------------------------------------ */

.scf-bar {
	gap: 0.75rem;
}

.scf-count {
	order: 1;
}

.scf-active {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	flex: 1 1 auto;
	order: 2;
}

.scf-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.15rem 0.6rem;
	border-radius: 999px;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	background: rgba( 0, 0, 0, 0.04 );
	font-size: 0.8rem;
	line-height: 1.5;
	cursor: pointer;
	color: inherit;
}

.scf-chip:hover {
	background: rgba( 0, 0, 0, 0.09 );
}

/* ---- Loading + fade ------------------------------------------------ */

.scf-is-loading {
	position: relative;
	transition: opacity 0.15s ease;
	opacity: 0.4;
}

.scf-is-loading::after {
	content: "";
	position: absolute;
	top: 1.5rem;
	left: 50%;
	width: 28px;
	height: 28px;
	margin-left: -14px;
	border: 3px solid rgba( 0, 0, 0, 0.15 );
	border-top-color: rgba( 0, 0, 0, 0.55 );
	border-radius: 50%;
	animation: scf-spin 0.7s linear infinite;
}

.scf-fade-in {
	animation: scf-fade 0.35s ease;
}

@keyframes scf-spin {
	to { transform: rotate( 360deg ); }
}

@keyframes scf-fade {
	from { opacity: 0.25; }
	to   { opacity: 1; }
}

.scf-busy .scf-submit {
	opacity: 0.6;
	pointer-events: none;
}

/* ---- Custom multi-select (replaces the bulky native <select multiple>) */

.scf-ms-native {
	display: none !important;
}

.scf-ms {
	position: relative;
}

.scf-ms-control {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem;
	box-sizing: border-box;
	min-height: 42px;
	height: auto;
	cursor: pointer;
	padding: 0.1rem 0.5rem;
	font-size: 0.875rem;
	line-height: 1.4;
}

.scf-ms-placeholder {
	opacity: 0.6;
	font-size: 0.875rem;
}

.scf-ms-tag {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	background: rgba( 0, 0, 0, 0.07 );
	border-radius: 3px;
	padding: 0.05rem 0.1rem 0.05rem 0.4rem;
	font-size: 0.8rem;
	line-height: 1.6;
}

.scf-ms-tag-x {
	border: 0;
	background: none;
	cursor: pointer;
	font-size: 1rem;
	line-height: 1;
	padding: 0 0.25rem;
	color: inherit;
	opacity: 0.6;
}

.scf-ms-tag-x:hover {
	opacity: 1;
}

.scf-ms-caret {
	margin-left: auto;
	opacity: 0.6;
	transition: transform 0.2s ease;
}

.scf-ms.is-open .scf-ms-caret {
	transform: rotate( 180deg );
}

.scf-ms-panel {
	position: absolute;
	z-index: 60;
	left: 0;
	right: 0;
	top: calc( 100% + 4px );
	max-height: 16rem;
	overflow: auto;
	background: #fff;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	border-radius: 4px;
	box-shadow: 0 6px 20px rgba( 0, 0, 0, 0.12 );
	padding: 0.35rem;
}

.scf-ms-search {
	width: 100%;
	margin-bottom: 0.35rem;
	padding: 0.3rem 0.45rem;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	border-radius: 3px;
	font: inherit;
}

.scf-ms-option {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.3rem 0.4rem;
	border-radius: 3px;
	cursor: pointer;
	font-size: 0.9rem;
}

.scf-ms-option:hover {
	background: rgba( 0, 0, 0, 0.05 );
}

.scf-ms-option input {
	pointer-events: none;
}

.scf-ms-icon {
	flex: 0 0 auto;
	margin-right: 0.15rem;
	opacity: 0.7;
}

/* ---- Icons in single selects (overlay, since native selects can't hold one) */

.scf-control-icon {
	position: relative;
	display: block;
}

.scf-control-icon .scf-ctrl-ico {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY( -50% );
	opacity: 0.7;
	pointer-events: none;
}

/* Inline SVG icons (fetched) sized via em so they match the surrounding text. */
.scf-icon {
	display: inline-flex;
	align-items: center;
}

.scf-icon .scf-icon-svg,
.scf-icon svg {
	width: 1.15em;
	height: 1.15em;
	vertical-align: middle;
}

.scf-control-icon .scf-select {
	padding-left: 38px;
}

/* ---- Button icons -------------------------------------------------- */

.scf-submit .uk-icon {
	margin-right: 0.4rem;
}

.scf-reset .uk-icon {
	margin-left: 0.4rem;
}

/* ---- Fixed-width search + flexing columns (the screenshot layout) -- */

.scf-layout-horizontal.scf-fixed-search .scf-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var( --scf-gap );
}

.scf-layout-horizontal.scf-fixed-search .scf-field-search {
	flex: 0 0 var( --scf-search-width, 320px );
}

.scf-layout-horizontal.scf-fixed-search .scf-controls > .scf-field:not( .scf-field-search ) {
	flex: 1 1 180px;
}

.scf-layout-horizontal.scf-fixed-search .scf-actions--inline {
	flex: 0 0 auto;
	margin-top: 0;
	align-self: flex-end;
}

@media ( max-width: 640px ) {
	.scf-layout-horizontal.scf-fixed-search .scf-field-search {
		flex-basis: 100%;
	}
}

/* Actions placed inline as the last column (grid layouts). */
.scf-actions--inline {
	margin-top: 0;
	align-self: end;
}

/* ---- Standalone sort + count -------------------------------------- */

.scf-sort {
	display: inline-block;
}

.scf-count--standalone {
	display: inline-block;
}

.scf-countbar {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.scf-active--standalone {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}
