/* Advanced search page (ADR-033 §4): a horizontal filter bar above the results, RTL first.
   ADR-032 put the filters in a sidebar; the owner asked for exdfs.com's layout, where every filter
   sits on two or three tidy lines above the whole grid and nothing has to be scrolled. */

.kf-search {
	display: block;
}

.kf-search__bar {
	display: grid;
	gap: 12px;
	margin-bottom: 18px;
	padding: 14px 16px;
	border: 1px solid rgba(15, 43, 74, 0.12);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 10px 28px rgba(15, 43, 74, 0.06);
	font-size: 0.95em;
}

.kf-search__row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 12px 16px;
	align-items: end;
}

/* Fixed order on the main line: search box · editions · three selects — so the fields never
   reflow into a ragged block when one facet is taller than the others (owner review 2026-09-16). */
.kf-search__row--main {
	grid-template-columns: minmax(220px, 2fr) minmax(230px, 1.6fr) repeat(3, minmax(150px, 1fr));
	align-items: start;
}

.kf-search__row .kf-facet--search {
	grid-column: auto;
}

/* Edition pills sit side by side and keep their own count inside the pill. */
.kf-facet__options {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
}

.kf-facet--edition .kf-facet__option {
	gap: 6px;
	padding: 6px 10px;
	border: 1px solid rgba(15, 43, 74, 0.16);
	border-radius: 999px;
	line-height: 1.4;
	font-size: 0.9em;
	background: #fff;
}

.kf-facet--edition .kf-facet__option .kf-facet__count {
	margin-inline-start: 2px;
}

.kf-search__more > summary {
	width: fit-content;
	padding: 4px 0;
	color: var(--kf-color-primary, #0f2b4a);
	font-size: 0.9em;
	font-weight: 700;
	cursor: pointer;
}

.kf-search__more[open] > summary {
	margin-bottom: 10px;
}

.kf-facet {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	border: 0;
}

.kf-search__row fieldset.kf-facet .kf-facet__option {
	display: inline-flex;
}

.kf-facet__title {
	margin: 0;
	padding: 0;
	font-weight: 700;
	font-size: 0.95em;
	color: var(--kf-color-primary, #0f2b4a);
}

.kf-facet__option {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	line-height: 1.9;
}

.kf-facet__option.is-empty {
	opacity: 0.45;
	cursor: default;
}

.kf-facet__count {
	margin-inline-start: auto;
	font-size: 0.85em;
	color: rgba(15, 43, 74, 0.6);
	font-variant-numeric: tabular-nums;
}

.kf-facet__range {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.kf-facet__hint {
	margin: 0;
	font-size: 0.8em;
	line-height: 1.7;
	color: rgba(15, 43, 74, 0.6);
}

.kf-search__bar input[type="number"],
.kf-search__bar input[type="search"],
.kf-search__bar select {
	width: 100%;
	max-width: 100%;
	padding: 8px 10px;
	border: 1px solid rgba(15, 43, 74, 0.18);
	border-radius: 9px;
	background: #fff;
	font: inherit;
}

.kf-search__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.kf-search__actions {
	justify-content: flex-start;
	padding-top: 4px;
	border-top: 1px solid rgba(15, 43, 74, 0.08);
}

.kf-search__submit {
	flex: 0 0 auto;
	min-width: 160px;
}

.kf-search__reset {
	font-size: 0.9em;
	text-decoration: underline dotted;
}

.kf-search__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}

.kf-search__count {
	margin: 0;
	font-weight: 700;
}

.kf-search__sort {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.9em;
}

.kf-search__sort select {
	padding: 6px 10px;
	border: 1px solid rgba(15, 43, 74, 0.18);
	border-radius: 9px;
	font: inherit;
}

.kf-search__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}

.kf-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 11px;
	border-radius: 999px;
	background: rgba(15, 43, 74, 0.07);
	color: inherit;
	font-size: 0.85em;
	text-decoration: none;
}

.kf-chip:hover {
	background: rgba(15, 43, 74, 0.14);
}

.kf-chip__x {
	font-size: 1.1em;
	line-height: 1;
	opacity: 0.7;
}

.kf-search__empty {
	padding: 28px;
	border: 1px dashed rgba(15, 43, 74, 0.2);
	border-radius: 14px;
	text-align: center;
}

.kf-search__pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
	margin-top: 22px;
}

.kf-search__page {
	min-width: 38px;
	padding: 6px 10px;
	border: 1px solid rgba(15, 43, 74, 0.16);
	border-radius: 9px;
	text-align: center;
	text-decoration: none;
	color: inherit;
}

.kf-search__page.is-current {
	background: var(--kf-color-primary, #0f2b4a);
	border-color: transparent;
	color: #fff;
}

.kf-search.is-loading .kf-search__results {
	opacity: 0.45;
	transition: opacity 0.15s ease;
}

@media (max-width: 1100px) {
	.kf-search__row--main {
		grid-template-columns: repeat(3, minmax(150px, 1fr));
	}

	.kf-search__row--main .kf-facet--search,
	.kf-search__row--main .kf-facet--edition {
		grid-column: span 3;
	}
}

@media (max-width: 700px) {
	.kf-search__row,
	.kf-search__row--main {
		grid-template-columns: 1fr;
	}

	.kf-search__row--main .kf-facet--search,
	.kf-search__row--main .kf-facet--edition {
		grid-column: 1 / -1;
	}
}
