/* Form generado por el shortcode [sharwinn_search].
   -----------------------------------------------------------------
   Patrón moderno usado por headers como el de Falabella: el buscador
   vive dentro de una fila flex (logo | categorías | BUSCADOR | cuenta),
   y es el único elemento con flex-grow para absorber el espacio
   sobrante.

   En el Theme Header Builder de Kadence, cada item del header queda
   envuelto en <div class="site-header-item"> (display:flex, SIN
   flex-grow) y, cuando el item es de tipo HTML, el contenido va además
   dentro de <div class="header-html-inner">. Como ninguno de los dos
   trae flex-grow por defecto, se encogen a su contenido mínimo — por
   eso el buscador se veía como una línea aunque por dentro ya estaba
   al 100%.

   :has() (CSS moderno, soportado en todos los navegadores actuales)
   nos permite "subir" desde el formulario hasta esos contenedores de
   Kadence y forzarlos a crecer, sin tocar el Header Builder a mano.
   Se incluyen además los equivalentes de Elementor como respaldo
   inofensivo, por si este shortcode se usa en otro maquetador. */
.site-header-item:has(.sharwinn-search-form),
.header-html-inner:has(.sharwinn-search-form),
.elementor-widget-html:has(.sharwinn-search-form),
.elementor-column:has(.sharwinn-search-form),
.elementor-widget-container:has(.sharwinn-search-form) {
	flex: 1 1 auto !important;
	width: auto !important;
	max-width: none !important;
	min-width: 0 !important;
	margin-right: 0 !important;
	display: flex !important;
}

.sharwinn-search-form {
	display: flex;
	width: 100%;
	max-width: 100%;
	margin: 0;
	flex: 1 1 280px;
	min-width: 160px;
}

.sw-search-wrapper {
	position: relative;
	width: 100%;
	flex: 1 1 auto;
	min-width: 0;
	--sw-btn-bg: #1d1d1f;
	--sw-btn-text: #ffffff;
	--sw-btn-border: #1d1d1f;
	--sw-bar-height: 44px;
	--sw-bar-radius: 999px;
}

/* La "píldora" completa: input + botón fundidos en una sola forma,
   estilo Falabella. overflow:hidden recorta las esquinas del botón
   para que calcen con el borde redondeado del conjunto. */
.sw-search-bar {
	position: relative;
	display: flex;
	align-items: stretch;
	height: var(--sw-bar-height);
	background: #fff;
	border: 1px solid #d9d9d9;
	border-radius: var(--sw-bar-radius);
	overflow: hidden;
}

.sw-search-input,
.sharwinn-search-form .search-field {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	border: none;
	outline: none;
	background: transparent;
	padding: 0 18px;
	font-size: 14px;
	line-height: 1;
	color: #1d1d1f;
}

.sw-submit-btn,
.sw-close-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: var(--sw-bar-height);
	height: 100%;
	padding: 0;
	margin: 0;
	border: none;
	cursor: pointer;
	border-radius: 0;
	transition: opacity 0.15s ease, background 0.15s ease;
}

.sw-submit-btn {
	background: var(--sw-btn-bg);
	color: var(--sw-btn-text);
}

.sw-submit-btn:hover {
	opacity: 0.88;
}

.sw-close-btn {
	display: none;
	background: transparent;
	color: #555;
	width: 38px;
}

/* Overlay móvil: la barra de búsqueda ocupa toda la pantalla al enfocarse.
   El breakpoint lo decide JS (cfg.mobileBreakpoint), por eso la clase
   .sw-overlay-open no depende de un @media fijo aquí. */
.sw-search-wrapper.sw-overlay-open {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100000;
	max-width: none !important;
	background: #fff;
	padding: 12px 12px 0;
	display: flex;
	flex-direction: column;
}

.sw-search-wrapper.sw-overlay-open .sw-search-bar {
	flex-shrink: 0;
}

.sw-search-wrapper.sw-overlay-open .sw-close-btn {
	display: flex;
}

.sw-search-wrapper.sw-overlay-open .sw-search-dropdown {
	position: static;
	flex: 1;
	margin-top: 10px;
	max-height: none;
	border: none;
	box-shadow: none;
	border-radius: 0;
	animation: none;
}

body.sw-overlay-active-body {
	overflow: hidden;
}

.sw-search-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
	max-height: 480px;
	overflow-y: auto;
	z-index: 9999;
	animation: sw-fade-in 0.12s ease-out;
}

@keyframes sw-fade-in {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.sw-section-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #999;
	padding: 10px 14px 6px;
	background: #fafafa;
}

.sw-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 14px;
	text-decoration: none;
	color: inherit;
	border-bottom: 1px solid #f4f4f4;
	transition: background 0.1s ease;
}

.sw-row:last-child {
	border-bottom: none;
}

.sw-row:hover,
.sw-row.is-active {
	background: #f6f6f7;
}

.sw-row-term .sw-icon {
	color: #999;
	flex-shrink: 0;
	display: flex;
}

.sw-row-term span:nth-child(2) {
	font-size: 13px;
	flex: 1;
}

.sw-count {
	font-size: 12px;
	color: #999;
}

.sw-row-product img,
.sw-noimg {
	width: 44px;
	height: 44px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
	background: #f0f0f0;
}

.sw-noimg {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #bbb;
}

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

.sw-name {
	font-size: 13px;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sw-name mark {
	background: none;
	color: inherit;
	font-weight: 700;
	padding: 0;
}

.sw-meta {
	font-size: 11px;
	color: #999;
}

.sw-desc {
	font-size: 12px;
	color: #777;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sw-price {
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	flex-shrink: 0;
}

.sw-row-more {
	justify-content: center;
	font-size: 13px;
	font-weight: 500;
	color: #2271b1;
	padding: 11px 14px;
}

.sw-empty {
	padding: 18px 14px;
	font-size: 13px;
	color: #888;
	text-align: center;
}

.sw-loading {
	display: flex;
	justify-content: center;
	padding: 20px;
}

.sw-spinner {
	width: 18px;
	height: 18px;
	border: 2px solid #e5e5e5;
	border-top-color: #999;
	border-radius: 50%;
	animation: sw-spin 0.6s linear infinite;
}

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

@media (max-width: 480px) {
	.sw-search-dropdown {
		max-height: 70vh;
	}
}
