/**
 * Lazy load — placeholder و انیمیشن بارگذاری
 *
 * @package NextShop
 */

.nextshop-lazy-wrap {
	position: relative;
	display: inline-block;
	max-width: 100%;
	overflow: hidden;
	/*
	background: linear-gradient(135deg, var(--ns-bg) 0%, color-mix(in srgb, var(--ns-bg) 50%, transparent) 50%, var(--ns-bg) 100%);
	-*/
	border-radius: inherit;
	vertical-align: middle;
}

.nextshop-lazy-wrap img.nextshop-lazy-img {
	display: block;
	max-width: 100%;
	height: auto;
	opacity: 0;
	transform: scale(1.02);
	transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.nextshop-lazy-wrap.is-loaded img.nextshop-lazy-img {
	opacity: 1;
	transform: scale(1);
}

.nextshop-lazy-placeholder {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	transition: opacity 0.35s ease, visibility 0.35s ease;
}

.nextshop-lazy-wrap.is-loaded .nextshop-lazy-placeholder {
	opacity: 0;
	visibility: hidden;
}

/* Shimmer */
.nextshop-lazy-shimmer {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		105deg,
		transparent 0%,
		transparent 40%,
		rgba(255, 255, 255, 0.55) 50%,
		transparent 60%,
		transparent 100%
	);
	background-size: 200% 100%;
	animation: nextshop-lazy-shimmer 1.6s ease-in-out infinite;
}

@keyframes nextshop-lazy-shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* Spinner */
.nextshop-lazy-spinner {
	position: relative;
	z-index: 2;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 3px solid rgba(0, 0, 0, 0.06);
	border-top-color: var(--ns-primary, #ef394e);
	border-right-color: var(--ns-primary, #ef394e);
	animation: nextshop-lazy-spin 0.75s linear infinite;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

@keyframes nextshop-lazy-spin {
	to {
		transform: rotate(360deg);
	}
}

/* بلوک‌های تم — پر کردن فضای والد */
.nextshop-cat-img-wrapper .nextshop-lazy-wrap,
.nextshop-post-thumb .nextshop-lazy-wrap,
.nextshop-product-grid .nextshop-lazy-wrap,
.woocommerce ul.products li.product .nextshop-lazy-wrap {
	display: block;
	width: 100%;
}

.nextshop-cat-img-wrapper .nextshop-lazy-wrap img,
.nextshop-post-thumb .nextshop-lazy-wrap img,
.woocommerce ul.products li.product .nextshop-lazy-wrap img {
	width: 100%;
}

.nextshop-main-slider__slide .nextshop-lazy-wrap {
	display: block;
	width: 100%;
	height: 100%;
}

.nextshop-main-slider__slide .nextshop-lazy-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
	.nextshop-lazy-shimmer,
	.nextshop-lazy-spinner {
		animation: none;
	}

	.nextshop-lazy-wrap img.nextshop-lazy-img {
		transition: opacity 0.2s ease;
	}
}
