/**
 * Smart AJAX Search — Estilos
 *
 * Todo el CSS está namespaced bajo el prefijo .smart-search para no
 * interferir con los estilos del tema Impreza. No se sobreescribe
 * ninguna clase propia del tema.
 *
 * @package SmartAjaxSearch
 */

.smart-search__wrapper {
	position: relative;
	display: inline-block;
	width: 100%;
}

/* Spinner de carga, superpuesto al input existente de Impreza. */
.smart-search__spinner {
	display: none;
	position: absolute;
	top: 50%;
	right: 12px;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: rgba(0, 0, 0, 0.55);
	border-radius: 50%;
	animation: smart-search-spin 0.6s linear infinite;
	pointer-events: none;
}

.smart-search__wrapper.is-loading .smart-search__spinner {
	display: block;
}

@keyframes smart-search-spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* Dropdown principal. */
.smart-search__dropdown {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 9999;
	background: #ffffff;
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
	overflow: hidden;
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity 0.18s ease, transform 0.18s ease;
	pointer-events: none;
}

.smart-search__dropdown:not([hidden]) {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.smart-search__list {
	list-style: none;
	margin: 0;
	padding: 6px 0;
	max-height: 400px; /* Scroll cuando se superan ~8 resultados. */
	overflow-y: auto;
}

.smart-search__item {
	padding: 0;
}

.smart-search__item-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 14px;
	text-decoration: none;
	color: var(--color-content-link)!important;
	transition: background-color 0.15s ease;
}

.smart-search__item:hover .smart-search__item-link,
.smart-search__item.is-active .smart-search__item-link {
	background-color: rgba(0, 0, 0, 0.045);
}

.smart-search__item-thumb {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border-radius: 8px;
	object-fit: cover;
	background: #f0f0f0;
}

.smart-search__item-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.smart-search__item-title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.smart-search__item-type {
	font-size: 12px;
	line-height: 1.3;
	opacity: 0.6;
}

.smart-search__empty {
	padding: 14px;
	font-size: 13px;
	opacity: 0.6;
	color: var(--color-content-link)!important;
	text-align: center;
}

.smart-search__view-all {
	display: block;
	padding: 10px 14px;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	color: var(--color-content-link)!important;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	background: rgba(0, 0, 0, 0.02);
	transition: background-color 0.15s ease;
}

.smart-search__view-all:hover {
	background: rgba(0, 0, 0, 0.06);
}

/* Modo móvil / responsive. */
@media (max-width: 600px) {
	.smart-search__dropdown {
		position: fixed;
		top: auto;
		left: 12px;
		right: 12px;
		max-height: 70vh;
	}

	.smart-search__list {
		max-height: 60vh;
	}

	.smart-search__item-thumb {
		width: 38px;
		height: 38px;
	}
}
