/**
 * ETM Filtres — styles publics.
 *
 * Toutes les classes sont préfixées `etm-f`. La typographie est héritée du
 * thème (Hello Elementor) : seule la couleur d'accent est imposée, et elle
 * est réglable dans WooCommerce → Filtres.
 *
 * Modificateurs d'état, communs à tous les composants :
 *   .est-cochee      option sélectionnée
 *   .est-desactivee  option qui ne donnerait aucun résultat
 *   .est-masquee     option au-delà de la limite « Voir plus »
 *   .est-replie      groupe refermé
 *   .est-utilise     groupe contenant au moins une sélection
 *   .est-ouvert      panneau mobile ouvert
 *   .est-occupe      mise à jour AJAX en cours
 */

:root {
	--etm-f-accent: #1f5c7a;
	--etm-f-encre: #16202a;
	--etm-f-gris: #5e6b76;
	--etm-f-trait: #e2e6ea;
	--etm-f-fond: #ffffff;
	--etm-f-fond-doux: #f4f6f8;
	--etm-f-rayon: 6px;
	--etm-f-espace: 1rem;
}

/* ---------------------------------------------------------------------------
   1. Conteneur
   --------------------------------------------------------------------------- */

.etm-f-zone {
	margin-bottom: 1.75rem;
}

.etm-f {
	font: inherit;
	color: var(--etm-f-encre);
}

.etm-f__entete {
	display: none; /* visible seulement dans le panneau mobile */
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--etm-f-trait);
}

.etm-f__titre {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
}

.etm-f__fermer {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 0;
	border-radius: var(--etm-f-rayon);
	background: transparent;
	color: var(--etm-f-gris);
	cursor: pointer;
}

/* Le bouton d'envoi disparaît dès que le JavaScript prend la main. */
.etm-f--js .etm-f__actions {
	display: none;
}

.etm-f__appliquer {
	width: 100%;
	padding: .85em 1.2em;
	border: 0;
	border-radius: var(--etm-f-rayon);
	background: var(--etm-f-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

/* ---------------------------------------------------------------------------
   2. Dispositions sur ordinateur
   --------------------------------------------------------------------------- */

/* Conteneur à deux colonnes.
   Un flottant ne convient pas : la grille produits de WooCommerce est un
   conteneur `grid`, qui ne s'écoule pas autour d'un flottant et se retrouve
   repoussé dessous. */
.etm-f-mise-en-page {
	display: block;
}

.etm-f-contenu {
	min-width: 0; /* sans quoi la grille refuse de se rétrécir */
}

@media (min-width: 900px) {
	.etm-f-disposition-colonne .etm-f-mise-en-page,
	.etm-f-disposition-colonne_barre .etm-f-mise-en-page {
		display: grid;
		grid-template-columns: 260px minmax(0, 1fr);
		gap: 2.5rem;
		align-items: start;
	}

	.etm-f-disposition-barre .etm-f-mise-en-page {
		display: block;
	}

	.etm-f-disposition-colonne .etm-f-zone--auto,
	.etm-f-disposition-colonne_barre .etm-f-zone--auto {
		position: sticky;
		top: 2rem;
		margin: 0;
	}

	/* Barre horizontale */
	.etm-f--barre .etm-f__groupes {
		display: flex;
		flex-wrap: wrap;
		gap: 1.25rem;
		align-items: flex-start;
	}

	.etm-f--barre .etm-f-groupe {
		flex: 1 1 200px;
		min-width: 180px;
		max-width: 280px;
		padding: 0;
		border: 1px solid var(--etm-f-trait);
		border-radius: var(--etm-f-rayon);
	}

	.etm-f--barre .etm-f-groupe__entete {
		padding: .7rem .9rem;
	}

	.etm-f--barre .etm-f-groupe__corps {
		max-height: 260px;
		overflow-y: auto;
		padding: 0 .9rem .9rem;
	}
}

/* ---------------------------------------------------------------------------
   3. Groupe de filtre
   --------------------------------------------------------------------------- */

.etm-f-groupe {
	padding: 0 0 1rem;
	border-bottom: 1px solid var(--etm-f-trait);
}

.etm-f-groupe:last-child {
	border-bottom: 0;
}

/* Les thèmes stylisent presque toujours `button` : la remise à zéro doit
   l'emporter, sinon l'en-tête ressemble à un champ de formulaire. */
.etm-f .etm-f-groupe__entete {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;
	width: 100%;
	min-height: 0;
	margin: 0;
	padding: 1rem 0 .7rem !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
	color: inherit !important;
	font: inherit;
	font-weight: 400;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.etm-f .etm-f-groupe__entete:hover,
.etm-f .etm-f-groupe__entete:focus {
	background: none !important;
	color: inherit !important;
}

/* Même traitement pour les autres boutons internes. */
.etm-f .etm-f-voirplus,
.etm-f .etm-f__fermer,
.etm-f-actifs__retirer,
.etm-f-actifs__vider {
	min-height: 0;
	border: 0 !important;
	border-radius: 0;
	box-shadow: none !important;
	text-transform: none;
	-webkit-appearance: none;
	appearance: none;
}

.etm-f-actifs__retirer {
	border-radius: 50% !important;
}

.etm-f-groupe__entete--fixe {
	cursor: default;
}

.etm-f-groupe__titre {
	font-size: .95rem;
	font-weight: 700;
	letter-spacing: .01em;
}

.etm-f-groupe__chevron {
	flex: 0 0 auto;
	width: .55rem;
	height: .55rem;
	border-right: 2px solid var(--etm-f-gris);
	border-bottom: 2px solid var(--etm-f-gris);
	transform: rotate(45deg) translate(-2px, -2px);
	transition: transform .18s ease;
}

.etm-f-groupe.est-replie .etm-f-groupe__chevron {
	transform: rotate(-45deg) translate(-2px, 2px);
}

.etm-f-groupe.est-replie .etm-f-groupe__corps {
	display: none;
}

.etm-f-groupe.est-utilise .etm-f-groupe__titre {
	color: var(--etm-f-accent);
}

/* ---------------------------------------------------------------------------
   4. Options en cases à cocher
   --------------------------------------------------------------------------- */

.etm-f-options,
.etm-f-sous-liste {
	margin: 0;
	padding: 0;
	list-style: none;
}

.etm-f-sous-liste {
	margin-left: 1.35rem;
	border-left: 1px solid var(--etm-f-trait);
	padding-left: .6rem;
}

.etm-f-option {
	display: flex;
	align-items: flex-start;
	margin: 0;
	padding: 0;
}

.etm-f-option.est-masquee {
	display: none;
}

.etm-f-groupe.est-deploye .etm-f-option.est-masquee,
.etm-f-groupe.est-deploye .etm-f-logo.est-masquee {
	display: flex;
}

.etm-f-option__case {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.etm-f-option__libelle {
	display: flex;
	align-items: center;
	gap: .55rem;
	width: 100%;
	padding: .38rem 0;
	font-size: .9rem;
	line-height: 1.35;
	cursor: pointer;
}

.etm-f-option__libelle::before {
	content: "";
	flex: 0 0 auto;
	width: 1.05rem;
	height: 1.05rem;
	border: 1.5px solid var(--etm-f-trait);
	border-radius: 3px;
	background: #fff center center no-repeat;
	transition: background-color .12s ease, border-color .12s ease;
}

.etm-f-option.est-cochee .etm-f-option__libelle::before {
	border-color: var(--etm-f-accent);
	background-color: var(--etm-f-accent);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l2.8 2.8L10 3.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-size: .8rem;
}

.etm-f-option__nom {
	flex: 1 1 auto;
}

.etm-f-option__compte {
	flex: 0 0 auto;
	color: var(--etm-f-gris);
	font-size: .78rem;
	font-variant-numeric: tabular-nums;
}

.etm-f-option.est-desactivee {
	opacity: .4;
}

.etm-f-option.est-desactivee .etm-f-option__libelle {
	cursor: not-allowed;
}

.etm-f-option__case:focus-visible + .etm-f-option__libelle::before {
	outline: 2px solid var(--etm-f-accent);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   5. Pastilles
   --------------------------------------------------------------------------- */

.etm-f-pastilles {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.etm-f-pastille.est-masquee {
	display: none;
}

.etm-f-pastille .etm-f-option__case {
	position: absolute;
	opacity: 0;
}

.etm-f-pastille .etm-f-option__libelle {
	gap: .35rem;
	padding: .4rem .75rem;
	border: 1px solid var(--etm-f-trait);
	border-radius: 999px;
	font-size: .82rem;
}

.etm-f-pastille .etm-f-option__libelle::before {
	display: none;
}

.etm-f-pastille.est-cochee .etm-f-option__libelle {
	border-color: var(--etm-f-accent);
	background: var(--etm-f-accent);
	color: #fff;
}

.etm-f-pastille.est-cochee .etm-f-option__compte {
	color: rgba(255, 255, 255, .8);
}

.etm-f-pastille.est-desactivee {
	opacity: .4;
}

/* ---------------------------------------------------------------------------
   6. Grille de logos de marques
   --------------------------------------------------------------------------- */

.etm-f-logos {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
	gap: .5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.etm-f-logo.est-masquee {
	display: none;
}

.etm-f-logo__case {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

.etm-f-logo__libelle {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .3rem;
	height: 100%;
	padding: .55rem .4rem;
	border: 1.5px solid var(--etm-f-trait);
	border-radius: var(--etm-f-rayon);
	background: #fff;
	cursor: pointer;
	transition: border-color .12s ease, box-shadow .12s ease;
}

.etm-f-logo__libelle:hover {
	border-color: var(--etm-f-gris);
}

.etm-f-logo.est-cochee .etm-f-logo__libelle {
	border-color: var(--etm-f-accent);
	box-shadow: inset 0 0 0 1px var(--etm-f-accent);
}

.etm-f-logo__cadre {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 42px;
}

.etm-f-logo__image {
	max-width: 100%;
	max-height: 42px;
	width: auto;
	height: auto;
	object-fit: contain;
	/* Les logos multicolores restent lisibles une fois sélectionnés. */
	filter: grayscale(100%);
	opacity: .75;
	transition: filter .15s ease, opacity .15s ease;
}

.etm-f-logo__libelle:hover .etm-f-logo__image,
.etm-f-logo.est-cochee .etm-f-logo__image {
	filter: none;
	opacity: 1;
}

.etm-f-logo__initiales {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--etm-f-fond-doux);
	color: var(--etm-f-gris);
	font-size: .82rem;
	font-weight: 700;
	text-transform: uppercase;
}

.etm-f-logo__nom {
	font-size: .74rem;
	line-height: 1.25;
	text-align: center;
}

.etm-f-logo__compte {
	color: var(--etm-f-gris);
	font-size: .7rem;
	font-variant-numeric: tabular-nums;
}

.etm-f-logo.est-desactivee {
	opacity: .35;
}

.etm-f-logo__case:focus-visible + .etm-f-logo__libelle {
	outline: 2px solid var(--etm-f-accent);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   7. Champs de saisie, bornes, liste déroulante
   --------------------------------------------------------------------------- */

.etm-f-champ__saisie,
.etm-f-select,
.etm-f-bornes__champ {
	width: 100%;
	padding: .55rem .7rem;
	border: 1px solid var(--etm-f-trait);
	border-radius: var(--etm-f-rayon);
	background: #fff;
	color: inherit;
	font: inherit;
	font-size: .88rem;
}

.etm-f-bornes {
	display: flex;
	align-items: center;
	gap: .5rem;
}

.etm-f-bornes__libelle {
	flex: 1 1 0;
}

.etm-f-bornes__separateur {
	color: var(--etm-f-gris);
}

/* ---------------------------------------------------------------------------
   8. Voir plus
   --------------------------------------------------------------------------- */

.etm-f-voirplus {
	margin-top: .5rem;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--etm-f-accent);
	font: inherit;
	font-size: .82rem;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

/* ---------------------------------------------------------------------------
   9. Filtres actifs
   --------------------------------------------------------------------------- */

.etm-f-actifs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4rem;
	padding: .75rem 0;
	border-bottom: 1px solid var(--etm-f-trait);
}

.etm-f-actifs__liste {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.etm-f-actifs__puce {
	display: inline-flex;
	align-items: center;
	gap: .35rem;
	padding: .28rem .5rem .28rem .65rem;
	border-radius: 999px;
	background: var(--etm-f-fond-doux);
	font-size: .78rem;
}

.etm-f-actifs__retirer {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.15rem;
	height: 1.15rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--etm-f-gris);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}

.etm-f-actifs__retirer:hover {
	background: rgba(0, 0, 0, .07);
	color: var(--etm-f-encre);
}

.etm-f-actifs__vider {
	margin-left: auto;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--etm-f-accent);
	font: inherit;
	font-size: .78rem;
	text-decoration: underline;
	cursor: pointer;
}

/* ---------------------------------------------------------------------------
   10. État de chargement
   --------------------------------------------------------------------------- */

.etm-f-resultats {
	margin: 0 0 1rem;
	color: var(--etm-f-gris);
	font-size: .85rem;
}

.etm-f-cible {
	position: relative;
	transition: opacity .15s ease;
}

.etm-f-cible.est-occupe {
	opacity: .45;
	pointer-events: none;
}

.etm-f.est-occupe {
	opacity: .6;
	pointer-events: none;
}

/* ---------------------------------------------------------------------------
   11. Mobile : bouton flottant et panneau plein écran
   --------------------------------------------------------------------------- */

.etm-f-declencheur {
	display: none;
	position: fixed;
	left: 50%;
	bottom: calc(1rem + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	align-items: center;
	gap: .5rem;
	padding: .75rem 1.4rem;
	border: 0;
	border-radius: 999px;
	background: var(--etm-f-encre);
	color: #fff;
	font: inherit;
	font-size: .88rem;
	font-weight: 600;
	box-shadow: 0 6px 20px rgba(16, 30, 44, .3);
	cursor: pointer;
	z-index: 9990;
}

.etm-f-declencheur__compteur {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.4em;
	height: 1.4em;
	padding: 0 .35em;
	border-radius: 999px;
	background: var(--etm-f-accent);
	font-size: .74rem;
}

.etm-f-voile {
	position: fixed;
	inset: 0;
	background: rgba(16, 30, 44, .45);
	opacity: 0;
	transition: opacity .2s ease;
	z-index: 9998;
}

.etm-f-voile.est-visible {
	opacity: 1;
}

@media (max-width: 899px) {
	/* Le bouton et le panneau coulissant supposent JavaScript : sans lui,
	   les filtres restent affichés en pleine largeur et parfaitement
	   utilisables par envoi de formulaire. */
	.etm-f-js .etm-f-declencheur {
		display: inline-flex;
	}

	.etm-f-js .etm-f {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		display: flex;
		flex-direction: column;
		width: min(400px, 100%);
		background: var(--etm-f-fond);
		box-shadow: 0 12px 40px rgba(16, 30, 44, .2);
		transform: translateX(100%);
		transition: transform .25s cubic-bezier(.32, .72, 0, 1);
		z-index: 9999;
	}

	.etm-f-js .etm-f.est-ouvert {
		transform: translateX(0);
	}

	.etm-f-js .etm-f__entete {
		display: flex;
		flex: 0 0 auto;
	}

	.etm-f-js .etm-f__groupes {
		flex: 1 1 auto;
		overflow-y: auto;
		padding: 0 1.25rem 1rem;
		-webkit-overflow-scrolling: touch;
	}

	.etm-f-js .etm-f-actifs {
		flex: 0 0 auto;
		padding: .75rem 1.25rem;
	}

	.etm-f-js .etm-f__actions {
		flex: 0 0 auto;
		padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom));
		border-top: 1px solid var(--etm-f-trait);
	}

	/* Sur mobile le bouton reste utile : il ferme le panneau. */
	.etm-f-js .etm-f--js .etm-f__actions {
		display: block;
	}

	.etm-f-zone--auto {
		position: static;
		width: auto;
		margin: 0;
	}

	.etm-f-logos {
		grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.etm-f,
	.etm-f-voile,
	.etm-f-cible,
	.etm-f-groupe__chevron {
		transition: none;
	}
}
