/**
 * Loaders Midi — page, recherche AJAX, barre NProgress
 */

@keyframes midi-bar-bounce {
	0%,
	80%,
	100% {
		transform: scaleY(0.45);
		opacity: 0.45;
	}
	40% {
		transform: scaleY(1);
		opacity: 1;
	}
}

@keyframes midi-ring-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Barre de progression page (NProgress) */
#nprogress .bar {
	height: 4px !important;
	background: linear-gradient(
		90deg,
		var(--midi-orange-dark, #e65100),
		var(--midi-orange, #ff6b00),
		var(--midi-orange-light, #ff8c42)
	) !important;
}

#nprogress .peg {
	box-shadow: 0 0 12px rgba(255, 107, 0, 0.45), 0 0 6px rgba(255, 107, 0, 0.35) !important;
}

#nprogress .spinner {
	display: none !important;
}

/* Preloader plein écran — visible au chargement, masqué avec .fade-in (Martfury) */
.mf-preloader .martfury-preloader:not(.fade-in) {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	background: rgba(255, 255, 255, 0.97) !important;
	backdrop-filter: blur(6px);
}

.mf-preloader .martfury-preloader.fade-in {
	display: none !important;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.mf-preloader .martfury-preloader .midi-loader {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 6px;
	height: 28px;
}

.mf-preloader .martfury-preloader .midi-loader__bar {
	display: block;
	width: 4px;
	height: 22px;
	border-radius: 3px;
	background: var(--midi-orange, #ff6b00);
	animation: midi-bar-bounce 1s ease-in-out infinite;
}

.mf-preloader .martfury-preloader .midi-loader__bar:nth-child(2) {
	animation-delay: 0.15s;
	height: 28px;
}

.mf-preloader .martfury-preloader .midi-loader__bar:nth-child(3) {
	animation-delay: 0.3s;
	height: 18px;
}

.mf-preloader .martfury-preloader .midi-loader__label {
	margin: 18px 0 0;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--midi-gray-text, #666);
}

/* Loader recherche AJAX — entre le champ et le bouton Rechercher */
.header-layout-3 #site-header .product-extra-search .psearch-content .midi-search-loader,
.header-layout-3 #site-header .product-extra-search .search-wrapper .midi-search-loader {
	position: absolute;
	right: calc(var(--midi-search-btn-width, 130px) + 12px);
	top: 50%;
	transform: translateY(-50%);
	display: none;
	align-items: flex-end;
	justify-content: center;
	gap: 5px;
	height: 20px;
	z-index: 20;
	pointer-events: none;
}

.header-layout-3 #site-header .product-extra-search .psearch-content .midi-search-loader span,
.header-layout-3 #site-header .product-extra-search .search-wrapper .midi-search-loader span {
	display: block;
	width: 3px;
	height: 14px;
	border-radius: 2px;
	background: var(--midi-orange, #ff6b00);
	animation: midi-bar-bounce 0.85s ease-in-out infinite;
}

.header-layout-3 #site-header .product-extra-search .psearch-content .midi-search-loader span:nth-child(2),
.header-layout-3 #site-header .product-extra-search .search-wrapper .midi-search-loader span:nth-child(2) {
	animation-delay: 0.12s;
	height: 18px;
}

.header-layout-3 #site-header .product-extra-search .psearch-content .midi-search-loader span:nth-child(3),
.header-layout-3 #site-header .product-extra-search .search-wrapper .midi-search-loader span:nth-child(3) {
	animation-delay: 0.24s;
	height: 10px;
}

.header-layout-3 #site-header .product-extra-search .products-search.searching .psearch-content .midi-search-loader,
.header-layout-3 #site-header .product-extra-search .products-search.searching .search-wrapper .midi-search-loader {
	display: flex !important;
}

.header-layout-3 #site-header .product-extra-search .products-search.searching .search-field {
	padding-right: 44px;
}

/* Fallback global (mobile, autres layouts) */
.midi-search-loader {
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%);
	display: none;
	align-items: flex-end;
	justify-content: center;
	gap: 5px;
	height: 18px;
	z-index: 10;
	pointer-events: none;
}

.midi-search-loader span {
	display: block;
	width: 3px;
	height: 14px;
	border-radius: 2px;
	background: var(--midi-orange, #ff6b00);
	animation: midi-bar-bounce 0.85s ease-in-out infinite;
}

.midi-search-loader span:nth-child(2) {
	animation-delay: 0.12s;
	height: 18px;
}

.midi-search-loader span:nth-child(3) {
	animation-delay: 0.24s;
	height: 10px;
}

.products-search.searching .midi-search-loader {
	display: flex !important;
}

.products-search.searching .search-field {
	padding-right: 38px;
}

/* Loader générique (.mf-loading) */
.mf-loading::before {
	border: none !important;
	width: 38px !important;
	height: 38px !important;
	background: conic-gradient(from 0deg, transparent 0 300deg, var(--midi-orange, #ff6b00) 300deg 360deg);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
	mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
	animation: midi-ring-spin 0.75s linear infinite !important;
}
