/**
 * =============================================================================
 * PROBAR - RICERCA WORLD-CLASS (search-ui)
 * -----------------------------------------------------------------------------
 * Caricato sitewide (inc/abm-search.php). Due blocchi:
 *   A) Tendina di ricerca istantanea (dropdown) sotto la barra.
 *   B) Pagina risultati (search.php): griglia e-commerce, testata, paginazione,
 *      stato vuoto. Fix del layout blog di Astra che impilava le card.
 * Lusso quieto: nero profondo, oro #FFCE53, Playfair per i titoli.
 * =============================================================================
 */

/* ==========================================================================
 * FOCUS DELLA BARRA - bordo oro soffuso, feedback "search-first"
 * ========================================================================== */
input.search-field {
	transition: box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

input.search-field:focus {
	border-color: #FFCE53 !important;
	box-shadow: 0 0 0 3px rgba(255, 206, 83, 0.14), 0 6px 22px rgba(0, 0, 0, 0.35) !important;
	outline: none !important;
}

/* ==========================================================================
 * A) TENDINA ISTANTANEA
 * ========================================================================== */

/* Astra ha una ricerca live nativa che disegna un proprio dropdown testuale
 * sullo stesso form: si sovrapporrebbe alla nostra tendina. La spegniamo a
 * livello visivo (la nostra la sostituisce in tutto e per tutto). */
.ast-live-search-results,
.ast-search-live-results {
	display: none !important;
}

.abm-search-host {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 140;
}

.search-form {
	position: relative;
}

/* Mobile: il form di ricerca dell'header e' stretto (~200px). Ancorare il
 * pannello a left:0/right:0 lo lasciava largo come il form, schiacciando le
 * righe prodotto (nome e prezzo si incolonnavano un carattere per riga). Qui
 * lo sganciamo dalla larghezza del form e lo centriamo sul viewport: righe
 * prodotto normali (thumb + nome + prezzo + CTA su una riga). Il form header
 * e' centrato, quindi il pannello resta simmetrico e dentro lo schermo. */
@media (max-width: 600px) {
	.abm-search-host {
		left: 50%;
		right: auto;
		transform: translateX(-50%);
		width: min(94vw, 480px);
	}
}

.abm-search-panel {
	background: #101010;
	border: 1px solid #4a3f1e;
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
	max-height: 72vh;
	overflow-y: auto;
	padding: 8px;
	color: #cdcdcd;
	animation: abm-search-in 0.18s ease;
	overscroll-behavior: contain;
}

@keyframes abm-search-in {
	from { opacity: 0; transform: translateY(-8px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.abm-search-panel { animation: none; }
}

.abm-search-panel.is-loading {
	cursor: progress;
}

/* larghezza minima utile anche quando la barra e' stretta (magnifier header) */
@media (min-width: 601px) {
	.abm-search-panel {
		min-width: 340px;
	}
}

/* Sezioni */
.abm-search-section {
	padding: 6px 4px 10px;
}

.abm-search-section + .abm-search-section {
	border-top: 1px solid #222;
	margin-top: 4px;
}

.abm-search-section__title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 4px 6px 8px;
	color: #9aa2a6;
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 1.6px;
}

.abm-search-clear {
	margin-left: auto;
	background: none;
	border: none;
	color: #7a7a7a;
	font-size: 0.7rem;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	padding: 2px 4px;
}

.abm-search-clear:hover {
	color: #FFCE53;
}

/* Voce generica (nav da tastiera) */
.abm-search-item {
	text-decoration: none;
	color: inherit;
	scroll-margin: 8px;
}

/* Prodotto */
.abm-search-product {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 10px;
	border-radius: 10px;
	transition: background 0.15s ease;
}

.abm-search-product.is-active,
.abm-search-product:hover {
	background: #191919;
}

.abm-search-product__thumb {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.abm-search-product__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 4px;
	box-sizing: border-box;
}

.abm-search-product__body {
	flex: 1;
	min-width: 0;
}

.abm-search-product__name {
	display: block;
	color: #f4f4f4;
	font-size: 0.92rem;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.abm-search-product__meta {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 3px;
}

.abm-search-product__price {
	color: #FFCE53;
	font-size: 0.86rem;
	font-weight: 600;
}

.abm-search-product__price .woocommerce-Price-amount {
	color: #FFCE53;
}

.abm-search-product__price del {
	color: #6f6f6f;
	font-weight: 400;
	margin-right: 4px;
}

.abm-search-product__price ins {
	text-decoration: none;
	color: #FFCE53;
}

.abm-search-product__price small {
	color: #7a7a7a;
	font-weight: 400;
}

/* Badge stock */
.abm-search-badge {
	font-size: 0.68rem;
	padding: 2px 8px;
	border-radius: 10px;
	white-space: nowrap;
	border: 1px solid transparent;
}

.abm-search-badge--instock {
	color: #8fd6a5;
	border-color: rgba(143, 214, 165, 0.35);
}

.abm-search-badge--low {
	color: #FFCE53;
	border-color: rgba(255, 206, 83, 0.4);
}

.abm-search-badge--backorder {
	color: #d9b38c;
	border-color: rgba(217, 179, 140, 0.4);
}

.abm-search-badge--soldout {
	color: #b06a6a;
	border-color: rgba(176, 106, 106, 0.4);
}

/* CTA rapida */
.abm-search-add,
.abm-search-view {
	flex: 0 0 auto;
	min-height: 34px;
	padding: 7px 14px;
	border-radius: 18px;
	font-size: 0.8rem;
	cursor: pointer;
	border: 1px solid transparent;
}

.abm-search-add {
	background: linear-gradient(180deg, #FFE9AE 0%, #FFCE53 100%);
	color: #111;
	font-weight: 600;
}

.abm-search-add:hover {
	box-shadow: 0 0 14px rgba(255, 206, 83, 0.35);
}

.abm-search-add.is-added {
	background: #1d1d1d;
	color: #FFCE53;
	border-color: #FFCE53;
}

.abm-search-add:disabled {
	opacity: 0.6;
	cursor: wait;
}

.abm-search-view {
	background: transparent;
	color: #9aa2a6;
	border-color: #3a3a3a;
}

.abm-search-product.is-active .abm-search-view {
	color: #FFCE53;
	border-color: #FFCE53;
}

/* Chips categorie / brand / termini */
.abm-search-section__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 6px;
}

.abm-search-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 13px;
	border: 1px solid #3a3a3a;
	border-radius: 20px;
	background: #0f0f0f;
	color: #d9d9d9;
	font-size: 0.85rem;
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.abm-search-chip em {
	font-style: normal;
	color: #7a7a7a;
	font-size: 0.75rem;
}

.abm-search-chip__ico {
	color: #FFCE53;
	font-size: 0.9rem;
	line-height: 1;
}

.abm-search-chip.is-active,
.abm-search-chip:hover {
	border-color: #FFCE53;
	color: #f4f4f4;
	background: #171512;
}

.abm-search-chip--brand .abm-search-chip__ico {
	color: #e8c877;
}

/* Vedi tutti */
.abm-search-viewall {
	display: block;
	text-align: center;
	padding: 11px;
	margin: 4px;
	border-radius: 10px;
	color: #FFCE53;
	font-size: 0.86rem;
	font-weight: 600;
	border: 1px solid #4a3f1e;
}

.abm-search-viewall.is-active,
.abm-search-viewall:hover {
	background: #171512;
	border-color: #FFCE53;
}

/* Nessun risultato (dropdown) */
.abm-search-noresult {
	padding: 22px 16px;
	text-align: center;
}

.abm-search-noresult__title {
	color: #f4f4f4;
	font-size: 0.98rem;
	margin: 0 0 6px;
}

.abm-search-noresult__hint {
	color: #9aa2a6;
	font-size: 0.85rem;
	line-height: 1.5;
	margin: 0 0 14px;
}

.abm-search-noresult__wa {
	display: inline-block;
	padding: 9px 18px;
	border-radius: 20px;
	border: 1px solid #FFCE53;
	color: #FFCE53;
	text-decoration: none;
	font-size: 0.85rem;
}

.abm-search-noresult__wa:hover {
	background: linear-gradient(180deg, #FFE9AE 0%, #FFCE53 100%);
	color: #111;
}

/* Toast */
.abm-search-toast {
	position: fixed;
	left: 50%;
	bottom: 40px;
	transform: translate(-50%, 20px);
	z-index: 200;
	background: linear-gradient(180deg, #1d1d1d 0%, #111 100%);
	border: 1px solid #FFCE53;
	color: #FFCE53;
	font-size: 0.9rem;
	padding: 12px 22px;
	border-radius: 26px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.abm-search-toast.is-in {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* ==========================================================================
 * B) PAGINA RISULTATI - griglia e-commerce (fix layout blog Astra)
 * ========================================================================== */
.abm-search-results {
	max-width: 1280px;
	margin: 0 auto;
	padding: 26px 16px 70px;
	color: #cdcdcd;
}

.abm-search-results__head {
	text-align: center;
	margin: 6px auto 30px;
	max-width: 760px;
}

.abm-search-results__kicker {
	color: #FFCE53;
	text-transform: uppercase;
	letter-spacing: 3px;
	font-size: 0.76rem;
	margin: 0 0 10px;
}

.abm-search-results__title {
	font-family: "Playfair Display", Georgia, serif;
	font-size: clamp(1.5rem, 3.6vw, 2.4rem);
	line-height: 1.2;
	color: #f4f4f4;
	margin: 0;
}

.abm-search-results__term {
	color: #FFCE53;
}

/* Griglia: definita qui perche' il CSS core di WooCommerce puo' non essere
 * accodato sulla pagina di ricerca. Uccido il clearfix che diventerebbe cella
 * di griglia (stesso trucco del fix account) e neutralizzo float/width di Woo. */
.abm-search-results ul.products {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 18px;
}

.abm-search-results ul.products::before,
.abm-search-results ul.products::after {
	content: none !important;
	display: none !important;
}

.abm-search-results ul.products li.product {
	width: auto !important;
	margin: 0 !important;
	float: none !important;
	clear: none !important;
}

@media (max-width: 1024px) {
	.abm-search-results ul.products {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 760px) {
	.abm-search-results ul.products {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 460px) {
	.abm-search-results ul.products {
		grid-template-columns: 1fr;
	}
}

/* Paginazione */
.abm-search-pagination {
	margin: 34px 0 0;
	display: flex;
	justify-content: center;
}

.abm-search-pagination .page-numbers {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
}

.abm-search-pagination .page-numbers li {
	margin: 0;
}

.abm-search-pagination .page-numbers a,
.abm-search-pagination .page-numbers span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 12px;
	border-radius: 12px;
	border: 1px solid #2a2a2a;
	color: #d9d9d9;
	text-decoration: none;
	transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.abm-search-pagination .page-numbers a:hover {
	border-color: #FFCE53;
	color: #FFCE53;
}

.abm-search-pagination .page-numbers .current {
	background: linear-gradient(180deg, #FFE9AE 0%, #FFCE53 100%);
	border-color: #FFCE53;
	color: #111;
	font-weight: 700;
}

/* Stato vuoto (pagina) */
.abm-search-empty {
	text-align: center;
	max-width: 620px;
	margin: 10px auto 0;
	background: #101010;
	border: 1px solid #2a2a2a;
	border-radius: 16px;
	padding: 40px 24px;
}

.abm-search-empty__ico {
	font-size: 2rem;
	color: #FFCE53;
	display: block;
	margin-bottom: 12px;
}

.abm-search-empty__title {
	font-family: "Playfair Display", Georgia, serif;
	font-size: 1.4rem;
	color: #f4f4f4;
	margin: 0 0 10px;
}

.abm-search-empty__text {
	color: #b9b9b9;
	line-height: 1.6;
	margin: 0 0 20px;
}

.abm-search-empty__chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0 0 22px;
}

.abm-search-empty__chip {
	display: inline-block;
	padding: 8px 15px;
	border-radius: 20px;
	border: 1px solid #3a3a3a;
	background: #0f0f0f;
	color: #d9d9d9;
	text-decoration: none;
	font-size: 0.86rem;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.abm-search-empty__chip:hover {
	border-color: #FFCE53;
	color: #FFCE53;
}

.abm-search-empty__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
}

.abm-search-empty__shop,
.abm-search-empty__wa {
	display: inline-block;
	min-height: 46px;
	padding: 12px 22px;
	border-radius: 24px;
	text-decoration: none;
	font-size: 0.9rem;
	font-weight: 600;
}

.abm-search-empty__shop {
	background: linear-gradient(180deg, #FFE9AE 0%, #FFCE53 100%);
	color: #111;
}

.abm-search-empty__shop:hover {
	box-shadow: 0 0 18px rgba(255, 206, 83, 0.35);
}

.abm-search-empty__wa {
	background: transparent;
	color: #e8e8e8;
	border: 1px solid #4a3f1e;
}

.abm-search-empty__wa:hover {
	border-color: #FFCE53;
	color: #FFCE53;
}
