/* ═══════════════════════════════════════════════════════════════
   Materiály – Filter block
   ═══════════════════════════════════════════════════════════════ */

.dku-materialy-filter__form {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--font-size--medium);
}

/* Search row */
.dku-materialy-filter__search-row {
	display: flex;
}

.dku-materialy-filter__search-wrap {
	position: relative;
	flex: 1;
}

.dku-materialy-filter__search-icon {
	position: absolute;
	left: 0.875rem;
	top: 50%;
	transform: translateY(-50%);
	width: 1.125rem;
	height: 1.125rem;
	display: flex;
	align-items: center;
	justify-content: center;
	color: currentColor;
	opacity: 0.5;
	pointer-events: none;
}

.dku-materialy-filter__search-icon svg {
	width: 1.125rem;
	height: 1.125rem;
}

.dku-materialy-filter__text-input {
	width: 100%;
	padding: 0.75rem var(--wp--preset--font-size--medium) 0.75rem 2.625rem;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 5px;
	font-size: var(--wp--preset--font-size--small);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	box-sizing: border-box;
	outline: none;
}

.dku-materialy-filter__text-input::placeholder {
	color: var(--wp--preset--color--stredneseda);
}

.dku-materialy-filter__text-input:focus {
	border-color: rgba(255, 255, 255, 0.8);
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Dropdowns row */
.dku-materialy-filter__dropdowns-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
	align-items: stretch;
}

/* Custom multi-select dropdown */
.dku-materialy-filter__dropdown {
	position: relative;
	flex: 1;
	min-width: 170px;
}

.dku-materialy-filter__dropdown-summary {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.625rem 0.75rem;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 5px;
	font-size: var(--wp--preset--font-size--small);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	list-style: none;
	user-select: none;
	white-space: nowrap;
}

.dku-materialy-filter__dropdown-summary::-webkit-details-marker {
	display: none;
}

.dku-materialy-filter__dropdown-summary:focus {
	outline: 2px solid rgba(255, 255, 255, 0.8);
	outline-offset: 1px;
}

.dku-materialy-filter__select-icon {
	flex-shrink: 0;
	width: var(--wp--preset--font-size--medium);
	height: var(--wp--preset--font-size--medium);
	display: flex;
	align-items: center;
	color: currentColor;
	opacity: 0.6;
}

.dku-materialy-filter__select-icon svg {
	width: var(--wp--preset--font-size--medium);
	height: var(--wp--preset--font-size--medium);
}

.dku-materialy-filter__dropdown-label {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dku-materialy-filter__select-chevron {
	flex-shrink: 0;
	width: var(--wp--preset--font-size--medium);
	height: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--stredneseda);
	transition: transform 0.2s;
}

.dku-materialy-filter__dropdown[open] .dku-materialy-filter__select-chevron {
	transform: rotate(180deg);
}

/* Dropdown panel */
.dku-materialy-filter__dropdown-panel {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	min-width: 100%;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--bledoseda);
	border-radius: 5px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	z-index: 100;
	padding: 0.375rem 0;
	max-height: 260px;
	overflow-y: auto;
}

/* Kategória tree has longer, indented labels — cap width and wrap instead of
   letting the panel stretch off-screen. */
.dku-materialy-filter__dropdown--kategoria .dku-materialy-filter__dropdown-panel {
	max-width: min(90vw, 26rem);
	/* the search box is sticky inside this scroll container, see below */
	padding-top: 0;
}

.dku-materialy-filter__dropdown--kategoria .dku-materialy-filter__checkbox-item {
	white-space: normal;
}

/* Search box pinned to the top of the Kategória dropdown panel */
.dku-materialy-filter__dropdown-search-wrap {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--wp--preset--color--base);
	padding: 0.5rem;
	border-bottom: 1px solid var(--wp--preset--color--bledoseda);
}

.dku-materialy-filter__dropdown-search {
	width: 100%;
	padding: 0.4375rem 0.625rem;
	border: 1px solid var(--wp--preset--color--bledoseda);
	border-radius: 4px;
	font-size: var(--wp--preset--font-size--small);
	font-family: inherit;
	color: var(--wp--preset--color--contrast);
	box-sizing: border-box;
	outline: none;
}

.dku-materialy-filter__dropdown-search:focus {
	border-color: var(--wp--preset--color--modra-alt);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--wp--preset--color--modra-alt) 20%, transparent);
}

.dku-materialy-filter__dropdown-items {
	padding: 0.375rem 0;
}

.dku-materialy-filter__dropdown-no-results {
	margin: 0;
	padding: 0.625rem 0.875rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--stredneseda);
}

.dku-materialy-filter__checkbox-item {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	padding: 0.5rem 0.875rem;
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	transition: background 0.1s;
}

.dku-materialy-filter__checkbox-item:hover {
	background: var(--wp--preset--color--svetloseda);
}

.dku-materialy-filter__checkbox-item input[type="checkbox"] {
	width: var(--wp--preset--font-size--medium);
	height: var(--wp--preset--font-size--medium);
	flex-shrink: 0;
	accent-color: var(--wp--preset--color--modra-alt);
	cursor: pointer;
}

/* Kategória dropdown: checkboxes stay in a fixed column; depth is marked by
   repeating the dash prefix (– , – – ) rather than padding, to avoid wasting
   horizontal space on long category names. */
.dku-materialy-filter__checkbox-text {
	flex: 1;
}

.dku-materialy-filter__checkbox-item--depth-0 {
	font-weight: 600;
}

.dku-materialy-filter__checkbox-item--depth-1,
.dku-materialy-filter__checkbox-item--depth-2 {
	font-weight: 400;
}

.dku-materialy-filter__checkbox-dash {
	color: var(--wp--preset--color--stredneseda);
}

.dku-materialy-filter__actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-left: auto;
}

.dku-materialy-filter__submit {
	padding: 0.625rem 1.5rem;
	background-color: var(--wp--preset--color--oranzova);
	border-radius: 5px;
	border: 1px solid var(--wp--preset--color--zlata);
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.15s;
}

.dku-materialy-filter__submit:hover,
.dku-materialy-filter__submit:focus {
	background-color: color-mix(in srgb, var(--wp--preset--color--oranzova) 85%, transparent);
	outline: none;
}

/* Tags row */
.dku-materialy-filter__tags-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.dku-materialy-filter__tag {
	padding: var(--wp--preset--spacing--20);
	background-color: var(--wp--preset--color--modra);
	border: none;
	border-radius: 5px;
	font-family: var(--wp--preset--font-family--bitter);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	color: var(--wp--preset--color--base);
	transition: background-color 0.15s;
}

.dku-materialy-filter__tag:hover,
.dku-materialy-filter__tag:focus {
	background-color: color-mix(in srgb, var(--wp--preset--color--modra-alt) 80%, var(--wp--preset--color--base));
	outline: none;
}

.dku-materialy-filter__tag--active {
	background-color: color-mix(in srgb, var(--wp--preset--color--modra-alt) 80%, var(--wp--preset--color--base));
}

/* "More areas" details/summary */
.dku-materialy-filter__more-details {
	display: contents; /* children flow inline with the other tags */
}

.dku-materialy-filter__more-details[open] > .dku-materialy-filter__more-summary {
	display: none; /* hide toggle once open */
}

.dku-materialy-filter__more-summary {
	list-style: none;
	cursor: pointer;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--base);
	padding: 0.3125rem 0.5rem;
	transition: opacity 0.15s;
	font-weight: 500;
}

.dku-materialy-filter__more-summary:hover {
	text-decoration: underline;
}

.dku-materialy-filter__more-summary::-webkit-details-marker {
	display: none;
}

.dku-materialy-filter__more-summary:hover {
	opacity: 1;
}

.dku-materialy-filter__more-tags {
	display: contents; /* additional tags flow inline */
}

.dku-materialy-filter__clear-tag,
.dku-materialy-filter__clear-tags,
.dku-materialy-filter__reset {
	font-size: var(--wp--preset--font-size--small);
	color: inherit;
	opacity: 0.6;
	background: none;
	border: none;
	text-decoration: none;
	padding: 0.25rem 0.5rem;
	border-radius: 5px;
	cursor: pointer;
	font-family: inherit;
	transition: opacity 0.15s;
}

.dku-materialy-filter__clear-tag:hover,
.dku-materialy-filter__clear-tags:hover,
.dku-materialy-filter__reset:hover {
	opacity: 1;
	text-decoration: underline;
}

/* Reset button is an <a>, keep it aligned with the button siblings */
.dku-materialy-filter__reset {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
}

/* "Skryť ďalšie oblasti" — appears inline among the expanded tags; native
   <details> visibility means it's only ever visible while open. */
.dku-materialy-filter__more-hide {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--base);
	opacity: 0.7;
	background: none;
	border: none;
	padding: 0.3125rem 0.5rem;
	cursor: pointer;
	font-family: inherit;
	text-decoration: underline;
	transition: opacity 0.15s;
}

.dku-materialy-filter__more-hide:hover {
	opacity: 1;
}

/* Autocomplete suggestions */
.dku-materialy-filter__suggestions {
	list-style: none;
	margin: 0;
	padding: 0.25rem 0;
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--bledoseda);
	border-radius: 5px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	z-index: 200;
	max-height: 260px;
	overflow-y: auto;
}

.dku-materialy-filter__suggestion-item {
	padding: 0.5rem 0.875rem;
	font-size: var(--wp--preset--font-size--medium);
	cursor: pointer;
	transition: background 0.1s;
}

.dku-materialy-filter__suggestion-item:hover,
.dku-materialy-filter__suggestion-item.is-active {
	background: var(--wp--preset--color--svetloseda);
}

.dku-materialy-filter__suggestion-item--attachment {
	color: var(--wp--preset--color--contrast-2, #555);
	font-size: 0.9em;
}

.dku-materialy-filter__suggestion-icon {
	margin-right: 0.375em;
}

/* Responsive */
@media (max-width: 640px) {
	.dku-materialy-filter__dropdowns-row {
		flex-direction: column;
	}

	.dku-materialy-filter__submit {
		width: 100%;
	}
}

/* ═══════════════════════════════════════════════════════════════
   Materiály – Results block
   ═══════════════════════════════════════════════════════════════ */

.dku-materialy-vysledky__active-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	margin: 0 0 1.25rem;
	background-color: var(--wp--preset--color--svetlomodra, color-mix(in srgb, var(--wp--preset--color--modra) 12%, transparent));
	border: 1px solid var(--wp--preset--color--bledoseda);
	border-radius: 6px;
	font-size: var(--wp--preset--font-size--small);
}

.dku-materialy-vysledky__active-filters-label {
	font-weight: 600;
}

.dku-materialy-vysledky__active-filter {
	padding: 0.1875rem 0.5rem;
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--bledoseda);
	border-radius: 4px;
}

.dku-materialy-vysledky__active-filter strong {
	font-weight: 600;
}

.dku-materialy-vysledky__reset-link {
	margin-left: auto;
	color: inherit;
	opacity: 0.7;
	text-decoration: underline;
	white-space: nowrap;
	transition: opacity 0.15s;
}

.dku-materialy-vysledky__reset-link:hover {
	opacity: 1;
}

.dku-materialy-vysledky__count {
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.65;
	margin: 0 0 1.25rem;
}

.dku-materialy-vysledky__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1.5rem;
}

.dku-materialy-vysledky__item {
	display: flex;
	flex-direction: column;
	border-radius: 5px;
	overflow: hidden;
	background: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--jemny);
	transition: box-shadow 0.2s;
}

.dku-materialy-vysledky__item:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
}

.dku-materialy-vysledky__thumbnail {
	display: block;
	position: relative;
	overflow: hidden;
	flex-shrink: 0;
}

.dku-materialy-vysledky__thumbnail img {
	width: 100%;
	height: 180px;
	object-fit: cover;
	display: block;
	transition: transform 0.3s;
}

.dku-materialy-vysledky__item:hover .dku-materialy-vysledky__thumbnail img {
	transform: scale(1.03);
}

/* Typ materiálu — format badge(s) overlaid on the thumbnail */
.dku-materialy-vysledky__typy {
	position: absolute;
	top: 0.625rem;
	left: 0.625rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
}

.dku-materialy-vysledky__typ {
	display: inline-flex;
	align-items: center;
	gap: 0.3125rem;
	font-size: 0.6875rem;
	font-weight: 600;
	line-height: 1.4;
	padding: 0.25rem 0.5625rem;
	border-radius: 300px;
	color: var(--wp--preset--color--tmavoseda);
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
	backdrop-filter: blur(2px);
}

.dku-materialy-vysledky__typ svg {
	width: 0.875rem;
	height: 0.875rem;
	flex-shrink: 0;
}

.dku-materialy-vysledky__body {
	padding: var(--wp--preset--font-size--medium) 1.125rem 1.125rem;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* Druh materiálu — primary category pills (solid brand colour) */
.dku-materialy-vysledky__druhy {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
}

.dku-materialy-vysledky__druh {
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
	padding: 0.1875rem 0.6875rem;
	border-radius: 300px;
	color: var(--wp--preset--color--modra-alt);
	background: color-mix(in srgb, var(--wp--preset--color--modra) 12%, var(--wp--preset--color--base));
}

.dku-materialy-vysledky__title {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	margin: 0;
	line-height: 1.35;
}

.dku-materialy-vysledky__title a {
	color: var(--wp--preset--color--modra-alt);
	text-decoration: none;
}

.dku-materialy-vysledky__title a:hover {
	text-decoration: underline;
}

.dku-materialy-vysledky__excerpt {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.55;
	opacity: 0.75;
	margin: 0;
	flex: 1;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	line-clamp: 3;
	overflow: hidden;
}

/* Meta footer — pushed to the bottom of the card */
.dku-materialy-vysledky__meta {
	margin-top: auto;
	padding-top: 0.625rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* Cieľová skupina — soft, icon-prefixed row */
.dku-materialy-vysledky__skupiny {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.75rem;
	color: var(--wp--preset--color--stredneseda);
}

.dku-materialy-vysledky__skupiny-icon {
	width: 0.9375rem;
	height: 0.9375rem;
	flex-shrink: 0;
}

.dku-materialy-vysledky__skupina {
	line-height: 1.4;
	padding: 0.0625rem 0.5rem;
	border-radius: 300px;
	border: 1px solid var(--wp--preset--color--bledoseda);
	color: var(--wp--preset--color--tmavoseda);
}

/* Témy / tagy — subtle hashtag-style chips */
.dku-materialy-vysledky__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.dku-materialy-vysledky__tag {
	font-size: 0.75rem;
	padding: 0.1875rem 0.5625rem;
	border-radius: 5px;
	background: var(--wp--preset--color--svetloseda);
	color: var(--wp--preset--color--stredneseda);
}

.dku-materialy-vysledky__tag::before {
	content: "#";
	opacity: 0.6;
	margin-right: 0.0625rem;
}

/* ── Matched filter highlight ──────────────────────────────────────
   Chips matching an active filter get emphasised so the user sees
   exactly why each result matched their search. */
.dku-materialy-vysledky__typ.is-match,
.dku-materialy-vysledky__druh.is-match,
.dku-materialy-vysledky__skupina.is-match,
.dku-materialy-vysledky__tag.is-match {
	color: var(--wp--preset--color--base);
	background: var(--wp--preset--color--modra);
	border-color: var(--wp--preset--color--modra);
	font-weight: 700;
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--wp--preset--color--modra) 30%, transparent);
}

.dku-materialy-vysledky__tag.is-match::before {
	opacity: 0.85;
}

/* Search-text highlight inside title / excerpt */
.dku-materialy-vysledky__mark {
	background: color-mix(in srgb, var(--wp--preset--color--zlata) 60%, transparent);
	color: inherit;
	padding: 0 0.15em;
	border-radius: 2px;
}

.dku-materialy-vysledky__empty {
	padding: 3rem var(--wp--preset--font-size--medium);
	text-align: center;
	opacity: 0.6;
	font-size: var(--wp--preset--font-size--medium);
}

/* Pagination */
.dku-materialy-vysledky__pagination {
	margin-top: var(--wp--preset--spacing--30);
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.dku-materialy-vysledky__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	height: 2.25rem;
	padding: 0 0.5rem;
	border-radius: 5px;
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
	color: inherit;
	border: 1px solid var(--wp--preset--color--bledoseda);
	transition: border-color 0.15s, background-color 0.15s;
}

.dku-materialy-vysledky__pagination .page-numbers:hover {
	border-color: var(--wp--preset--color--modra-alt);
}

.dku-materialy-vysledky__pagination .page-numbers.current {
	font-weight: 700;
	border-color: var(--wp--preset--color--modra-alt);
	color: var(--wp--preset--color--modra-alt);
}

.dku-materialy-vysledky__pagination .page-numbers.dots {
	border-color: transparent;
	cursor: default;
}

/* AJAX loading state */
.dku-materialy-vysledky[aria-busy="true"] .dku-materialy-vysledky__grid,
.dku-materialy-vysledky[aria-busy="true"] .dku-materialy-vysledky__count,
.dku-materialy-vysledky[aria-busy="true"] .dku-materialy-vysledky__pagination,
.dku-materialy-vysledky[aria-busy="true"] .dku-materialy-vysledky__empty {
	opacity: 0.4;
	pointer-events: none;
	transition: opacity 0.2s;
}

.dku-materialy-vysledky__spinner {
	display: flex;
	justify-content: center;
	padding: 1.5rem 0 0.5rem;
}

.dku-materialy-vysledky__spinner::after {
	content: '';
	display: block;
	width: 2rem;
	height: 2rem;
	border: 3px solid var(--wp--preset--color--bledoseda);
	border-top-color: var(--wp--preset--color--modra-alt);
	border-radius: 50%;
	animation: dku-spin 0.7s linear infinite;
}

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