/**
 * BH Publications Filter — styles front (mode A1-b).
 * Ne style QUE l'UI de filtres (le listing est rendu par Elementor Pro).
 * Volontairement neutre et surchargeable (variables CSS).
 */

.bhpf-app {
	--bhpf-radius: 8px;
	--bhpf-border: #e2e2e2;
	--bhpf-muted: #666;
	--bhpf-accent: #273E6D;
	--bhpf-bg-soft: #f6f7f9;
}

/* --- Groupes de filtres --- */
.bhpf-filter-group {
	margin-bottom: 1.5rem;
}

.bhpf-filter-group fieldset {
	border: 0;
	margin: 0;
	padding: 0;
}

.bhpf-filter-legend {
	font-family: 'Raleway', sans-serif;
	font-size: 26px;
	font-weight: 400;
	color: #273E6D;
	margin: 0.5em 0 0.2em 0;
	padding: 0;
}

.bhpf-filter-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bhpf-filter-item {
	margin: 0 0 0.35rem;
}

.bhpf-filter-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	line-height: 1.3;
}

.bhpf-checkbox {
	width: 1.1rem;
	height: 1.1rem;
	flex: 0 0 auto;
	accent-color: var(--bhpf-accent);
	cursor: pointer;
}

.bhpf-filter-text {
	font-size: 0.95rem;
}

/* Focus visible clavier */
.bhpf-checkbox:focus-visible,
.bhpf-app button:focus-visible {
	outline: 3px solid var(--bhpf-accent);
	outline-offset: 2px;
}

/* --- Compteur --- */
.bhpf-counter {
	font-weight: 600;
	color: var(--bhpf-muted);
	margin: 0.75rem 0;
}

/* --- Filtres actifs --- */
.bhpf-active-list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.75rem 0;
	padding: 0;
}

.bhpf-active-remove {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	background: var(--bhpf-bg-soft);
	border: 1px solid var(--bhpf-border);
	border-radius: 999px;
	padding: 0.25rem 0.75rem;
	font-size: 0.85rem;
	cursor: pointer;
	color: inherit;
}

.bhpf-active-remove:hover {
	background: #ececef;
}

.bhpf-active-x {
	font-size: 1.1em;
	line-height: 1;
}

.bhpf-clear {
	background: none;
	border: 0;
	color: var(--bhpf-accent);
	text-decoration: underline;
	cursor: pointer;
	font-size: 0.85rem;
	padding: 0.25rem 0;
}

/* --- État de chargement --- */
/* Sur l'UI de filtres : petit spinner coin haut droite. */
.bhpf-app {
	position: relative;
}

.bhpf-is-loading::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	width: 1.25rem;
	height: 1.25rem;
	border: 3px solid var(--bhpf-border);
	border-top-color: var(--bhpf-accent);
	border-radius: 50%;
	animation: bhpf-spin 0.7s linear infinite;
}

/* Sur le widget Elementor cible pendant le chargement. */
.bhpf-target-loading {
	opacity: 0.5;
	transition: opacity 0.15s ease;
	pointer-events: none;
}

@keyframes bhpf-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.bhpf-is-loading::after,
	.bhpf-target-loading {
		transition: none;
		animation: none;
	}
}

/* --- Pagination : scroll infini (load more maison) --- */
.bhpf-scroll-sentinel {
	width: 100%;
	height: 1px;
	margin: 0;
	padding: 0;
	pointer-events: none;
}

/* Masque l'ancre « load more » native d'Elementor, neutralisée au profit
   de notre pagination qui conserve les filtres actifs. */
.e-load-more-anchor.bhpf-native-lm-off {
	display: none !important;
}

/* Indicateur de chargement discret pendant un append de page. */
.bhpf-target-loading {
	position: relative;
}
.bhpf-target-loading::after {
	content: "";
	display: block;
	width: 100%;
	height: 2px;
	margin-top: 8px;
	background: linear-gradient( 90deg, transparent, var(--bhpf-accent, #1a4b8c), transparent );
	animation: bhpf-lm-pulse 1s ease-in-out infinite;
}
@keyframes bhpf-lm-pulse {
	0%, 100% { opacity: 0.25; }
	50% { opacity: 1; }
}
@media ( prefers-reduced-motion: reduce ) {
	.bhpf-target-loading::after { animation: none; opacity: 0.6; }
}
