/* Nexo Busca */

.nexo-search {
	--nexo-search-width: 320px;
	--nexo-search-color: #111827;
	--nexo-search-bg: #ffffff;
	--nexo-search-radius: 999px;
	--nexo-search-focus: #6d28d9;
	--nexo-btn-color: #ffffff;
	--nexo-btn-bg: #6d28d9;
	--nexo-btn-hover-bg: #5b21b6;
	--nexo-results-bg: #ffffff;
	--nexo-results-hover: #f5f3ff;

	position: relative;
	display: inline-block;
	max-width: 100%;
	width: var(--nexo-search-width);
}

.nexo-search__form {
	display: flex;
	align-items: stretch;
	width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	background: var(--nexo-search-bg);
	border: 1px solid #d1d5db;
	border-radius: var(--nexo-search-radius);
	transition: border-color .2s ease, box-shadow .2s ease;
}

.nexo-search__form:focus-within {
	border-color: var(--nexo-search-focus);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--nexo-search-focus) 22%, transparent);
}

.nexo-search__input {
	flex: 1 1 auto;
	min-width: 0;
	box-sizing: border-box;
	margin: 0;
	padding: 12px 16px;
	font: inherit;
	color: var(--nexo-search-color);
	background: transparent;
	border: 0;
	outline: none;
	box-shadow: none;
	appearance: none;
}

/* Remove o "x" nativo do campo de busca para usar só o nosso visual */
.nexo-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.nexo-search__input::placeholder {
	color: #9ca3af;
	opacity: 1;
}

.nexo-search__button {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0 16px;
	font: inherit;
	font-weight: 600;
	color: var(--nexo-btn-color);
	background: var(--nexo-btn-bg);
	border: 0;
	cursor: pointer;
	transition: background-color .2s ease;
}

.nexo-search__button:hover {
	background: var(--nexo-btn-hover-bg);
}

.nexo-search__button:focus-visible,
.nexo-search__open:focus-visible {
	outline: 2px solid var(--nexo-search-focus);
	outline-offset: 2px;
}

.nexo-search__icon {
	display: block;
	flex: 0 0 auto;
}

.nexo-search__open {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--nexo-search-color);
	background: var(--nexo-search-bg);
	border: 1px solid #d1d5db;
	border-radius: 50%;
	cursor: pointer;
}

/* Resultados ao vivo */
.nexo-search__results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 1000;
	box-sizing: border-box;
	min-width: 280px;
	max-height: 380px;
	overflow-y: auto;
	padding: 8px;
	background: var(--nexo-results-bg);
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, .12);
}

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

.nexo-search__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.nexo-search__link {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 10px 12px;
	color: var(--nexo-search-color);
	text-decoration: none;
	border-radius: 8px;
}

.nexo-search__link:hover,
.nexo-search__link:focus-visible {
	background: var(--nexo-results-hover);
	outline: none;
}

.nexo-search__title {
	font-weight: 600;
	line-height: 1.3;
}

.nexo-search__type {
	font-size: .78rem;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.nexo-search__all,
.nexo-search__empty {
	display: block;
	margin: 6px 0 0;
	padding: 8px 12px;
	font-size: .9rem;
	color: var(--nexo-search-focus);
	text-decoration: none;
}

.nexo-search__empty {
	color: #6b7280;
}

.nexo-search__all:hover {
	text-decoration: underline;
}

/* Estilo "ícone que abre" */
.nexo-search--expand .nexo-search__open {
	display: inline-flex;
}

.nexo-search--expand .nexo-search__form {
	position: absolute;
	top: 50%;
	right: 0;
	width: var(--nexo-search-width);
	max-width: calc(100vw - 32px);
	transform: translateY(-50%) scaleX(0);
	transform-origin: right center;
	opacity: 0;
	visibility: hidden;
	transition: transform .25s ease, opacity .2s ease, visibility .25s;
}

.nexo-search--expand.is-open .nexo-search__form {
	transform: translateY(-50%) scaleX(1);
	opacity: 1;
	visibility: visible;
}

.nexo-search--expand {
	width: auto;
	min-height: 44px;
}

.nexo-search--expand.is-open .nexo-search__results {
	top: calc(100% + 8px);
	right: 0;
	left: auto;
	width: var(--nexo-search-width);
}

/* Telas pequenas: campo ocupa a largura disponível */
@media (max-width: 767px) {
	.nexo-search {
		width: 100%;
	}

	.nexo-search__results {
		min-width: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nexo-search__form,
	.nexo-search__button {
		transition: none;
	}
}
