/**
 * EZWP Search — modes, icon overlay, suggestions dropdown.
 */

/* En modo icono el widget Elementor no debe estirarse a todo el ancho de columna */
.elementor-widget-ezwp_search:has(.ezwp-search--icon) {
	width: auto;
	max-width: max-content;
}

.ezwp-search {
	--ezwp-search-bg: #fff;
	--ezwp-search-border: #d4d4d4;
	--ezwp-search-text: #1a1a1a;
	--ezwp-search-muted: #6b6b6b;
	--ezwp-search-accent: #2c2c2c;
	--ezwp-search-radius: 4px;
	--ezwp-search-z: 10050;

	position: relative;
	display: block;
	width: 100%;
	max-width: 28rem;
	color: var(--ezwp-search-text);
	font-size: 0.9375rem;
	line-height: 1.4;
	box-sizing: border-box;
}

.ezwp-search *,
.ezwp-search *::before,
.ezwp-search *::after {
	box-sizing: border-box;
}

.ezwp-search__panel {
	position: relative;
	width: 100%;
}

.ezwp-search__form {
	display: flex;
	align-items: stretch;
	gap: 0.5rem;
	width: 100%;
}

.ezwp-search__input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0.625rem 0.75rem;
	border: 1px solid var(--ezwp-search-border);
	border-radius: var(--ezwp-search-radius);
	background: var(--ezwp-search-bg);
	color: inherit;
	font: inherit;
}

.ezwp-search__input:focus,
.ezwp-search__input:focus-visible {
	outline: none;
	box-shadow: none;
}

.ezwp-search__submit {
	flex: 0 0 auto;
	margin: 0;
	padding: 0.625rem 1rem;
	border: 1px solid var(--ezwp-search-accent);
	border-radius: var(--ezwp-search-radius);
	background: var(--ezwp-search-accent);
	color: #fff;
	font: inherit;
	cursor: pointer;
	transition: filter 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.ezwp-search__submit:hover {
	filter: brightness(1.08);
}

.ezwp-search__close {
	display: none;
}

/* Mode: input only */
.ezwp-search--input_only .ezwp-search__submit {
	display: none;
}

/* -------------------------------------------------------------------------
   Mode: solo icono — el wrapper mide solo el botón; el input flota encima.
   ------------------------------------------------------------------------- */
.ezwp-search--icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	max-width: none;
	vertical-align: middle;
}

.ezwp-search--icon .ezwp-search__toggle {
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 1px solid var(--ezwp-search-border);
	border-radius: var(--ezwp-search-radius);
	background: var(--ezwp-search-bg);
	color: inherit;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.ezwp-search--icon .ezwp-search__toggle:hover {
	border-color: var(--ezwp-search-accent);
}

.ezwp-search--icon .ezwp-search__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	font-size: 1.125rem;
	color: inherit;
}

.ezwp-search__svg {
	display: block;
	width: 1em;
	height: 1em;
	flex-shrink: 0;
}

/* Panel overlay: fuera del flujo; no ensancha el widget */
.ezwp-search--icon .ezwp-search__panel {
	position: absolute;
	top: 50%;
	width: 280px;
	max-width: min(280px, calc(100vw - 1.5rem));
	margin: 0;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(-50%) scale(0.96);
	transform-origin: center right;
	transition:
		opacity 0.18s ease,
		transform 0.18s ease,
		visibility 0.18s ease;
	z-index: calc(var(--ezwp-search-z) + 1);
}

.ezwp-search--icon.ezwp-search--expand-left .ezwp-search__panel {
	right: 0;
	left: auto;
	transform-origin: center right;
}

.ezwp-search--icon.ezwp-search--expand-right .ezwp-search__panel {
	left: 0;
	right: auto;
	transform-origin: center left;
}

.ezwp-search--icon.is-open .ezwp-search__panel {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(-50%) scale(1);
}

/* El botón sigue ocupando el espacio; el overlay lo cubre */
.ezwp-search--icon.is-open .ezwp-search__toggle {
	opacity: 0;
	pointer-events: none;
}

.ezwp-search--icon .ezwp-search__form {
	align-items: center;
	gap: 0.35rem;
	padding: 0.2rem;
	border: 1px solid var(--ezwp-search-border);
	border-radius: var(--ezwp-search-radius);
	background: var(--ezwp-search-bg);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.ezwp-search--icon .ezwp-search__input {
	border: 0;
	box-shadow: none;
	outline-offset: 0;
}


.ezwp-search--icon .ezwp-search__close {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--ezwp-search-radius);
	background: transparent;
	color: var(--ezwp-search-muted);
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
}

.ezwp-search--icon .ezwp-search__close:hover {
	color: var(--ezwp-search-text);
	background: #f0f0f0;
}

.ezwp-search--icon .ezwp-search__results {
	top: calc(100% + 0.35rem);
	left: 0;
	right: 0;
	width: 100%;
	min-width: 100%;
}

/* Results dropdown */
.ezwp-search__results {
	position: absolute;
	top: calc(100% + 0.35rem);
	left: 0;
	right: 0;
	z-index: var(--ezwp-search-z);
	max-height: 20rem;
	overflow-y: auto;
	margin: 0;
	padding: 0.35rem 0;
	border: 1px solid var(--ezwp-search-border);
	border-radius: var(--ezwp-search-radius);
	background: var(--ezwp-search-bg);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ezwp-search__status {
	padding: 0.75rem 1rem;
	color: var(--ezwp-search-muted);
	font-size: 0.875rem;
}

.ezwp-search__item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 0.75rem;
	color: inherit;
	text-decoration: none;
}

.ezwp-search__item:hover,
.ezwp-search__item:focus {
	background: #f4f4f4;
	outline: none;
}

.ezwp-search__thumb {
	flex: 0 0 48px;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 2px;
	background: #eee;
}

.ezwp-search__thumb--empty {
	display: block;
}

.ezwp-search__meta {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}

.ezwp-search__title {
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ezwp-search__price {
	color: var(--ezwp-search-muted);
	font-size: 0.875rem;
}

.ezwp-search__price del {
	opacity: 0.7;
	margin-right: 0.35em;
}

.ezwp-search .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 480px) {
	.ezwp-search:not(.ezwp-search--icon) {
		max-width: 100%;
	}

	.ezwp-search--icon .ezwp-search__panel {
		max-width: calc(100vw - 1.5rem);
	}

	.ezwp-search__submit {
		padding-inline: 0.75rem;
	}
}
