/* =========================================================
   Nelb Search — frontend  (v1.3.2)
   Restyle minimal: righe compatte, prezzo su una riga,
   clear discreto, hairline tra i prodotti.
   Conforme brandbook v1.5: card 14px, bordo #EDEDED, campo
   #E0E0E0, testo #212121, secondario #4A4A4A / #8C8C8C.
   Dual-brand: --ns-accent arancio (vendita) o blu (Nolopoint).
   ========================================================= */

.nelb-search {
	--ns-accent: #FE3F12;
	--ns-accent-h: #E5380F;
	--ns-accent-soft: #FFF3EF;
	position: relative;
	width: 100%;
	max-width: none; /* v1.2.1: si adatta allo spazio del contenitore */
	font-family: 'Gudea', sans-serif;
}
.nelb-search--nolo {
	--ns-accent: #0284C7;
	--ns-accent-h: #0C4A6E;
	--ns-accent-soft: #E0F2FE;
}

/* ── Campo ─────────────────────────────────────────────── */
.nelb-search__box {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #fff;
	border: 1.5px solid #E0E0E0;
	border-radius: 10px;
	padding: 0 12px;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.nelb-search__box:focus-within {
	border-color: var(--ns-accent);
	box-shadow: 0 0 0 3px var(--ns-accent-soft);
}
.nelb-search__icon {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
	color: #8C8C8C;
}
.nelb-search__box:focus-within .nelb-search__icon {
	color: var(--ns-accent);
}
.nelb-search__input {
	flex: 1;
	border: 0 !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
	padding: 12px 0 !important;
	font-family: 'Gudea', sans-serif !important;
	font-size: 15px !important;
	color: #212121 !important;
}
.nelb-search__input::-webkit-search-cancel-button { display: none; }
.nelb-search__clear {
	flex: 0 0 auto;
	border: 0;
	background: transparent;
	color: #8C8C8C;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	line-height: 1;
	font-size: 17px;
	cursor: pointer;
	padding: 0;
	transition: color .15s ease, background .15s ease;
}
.nelb-search__clear:hover { background: #F5F7F7; color: #212121; }

/* ── Dropdown ──────────────────────────────────────────── */
.nelb-search__panel {
	position: absolute;
	z-index: 999;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #EDEDED;
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(20, 20, 20, .10);
	overflow: hidden;
	max-height: 70vh;
	overflow-y: auto;
	padding: 6px;
}

.nelb-search__section {
	font-family: 'Libre Franklin', sans-serif;
	font-weight: 800;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: #8C8C8C;
	padding: 10px 12px 4px;
}

/* Correzione */
.nelb-search__correction {
	font-size: 13px;
	color: #4A4A4A;
	background: #FFF8E6;
	border-radius: 10px;
	padding: 8px 12px;
	margin: 4px 4px 2px;
}
.nelb-search__corr-btn {
	border: 0;
	background: none;
	color: var(--ns-accent);
	font-weight: 700;
	font-family: inherit;
	font-size: 13px;
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
}

/* Termini suggeriti */
.nelb-search__term {
	display: block;
	width: 100%;
	text-align: left;
	border: 0;
	background: none;
	font-family: 'Gudea', sans-serif;
	font-size: 14px;
	color: #212121;
	padding: 8px 12px;
	border-radius: 8px;
	cursor: pointer;
}
.nelb-search__term:hover,
.nelb-search__term.is-active { background: var(--ns-accent-soft); }

/* Prodotti */
.nelb-search__product {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 7px 12px;
	border-radius: 10px;
	text-decoration: none !important;
}
.nelb-search__product + .nelb-search__product {
	border-top: 1px solid #F5F7F7;
	border-radius: 0 0 10px 10px;
}
.nelb-search__product:hover,
.nelb-search__product.is-active { background: #F5F7F7; }
.nelb-search__thumb {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	border: 1px solid #EDEDED;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}
.nelb-search__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}
.nelb-search__noimg {
	width: 100%;
	height: 100%;
	background: #F5F7F7;
	display: block;
}
.nelb-search__meta {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}
.nelb-search__title {
	font-size: 14px;
	font-weight: 700;
	color: #212121;
	line-height: 1.35;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.nelb-search__sub {
	font-size: 12px;
	color: #8C8C8C;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.nelb-search__right {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
}
.nelb-search__price {
	font-size: 13.5px;
	font-weight: 700;
	color: #212121;
	white-space: nowrap;
}
.nelb-search__oos {
	font-size: 11px;
	color: #DC2626;
	background: #FDECEA;
	border-radius: 6px;
	padding: 1px 6px;
}

/* Categorie */
.nelb-search__cat {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 14px;
	color: #212121;
	text-decoration: none !important;
}
.nelb-search__cat:hover,
.nelb-search__cat.is-active { background: var(--ns-accent-soft); }
.nelb-search__count {
	font-size: 11px;
	color: #4A4A4A;
	background: #EDEDED;
	border-radius: 999px;
	padding: 1px 8px;
}

/* Footer / vuoto */
.nelb-search__all {
	display: block;
	text-align: center;
	font-weight: 700;
	font-size: 13.5px;
	color: #fff !important;
	background: var(--ns-accent);
	border-radius: 10px;
	padding: 10px 12px;
	margin: 6px 4px 4px;
	text-decoration: none !important;
	transition: background .15s ease;
}
.nelb-search__all:hover,
.nelb-search__all.is-active { background: var(--ns-accent-h); }

.nelb-search__empty {
	font-size: 13.5px;
	color: #8C8C8C;
	text-align: center;
	padding: 18px 12px;
}

/* ── Modalità compact: lente → campo con animazione ────────
   Motion (brandbook §Motion, rev. durate 14/07):
   - espansione: 350ms cubic-bezier(.22,1,.36,1)  [ease-out deciso]
   - dissolvenza contenuti: 200ms ease
   - rispetto di prefers-reduced-motion
   ─────────────────────────────────────────────────────────── */
.nelb-search--compact {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}
.nelb-search__toggle {
	/* v1.2.1: !important mirati per vincere sugli stili globali
	   dei bottoni del tema/Elementor (lente invisibile, hover fucsia) */
	flex: 0 0 auto;
	width: 42px !important;
	height: 42px !important;
	min-width: 42px;
	border: 0 !important;
	border-radius: 50% !important;
	background: #fff !important;
	background-image: none !important;
	color: #212121 !important;
	fill: none !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
	margin: 0;
	line-height: 1;
	box-shadow: 0 1px 4px rgba(20, 20, 20, .12) !important;
	-webkit-appearance: none;
	appearance: none;
	transition: transform 200ms ease, box-shadow 200ms ease;
}
.nelb-search__toggle svg {
	width: 20px;
	height: 20px;
	display: block;
}
.nelb-search__toggle svg circle,
.nelb-search__toggle svg path {
	stroke: #212121 !important; /* la lente resta scura sempre */
	fill: none !important;
}
.nelb-search__toggle:hover,
.nelb-search__toggle:focus {
	background: #fff !important;
	color: #212121 !important;
	transform: scale(1.06);
	box-shadow: 0 2px 8px rgba(20, 20, 20, .18) !important;
	outline: none;
}
.nelb-search__toggle:active {
	background: #fff !important;
	transform: scale(.96);
}

/* v1.3.2: il campo aperto è un OVERLAY ancorato a destra — si prende
   700px reali (o quasi tutto il viewport) anche se la colonna del
   builder è stretta. La lente sparisce quando il campo è aperto. */
.nelb-search--compact {
	position: relative;
	min-width: 42px;
	min-height: 42px;
}
.nelb-search--compact .nelb-search__box {
	position: absolute;
	top: 0;
	right: 0;
	width: min(700px, calc(100vw - 32px));
	max-width: none;
	opacity: 1;
	z-index: 998;
	box-shadow: 0 4px 16px rgba(20, 20, 20, .12);
	transition: width 350ms cubic-bezier(.22, 1, .36, 1), opacity 200ms ease;
}
.nelb-search--compact.is-collapsed .nelb-search__box {
	width: 0;
	opacity: 0;
	border-width: 0;
	padding: 0;
	pointer-events: none;
	overflow: hidden;
}
/* Lente nascosta a campo aperto (il campo ha già la sua icona) */
.nelb-search--compact:not(.is-collapsed) .nelb-search__toggle {
	opacity: 0;
	pointer-events: none;
}
/* Dropdown ancorato all'overlay, stessa larghezza */
.nelb-search--compact .nelb-search__panel {
	left: auto;
	right: 0;
	width: min(700px, calc(100vw - 32px));
	top: calc(46px + 6px);
}
.nelb-search--compact.is-collapsed .nelb-search__panel {
	display: none;
}

/* Accessibilità: chi preferisce meno movimento, niente animazioni */
@media (prefers-reduced-motion: reduce) {
	.nelb-search--compact .nelb-search__box,
	.nelb-search__toggle {
		transition: none;
	}
}
