/* Filarete Ajax Filters */

.filarete-af-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 40px;
	padding: 24px 0 32px;
	margin-bottom: 32px;
	border-bottom: 1px solid #e5e5e5;
}

.filarete-af-group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 24px;
}

.filarete-af-label {
	white-space: nowrap;
}

.filarete-af-dd {
	position: relative;
}

.filarete-af-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-width: 240px;
	height: 56px;
	padding: 0 20px 0 24px;
	margin: 0;
	background: #fff;
	border: 1px solid #dcdcdc;
	border-radius: 0;
	box-shadow: none;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
}

.filarete-af-dd[data-type="price"] .filarete-af-toggle {
	min-width: 220px;
}

.filarete-af-toggle:hover,
.filarete-af-dd.is-open .filarete-af-toggle {
	border-color: #b5b5b5;
}

.filarete-af-toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.filarete-af-current {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.filarete-af-chevron {
	flex: none;
	transition: transform .2s ease;
}

.filarete-af-dd.is-open .filarete-af-chevron {
	transform: rotate(180deg);
}

.filarete-af-menu {
	position: absolute;
	z-index: 60;
	top: calc(100% - 1px);
	left: 0;
	min-width: 100%;
	max-height: 340px;
	overflow-y: auto;
	margin: 0;
	padding: 8px 0;
	list-style: none;
	background: #fff;
	border: 1px solid #b5b5b5;
	box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
}

.filarete-af-menu[hidden] {
	display: none;
}

.filarete-af-menu [role="option"] {
	margin: 0;
	padding: 10px 24px;
	cursor: pointer;
	white-space: nowrap;
}

.filarete-af-menu [role="option"]:hover,
.filarete-af-menu [role="option"]:focus {
	background: #f5f5f5;
	outline: none;
}

.filarete-af-menu [aria-selected="true"] {
	font-weight: 600;
}

.filarete-af-reset {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}

.filarete-af-reset:hover,
.filarete-af-reset:focus {
	opacity: .7;
}

.filarete-af-count {
	margin-left: auto;
	color: #9a9a9a;
	white-space: nowrap;
}

.filarete-af-results {
	transition: opacity .2s ease;
}

.filarete-af-results.is-loading {
	opacity: .45;
	pointer-events: none;
}


/* Elementi del pannello mobile: nascosti su desktop */
.filarete-af-open,
.filarete-af-panel-head,
.filarete-af-backdrop {
	display: none;
}

/* Tablet */
@media (max-width: 1199px) {
	.filarete-af-bar { gap: 16px 32px; }
	.filarete-af-toggle,
	.filarete-af-dd[data-type="price"] .filarete-af-toggle { min-width: 200px; height: 52px; }
}

/* ------------------------------------------------------------------
 * Mobile: bottone "Filtri" + ordinamento su una riga,
 * categoria e prezzo in un pannello che sale dal basso
 * ---------------------------------------------------------------- */
@media (max-width: 767px) {

	.filarete-af-bar {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		gap: 10px 8px;
		align-items: center;
		padding: 16px 0 20px;
		margin-bottom: 24px;
	}

	/* Bottone Filtri */
	.filarete-af-open {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		height: 48px;
		padding: 0 16px;
		margin: 0;
		background: #fff;
		border: 1px solid #dcdcdc;
		border-radius: 0;
		box-shadow: none;
		font: inherit;
		font-size: 15px;
		color: inherit;
		cursor: pointer;
		white-space: nowrap;
	}

	.filarete-af-open:focus-visible {
		outline: 2px solid currentColor;
		outline-offset: 2px;
	}

	.filarete-af-badge {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 20px;
		height: 20px;
		padding: 0 6px;
		border-radius: 10px;
		background: currentColor;
		font-size: 12px;
		line-height: 1;
	}

	.filarete-af-badge span {
		color: #fff;
	}

	/* Ordinamento a fianco del bottone, senza etichetta */
	.filarete-af-group--order {
		display: block;
		min-width: 0;
	}

	.filarete-af-group--order .filarete-af-label {
		position: absolute !important;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.filarete-af-group--order .filarete-af-current::before {
		content: "Ordina: ";
		opacity: .7;
	}

	.filarete-af-group--order .filarete-af-menu {
		left: auto;
		right: 0;
		max-height: 60vh;
	}

	.filarete-af-toggle,
	.filarete-af-dd[data-type="price"] .filarete-af-toggle {
		width: 100%;
		min-width: 0;
		height: 48px;
		padding: 0 14px 0 16px;
		gap: 8px;
		font-size: 15px;
	}

	.filarete-af-menu [role="option"] {
		padding: 12px 20px;
		white-space: normal;
	}

	.filarete-af-count {
		grid-column: 1 / -1;
		margin-left: 0;
		font-size: 14px;
	}

	/* Pannello */
	.filarete-af-group--filters {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 100001;
		display: block;
		max-height: 85vh;
		margin: 0;
		padding: 0 16px 24px;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		background: #fff;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -4px 24px rgba(0, 0, 0, .15);
		transform: translateY(100%);
		visibility: hidden;
		transition: transform .25s ease, visibility 0s linear .25s;
	}

	.filarete-af-bar.is-panel-open .filarete-af-group--filters {
		transform: translateY(0);
		visibility: visible;
		transition: transform .25s ease, visibility 0s;
	}

	.filarete-af-panel-head {
		position: sticky;
		top: 0;
		z-index: 2;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 0 -16px 16px;
		padding: 14px 16px;
		background: #fff;
		border-bottom: 1px solid #e5e5e5;
	}

	.filarete-af-panel-title {
		font-size: 18px;
		font-weight: 600;
	}

	.filarete-af-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		margin: -8px -10px -8px 0;
		padding: 0;
		background: transparent;
		border: 0;
		color: inherit;
		cursor: pointer;
	}

	/* Nel pannello: tendine a tutta larghezza, elenco aperto sotto (non sovrapposto) */
	.filarete-af-group--filters .filarete-af-label {
		display: none;
	}

	.filarete-af-group--filters .filarete-af-dd {
		position: static;
		width: 100%;
		margin: 0 0 10px;
	}

	.filarete-af-group--filters .filarete-af-menu {
		position: static;
		max-height: 45vh;
		margin-top: -1px;
		box-shadow: none;
	}

	.filarete-af-group--filters .filarete-af-reset {
		margin-top: 8px;
		font-size: 14px;
	}

	.filarete-af-backdrop {
		position: fixed;
		inset: 0;
		z-index: 100000;
		background: rgba(0, 0, 0, .4);
	}

	.filarete-af-bar.is-panel-open .filarete-af-backdrop {
		display: block;
	}

	html.filarete-af-lock,
	html.filarete-af-lock body {
		overflow: hidden;
	}
}