/**
 * WDM - Search.
 *
 * Campi e tendina sul modello dei form di Flowbite. Colori e misure passano
 * da variabili che i controlli di Elementor sovrascrivono.
 */
.aa-wdm-search {
	--wdms-field-bg: #f9fafb;
	--wdms-field-line: #d1d5db;
	--wdms-text: #111827;
	--wdms-muted: #6b7280;
	--wdms-accent: #393433;
	--wdms-btn-bg: #393433;
	--wdms-btn-bg-h: #211d1c;
	--wdms-btn-color: #fff;
	--wdms-status: #374151;
	--wdms-h: 44px;
	--wdms-radius: 5px;
	--wdms-gap: 8px;

	position: relative;
	margin: 0;
	color: var(--wdms-text);
	font-size: 14px;
	line-height: 1.4;
}
.aa-wdm-search *,
.aa-wdm-search *::before,
.aa-wdm-search *::after {
	box-sizing: border-box;
}

.aa-wdm-search__row {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: var(--wdms-gap);
}
.aa-wdm-search--row .aa-wdm-search__field--q {
	flex: 1 1 260px;
}
.aa-wdm-search--row .aa-wdm-search__dd,
.aa-wdm-search--row .aa-wdm-search__field--cat {
	flex: 0 1 220px;
}
.aa-wdm-search--stack .aa-wdm-search__row {
	flex-direction: column;
}

.aa-wdm-search__field {
	position: relative;
	min-width: 0;
}

/* campo di testo con la lente */
.aa-wdm-search__icon {
	position: absolute;
	top: 50%;
	left: 12px;
	display: flex;
	color: var(--wdms-muted);
	transform: translateY(-50%);
	pointer-events: none;
}
.aa-wdm-search .aa-wdm-search__input,
.aa-wdm-search .aa-wdm-search__select,
.aa-wdm-search .aa-wdm-search__ddbtn {
	display: block;
	width: 100%;
	height: var(--wdms-h);
	min-height: var(--wdms-h);
	margin: 0;
	border: 1px solid var(--wdms-field-line);
	border-radius: var(--wdms-radius);
	background: var(--wdms-field-bg);
	color: var(--wdms-text);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.2;
	box-shadow: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.aa-wdm-search .aa-wdm-search__input {
	padding: 0 40px 0 40px;
	-webkit-appearance: none;
	appearance: none;
}
.aa-wdm-search .aa-wdm-search__input::placeholder {
	color: var(--wdms-muted);
	opacity: 1;
}
/* tolgo la X del browser, uso la mia uguale ovunque */
.aa-wdm-search .aa-wdm-search__input::-webkit-search-cancel-button,
.aa-wdm-search .aa-wdm-search__input::-webkit-search-decoration {
	display: none;
	-webkit-appearance: none;
	appearance: none;
}
.aa-wdm-search .aa-wdm-search__input::-ms-clear {
	display: none;
}
.aa-wdm-search .aa-wdm-search__clear {
	position: absolute;
	top: 50%;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	color: var(--wdms-muted);
	line-height: 1;
	box-shadow: none;
	transform: translateY(-50%);
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.aa-wdm-search .aa-wdm-search__clear svg {
	width: 16px;
	height: 16px;
}
.aa-wdm-search .aa-wdm-search__clear:hover {
	background: #e5e7eb;
	color: var(--wdms-text);
}
.aa-wdm-search .aa-wdm-search__clear:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--wdms-accent) 35%, transparent);
}
.aa-wdm-search .aa-wdm-search__clear[hidden] {
	display: none;
}
.aa-wdm-search .aa-wdm-search__input:focus,
.aa-wdm-search .aa-wdm-search__select:focus,
.aa-wdm-search .aa-wdm-search__ddbtn:focus-visible,
.aa-wdm-search .aa-wdm-search__ddbtn[aria-expanded="true"] {
	border-color: var(--wdms-accent);
	outline: none;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wdms-accent) 20%, transparent);
}

/* select della categoria con la freccia mia */
.aa-wdm-search .aa-wdm-search__select {
	padding: 0 36px 0 12px;
	-webkit-appearance: none;
	appearance: none;
	background-image: none;
	cursor: pointer;
	text-overflow: ellipsis;
}
.aa-wdm-search__chev {
	display: flex;
	color: var(--wdms-muted);
	transition: transform .15s ease;
}
.aa-wdm-search__chev--select {
	position: absolute;
	top: 50%;
	right: 12px;
	transform: translateY(-50%);
	pointer-events: none;
}

/* tendina allergeni */
.aa-wdm-search .aa-wdm-search__ddbtn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 12px;
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	font-weight: 400;
	cursor: pointer;
}
.aa-wdm-search .aa-wdm-search__ddbtn:hover {
	background: var(--wdms-field-bg);
	color: var(--wdms-text);
}
.aa-wdm-search__ddlabel {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.aa-wdm-search__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 9999px;
	background: var(--wdms-accent);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
}
.aa-wdm-search__count[hidden] {
	display: none;
}
.aa-wdm-search__ddbtn[aria-expanded="true"] .aa-wdm-search__chev {
	transform: rotate(180deg);
}

.aa-wdm-search__panel {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 50;
	width: max(100%, 260px);
	max-height: 320px;
	padding: 12px;
	overflow-y: auto;
	border: 1px solid #e5e7eb;
	border-radius: var(--wdms-radius);
	background: #fff;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
}
.aa-wdm-search__panel[hidden] {
	display: none;
}
.aa-wdm-search__paneltitle {
	margin: 0 0 8px;
	color: var(--wdms-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .03em;
	text-transform: uppercase;
}
.aa-wdm-search .aa-wdm-search__alglist {
	display: grid;
	gap: 2px;
	margin: 0 0 8px;
	padding: 0;
	list-style: none;
}
.aa-wdm-search .aa-wdm-search__alglist li {
	margin: 0;
	padding: 0;
	list-style: none;
}
.aa-wdm-search .aa-wdm-search__alg {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 7px 8px;
	border-radius: 4px;
	color: var(--wdms-text);
	font-size: 14px;
	font-weight: 400;
	cursor: pointer;
}
.aa-wdm-search .aa-wdm-search__alg:hover {
	background: #f3f4f6;
}
.aa-wdm-search .aa-wdm-search__check {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--wdms-accent);
	cursor: pointer;
}
.aa-wdm-search .aa-wdm-search__algimg {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	margin: 0;
	object-fit: contain;
}
.aa-wdm-search .aa-wdm-search__clearall {
	display: inline-block;
	margin: 0;
	padding: 4px 8px;
	border: 0;
	background: none;
	color: var(--wdms-accent);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	text-decoration: underline;
	text-transform: none;
	cursor: pointer;
}

/* tendina categorie, stile listbox di Flowbite */
.aa-wdm-search__panel--cat {
	width: max(100%, 240px);
	padding: 6px;
}
.aa-wdm-search .aa-wdm-search__catlist {
	display: grid;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.aa-wdm-search .aa-wdm-search__catlist li {
	margin: 0;
	padding: 0;
	list-style: none;
}
.aa-wdm-search .aa-wdm-search__catopt {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	min-height: 0;
	margin: 0;
	padding: 8px 10px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--wdms-text);
	font-family: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
	letter-spacing: 0;
	text-align: left;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
}
.aa-wdm-search .aa-wdm-search__catopt--d1 { padding-left: 26px; }
.aa-wdm-search .aa-wdm-search__catopt--d2 { padding-left: 42px; }
.aa-wdm-search .aa-wdm-search__catopt--d3 { padding-left: 58px; }
.aa-wdm-search .aa-wdm-search__catopt:hover,
.aa-wdm-search .aa-wdm-search__catopt:focus-visible {
	background: #f3f4f6;
	color: var(--wdms-text);
	outline: none;
}
.aa-wdm-search .aa-wdm-search__catopt.is-selected {
	background: color-mix(in srgb, var(--wdms-accent) 8%, #fff);
	color: var(--wdms-accent);
	font-weight: 600;
}
.aa-wdm-search__tick {
	display: flex;
	flex: 0 0 auto;
	color: var(--wdms-accent);
	visibility: hidden;
}
.aa-wdm-search__tick svg {
	width: 16px;
	height: 16px;
}
.aa-wdm-search__catopt.is-selected .aa-wdm-search__tick {
	visibility: visible;
}

/* pulsante Cerca */
.aa-wdm-search .aa-wdm-search__btn {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: var(--wdms-h);
	margin: 0;
	padding: 0 20px;
	border: 0;
	border-radius: var(--wdms-radius);
	background: var(--wdms-btn-bg);
	color: var(--wdms-btn-color);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background-color .15s ease, box-shadow .15s ease;
}
.aa-wdm-search .aa-wdm-search__btn:hover {
	background: var(--wdms-btn-bg-h);
	color: var(--wdms-btn-color-h, var(--wdms-btn-color));
}
.aa-wdm-search .aa-wdm-search__btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wdms-btn-bg) 30%, transparent);
}
.aa-wdm-search--stack .aa-wdm-search__btn {
	width: 100%;
}
.aa-wdm-search.is-loading .aa-wdm-search__btn {
	opacity: .7;
	pointer-events: none;
}

/* riga dei risultati */
.aa-wdm-search__status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	margin-top: 10px;
	color: var(--wdms-status);
	font-size: 14px;
}
.aa-wdm-search__status[hidden] {
	display: none;
}
.aa-wdm-search .aa-wdm-search__reset {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--wdms-accent);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: underline;
	text-transform: none;
	letter-spacing: 0;
	line-height: 1.3;
	box-shadow: none;
	cursor: pointer;
	transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.aa-wdm-search .aa-wdm-search__reset:focus-visible {
	outline: 2px solid color-mix(in srgb, var(--wdms-accent) 40%, transparent);
	outline-offset: 2px;
}

/* telefono: campo di testo e pulsante a tutta riga, filtri affiancati */
@media (max-width: 640px) {
	.aa-wdm-search--row .aa-wdm-search__field--q {
		flex: 1 1 100%;
	}
	.aa-wdm-search--row .aa-wdm-search__dd,
	.aa-wdm-search--row .aa-wdm-search__field--cat {
		flex: 1 1 calc(50% - var(--wdms-gap));
	}
	.aa-wdm-search--row .aa-wdm-search__btn {
		flex: 1 1 100%;
	}
	/* la tendina categorie sta a destra: la apro verso sinistra per non uscire dallo schermo */
	.aa-wdm-search--row .aa-wdm-search__panel--cat {
		right: 0;
		left: auto;
	}
	.aa-wdm-search .aa-wdm-search__input,
	.aa-wdm-search .aa-wdm-search__select,
	.aa-wdm-search .aa-wdm-search__ddbtn {
		/* sotto i 16px iOS ingrandisce la pagina al tocco */
		font-size: 16px;
	}
}
