/**
 * Carnova Toolkit — product search overlay.
 */

:root {
	--ews-accent: #ffd200;
	--ews-panel: #ffffff;
	--ews-text: #10151c;
	--ews-muted: #6b7280;
	--ews-line: rgba(16, 21, 28, .1);
	--ews-radius: 16px;
}

/* The overlay must beat sticky headers, Elementor popups and the admin bar. */
.ews-overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: none;
	padding: 0;
	background: rgba(8, 11, 16, .72);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.ews-overlay.is-open {
	display: block;
	animation: ews-fade .18s ease-out;
}

@keyframes ews-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* Lock the page behind the overlay. */
html.ews-lock,
body.ews-lock {
	overflow: hidden !important;
}

/* Belt and braces: keep theme search UI out of sight while we are open. */
body.ews-lock .search-popup,
body.ews-lock .header-search-form,
body.ews-lock .site-search,
body.ews-lock .searchform {
	visibility: hidden !important;
}

.ews-panel {
	box-sizing: border-box;
	width: 100%;
	max-width: 1120px;
	margin: 0 auto;
	padding: 0 20px 64px;
}

/* ---------------------------------------------------------------- Search bar */

.ews-bar {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 10px;
	box-sizing: border-box;
	margin: 24px 0 20px;
	padding: 14px 16px;
	border-radius: var(--ews-radius);
	background: var(--ews-panel);
	box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
}

.ews-bar__icon {
	flex: 0 0 auto;
	color: var(--ews-muted);
}

.ews-bar__input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 6px 4px;
	border: 0;
	background: none;
	box-shadow: none;
	color: var(--ews-text);
	font-size: 20px;
	line-height: 1.4;
	font-weight: 500;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.ews-bar__input::placeholder {
	color: var(--ews-muted);
	opacity: 1;
}

.ews-bar__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(16, 21, 28, .06);
	color: var(--ews-text);
	cursor: pointer;
	transition: background .15s ease;
}

.ews-bar__close:hover {
	background: rgba(16, 21, 28, .14);
}

/* ------------------------------------------------------------------- Results */

.ews-body {
	color: #fff;
}

.ews-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 16px;
	margin: 0 0 14px;
	padding: 0 2px;
}

.ews-head__title {
	margin: 0;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .01em;
}

.ews-head__count {
	margin-left: 10px;
	color: rgba(255, 255, 255, .6);
	font-weight: 400;
}

.ews-head__all {
	color: var(--ews-accent);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.ews-head__all:hover {
	border-bottom-color: currentColor;
}

.ews-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 14px;
}

.ews-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 14px;
	background: var(--ews-panel);
	color: var(--ews-text);
	text-decoration: none;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	transition: transform .16s ease, box-shadow .16s ease;
}

.ews-card:hover,
.ews-card:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 16px 34px rgba(0, 0, 0, .3);
	outline: none;
}

.ews-card:focus-visible {
	box-shadow: 0 0 0 3px var(--ews-accent), 0 16px 34px rgba(0, 0, 0, .3);
}

.ews-card__media {
	position: relative;
	aspect-ratio: 1 / 1;
	background: #f4f5f7;
}

.ews-card__media img {
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	display: block;
}

/* Belt and braces: no discount markup should reach the card, but if a theme
   or plugin filters its own back into the price HTML, keep it out of sight. */
.ews-card__price del,
.ews-card__price .ews-card__badge,
.ews-card__media .ews-card__badge,
.ews-card .onsale {
	display: none !important;
}

.ews-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 6px;
	padding: 12px 14px 14px;
}

.ews-card__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	color: var(--ews-text);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
}

.ews-card__price {
	margin-top: auto;
	color: var(--ews-text);
	font-size: 14px;
	font-weight: 700;
}

.ews-card__price del {
	margin-right: 6px;
	color: var(--ews-muted);
	font-weight: 400;
}

.ews-card__price ins {
	text-decoration: none;
}

/* ------------------------------------------------------------------- Pages */

.ews-pages {
	margin-top: 28px;
}

.ews-head--sub {
	margin-bottom: 10px;
}

.ews-head--sub .ews-head__title {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .55);
}

.ews-pagelist {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ews-page {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border-radius: 12px;
	background: rgba(255, 255, 255, .06);
	color: #fff;
	text-decoration: none;
	transition: background .16s ease, transform .16s ease;
}

.ews-page:hover,
.ews-page:focus-visible {
	background: rgba(255, 255, 255, .12);
	transform: translateY(-1px);
}

.ews-page:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px var(--ews-accent);
}

.ews-page__icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 9px;
	background: rgba(255, 255, 255, .1);
	color: rgba(255, 255, 255, .8);
}

.ews-page__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.ews-page__title {
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

.ews-page__text {
	overflow: hidden;
	color: rgba(255, 255, 255, .6);
	font-size: 13px;
	line-height: 1.4;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.ews-page__arrow {
	display: inline-flex;
	flex: 0 0 auto;
	color: rgba(255, 255, 255, .45);
}

/* --------------------------------------------------------------- Empty state */

.ews-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 48px 20px;
	color: rgba(255, 255, 255, .82);
	text-align: center;
	font-size: 15px;
}

.ews-state__title {
	margin: 0;
	color: #fff;
	font-size: 18px;
	font-weight: 600;
}

.ews-state__text {
	margin: 0;
	color: rgba(255, 255, 255, .66);
	font-size: 14px;
}

/* The dead-end helper: the only thing on screen when nothing matched, so it
   is allowed to be the loudest element in the overlay. */

.ews-cta {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: 460px;
	margin-top: 26px;
	padding: 26px 24px;
	border: 1px solid rgba(255, 255, 255, .12);
	border-radius: 16px;
	background: rgba(255, 255, 255, .06);
}

.ews-cta__title {
	margin: 0;
	color: #fff;
	font-size: 17px;
	font-weight: 700;
}

.ews-cta__text {
	margin: 0;
	color: rgba(255, 255, 255, .7);
	font-size: 14px;
	line-height: 1.5;
}

.ews-cta__btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 6px;
	padding: 11px 22px;
	border-radius: 999px;
	background: var(--ews-accent);
	color: #10151c;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	transition: filter .16s ease, transform .16s ease;
}

.ews-cta__btn:hover {
	filter: brightness(.94);
	transform: translateY(-1px);
}

.ews-cta__btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px #fff;
}

.ews-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	margin-right: 10px;
	border: 2px solid rgba(255, 255, 255, .3);
	border-top-color: #fff;
	border-radius: 50%;
	vertical-align: -4px;
	animation: ews-spin .7s linear infinite;
}

@keyframes ews-spin {
	to { transform: rotate(360deg); }
}

.ews-results:not(.is-visible) {
	display: none;
}

/* ------------------------------------------------------------------ Trigger */

.ews-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--ews-accent);
	color: #10151c;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.ews-trigger:hover {
	filter: brightness(.95);
}

/* -------------------------------------------------------------- Small screens */

@media (max-width: 782px) {
	.ews-panel {
		padding: 0 14px 48px;
	}

	.ews-bar {
		margin: 14px 0 16px;
		padding: 10px 12px;
	}

	.ews-bar__input {
		font-size: 17px;
	}

	.ews-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ews-overlay.is-open,
	.ews-card,
	.ews-spinner {
		animation: none;
		transition: none;
	}
}
