/* Filtre des produits (voir inc/filtre-produits.php) — boutique et catégories. */

.anaaz-filtre {
	--anaaz-filtre-fond: #f4f4f4;
	--anaaz-filtre-actif: #f9ebda;
	--anaaz-filtre-texte: #111;
	--anaaz-filtre-doux: #757575;
	--anaaz-filtre-bord: #e5e5e5;
	margin: 0 0 18px;
	color: var(--anaaz-filtre-texte);
	font-size: 14px;
}

.anaaz-filtre [hidden] {
	display: none !important;
}

/* Barre collée en haut de l'écran quand on descend (sous la barre d'administration si connectée) */
.anaaz-filtre {
	position: sticky;
	top: 0;
	z-index: 50;
	padding: 10px 0;
	background: #fff;
}

body.admin-bar .anaaz-filtre {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	body.admin-bar .anaaz-filtre {
		top: 0; /* la barre d'administration n'est plus fixe sous 600 px */
	}
}

/* Panneau mobile ouvert : au-dessus de tout le reste de la page */
.anaaz-filtre.is-ouvert {
	z-index: 100000;
}

/* ---------- Flèches des vignettes : seulement si les vignettes dépassent (ordinateur) ---------- */

@media (min-width: 768px) {
	.anaaz-vignettes-tiennent .category-scroll-arrow {
		display: none !important;
	}
}

/* ---------- Vignette active (catégorie en cours ou ancêtre le plus proche) ---------- */

.custom-sorting-bar .filter-btn.anaaz-vignette-active {
	background: #f9ebda !important;
	color: #000 !important;
}

.custom-sorting-bar .filter-btn.anaaz-vignette-active .filter-btn-title {
	color: #000 !important;
	font-weight: 600 !important;
}

/* ---------- Section « Catégorie » ---------- */

.anaaz-filtre__categories {
	padding: 12px 14px 14px;
	max-height: 380px;
	overflow-y: auto;
}

.anaaz-filtre__cat-retour {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 8px;
	color: var(--anaaz-filtre-texte) !important;
	font-weight: 500;
	text-decoration: none !important;
}

.anaaz-filtre__cat-retour:hover {
	text-decoration: underline !important;
}

.anaaz-filtre__cat-liste,
.anaaz-filtre__cat-enfants {
	list-style: none;
	margin: 0;
	padding: 0;
}

.anaaz-filtre__cat-enfants {
	padding-left: 14px;
}

.anaaz-filtre__cat-liste li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.anaaz-filtre__cat-lien {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 7px 6px;
	border-radius: 6px;
	color: var(--anaaz-filtre-texte) !important;
	text-decoration: none !important;
	line-height: 1.25;
}

a.anaaz-filtre__cat-lien:hover {
	background: var(--anaaz-filtre-fond);
}

.anaaz-filtre__cat-lien.is-courante {
	font-weight: 700;
}

.anaaz-filtre__barre {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	padding-left: 10px !important;
	padding-right: 10px !important;
}

.anaaz-filtre__form {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
}

.anaaz-filtre__sections {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* Bouton « Filtrer » et en-tête du panneau : mobile seulement */
.anaaz-filtre__ouvrir,
.anaaz-filtre__entete,
.anaaz-filtre__pied {
	display: none;
}

/* ---------- Sections (ordinateur : menus déroulants) ---------- */

.anaaz-filtre__section {
	position: relative;
}

.anaaz-filtre__resume {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	background: var(--anaaz-filtre-fond);
	border-radius: 30px;
	cursor: pointer;
	list-style: none;
	font-weight: 500;
	line-height: 1.2;
	user-select: none;
}

.anaaz-filtre__resume::-webkit-details-marker {
	display: none;
}

.anaaz-filtre__resume::after {
	content: "";
	width: 7px;
	height: 7px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
}

.anaaz-filtre__section[open] > .anaaz-filtre__resume::after {
	margin-top: 3px;
	transform: rotate(-135deg);
}

.anaaz-filtre__section[open] > .anaaz-filtre__resume,
.anaaz-filtre__resume:hover {
	background: var(--anaaz-filtre-actif);
}

.anaaz-filtre__nb-section,
.anaaz-filtre__pastille-nb {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: var(--anaaz-filtre-texte);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
}

.anaaz-filtre__deroulant {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 60;
	width: 290px;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

@media (min-width: 768px) {
	.anaaz-filtre__section[data-section="couleur"] .anaaz-filtre__deroulant {
		width: 370px;
	}
}

.anaaz-filtre__section:last-child .anaaz-filtre__deroulant {
	left: auto;
	right: 0;
}

.anaaz-filtre__deroulant .anaaz-filtre__choix {
	max-height: 320px;
	overflow-y: auto;
	padding: 10px 14px 0;
}

.anaaz-filtre__choix {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.anaaz-filtre__choix--couleur {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: 10px;
}

.anaaz-filtre__option {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 7px 4px;
	margin: 0;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 400;
	line-height: 1.25;
}

.anaaz-filtre__option:hover {
	background: var(--anaaz-filtre-fond);
}

.anaaz-filtre__option input {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--anaaz-filtre-texte);
	cursor: pointer;
}

.anaaz-filtre__option.is-vide {
	opacity: 0.4;
	cursor: default;
}

.anaaz-filtre__option.is-vide:hover {
	background: none;
}

.anaaz-filtre__nom {
	flex: 1 1 auto;
}

.anaaz-filtre__nombre {
	color: var(--anaaz-filtre-doux);
	font-size: 12px;
}

/* Pastilles de couleur des familles */
.anaaz-filtre__pastille {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--teinte, #ccc);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.anaaz-filtre__pastille--metallise {
	background: linear-gradient(135deg, #8d8d8d 0%, #f2f2f2 45%, #b8b8b8 55%, #e0c76f 100%);
}

.anaaz-filtre__pastille--multicolore {
	background: conic-gradient(#e53935, #fbc02d, #43a047, #1e88e5, #8e24aa, #e53935);
}

/* Boutons */
.anaaz-filtre__pied-section {
	padding: 10px 14px 14px;
}

.anaaz-filtre__valider {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 11px 18px;
	border: 0;
	border-radius: 30px;
	background: var(--anaaz-filtre-texte);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.anaaz-filtre__valider:disabled {
	opacity: 0.4;
	cursor: default;
}

.anaaz-filtre__effacer {
	color: var(--anaaz-filtre-texte);
	text-decoration: underline;
	font-size: 13px;
}

.anaaz-filtre__resultat {
	margin: 0 0 0 auto;
	color: var(--anaaz-filtre-doux);
	font-size: 13px;
}

/* Filtres actifs */
.anaaz-filtre__actifs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 12px;
	padding-left: 10px !important;
	padding-right: 10px !important;
}

.anaaz-filtre__puce {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px;
	border-radius: 30px;
	background: var(--anaaz-filtre-actif);
	color: var(--anaaz-filtre-texte) !important;
	text-decoration: none !important;
	font-size: 13px;
}

.anaaz-filtre__puce:hover {
	opacity: 0.75;
}

.anaaz-filtre__voile {
	display: none;
}

/* ---------- Mobile : bouton « Filtrer » et panneau latéral ---------- */

/* Mobile : le panneau est caché dès le premier affichage (avant même le script),
   sinon il apparaît puis glisse hors de l'écran au chargement (flash, 15/10/2026). */
@media (max-width: 767px) {
	.anaaz-filtre .anaaz-filtre__ouvrir {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 10px 18px;
		border: 0;
		border-radius: 30px;
		background: var(--anaaz-filtre-fond);
		color: var(--anaaz-filtre-texte);
		font: inherit;
		font-weight: 600;
		cursor: pointer;
	}

	.anaaz-filtre .anaaz-filtre__form {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		z-index: 100001;
		display: flex;
		flex-direction: column;
		align-items: stretch;
		flex-wrap: nowrap;
		gap: 0;
		width: min(88vw, 380px);
		background: #fff;
		box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
		transform: translateX(100%);
		visibility: hidden;
		transition: transform 0.25s ease, visibility 0s linear 0.25s;
	}

	.anaaz-filtre.is-ouvert .anaaz-filtre__form {
		transform: translateX(0);
		visibility: visible;
		transition: transform 0.25s ease;
	}

	.anaaz-filtre .anaaz-filtre__entete {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 16px 18px;
		border-bottom: 1px solid var(--anaaz-filtre-bord);
	}

	.anaaz-filtre__titre {
		font-size: 17px;
		font-weight: 600;
	}

	.anaaz-filtre__fermer {
		width: 36px;
		height: 36px;
		border: 0;
		border-radius: 50%;
		background: var(--anaaz-filtre-fond);
		color: var(--anaaz-filtre-texte);
		font-size: 22px;
		line-height: 1;
		cursor: pointer;
	}

	.anaaz-filtre .anaaz-filtre__sections {
		flex: 1 1 auto;
		flex-direction: column;
		flex-wrap: nowrap;
		gap: 0;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 0 18px;
	}

	.anaaz-filtre .anaaz-filtre__section {
		border-bottom: 1px solid var(--anaaz-filtre-bord);
	}

	.anaaz-filtre .anaaz-filtre__resume {
		display: flex;
		justify-content: space-between;
		width: 100%;
		padding: 16px 0;
		background: none;
		border-radius: 0;
		font-size: 15px;
	}

	.anaaz-filtre .anaaz-filtre__resume:hover,
	.anaaz-filtre .anaaz-filtre__section[open] > .anaaz-filtre__resume {
		background: none;
	}

	.anaaz-filtre .anaaz-filtre__nb-section {
		margin-left: auto;
	}

	.anaaz-filtre__deroulant {
		position: static;
		width: auto;
		box-shadow: none;
		border-radius: 0;
	}

	.anaaz-filtre__deroulant .anaaz-filtre__choix,
	.anaaz-filtre__categories {
		max-height: none;
		overflow: visible;
		padding: 0 0 12px;
	}

	.anaaz-filtre__cat-lien {
		padding: 10px 4px;
	}

	.anaaz-filtre .anaaz-filtre__pied-section {
		display: none !important;
	}

	.anaaz-filtre__choix--couleur {
		grid-template-columns: 1fr;
	}

	.anaaz-filtre__option {
		padding: 10px 4px;
	}

	.anaaz-filtre .anaaz-filtre__pied {
		display: flex;
		align-items: center;
		gap: 16px;
		padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
		border-top: 1px solid var(--anaaz-filtre-bord);
		background: #fff;
	}

	.anaaz-filtre .anaaz-filtre__pied .anaaz-filtre__effacer {
		flex: 0 0 auto;
	}

	.anaaz-filtre .anaaz-filtre__voile {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 100000;
		background: rgba(0, 0, 0, 0.35);
	}

	html.anaaz-filtre-bloque,
	html.anaaz-filtre-bloque body {
		overflow: hidden;
	}

	.anaaz-filtre__actifs {
		margin-top: 10px;
	}
}
