/**
 * Live search results under the header search field (inc/components/live-search.php, assets/js/live-search.js).
 */

.site-search__results {
	max-width: calc(var(--mv-container) + 2 * var(--mv-gutter));
	margin-inline: auto;
	/* Aligned with the field: the close button (44) + gap (12) stay on the right. */
	padding: 0 calc(var(--mv-gutter) + 56px) 20px var(--mv-gutter);
}

.site-search__results[hidden] {
	display: none;
}

.site-search__results-inner {
	max-height: min(68vh, 560px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding-top: 16px;
	border-top: 1px solid var(--mv-color-border);
	scrollbar-width: thin;
	scrollbar-color: var(--mv-color-border) transparent;
	animation: mv-live-in 0.16s ease-out both;
}

@keyframes mv-live-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
}

.mv-live {
	display: grid;
	grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
	gap: 16px 32px;
	transition: opacity 0.15s ease;
}

.mv-live--single,
.mv-live--skeleton {
	grid-template-columns: minmax(0, 1fr);
}

.site-search__results.is-loading .mv-live {
	opacity: 0.55;
}

.mv-live__col {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.mv-live__col--posts {
	padding-left: 32px;
	border-left: 1px solid var(--mv-color-border);
}

.mv-live--single .mv-live__col--posts {
	padding-left: 0;
	border-left: 0;
}

/* Section head */
.mv-live__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 0 10px 4px;
}

.mv-live__title {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	color: #637381;
	font-size: var(--mv-fs-12);
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.3;
	text-transform: uppercase;
}

.mv-live__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 20px;
	padding-inline: 6px;
	border-radius: 10px;
	background-color: var(--mv-color-surface-alt);
	color: var(--mv-color-muted);
	font-size: var(--mv-fs-11);
	letter-spacing: 0;
	font-variant-numeric: tabular-nums;
}

.mv-live__all {
	color: var(--mv-color-accent);
	font-size: var(--mv-fs-13);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.mv-live__all:hover {
	color: var(--mv-color-accent-hover);
}

/* Rows */
.mv-live__list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.mv-live__item {
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	padding: 8px 10px;
	border-radius: var(--mv-radius-md);
	color: var(--mv-color-text);
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.mv-live__item--post {
	grid-template-columns: 64px minmax(0, 1fr);
}

.mv-live__item:hover,
.mv-live__item.is-active {
	background-color: var(--mv-color-surface-alt);
}

.mv-live__item.is-active {
	box-shadow: inset 0 0 0 1.5px rgba(9, 177, 231, 0.35);
}

.mv-live__thumb {
	display: block;
	overflow: hidden;
	width: 48px;
	height: 48px;
	border-radius: 10px;
	background-color: var(--mv-color-photo-bg);
}

.mv-live__thumb--post {
	width: 64px;
	height: 48px;
	border-radius: 8px;
}

.mv-live__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mv-live__text {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.mv-live__name {
	font-size: var(--mv-fs-14);
	font-weight: 600;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mv-live__name mark {
	padding: 0 1px;
	border-radius: 3px;
	background-color: rgba(9, 177, 231, 0.16);
	color: inherit;
}

.mv-live__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0 6px;
	color: #637381;
	font-size: var(--mv-fs-12);
	line-height: 1.3;
}

.mv-live__meta > span + span::before {
	content: "·";
	margin-right: 6px;
	color: var(--mv-color-subtle);
}

.mv-live__stock {
	color: var(--mv-color-success);
}

.mv-live__stock.is-out {
	color: #9ba1ac;
}

.mv-live__price {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	color: var(--mv-color-text);
	font-size: var(--mv-fs-14);
	font-weight: 700;
	line-height: 1.25;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.mv-live__price del {
	order: 2;
	color: #9ba1ac;
	font-size: var(--mv-fs-12);
	font-weight: 500;
}

.mv-live__price ins {
	color: #e02424;
	text-decoration: none;
}

/* «Показати всі товари…» */
.mv-live__more {
	display: block;
	margin-top: 6px;
	padding: 12px 14px;
	border-radius: var(--mv-radius-md);
	background-color: var(--mv-color-surface-alt);
	color: var(--mv-color-accent);
	font-size: var(--mv-fs-14);
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.mv-live__more:hover,
.mv-live__more.is-active {
	background-color: #ecf8fe;
	box-shadow: none;
}

/* Empty, hint, error */
.mv-live__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 20px 16px 8px;
	text-align: center;
}

.mv-live__empty-title {
	margin: 0;
	color: var(--mv-color-text);
	font-size: var(--mv-fs-15);
	font-weight: 700;
}

.mv-live__empty-text {
	margin: 0;
	color: #637381;
	font-size: var(--mv-fs-13);
}

.mv-live__catalog {
	display: inline-flex;
	margin-top: 8px;
	padding: 8px 14px;
	border-radius: var(--mv-radius-md);
	color: var(--mv-color-accent);
	font-size: var(--mv-fs-14);
	font-weight: 600;
	text-decoration: none;
}

.mv-live__catalog:hover,
.mv-live__catalog.is-active {
	background-color: #ecf8fe;
}

.mv-live__hint {
	margin: 0;
	padding: 4px 10px;
	color: #637381;
	font-size: var(--mv-fs-13);
}

.mv-live__hint.is-error {
	color: #b42318;
}

/* Skeleton */
.mv-live--skeleton .mv-live__item {
	grid-template-columns: 48px minmax(0, 1fr);
}

.mv-live__line {
	display: block;
	width: 70%;
	height: 12px;
	border-radius: 6px;
}

.mv-live__line--short {
	width: 40%;
}

.mv-live__shimmer {
	background: linear-gradient(90deg, #f0f2f5 25%, #f8f9fb 37%, #f0f2f5 63%);
	background-size: 400% 100%;
	animation: mv-live-shimmer 1.2s ease-in-out infinite;
}

@keyframes mv-live-shimmer {
	0% {
		background-position: 100% 50%;
	}

	100% {
		background-position: 0 50%;
	}
}

/* Adaptive */
@media (max-width: 1023.98px) {
	.mv-live {
		grid-template-columns: minmax(0, 1fr);
	}

	.mv-live__col--posts {
		padding-top: 12px;
		padding-left: 0;
		border-top: 1px solid var(--mv-color-border);
		border-left: 0;
	}
}

@media (max-width: 767.98px) {
	.site-search__results {
		padding-right: var(--mv-gutter);
		padding-bottom: 12px;
	}

	.site-search__results-inner {
		max-height: calc(100dvh - var(--mv-header-offset, 98px) - 96px);
	}

	.mv-live__item {
		grid-template-columns: 44px minmax(0, 1fr) auto;
		gap: 10px;
		padding: 8px 6px;
	}

	.mv-live__item--post {
		grid-template-columns: 56px minmax(0, 1fr);
	}

	.mv-live__thumb {
		width: 44px;
		height: 44px;
	}

	.mv-live__thumb--post {
		width: 56px;
		height: 44px;
	}

	.mv-live__head {
		padding-inline: 6px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.site-search__results-inner,
	.mv-live__shimmer {
		animation: none;
	}
}
