/* =============================================================================
   Delegate Search Widget — blaek-ds
   Visual language follows association-finder (blaek-af): 68px inputs, soft
   shadows, Elementor global colours with the BLÄK blue as fallback.
   ============================================================================= */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.blaek-ds {
	font-size: 1rem;
	line-height: 1.5;
}

/* ── Heading + info ──────────────────────────────────────────────────────── */
.blaek-ds__heading {
	margin-top: 0;
	margin-bottom: 32px;
}

.blaek-ds__info {
	margin: 0 0 32px;
}

.blaek-ds__info > :last-child {
	margin-bottom: 0;
}

/* ── Search area ─────────────────────────────────────────────────────────── */
.blaek-ds__search {
	margin-bottom: 2rem;
}

.blaek-ds__input-row {
	display: flex;
	align-items: stretch;
	box-shadow: 0 0 25px 0 rgba(0, 0, 0, 0.1);
	margin-bottom: 16px;
}

.blaek-ds__text-input {
	flex: 1 1 auto;
	height: 68px;
	padding: 0.65rem 20px !important;
	font-size: 1rem;
	border: 1px solid rgba(110, 120, 130, 1) !important;
	border-right: none !important;
	border-radius: 0 !important;
	outline: none;
	background: rgba(255, 255, 255, 0.8);
	backdrop-filter: blur(30px);
	-webkit-backdrop-filter: blur(30px);
	color: inherit;
	transition: border-color 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

.blaek-ds__text-input::-webkit-search-decoration,
.blaek-ds__text-input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.blaek-ds__text-input:focus {
	border-color: var(--e-global-color-f733163, #0F7DC8);
}

.blaek-ds__search-btn {
	flex: 0 0 68px;
	width: 68px;
	height: 68px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: var(--e-global-color-f733163, #0F7DC8);
	color: #fff;
	border: none;
	border-radius: 0;
	cursor: pointer;
	transition: background 0.15s;
}

.blaek-ds__search-btn:hover,
.blaek-ds__search-btn:focus {
	background: #00508a;
	outline: none;
}

.blaek-ds__search-btn svg {
	width: 30px;
	height: 30px;
}

/* Dropdowns */
.blaek-ds__dropdowns {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.blaek-ds__select-wrap {
	position: relative;
}

.blaek-ds__select {
	width: 100%;
}

/* ── Select2 overrides (mirrors blaek-af) ────────────────────────────────── */
.blaek-ds .select2-container {
	width: 100% !important;
}

.blaek-ds .select2-container--default .select2-selection--single {
	min-height: 68px;
	display: flex;
	align-items: center;
	/* Right padding reserves the arrow's lane so a long association name is
	   cut with an ellipsis instead of running underneath the arrow. */
	padding: 0.65rem 52px 0.65rem 20px;
	border: 1px solid #d0d0d0;
	border-radius: 0;
	font-size: 1rem;
	line-height: 1.5;
	background: rgba(255, 255, 255, 0.8);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 0 25px 0 rgba(0, 0, 0, 0.1);
	transition: border-color 0.15s;
}

.blaek-ds .select2-container--default.select2-container--open .select2-selection--single,
.blaek-ds .select2-container--default.select2-container--focus .select2-selection--single {
	border-color: var(--e-global-color-f733163, #0F7DC8);
	outline: none;
}

.blaek-ds .select2-container--default .select2-selection--single .select2-selection__rendered {
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	min-width: 0;
	padding: 0;
	color: var(--e-global-color-f733163, #0F7DC8);
	line-height: inherit;
	font-weight: 400;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.blaek-ds .select2-container--default .select2-selection--single .select2-selection__placeholder {
	color: var(--e-global-color-97e2714, #085A9C);
}

.blaek-ds .select2-container--default .select2-selection--single .select2-selection__arrow {
	top: 50%;
	right: 1rem;
	transform: translateY(-50%);
	height: auto;
	width: 16px;
}

.blaek-ds .select2-container--default .select2-selection--single .select2-selection__arrow b {
	display: none;
}

.blaek-ds .select2-container--default .select2-selection--single .select2-selection__arrow::after {
	content: '';
	display: block;
	width: 10px;
	height: 10px;
	border-right: 2px solid var(--e-global-color-f733163, #0F7DC8);
	border-bottom: 2px solid var(--e-global-color-f733163, #0F7DC8);
	transform: rotate(45deg) translateY(-3px);
}

.blaek-ds .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow::after {
	transform: rotate(-135deg) translateY(-3px);
}

.blaek-ds .select2-container--default .select2-selection--single .select2-selection__clear {
	position: static;
	display: inline-flex;
	align-items: center;
	align-self: center;
	flex-shrink: 0;
	order: -1;
	margin-right: 0.5rem;
	color: var(--e-global-color-f733163, #0F7DC8);
	font-size: 1.1rem;
	padding-left: 0;
	line-height: 1;
	height: auto;
}

.blaek-ds .select2-dropdown {
	border: 1px solid #d0d0d0;
	border-top: none;
	border-radius: 0;
	font-size: 1rem;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.blaek-ds .select2-container--default .select2-search--dropdown .select2-search__field {
	padding: 0.5rem 0.75rem;
	border: 1px solid #d0d0d0;
	border-radius: 0;
	font-size: 0.95rem;
}

.blaek-ds .select2-container--default .select2-results__option {
	padding: 0.6rem 1rem;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	letter-spacing: inherit;
}

.blaek-ds .select2-container--default .select2-results__option--highlighted[aria-selected] {
	background-color: var(--e-global-color-f733163, #0F7DC8);
	color: #fff;
}

/* Function checkboxes (board / vice presidents / none) */
.blaek-ds__checks {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 20px;
	margin: 16px 0 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.blaek-ds__checks-label {
	padding: 0;
	margin-right: 4px;
	font-weight: 600;
	float: left; /* legend behaves like an inline flex item this way */
}

.blaek-ds__check {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	cursor: pointer;
	font-size: 0.95rem;
	white-space: nowrap;
}

.blaek-ds__check input {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--e-global-color-f733163, #0F7DC8);
	cursor: pointer;
}

/* Sort dropdown in the toolbar */
.blaek-ds__sort-by {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.blaek-ds__sort-by > span,
.blaek-ds__per-page > span {
	white-space: nowrap;
}

.blaek-ds__sort-select {
	/* The theme draws the arrow near the right edge: give the value air. */
	padding: 0.3rem 2.75rem 0.3rem 0.9rem;
	font: inherit;
	color: var(--e-global-color-f733163, #0F7DC8);
	background: rgba(255, 255, 255, 0.8);
	border: 1px solid #d0d0d0;
	border-radius: 0;
	cursor: pointer;
}

.blaek-ds__sort-select:focus {
	outline: none;
	border-color: var(--e-global-color-f733163, #0F7DC8);
}

/* Status badges (SAVD: Vorstand / Vizepräsident) */
.blaek-ds__badges {
	display: block;
	margin-top: 0.35rem;
}

.blaek-ds__badge {
	display: inline-block;
	margin: 0 0.35rem 0.25rem 0;
	padding: 0.1em 0.55em;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.5;
	color: var(--e-global-color-f733163, #0F7DC8);
	border: 1px solid currentColor;
	border-radius: 2px;
	white-space: nowrap;
}

.blaek-ds__badge--vize {
	color: #fff;
	background: var(--e-global-color-f733163, #0F7DC8);
	border-color: var(--e-global-color-f733163, #0F7DC8);
}

/* Manually maintained function (e.g. president) */
.blaek-ds__badge--manual {
	color: #fff;
	background: #085A9C;
	border-color: #085A9C;
}

/* Reset link */
.blaek-ds__reset-row {
	display: flex;
	justify-content: flex-end;
	margin-top: 16px;
}

/* Function checkboxes and reset share one line; the reset link only drops
   below when the line gets too narrow (phones). */
.blaek-ds__foot--with-checks {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 24px;
	margin-top: 16px;
}

.blaek-ds__foot--with-checks .blaek-ds__checks,
.blaek-ds__foot--with-checks .blaek-ds__reset-row {
	margin-top: 0;
}

.blaek-ds__foot--with-checks .blaek-ds__reset-row {
	margin-left: auto;
}

.blaek-ds__reset {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.9rem;
	color: var(--e-global-color-f733163, #0F7DC8);
	text-decoration: none;
	cursor: pointer;
}

.blaek-ds__reset:hover {
	text-decoration: none;
}

.blaek-ds__reset-icon {
	flex-shrink: 0;
	display: inline-block;
	vertical-align: middle;
	position: relative;
	bottom: -1.5px;
}

/* ── Results wrapper + loader ────────────────────────────────────────────── */
.blaek-ds__results-wrap {
	position: relative;
	min-height: 60px;
}

.blaek-ds__loader {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	position: absolute;
	inset: 0;
	z-index: 10;
	background: rgba(255, 255, 255, 0.75);
	backdrop-filter: blur(2px);
	border-radius: 4px;
}

.blaek-ds__results-wrap.is-loading .blaek-ds__loader {
	display: flex;
}

.blaek-ds__results-wrap.is-loading .blaek-ds__table,
.blaek-ds__results-wrap.is-loading .blaek-ds__count {
	opacity: 0.35;
	pointer-events: none;
	transition: opacity 0.15s;
}

.blaek-ds__loader-spinner {
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 3px solid #d0d0d0;
	border-top-color: var(--e-global-color-f733163, #0F7DC8);
	border-radius: 50%;
	animation: blaek-ds-spin 0.7s linear infinite;
	flex-shrink: 0;
}

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

.blaek-ds__loader-text {
	font-size: 0.9rem;
	color: #555;
}

/* Result count */
.blaek-ds__count {
	margin: 0;
}

/* Messages */
.blaek-ds__no-results,
.blaek-ds__empty,
.blaek-ds__error {
	padding: 1rem 0;
	color: #666;
	font-style: italic;
}

.blaek-ds__empty[hidden],
.blaek-ds__no-results[hidden],
.blaek-ds__error[hidden],
.blaek-ds__count[hidden] {
	display: none;
}

/* ── Toolbar: count + per-page selector ──────────────────────────────────── */
.blaek-ds__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 0 0 12px;
	font-size: 0.9rem;
	color: #666;
}

.blaek-ds__toolbar:empty {
	display: none;
}

.blaek-ds__per-page {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin-left: auto;
}

.blaek-ds__per-page-select {
	/* The theme draws the arrow near the right edge: give the value air. */
	padding: 0.3rem 2.75rem 0.3rem 0.9rem;
	font: inherit;
	color: var(--e-global-color-f733163, #0F7DC8);
	background: rgba(255, 255, 255, 0.8);
	border: 1px solid #d0d0d0;
	border-radius: 0;
	cursor: pointer;
}

.blaek-ds__per-page-select:focus {
	outline: none;
	border-color: var(--e-global-color-f733163, #0F7DC8);
}

/* ── Table ───────────────────────────────────────────────────────────────── */
/* The theme's reset.css gives every table grid borders, zebra rows and a
   0.9em font. The list follows the association-finder cards instead:
   horizontal separators only, full size, no stripes. */
.blaek-ds__table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	border-spacing: 0;
	table-layout: fixed;
	/* Same size as the site's editor tables (17px throughout). */
	font-size: 17px;
	line-height: 1.5;
	background: transparent;
	transition: opacity 0.15s;
}

.blaek-ds__table[hidden] {
	display: none;
}

.blaek-ds__table th,
.blaek-ds__table td {
	border: 0;
	background: transparent;
	font-size: 1em;
	line-height: inherit;
}

/* Zebra override only — must not touch borders: its :nth-child specificity
   would otherwise beat the row separator rule below. */
.blaek-ds__table tbody > tr:nth-child(2n+1) > td,
.blaek-ds__table tbody > tr:nth-child(2n+1) > th {
	background: transparent;
	background-color: transparent;
}

/* Zebra and hover as in the site's editor tables (blaek-editor-tables.css).
   Every person is two rows (row + detail), so "every second person" is
   4n+3, and its detail row (4n) shares the tint. */
.blaek-ds__table tbody > tr:nth-child(4n+3),
.blaek-ds__table tbody > tr:nth-child(4n) {
	background-color: hsla(0, 0%, 50%, 0.071);
}

.blaek-ds__table tbody > tr.blaek-ds__row:hover {
	background-color: rgba(20, 70, 110, 0.06);
}

.blaek-ds__th {
	padding: 0 16px 14px 0;
	text-align: left;
	vertical-align: bottom;
	border-bottom: 1px solid #979797;
	font-weight: 700;
}

.blaek-ds__th--name      { width: 32%; }
.blaek-ds__th--specialty { width: 30%; }
.blaek-ds__th--kv        { width: 19%; }
.blaek-ds__th--bv        { width: 19%; }

/* Theme button rules (white text on hover, nowrap) must not reach our
   text-style buttons — hence the explicit, !important-backed overrides. */
.blaek-ds__sort {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0;
	background: none;
	border: none;
	border-radius: 0;
	color: inherit;
	font: inherit;
	font-weight: 700;
	text-align: left;
	white-space: normal;
	cursor: pointer;
}

.blaek-ds .blaek-ds__sort:hover,
.blaek-ds .blaek-ds__sort:focus,
.blaek-ds .blaek-ds__sort:active {
	color: var(--e-global-color-f733163, #0F7DC8) !important;
	background: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
	outline: none;
}

.blaek-ds__sort:focus-visible {
	outline: 2px solid var(--e-global-color-f733163, #0F7DC8);
	outline-offset: 2px;
}

/* Sort indicator: small chevron, only on the sorted column */
.blaek-ds__sort-icon {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	opacity: 0;
	transition: opacity 0.15s, transform 0.15s;
}

.blaek-ds__th.is-sorted .blaek-ds__sort-icon {
	opacity: 1;
}

.blaek-ds__th.is-sorted.is-desc .blaek-ds__sort-icon {
	transform: rotate(-135deg) translateY(-2px);
}

/* Rows */
.blaek-ds__table .blaek-ds__row > td {
	padding: 24px 16px 24px 0;
	border-bottom: 1px solid #979797;
	vertical-align: top;
	overflow-wrap: anywhere;
}

/* Tinted rows need air at both edges. */
.blaek-ds__table .blaek-ds__row > td:first-child,
.blaek-ds__table thead th:first-child {
	padding-left: 16px;
}

.blaek-ds__table .blaek-ds__row > td:last-child {
	padding-right: 16px;
}

.blaek-ds__table .blaek-ds__row.is-open > td {
	border-bottom: none;
}

.blaek-ds__table .blaek-ds__cell--name {
	font-size: inherit;
	font-weight: 700;
}

/* Name is the toggle for the detail panel */
.blaek-ds__toggle {
	display: inline-flex;
	align-items: flex-start;
	gap: 0.6rem;
	max-width: 100%;
	padding: 0;
	background: none;
	border: none;
	border-radius: 0;
	color: var(--e-global-color-f733163, #0F7DC8);
	font: inherit;
	text-align: left;
	white-space: normal;
	cursor: pointer;
}

.blaek-ds__toggle-text {
	min-width: 0;
	overflow-wrap: anywhere;
}

.blaek-ds .blaek-ds__toggle:hover,
.blaek-ds .blaek-ds__toggle:focus,
.blaek-ds .blaek-ds__toggle:active,
.blaek-ds .blaek-ds__toggle[aria-expanded="true"] {
	color: var(--e-global-color-f733163, #0F7DC8) !important;
	background: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
	outline: none;
}

.blaek-ds .blaek-ds__toggle:hover,
.blaek-ds .blaek-ds__toggle:focus {
	text-decoration: underline;
}

.blaek-ds__toggle:focus-visible {
	outline: 2px solid var(--e-global-color-f733163, #0F7DC8);
	outline-offset: 2px;
}

.blaek-ds__toggle-icon {
	flex-shrink: 0;
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-top: 0.55em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.15s;
}

.blaek-ds__toggle[aria-expanded="true"] .blaek-ds__toggle-icon {
	transform: rotate(45deg);
}

/* Detail panel row */
.blaek-ds__table .blaek-ds__detail > td {
	padding: 0 16px 28px;
	border-bottom: 1px solid #979797;
}

.blaek-ds__detail[hidden] {
	display: none;
}

.blaek-ds__panel {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px 40px;
	padding: 4px 0 0 1.25rem;
}

.blaek-ds__panel-block {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.blaek-ds__panel-label {
	font-weight: 600;
}

.blaek-ds__panel-value {
	display: block;
}

.blaek-ds__panel-address {
	display: block;
	color: #555;
}

/* Crosslink to the map page (phase 3) */
.blaek-ds__panel-link {
	color: var(--e-global-color-f733163, #0F7DC8);
	text-decoration: none;
	border-bottom: 1px solid currentColor;
}

.blaek-ds__panel-link:hover,
.blaek-ds__panel-link:focus {
	text-decoration: none;
	border-bottom-color: transparent;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.blaek-ds__pagination {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 16px;
	margin-top: 40px;
	font-size: 17px;
	color: #1f2937;
}

.blaek-ds__pagination[hidden] {
	display: none;
}

.blaek-ds__pagination-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: none;
	background-color: transparent;
	border: none;
	border-radius: 4px;
	color: #1f2937;
	cursor: pointer;
	transition: color 0.2s ease;
}

.blaek-ds .blaek-ds__pagination-btn:hover:not(:disabled),
.blaek-ds .blaek-ds__pagination-btn:focus:not(:disabled) {
	color: var(--e-global-color-f733163, #0F7DC8) !important;
}

.blaek-ds .blaek-ds__pagination-btn:hover,
.blaek-ds .blaek-ds__pagination-btn:focus,
.blaek-ds .blaek-ds__pagination-btn:active {
	background: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
	outline: none !important;
}

.blaek-ds__pagination-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.blaek-ds__pagination-info {
	user-select: none;
}

/* ── Responsive: stack the table into cards ──────────────────────────────── */
@media (max-width: 768px) {
	/* Toolbar: count on its own line, then sort + per page side by side */
	.blaek-ds__toolbar {
		flex-wrap: wrap;
		row-gap: 10px;
	}

	.blaek-ds__count {
		flex: 1 0 100%;
	}

	.blaek-ds__sort-by,
	.blaek-ds__per-page {
		flex: 1 1 calc(50% - 8px);
		margin-left: 0;
		min-width: 0;
	}

	.blaek-ds__sort-select,
	.blaek-ds__per-page-select {
		flex: 1 1 auto;
		min-width: 0;
	}

	.blaek-ds__checks {
		gap: 8px 14px;
	}

	.blaek-ds__table,
	.blaek-ds__table tbody,
	.blaek-ds__table tr,
	.blaek-ds__table td {
		display: block;
		width: 100%;
	}

	.blaek-ds__table thead {
		display: none;
	}

	.blaek-ds__row {
		padding: 20px 16px;
		border-bottom: 1px solid #979797;
	}

	.blaek-ds__row.is-open {
		border-bottom: none;
	}

	.blaek-ds__table .blaek-ds__row td,
	.blaek-ds__table .blaek-ds__row > td:first-child,
	.blaek-ds__table .blaek-ds__row > td:last-child {
		padding: 0 0 6px;
		border-bottom: none;
	}

	.blaek-ds__cell--specialty,
	.blaek-ds__cell--kv,
	.blaek-ds__cell--bv {
		font-size: 0.95rem;
		color: #555;
	}

	.blaek-ds__cell--kv::before,
	.blaek-ds__cell--bv::before {
		content: attr(data-label) ": ";
		font-weight: 600;
	}

	.blaek-ds__cell--kv,
	.blaek-ds__cell--bv {
		display: inline-block;
		width: auto;
		margin-right: 16px;
	}

	.blaek-ds__table .blaek-ds__detail td {
		padding: 8px 16px 20px;
		border-bottom: 1px solid #979797;
	}

	.blaek-ds__panel {
		grid-template-columns: 1fr;
		gap: 14px;
		padding-left: 1.25rem;
	}
}
