/*
 * Premium fullscreen search overlay — native iOS feel over a Liquid Glass
 * background, not a flat white takeover.
 */

.agm-search[hidden] {
	display: none;
}

.agm-search {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	font-family: var( --agm-font );
	background: rgba( 255, 255, 255, var( --agm-glass-opacity ) );
	backdrop-filter: blur( var( --agm-blur ) );
	-webkit-backdrop-filter: blur( var( --agm-blur ) );
	transform: translateY( 12px );
	opacity: 0;
	transition: transform var( --agm-animation-speed ) cubic-bezier( .32, .72, 0, 1 ), opacity var( --agm-animation-speed ) ease;
	padding-top: var( --agm-safe-top );
	padding-bottom: var( --agm-safe-bottom );
}

.agm-search.is-open {
	transform: translateY( 0 );
	opacity: 1;
}

.agm-search__header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-bottom: 1px solid rgba( 0, 0, 0, .06 );
}

.agm-search__input-wrap {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba( 255, 255, 255, .6 );
	border: 1px solid rgba( 255, 255, 255, .7 );
	border-radius: var( --agm-radius );
	padding: 0 12px;
	height: var( --agm-tap-size );
	backdrop-filter: blur( 10px );
	-webkit-backdrop-filter: blur( 10px );
	color: rgba( 0, 0, 0, .85 );
}

.agm-search__input {
	flex: 1;
	border: none;
	background: none;
	outline: none;
	font-size: 16px;
	height: 100%;
	color: inherit;
}

.agm-search__input::placeholder {
	color: rgba( 0, 0, 0, .4 );
}

.agm-search__close {
	min-height: var( --agm-tap-size );
	padding: 0 8px;
	background: none;
	border: none;
	color: var( --agm-accent );
	font-weight: 600;
	font-size: 15px;
}

.agm-search__body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 20px 16px;
	-webkit-overflow-scrolling: touch;
}

.agm-search__section + .agm-search__section {
	margin-top: 28px;
}

.agm-search__section-title {
	font-size: 12.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: rgba( 0, 0, 0, .45 );
	margin: 0 0 12px;
}

.agm-search__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.agm-search__chip {
	min-height: var( --agm-tap-size );
	display: inline-flex;
	align-items: center;
	padding: 0 14px;
	border-radius: 999px;
	background: rgba( 255, 255, 255, .5 );
	border: none;
	font-size: 14px;
}

/*
 * Categories: a plain vertical list of names only — no images, no chips,
 * no pills, no coloured backgrounds.
 */
.agm-search__categories {
	list-style: none;
	margin: 0;
	padding: 0;
}

.agm-search__categories li + li {
	border-top: 1px solid rgba( 0, 0, 0, .06 );
}

.agm-search__category {
	display: block;
	width: 100%;
	text-align: left;
	background: none;
	border: none;
	padding: 13px 2px;
	font-size: 15.5px;
	font-weight: 500;
	color: rgba( 0, 0, 0, .85 );
	min-height: var( --agm-tap-size );
}

.agm-search__category.is-active {
	color: var( --agm-accent );
	font-weight: 600;
}

/*
 * Product discovery rows: image, title, price — nothing else. Rendered
 * server-side (see Rest::render_products_html()); this only lays them out.
 */
.agm-search__results-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.agm-search__result {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 2px;
	text-decoration: none;
	color: inherit;
}

.agm-search__result-image {
	width: 52px;
	height: 52px;
	border-radius: 12px;
	object-fit: cover;
	flex: 0 0 auto;
	background: rgba( 0, 0, 0, .05 );
}

.agm-search__result-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.agm-search__result-title {
	font-size: 14.5px;
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.agm-search__result-price {
	font-size: 13px;
	color: rgba( 0, 0, 0, .55 );
}

.agm-search__result-price del {
	font-weight: 400;
	opacity: .6;
	margin-right: 4px;
}

.agm-search__result-price ins {
	text-decoration: none;
}

/* Loading skeletons — same row shape as the real results. */
.agm-search__skeletons {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.agm-search__skeletons[hidden] {
	display: none;
}

.agm-search__skeleton-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.agm-search__skeleton-media,
.agm-search__skeleton-line {
	background: linear-gradient( 90deg, rgba( 0, 0, 0, .06 ) 25%, rgba( 0, 0, 0, .1 ) 37%, rgba( 0, 0, 0, .06 ) 63% );
	background-size: 400% 100%;
	animation: agm-skeleton-shimmer 1400ms ease infinite;
	border-radius: 8px;
}

.agm-search__skeleton-media {
	width: 52px;
	height: 52px;
	border-radius: 12px;
	flex: 0 0 auto;
}

.agm-search__skeleton-lines {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.agm-search__skeleton-line {
	height: 10px;
}

.agm-search__skeleton-line--title {
	width: 60%;
}

.agm-search__skeleton-line--price {
	width: 25%;
}

@keyframes agm-skeleton-shimmer {
	0% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0 50%;
	}
}

.agm-search__empty[hidden] {
	display: none;
}

.agm-search__empty {
	text-align: center;
	color: rgba( 0, 0, 0, .55 );
	margin-top: 56px;
	padding: 0 24px;
}

.agm-search__empty-icon {
	color: rgba( 0, 0, 0, .25 );
	margin-bottom: 12px;
}

.agm-search__empty-title {
	font-size: 16px;
	font-weight: 600;
	color: inherit;
	margin: 0 0 4px;
}

.agm-search__empty-text {
	font-size: 13px;
	margin: 0;
	opacity: .8;
}

.agm-search__show-all[hidden] {
	display: none;
}

.agm-search__show-all {
	display: block;
	width: 100%;
	margin-top: 24px;
	min-height: var( --agm-tap-size );
	border: none;
	border-radius: var( --agm-radius );
	background: var( --agm-accent );
	color: #fff;
	font-size: 14.5px;
	font-weight: 600;
}

@media ( prefers-color-scheme: dark ) {
	body:not( .agm-theme-light ) .agm-search {
		background: rgba( 20, 20, 22, var( --agm-glass-opacity ) );
		color: #fff;
	}

	body:not( .agm-theme-light ) .agm-search__header {
		border-bottom-color: rgba( 255, 255, 255, .1 );
	}

	body:not( .agm-theme-light ) .agm-search__input-wrap,
	body:not( .agm-theme-light ) .agm-search__chip {
		background: rgba( 255, 255, 255, .1 );
		border-color: rgba( 255, 255, 255, .15 );
		color: #fff;
	}

	body:not( .agm-theme-light ) .agm-search__categories li + li {
		border-top-color: rgba( 255, 255, 255, .1 );
	}

	body:not( .agm-theme-light ) .agm-search__category {
		color: rgba( 255, 255, 255, .9 );
	}

	body:not( .agm-theme-light ) .agm-search__result-price {
		color: rgba( 255, 255, 255, .6 );
	}
}

body.agm-theme-dark .agm-search {
	background: rgba( 20, 20, 22, var( --agm-glass-opacity ) );
	color: #fff;
}

body.agm-theme-dark .agm-search__header {
	border-bottom-color: rgba( 255, 255, 255, .1 );
}

body.agm-theme-dark .agm-search__input-wrap,
body.agm-theme-dark .agm-search__chip {
	background: rgba( 255, 255, 255, .1 );
	border-color: rgba( 255, 255, 255, .15 );
	color: #fff;
}

body.agm-theme-dark .agm-search__categories li + li {
	border-top-color: rgba( 255, 255, 255, .1 );
}

body.agm-theme-dark .agm-search__category {
	color: rgba( 255, 255, 255, .9 );
}

body.agm-theme-dark .agm-search__result-price {
	color: rgba( 255, 255, 255, .6 );
}

@media ( prefers-reduced-motion: reduce ) {
	body.agm-respect-reduced-motion .agm-search {
		transition: none !important;
	}

	body.agm-respect-reduced-motion .agm-search__skeleton-media,
	body.agm-respect-reduced-motion .agm-search__skeleton-line {
		animation: none;
	}
}
