/**
 * JSH Ajax Search — structural styles only.
 * Appearance (colors, fonts, link styles) is left to the theme / browser defaults.
 */

.jsh-ajax-search {
	position: relative;
}

.jsh-ajax-search-results,
.ajax-search-results {
	position: absolute;
	top: 100%;
	left: 0;
	width: 100%;
	max-height: 300px;
	overflow: auto;
	z-index: 20;
	display: none;
	box-sizing: border-box;
}

.jsh-ajax-search-results.is-hidden,
.jsh-ajax-search-results.hidden,
.ajax-search-results.is-hidden,
.ajax-search-results.hidden {
	display: none;
}

.jsh-ajax-search-results:not(.is-hidden):not(.hidden),
.ajax-search-results:not(.is-hidden):not(.hidden) {
	display: block;
}

.jsh-ajax-search--stacked .jsh-ajax-search-results,
.jsh-ajax-search--stacked .ajax-search-results {
	position: relative;
	top: auto;
	z-index: 1;
	margin-top: 0.5em;
}

.jsh-ajax-search-results__list,
.search-results-container {
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	padding: 0.75em 1em;
	box-sizing: border-box;
}

.jsh-ajax-search-results__item,
.search-result {
	margin: 0;
}

.jsh-ajax-search-results__item p,
.search-result p {
	margin: 0;
}

.jsh-ajax-search-results__link {
	display: flex;
	align-items: center;
	gap: 0.75em;
	text-decoration: none;
	color: inherit;
}

.jsh-ajax-search-results__thumb {
	flex: 0 0 auto;
	display: block;
	width: calc(60px * 16 / 9);
	height: 60px;
	overflow: hidden;
	background: transparent;
	border-radius: 5px;
}

.jsh-ajax-search-results__thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 5px;
}

.jsh-ajax-search-results__title {
	flex: 1 1 auto;
	min-width: 0;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

.jsh-ajax-search-results__loading {
	display: flex;
	flex-direction: column;
	gap: 0.75em;
}

.jsh-ajax-search-results__loading-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.jsh-ajax-search-results__skeleton {
	display: flex;
	align-items: center;
	gap: 0.75em;
}

.jsh-ajax-search-results__skeleton-thumb {
	flex: 0 0 auto;
	width: calc(60px * 16 / 9);
	height: 60px;
	border-radius: 5px;
	background: linear-gradient(
		90deg,
		currentColor 0%,
		transparent 40%,
		currentColor 80%
	);
	background-size: 200% 100%;
	opacity: 0.12;
	animation: jsh-ajax-search-shimmer 1.2s ease-in-out infinite;
}

.jsh-ajax-search-results__skeleton-lines {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.45em;
}

.jsh-ajax-search-results__skeleton-line {
	display: block;
	height: 0.7em;
	width: 88%;
	border-radius: 4px;
	background: linear-gradient(
		90deg,
		currentColor 0%,
		transparent 40%,
		currentColor 80%
	);
	background-size: 200% 100%;
	opacity: 0.12;
	animation: jsh-ajax-search-shimmer 1.2s ease-in-out infinite;
}

.jsh-ajax-search-results__skeleton-line--short {
	width: 58%;
	animation-delay: 0.15s;
}

@keyframes jsh-ajax-search-shimmer {
	0% {
		background-position: 100% 0;
		opacity: 0.08;
	}
	50% {
		opacity: 0.2;
	}
	100% {
		background-position: -100% 0;
		opacity: 0.08;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jsh-ajax-search-results__skeleton-thumb,
	.jsh-ajax-search-results__skeleton-line {
		animation: none;
		opacity: 0.14;
	}
}

/* Hide legacy custom scrollbar markup if theme still has it */
.jsh-ajax-search-results__scrollbar,
.custom-scroll-bar,
.custom-scroll-thumb {
	display: none !important;
}
