/* ==========================================================================
   WC Image Fixer
   قاب ثابت برای عکس‌های محصول ووکامرس + پس‌زمینه بلور و زوم‌شده
   ========================================================================== */

.wcif-frame {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: var(--wcif-radius, 8px);
	background: #f3f3f3;
	/* aspect-ratio مدرن، با پشتیبان padding-top برای مرورگرهای قدیمی */
	aspect-ratio: var(--wcif-ratio-w, 1) / var(--wcif-ratio-h, 1);
	display: block;
}

/* پشتیبان مرورگرهایی که aspect-ratio را نمی‌شناسند */
@supports not (aspect-ratio: 1 / 1) {
	.wcif-frame {
		height: 0;
		padding-top: var(--wcif-ratio-pt, 100%);
	}
	.wcif-frame > * {
		position: absolute;
		top: 0;
		right: 0;
		left: 0;
		bottom: 0;
	}
}

/* لایه پس‌زمینه بلور (فقط وقتی عکس با قاب هم‌خوانی ندارد ساخته می‌شود) */
.wcif-frame .wcif-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	filter: blur(var(--wcif-blur, 25px));
	transform: scale(var(--wcif-zoom, 1.35));
	z-index: 1;
}

/* تیرگی ملایم روی پس‌زمینه بلور برای خوانایی بهتر عکس اصلی */
.wcif-frame .wcif-bg::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, var(--wcif-overlay, 0.15));
}

/* عکس اصلی (و در صورت وجود عکس هاور) همیشه کامل، بدون برش و دقیقاً روی هم قرار می‌گیرند
   تا تعویض عکس با هاور هیچ‌وقت باعث تغییر ابعاد/جابه‌جایی کارت محصول نشود */
.wcif-frame img.wcif-main-img {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	display: block;
	margin: auto;
}

/* تا وقتی جاوااسکریپت اجرا نشده، لودینگ ساده نشان بده تا پرش تصویری نداشته باشیم */
.wcif-frame:not(.wcif-ready) {
	background: linear-gradient(90deg, #ececec 25%, #f7f7f7 50%, #ececec 75%);
	background-size: 200% 100%;
	animation: wcif-shimmer 1.4s infinite;
}
@keyframes wcif-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* اطمینان از عدم شکستن گرید محصولات ووکامرس */
.woocommerce ul.products li.product .wcif-frame,
.woocommerce-page ul.products li.product .wcif-frame {
	margin-bottom: 0.5em;
}

/* گالری صفحه تک محصول: تصویر اصلی و بندانگشتی‌ها هم قاب یکسان بگیرند */
.woocommerce div.product div.images .woocommerce-product-gallery__image {
	overflow: visible;
}
.woocommerce div.product div.images .wcif-frame {
	border-radius: var(--wcif-radius, 8px);
}

/* آیتم‌های سبد خرید / تسویه حساب */
.woocommerce-cart table.cart img.wcif-main-img,
.woocommerce-checkout .wcif-frame {
	max-width: 100%;
}
.woocommerce-cart table.cart td.product-thumbnail .wcif-frame,
.cart_item .wcif-frame {
	width: 64px;
	height: 64px;
	aspect-ratio: 1 / 1;
}

/* ویجت‌ها (پرفروش‌ترین، اخیراً بازدید شده و ...) */
.widget_products .wcif-frame,
.widget_top_rated_products .wcif-frame,
.widget_recent_reviews .wcif-frame {
	width: 60px;
	height: 60px;
	aspect-ratio: 1 / 1;
	flex-shrink: 0;
}
