/* Omnia Search · estilos
   Todo hereda la tipografía de la web (font: inherit) y los colores
   se controlan con las variables CSS inyectadas por el shortcode. */

.omnia-search {
	display: inline-flex;
	font-family: inherit;
}

.omnia-search * {
	box-sizing: border-box;
}

/* --- Botón / lupa --- */
.omnia-search__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	margin: 0;
	border: 0;
	background: transparent;
	color: var(--omnia-icon-color, currentColor);
	cursor: pointer;
	line-height: 0;
	border-radius: 50%;
	transition: opacity .2s ease, transform .2s ease;
}

.omnia-search__toggle:hover {
	opacity: .7;
}

.omnia-search__toggle:active {
	transform: scale(.92);
}

.omnia-search__toggle:focus-visible {
	outline: 2px solid var(--omnia-accent, #111);
	outline-offset: 3px;
}

.omnia-search__svg {
	width: var(--omnia-icon-size, 24px);
	height: var(--omnia-icon-size, 24px);
	display: block;
}

/* --- Overlay --- */
.omnia-search__overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: var(--omnia-overlay-top, 12%) 16px 16px;
	background: var(--omnia-overlay-bg, rgba(0,0,0,.55));
	backdrop-filter: blur(2px);
	opacity: 0;
	transition: opacity .22s ease;
	font-family: inherit;
}

.omnia-search__overlay[hidden] {
	display: none;
}

.omnia-search__overlay.is-open {
	opacity: 1;
}

/* --- Panel --- */
.omnia-search__panel {
	width: 100%;
	max-width: 620px;
	background: var(--omnia-panel-bg, #fff);
	color: var(--omnia-text-color, inherit);
	border-radius: var(--omnia-radius, 12px);
	box-shadow: 0 24px 60px rgba(0,0,0,.25);
	overflow: hidden;
	transform: translateY(-12px);
	transition: transform .22s ease;
}

.omnia-search__overlay.is-open .omnia-search__panel {
	transform: translateY(0);
}

/* --- Input --- */
.omnia-search__inputwrap {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 18px;
	border-bottom: 1px solid rgba(0,0,0,.08);
	color: var(--omnia-accent, #111);
}

.omnia-search__inputwrap .omnia-search__svg {
	flex: 0 0 auto;
	opacity: .6;
}

.omnia-search__input {
	flex: 1 1 auto;
	border: 0;
	outline: 0;
	background: transparent;
	font-family: inherit;
	font-size: 1.1rem;
	color: var(--omnia-text-color, inherit);
	padding: 4px 0;
}

.omnia-search__input::placeholder {
	color: currentColor;
	opacity: .45;
}

.omnia-search__close {
	flex: 0 0 auto;
	border: 0;
	background: transparent;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	color: inherit;
	opacity: .5;
	padding: 0 4px;
	transition: opacity .2s ease;
}

.omnia-search__close:hover {
	opacity: 1;
}

/* --- Resultados --- */
.omnia-search__results {
	max-height: 58vh;
	overflow-y: auto;
	font-family: inherit;
}

.omnia-search__results::-webkit-scrollbar {
	width: 8px;
}

.omnia-search__results::-webkit-scrollbar-thumb {
	background: var(--omnia-accent, #111);
	border-radius: 8px;
	opacity: .4;
}

.omnia-search__item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 18px;
	text-decoration: none;
	color: inherit;
	border-bottom: 1px solid rgba(0,0,0,.05);
	transition: background .15s ease;
}

.omnia-search__item:last-child {
	border-bottom: 0;
}

.omnia-search__item:hover,
.omnia-search__item.is-active {
	background: rgba(0,0,0,.04);
}

.omnia-search__thumb {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 8px;
	background: rgba(0,0,0,.05);
}

.omnia-search__meta {
	flex: 1 1 auto;
	min-width: 0;
}

.omnia-search__title {
	font-weight: 600;
	font-size: .95rem;
	margin: 0 0 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.omnia-search__title mark {
	background: transparent;
	color: var(--omnia-accent, #111);
	font-weight: 700;
}

.omnia-search__price {
	font-size: .85rem;
	opacity: .8;
}

.omnia-search__price del {
	opacity: .5;
	margin-right: 6px;
}

.omnia-search__state {
	padding: 28px 18px;
	text-align: center;
	font-size: .95rem;
	opacity: .65;
}

@media (max-width: 600px) {
	.omnia-search__overlay {
		padding: var(--omnia-overlay-top-mobile, 30%) 10px 10px;
		align-items: flex-start;
	}
	.omnia-search__input {
		font-size: 1rem;
	}
}

/* ============================================================
   Modos inline y barra siempre visible
   ============================================================ */

/* Panel inline: se despliega bajo/junto a la lupa, sin overlay. */
.omnia-search--inline {
	position: relative;
}

.omnia-search__inline-panel {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 9999;
	width: var(--omnia-inline-width, 320px);
	max-width: 90vw;
	background: var(--omnia-panel-bg, #fff);
	color: var(--omnia-text-color, inherit);
	border-radius: var(--omnia-radius, 12px);
	box-shadow: 0 16px 40px rgba(0,0,0,.18);
	overflow: hidden;
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity .2s ease, transform .2s ease;
}

.omnia-search__inline-panel[hidden] { display: none; }

.omnia-search__inline-panel.is-open {
	opacity: 1;
	transform: translateY(0);
}

/* Barra siempre visible. */
.omnia-search--bar {
	display: block;
	width: var(--omnia-inline-width, 320px);
	max-width: 100%;
	position: relative;
	font-family: inherit;
}

.omnia-search__bar {
	position: relative;
}

.omnia-search--bar .omnia-search__inputwrap {
	border: 1px solid rgba(0,0,0,.15);
	border-radius: var(--omnia-radius, 12px);
	background: var(--omnia-panel-bg, #fff);
}

.omnia-search--bar .omnia-search__close { display: none; }

.omnia-search--bar .omnia-search__results {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 9999;
	background: var(--omnia-panel-bg, #fff);
	border-radius: var(--omnia-radius, 12px);
	box-shadow: 0 16px 40px rgba(0,0,0,.18);
	max-height: 60vh;
}

.omnia-search--bar .omnia-search__results:empty { display: none; }

/* Campos extra en resultados. */
.omnia-search__sku {
	display: block;
	font-size: .78rem;
	opacity: .55;
	margin-top: 1px;
}

.omnia-search__foot {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 3px;
}

.omnia-search__stock {
	font-size: .75rem;
	font-weight: 600;
	padding: 1px 7px;
	border-radius: 999px;
}

.omnia-search__stock.is-in {
	color: #0a7d36;
	background: rgba(10,125,54,.12);
}

.omnia-search__stock.is-out {
	color: #b42318;
	background: rgba(180,35,24,.12);
}

@media (max-width: 600px) {
	/* En móvil, el panel inline pasa a comportarse como barra ancha. */
	.omnia-search__inline-panel {
		position: fixed;
		left: 10px;
		right: 10px;
		top: var(--omnia-overlay-top-mobile, 30%);
		width: auto;
		max-width: none;
	}
}

/* ============================================================
   v2: botón limpiar, skeleton, estados, contexto, rating
   ============================================================ */

/* Botón limpiar (texto "Limpiar" dentro del input). */
.omnia-search__clear {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: transparent;
	color: var(--omnia-accent, #111);
	font-family: inherit;
	font-size: .82rem;
	opacity: .7;
	cursor: pointer;
	padding: 2px 6px;
	border-radius: 6px;
	transition: opacity .15s ease;
}
.omnia-search__clear:hover { opacity: 1; text-decoration: underline; }
.omnia-search__clear[hidden] { display: none; }

/* Oculta la X nativa que algunos navegadores añaden a type="search". */
.omnia-search__input::-webkit-search-cancel-button,
.omnia-search__input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
}
.omnia-search__input::-ms-clear { display: none; width: 0; height: 0; }

/* Estados. */
.omnia-search__state {
	padding: 26px 18px;
	text-align: center;
	font-size: .95rem;
	opacity: .7;
}
.omnia-search__state.is-error {
	color: #b42318;
	opacity: 1;
}

/* Skeleton loader. */
.omnia-search__skeleton { padding: 6px 0; }
.omnia-search__skel-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 18px;
}
.omnia-search__skel-thumb {
	width: 48px; height: 48px;
	border-radius: 8px;
	flex: 0 0 auto;
}
.omnia-search__skel-lines { flex: 1 1 auto; }
.omnia-search__skel-lines span {
	display: block;
	height: 10px;
	border-radius: 6px;
	margin-bottom: 8px;
}
.omnia-search__skel-lines span:first-child { width: 70%; }
.omnia-search__skel-lines span:last-child { width: 40%; margin-bottom: 0; }
.omnia-search__skel-thumb,
.omnia-search__skel-lines span {
	background: linear-gradient( 90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.12) 37%, rgba(0,0,0,.06) 63% );
	background-size: 400% 100%;
	animation: omnia-shimmer 1.2s ease-in-out infinite;
}
@keyframes omnia-shimmer {
	0% { background-position: 100% 0; }
	100% { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
	.omnia-search__skel-thumb,
	.omnia-search__skel-lines span { animation: none; }
}

/* Contexto inicial: grupos y chips. */
.omnia-search__group { padding: 10px 14px 6px; }
.omnia-search__group-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	opacity: .55;
	padding: 10px 18px 6px;
}
.omnia-search__count { font-weight: 600; opacity: .8; }
.omnia-search__recent-clear {
	border: 0; background: transparent;
	font-size: .7rem; text-transform: none; letter-spacing: 0;
	cursor: pointer; color: var(--omnia-accent, #111);
	opacity: .8; padding: 0;
}
.omnia-search__recent-clear:hover { opacity: 1; text-decoration: underline; }

.omnia-search__chip {
	display: inline-block;
	margin: 4px 6px 0 14px;
	padding: 5px 12px;
	border: 1px solid rgba(0,0,0,.12);
	border-radius: 999px;
	background: transparent;
	font-family: inherit;
	font-size: .85rem;
	color: inherit;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}
.omnia-search__chip + .omnia-search__chip { margin-left: 0; }
.omnia-search__chip:hover {
	border-color: var(--omnia-accent, #111);
	background: rgba(0,0,0,.03);
}

/* Rating con estrellas. */
.omnia-search__rating { display: inline-flex; gap: 1px; margin-right: 8px; }
.omnia-search__star { color: rgba(0,0,0,.2); font-size: .8rem; line-height: 1; }
.omnia-search__star.is-on { color: #f5a623; }

/* Sección de categorías coincidentes. */
.omnia-search__cat {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 18px;
	text-decoration: none;
	color: inherit;
	border-bottom: 1px solid rgba(0,0,0,.05);
	transition: background .15s ease;
}
.omnia-search__cat:hover { background: rgba(0,0,0,.04); }
.omnia-search__cat-name { font-size: .92rem; font-weight: 600; }
.omnia-search__cat-count {
	font-size: .78rem;
	opacity: .6;
	background: rgba(0,0,0,.06);
	padding: 1px 8px;
	border-radius: 999px;
}
