/* ==========================================================
   EF Category Boost — Mobile Category Page
   Compatible Flatsome + WooCommerce
   Mobile only (< 768px)
   ========================================================== */

.efcb-mobile-product { display: none !important; }
.efcb-toolbar { display: none; }
.efcb-cat-header { display: none; }
.efcb-toolbar--desktop { display: none; }
.efcb-toolbar--mobile { display: none; }

@media (max-width: 767px) {

	/* Masquer éléments inutiles */
	#discount-btn { display: none !important; }
	.efcb-cat-header { display: block !important; }
	.efcb-toolbar--desktop { display: none !important; }

	/* Z-INDEX */
	.mfp-wrap, .mfp-bg, #main-menu,
	.off-canvas-left, .off-canvas-right, .sidebar-menu,
	#shop-sidebar, .off-canvas-overlay, .mfp-content { z-index: 9999 !important; }
	.header-main, .header-wrapper, #header { z-index: 1000 !important; }

	/* Masquer header Flatsome catégorie */
	.shop-page-title.category-page-title,
	.category-page-title,
	.page-title.category-page-title,
	.category-filtering.category-filter-row,
	.term-description,
	.woocommerce-products-header__description,
	.custom-category-header,
	.custom-page-title { display: none !important; }

	/* ── HEADER CATÉGORIE ── */

	.efcb-cat-header {
		padding: 0 15px 0;
		margin-top: -18px;
		background: #fff;
	}

	.efcb-cat-header__breadcrumb {
		font-size: 13px;
		color: #888;
		margin-bottom: 20px;
		line-height: 1.4;
		text-transform: uppercase;
	}

	.efcb-cat-header__breadcrumb a { color: #888; text-decoration: none; text-transform: uppercase; }
	.efcb-cat-header__breadcrumb strong { color: #333; text-transform: uppercase; }

	/* Body: image left + text right when image exists */
	.efcb-cat-header__body.has-image {
		display: flex;
		flex-direction: row;
		gap: 12px;
		align-items: flex-start;
	}

	.efcb-cat-header__body.has-image .efcb-cat-header__image {
		flex-shrink: 0;
		width: 90px;
		border-radius: 6px;
		overflow: hidden;
	}

	.efcb-cat-header__body.has-image .efcb-cat-header__img {
		width: 100%;
		height: auto;
		display: block;
		border-radius: 6px;
	}

	.efcb-cat-header__body.has-image .efcb-cat-header__text {
		flex: 1;
		min-width: 0;
	}

	/* Without image — normal flow */
	.efcb-cat-header__image { margin-bottom: 10px; border-radius: 6px; overflow: hidden; }
	.efcb-cat-header__img { width: 100%; height: auto; display: block; border-radius: 6px; }

	.efcb-cat-header__title { font-size: 20px; font-weight: 700; color: #111; margin: 0 0 2px; line-height: 1.2; }
	.efcb-cat-header__count { font-size: 12px; color: #888; display: block; margin-bottom: 6px; }

	.efcb-cat-header__desc-wrap { margin-bottom: 4px; }
	.efcb-cat-header__desc {
		font-size: 12px; line-height: 1.4; color: #555;
		display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	}
	.efcb-cat-header__desc-wrap.expanded .efcb-cat-header__desc { -webkit-line-clamp: unset; display: block; }
	.efcb-cat-header__more { background: none; border: none; padding: 4px 0; font-size: 12px; font-weight: 600; color: var(--efcb-primary); cursor: pointer; }

	/* ── TOOLBAR ── */

	.efcb-toolbar--mobile {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center;
		padding: 10px 15px;
		margin-top: -10px;
		border-bottom: none;
		position: relative;
		background: #fff;
		position: sticky;
		top: 0;
		z-index: 99;
		gap: 0;
	}

	.efcb-toolbar::after {
		content: '';
		position: absolute;
		bottom: 0;
		left: -9999px;
		right: -9999px;
		height: 1px;
		background: #e0e0e0;
	}

	.efcb-toolbar__filter {
		display: flex; align-items: center; gap: 5px;
		background: none; border: none; padding: 0; margin: 0;
		font-size: 14px; font-weight: 600; color: #333;
		cursor: pointer; text-decoration: none; white-space: nowrap; flex-shrink: 0;
	}

	.efcb-toolbar__filter svg { width: 16px; height: 16px; flex-shrink: 0; }

	.efcb-toolbar__sort-btn {
		flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
		background: none; border: none; padding: 0; margin-left: 20px; margin-top: 12px;
		font-size: 13px; font-weight: 600; color: #333; cursor: pointer; white-space: nowrap; min-width: 0;
	}

	.efcb-toolbar__sort-btn span { overflow: hidden; text-overflow: ellipsis; }
	.efcb-toolbar__sort-btn svg { flex-shrink: 0; }

	/* Bottom sheet */
	.efcb-sort-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 10000; }
	.efcb-sort-overlay.open { display: block; }

	.efcb-sort-sheet {
		display: none; position: fixed; bottom: 0; left: 0; right: 0;
		background: #fff; border-radius: 14px 14px 0 0; z-index: 10001;
		padding: 0 0 20px; max-height: 60vh; overflow-y: auto;
	}
	.efcb-sort-sheet.open { display: block; }

	.efcb-sort-sheet__header {
		display: flex; align-items: center; justify-content: space-between;
		padding: 16px 20px 12px; font-size: 16px; font-weight: 700; color: #111; border-bottom: 1px solid #eee;
	}
	.efcb-sort-sheet__close { background: none; border: none; font-size: 24px; color: #888; cursor: pointer; padding: 0; line-height: 1; }

	.efcb-sort-sheet__option {
		display: flex; align-items: center; justify-content: space-between;
		padding: 14px 20px; font-size: 14px; color: #333; text-decoration: none; border-bottom: 1px solid #f5f5f5;
	}
	.efcb-sort-sheet__option.active { color: var(--efcb-primary); font-weight: 600; }
	.efcb-sort-sheet__option:last-child { border-bottom: none; }

	.efcb-toolbar__view-btn {
		background: none; border: none; padding: 4px; margin: 0;
		cursor: pointer; opacity: 0.3; transition: opacity 0.15s; line-height: 0; flex-shrink: 0;
	}
	.efcb-toolbar__view-btn + .efcb-toolbar__view-btn { margin-left: 2px; }
	.efcb-toolbar__view-btn.active { opacity: 1; }
	.efcb-toolbar__view-btn svg { width: 22px; height: 22px; fill: #333; }

	/* ── VISIBILITÉ ── */

	.efcb-desktop-product {
		display: none !important;
	}

	.efcb-mobile-product {
		display: block !important;
		width: 100% !important; max-width: 100% !important;
		padding: 0 !important; margin: 0 !important; float: none !important;
	}

	/* ── VUE GRILLE ── */

	.products.efcb-view-grid {
		display: grid !important;
		grid-template-columns: 1fr 1px 1fr;
		margin: 0 !important; padding: 0 !important; gap: 0; background: #fff;
	}

	.products.efcb-view-grid::after {
		content: ''; grid-column: 2; grid-row: 1 / span 999; background: #e0e0e0;
	}

	.efcb-view-grid .efcb-desktop-product { display: none !important; }

	.efcb-view-grid .efcb-mobile-product {
		padding: 10px 12px !important; margin: 0 !important;
		box-sizing: border-box; background: #fff; position: relative;
	}

	.efcb-view-grid .efcb-mobile-product::after {
		content: ''; position: absolute; bottom: 0; left: -12px; right: -12px; height: 1px; background: #e0e0e0;
	}

	.efcb-view-grid .efcb-card {
		display: flex; flex-direction: column; border: none; border-radius: 0;
		padding: 0; gap: 0; height: 100%; background: #fff;
	}

	.efcb-view-grid .efcb-card__image-link {
		width: 100%; height: 190px; border-radius: 4px; background: #f5f5f5;
		display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative;
	}

	.efcb-view-grid .efcb-card__info { padding: 8px 4px 6px; gap: 4px; display: flex; flex-direction: column; }
	.efcb-view-grid .efcb-card__category { font-size: 10px; text-transform: uppercase; color: #888; font-weight: 600; letter-spacing: 0.3px; }
	.efcb-view-grid .efcb-card__title { font-size: 13px !important; -webkit-line-clamp: 2; }
	.efcb-view-grid .efcb-card__price { font-size: 15px; font-weight: 700; color: #c2185b; }
	.efcb-view-grid .efcb-card__rating .star-rating { font-size: 11px; }
	.efcb-view-grid .efcb-card__rating-count { font-size: 11px; }
	.efcb-view-grid .efcb-badge { font-size: 11px; }

	/* In grid mobile: stock row is simple, no flex */
	.efcb-view-grid .efcb-card__stock-row {
		display: block;
	}
	.efcb-view-grid .efcb-card__atc { display: none !important; }
	.efcb-view-grid .efcb-card__actions { display: none !important; }

	/* Masquer quickview + actions desktop sur mobile */
	.efcb-card__quickview { display: none !important; }
	.efcb-card__actions { display: none !important; }

	/* Hide inline ATC + actions + voir le panier in grid view on mobile — always */
	.efcb-view-grid .efcb-card__atc-inline,
	.efcb-view-grid .efcb-card__actions,
	.efcb-view-grid .added_to_cart,
	.efcb-view-grid .efcb-card__stock-row .added_to_cart { display: none !important; }

	/* Stock row — badge left, ATC right */
	.efcb-card__stock-row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
		margin-top: 2px;
	}

	.efcb-card__atc-inline {
		display: inline-flex;
		align-items: center;
		gap: 4px;
		background: var(--efcb-primary);
		color: #fff;
		border: 2px solid var(--efcb-primary);
		border-radius: 99px;
		padding: 6px 12px;
		font-size: 11px;
		font-weight: 600;
		cursor: pointer;
		line-height: 1.4;
		text-transform: none;
		text-decoration: none;
		white-space: nowrap;
		flex-shrink: 0;
	}

	.efcb-card__atc-inline svg { flex-shrink: 0; }
	.efcb-card__atc-inline.efcb-atc--outofstock { background: #bbb; cursor: not-allowed; border-color: #bbb; }
	.efcb-card__atc-inline.added { display: none !important; }

	/* Compact ATC in mobile list */
	.efcb-view-list .efcb-card__atc-inline {
		padding: 4px 10px !important;
		font-size: 10px !important;
		line-height: 1.4 !important;
		border-width: 1.5px !important;
	}
	.efcb-card__atc-inline.loading::after {
		content: ''; display: inline-block; width: 10px; height: 10px;
		border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
		border-radius: 50%; animation: efcb-spin 0.6s linear infinite; margin-left: 4px;
	}

	/* After add to cart: hide ATC, show "Voir le panier" */
	.efcb-card__atc-inline.added,
	a.efcb-card__atc-inline.added { display: none !important; }
	.efcb-card__stock-row .added_to_cart,
	.efcb-card__info .added_to_cart,
	.efcb-card .added_to_cart {
		display: inline-flex !important;
		align-items: center;
		gap: 4px;
		background: transparent !important;
		color: var(--efcb-primary) !important;
		border: 2px solid var(--efcb-primary) !important;
		border-radius: 99px !important;
		padding: 0 12px !important;
		font-size: 13px !important;
		font-weight: 600 !important;
		text-decoration: none !important;
		white-space: nowrap;
		line-height: 2.19em !important;
	}

	/* Hide inline ATC in grid (unless option) */
	.efcb-view-grid .efcb-card__atc-inline { display: none !important; }
	.efcb-show-atc-grid .efcb-view-grid .efcb-card__atc-inline { display: inline-flex !important; }

	/* ── VUE LISTE ── */

	.products.efcb-view-list {
		display: grid !important; grid-template-columns: 1fr;
		margin: 0 !important; padding: 0 !important; gap: 0;
	}

	.efcb-view-list .efcb-desktop-product { display: none !important; }

	.efcb-view-list .efcb-mobile-product {
		padding: 0 !important; margin: 0 !important;
		box-sizing: border-box; background: #fff; position: relative;
	}

	.efcb-view-list .efcb-mobile-product::after {
		content: ''; position: absolute; bottom: 0; left: -9999px; right: -9999px; height: 1px; background: #e0e0e0;
	}

	.efcb-view-list .efcb-mobile-product:first-of-type::before {
		content: ''; position: absolute; top: 0; left: -9999px; right: -9999px; height: 1px; background: #e0e0e0;
	}

	.efcb-view-list .efcb-card {
		display: flex; flex-direction: row; align-items: stretch; flex-wrap: wrap;
		background: #fff; border: none; border-radius: 0; padding: 12px; gap: 12px;
	}

	.efcb-view-list .efcb-card__image-link {
		flex-shrink: 0; width: 120px; height: 150px; border-radius: 0; background: #f8f8f8;
		display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative;
	}

	.efcb-view-list .efcb-card__info {
		gap: 4px; padding: 0; display: flex; flex-direction: column; justify-content: center; flex: 1; min-width: 0;
	}

	.efcb-view-list .efcb-card__actions {
		width: 100%;
	}

	.efcb-view-list .efcb-card__category { font-size: 11px; text-transform: uppercase; color: #888; font-weight: 600; letter-spacing: 0.3px; }
	.efcb-view-list .efcb-card__title { font-size: 14px !important; -webkit-line-clamp: 3; }
	.efcb-view-list .efcb-card__price { font-size: 16px; font-weight: 700; color: var(--efcb-primary); }

	/* Hide old big ATC button in mobile list */
	.efcb-view-list .efcb-card__atc {
		display: none !important;
	}

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

	/* ── COMMUNS ── */

	.efcb-card__img { width: 100% !important; height: 100% !important; object-fit: contain; }

	.efcb-card__sale-badge {
		position: absolute; top: 6px; left: 6px; background: #e74c3c; color: #fff;
		font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px; line-height: 1.4; text-transform: uppercase;
	}

	.efcb-card__title-link { text-decoration: none; color: inherit; }

	.efcb-card__title {
		font-size: 14px !important; font-weight: 600 !important; line-height: 1.35 !important;
		color: #111 !important; margin: 0 !important; padding: 0 !important;
		display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
		overflow: hidden; text-overflow: ellipsis; height: auto !important; text-transform: none !important;
	}

	.efcb-card__rating { display: flex; align-items: center; gap: 4px; }
	.efcb-card__rating .star-rating { font-size: 12px; margin: 0; }
	.efcb-card__rating-count { font-size: 12px; color: #666; }

	.efcb-card__price del { font-size: 12px; font-weight: 400; color: #999; }
	.efcb-card__price ins { text-decoration: none; font-weight: 700; }

	.efcb-badge { font-size: 12px; font-weight: 600; line-height: 1; display: flex; align-items: center; gap: 4px; }
	.efcb-badge::before { content: '●'; font-size: 8px; }
	.efcb-badge--instock { color: #067d06; }
	.efcb-badge--onorder { color: #d68000; }
	.efcb-badge--outofstock { color: #333; }

} /* fin @media */
