/**
 * ChaCha Home — DEV-17 Smart Search / Autocomplete v1.0
 */

.chacha-smart-search-host {
	position: relative;
	min-width: 0;
}

.chacha-smart-search[hidden] {
	display: none !important;
}

.chacha-smart-search {
	position: absolute;
	z-index: 1200;
	top: calc(100% + 9px);
	left: 0;
	right: 0;
	display: block;
	max-height: min(68vh, 620px);
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--chacha-bg, #FFFDFC);
	border: 1px solid var(--chacha-border, #D7CEC4);
	border-radius: 8px;
	box-shadow: 0 18px 46px rgba(32, 26, 23, 0.14);
	color: var(--chacha-text-strongest, #201A17);
	font-family: var(--chacha-font-body, "Inter", sans-serif);
}

.chacha-smart-search__section + .chacha-smart-search__section {
	border-top: 1px solid rgba(215, 206, 196, 0.65);
}

.chacha-smart-search__heading {
	padding: 13px 16px 9px;
	color: var(--chacha-text-muted, #6A5F58);
	font-size: 10px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.chacha-smart-search__list,
.chacha-smart-search__category-list {
	display: grid;
	margin: 0;
	padding: 0 8px 9px;
}

.chacha-smart-search__product,
.chacha-smart-search__category,
.chacha-smart-search__all-results,
.chacha-smart-search__empty-cta {
	text-decoration: none !important;
}

.chacha-smart-search__product {
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	min-width: 0;
	padding: 8px;
	border-radius: 5px;
	color: inherit;
	transition: background-color 150ms ease;
}

.chacha-smart-search__product:hover,
.chacha-smart-search__product:focus-visible,
.chacha-smart-search__product.is-active,
.chacha-smart-search__category:hover,
.chacha-smart-search__category:focus-visible,
.chacha-smart-search__category.is-active {
	background: rgba(176, 141, 87, 0.085);
	color: var(--chacha-espresso, #201A17);
}

.chacha-smart-search__product:focus-visible,
.chacha-smart-search__category:focus-visible,
.chacha-smart-search__all-results:focus-visible,
.chacha-smart-search__empty-cta:focus-visible {
	outline: 2px solid var(--chacha-brass, #B08D57);
	outline-offset: -2px;
}

.chacha-smart-search__product-image {
	position: relative;
	display: block;
	width: 48px;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	border-radius: 4px;
	background: var(--chacha-bg-soft, #FBF8F4);
}

.chacha-smart-search__product-image img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.chacha-smart-search__product-body {
	display: grid;
	gap: 4px;
	min-width: 0;
}

.chacha-smart-search__product-name {
	display: block;
	overflow: hidden;
	color: var(--chacha-text-strongest, #201A17);
	font-family: var(--chacha-font-heading, "Cormorant Garamond", Georgia, serif);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.22;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chacha-smart-search__product-meta {
	display: block;
	overflow: hidden;
	color: var(--chacha-text-muted, #6A5F58);
	font-size: 10px;
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: 0.025em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chacha-smart-search__product-price {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 6px;
	color: var(--chacha-espresso, #201A17);
	font-size: 12px;
	font-weight: 650;
	line-height: 1.25;
}

.chacha-smart-search__product-price del {
	color: var(--chacha-text-muted, #6A5F58);
	font-weight: 400;
	opacity: 0.68;
}

.chacha-smart-search__product-price ins {
	color: inherit;
	font-weight: inherit;
	text-decoration: none;
}

.chacha-smart-search__arrow {
	flex: 0 0 auto;
	color: var(--chacha-brass-dark, #8F6F3F);
	font-size: 15px;
	line-height: 1;
}

.chacha-smart-search__category {
	display: grid;
	grid-template-columns: 28px minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 9px;
	min-height: 42px;
	padding: 7px 9px;
	border-radius: 5px;
	color: inherit;
	transition: background-color 150ms ease;
}

.chacha-smart-search__category-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 1px solid rgba(176, 141, 87, 0.34);
	border-radius: 50%;
	color: var(--chacha-brass-dark, #8F6F3F);
}

.chacha-smart-search__category-icon svg {
	width: 15px;
	height: 15px;
}

.chacha-smart-search__category-name {
	min-width: 0;
	overflow: hidden;
	font-size: 12px;
	font-weight: 650;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chacha-smart-search__category-count {
	color: var(--chacha-text-muted, #6A5F58);
	font-size: 10px;
	font-weight: 500;
	white-space: nowrap;
}

.chacha-smart-search__all-results {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 10px 16px;
	border-top: 1px solid rgba(215, 206, 196, 0.78);
	background: var(--chacha-bg-soft, #FBF8F4);
	color: var(--chacha-espresso, #201A17);
	font-size: 11px;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0.055em;
	text-align: center;
	text-transform: uppercase;
}

.chacha-smart-search__all-results:hover,
.chacha-smart-search__all-results.is-active {
	background: rgba(176, 141, 87, 0.11);
	color: var(--chacha-espresso, #201A17);
}

.chacha-smart-search__state,
.chacha-smart-search__empty {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 78px;
	padding: 18px;
	color: var(--chacha-text-muted, #6A5F58);
	font-size: 12px;
	line-height: 1.55;
	text-align: center;
}

.chacha-smart-search__spinner {
	width: 16px;
	height: 16px;
	border: 1.5px solid rgba(176, 141, 87, 0.25);
	border-top-color: var(--chacha-brass-dark, #8F6F3F);
	border-radius: 50%;
	animation: chachaSmartSearchSpin 650ms linear infinite;
}

.chacha-smart-search__empty {
	flex-direction: column;
	gap: 7px;
}

.chacha-smart-search__empty-title {
	color: var(--chacha-text-strongest, #201A17);
	font-family: var(--chacha-font-heading, "Cormorant Garamond", Georgia, serif);
	font-size: 18px;
	font-weight: 600;
	line-height: 1.25;
}

.chacha-smart-search__empty-copy {
	max-width: 420px;
}

.chacha-smart-search__empty-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	margin-top: 4px;
	padding: 8px 14px;
	border: 1px solid rgba(176, 141, 87, 0.52);
	border-radius: 4px;
	color: var(--chacha-espresso, #201A17);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.chacha-smart-search__empty-cta:hover,
.chacha-smart-search__empty-cta.is-active {
	background: rgba(176, 141, 87, 0.09);
	color: var(--chacha-espresso, #201A17);
}

@keyframes chachaSmartSearchSpin {
	to {
		transform: rotate(360deg);
	}
}

/* Kadence responsive search drawer. */
#search-drawer .chacha-smart-search-host--drawer {
	width: min(100%, 780px);
	margin-inline: auto;
}

#search-drawer .chacha-smart-search-host--drawer .chacha-smart-search {
	top: calc(100% + 12px);
	max-height: min(54vh, 560px);
}

@media (max-width: 1024px) {
	#search-drawer .chacha-smart-search-host--drawer {
		width: min(calc(100vw - 40px), 720px);
	}

	#search-drawer .chacha-smart-search {
		left: 0;
		right: 0;
	}
}

@media (max-width: 600px) {
	#search-drawer .chacha-smart-search-host--drawer {
		width: calc(100vw - 28px);
	}

	#search-drawer .chacha-smart-search-host--drawer .chacha-smart-search {
		top: calc(100% + 8px);
		max-height: min(58vh, 500px);
		border-radius: 6px;
	}

	.chacha-smart-search__heading {
		padding-inline: 12px;
	}

	.chacha-smart-search__list,
	.chacha-smart-search__category-list {
		padding-inline: 5px;
	}

	.chacha-smart-search__product {
		grid-template-columns: 42px minmax(0, 1fr) auto;
		gap: 10px;
		padding: 7px;
	}

	.chacha-smart-search__product-image {
		width: 42px;
	}

	.chacha-smart-search__product-name {
		font-size: 15px;
	}

	.chacha-smart-search__product-meta,
	.chacha-smart-search__category-count {
		font-size: 9px;
	}

	.chacha-smart-search__category {
		grid-template-columns: 28px minmax(0, 1fr) auto;
	}

	.chacha-smart-search__category-count {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.chacha-smart-search__product,
	.chacha-smart-search__category,
	.chacha-smart-search__spinner {
		transition: none !important;
		animation: none !important;
	}
}
