/* =========================================================
   Boutique - filtres YITH en version mobile / tablette
   (<= 921px = point de rupture ou Astra empile la sidebar)
   - la barre laterale passe AVANT la grille produits
   - chaque filtre devient une puce (Domaines / Categories / Marques)
     qui ouvre son panneau de cases a cocher en dessous
   Desktop : aucun changement.
   ========================================================= */
@media (max-width: 921px) {

	/* Sidebar avant les produits (Astra force column-reverse) */
	body.woocommerce.ast-left-sidebar #content > .ast-container {
		flex-direction: column;
	}

	body.woocommerce #secondary {
		width: 100%;
		margin: 30px 0 20px;
		padding: 0;
	}

	/* On aplatit toute la hierarchie pour que puces et panneaux
	   soient des enfants directs d'une meme ligne flex */
	body.woocommerce #secondary .sidebar-main {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		margin: 0;
		padding: 0;
		background: none;
		border: 0;
		box-shadow: none;
	}
	body.woocommerce #secondary .sidebar-main > .ast-filter-wrap,
	body.woocommerce #secondary .ast-woo-sidebar-widget,
	body.woocommerce #secondary .yith-wcan-filters,
	body.woocommerce #secondary .yith-wcan-filters .filters-container,
	body.woocommerce #secondary .yith-wcan-filters form,
	body.woocommerce #secondary .yith-wcan-filter {
		display: contents;
	}

	/* Puce = titre du filtre */
	body.woocommerce #secondary .yith-wcan-filter > .filter-title {
		position: relative;
		flex: 0 0 auto;
		margin: 0;
		padding: 10px 34px 10px 14px;
		font-size: 14px;
		font-weight: 600;
		line-height: 1.2;
		color: #1D779C;
		background: #fff;
		border: 1px solid #1D779C;
		border-radius: 999px;
		cursor: pointer;
		user-select: none;
		-webkit-tap-highlight-color: transparent;
	}
	body.woocommerce #secondary .yith-wcan-filter > .filter-title::after {
		content: "";
		position: absolute;
		right: 14px;
		top: 50%;
		width: 7px;
		height: 7px;
		border-right: 2px solid currentColor;
		border-bottom: 2px solid currentColor;
		transform: translateY(-70%) rotate(45deg);
		transition: transform .2s ease;
	}
	body.woocommerce #secondary .yith-wcan-filter.np-open > .filter-title {
		color: #fff;
		background: #1D779C;
	}
	body.woocommerce #secondary .yith-wcan-filter.np-open > .filter-title::after {
		transform: translateY(-20%) rotate(-135deg);
	}
	/* Pastille quand un choix est actif dans ce filtre */
	body.woocommerce #secondary .yith-wcan-filter.np-has-active > .filter-title::before {
		content: "";
		position: absolute;
		top: -3px;
		right: -2px;
		width: 11px;
		height: 11px;
		border-radius: 50%;
		background: #e5a52a;
		border: 2px solid #fff;
	}

	/* Panneau du filtre : pleine largeur, sous la ligne de puces */
	body.woocommerce #secondary .yith-wcan-filter > .filter-content {
		display: none;
		flex: 0 0 100%;
		order: 10;
		margin: 0;
		padding: 14px 16px;
		background: #fff;
		border: 1px solid #dfe5e7;
		border-radius: 12px;
	}
	body.woocommerce #secondary .yith-wcan-filter.np-open > .filter-content {
		display: block;
	}
	body.woocommerce #secondary .filter-content .filter-items {
		margin: 0;
		padding: 0;
		list-style: none;
	}
	body.woocommerce #secondary .filter-content .filter-item {
		margin: 0 0 6px;
		font-size: 15px;
	}
	body.woocommerce #secondary .filter-content .filter-item:last-child {
		margin-bottom: 0;
	}
	body.woocommerce #secondary .filter-content .filter-item label {
		display: block;
		padding: 6px 0;
	}

	/* Bouton "Tous les produits" : meme gabarit que les puces, en fin de ligne */
	body.woocommerce #secondary .widget_block .wp-block-buttons {
		order: 5;
		margin: 0;
	}
	body.woocommerce #secondary .widget_block .wp-block-button {
		margin: 0;
	}
	body.woocommerce #secondary .widget_block .wp-block-button__link {
		padding: 10px 14px;
		font-size: 14px;
		line-height: 1.2;
		border-radius: 999px;
	}

	/* Elements injectes par YITH (reset, filtres actifs) : pleine largeur sous les puces */
	body.woocommerce #secondary .yith-wcan-reset-filters,
	body.woocommerce #secondary .yith-wcan-active-filters,
	body.woocommerce #secondary .yith-wcan-filters .apply-filters {
		flex: 0 0 100%;
		order: 11;
		margin: 0;
	}
}
