/**
 * گالری موبایل فروشگاه — تا عرض ۷۸۲px.
 * دکمه در ul.rey-viewSelector-list-mb: اندازه هم‌تراز با li[data-count="2"] در REY.
 */

.iddd-gallery-price-onimg {
	display: none !important;
	pointer-events: none;
	box-sizing: border-box;
}

.iddd-gallery-price-below {
	display: none !important;
	box-sizing: border-box;
}

.rey-viewSelector-list-mb {
	--iddd-vs-cell: calc((var(--mobile-box-size, 18px) - 2px) / 2);
}

.rey-viewSelector-list-mb > li.iddd-shop-gallery-fab-item {
	box-sizing: border-box;
	display: flex !important;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	align-self: center;
	width: calc(var(--iddd-vs-cell, 8px) * 2 + 2px);
	height: calc(var(--iddd-vs-cell, 8px) * 2 + 2px);
	margin: 0;
	padding: 0;
	list-style: none;
	grid-template-columns: unset !important;
	cursor: pointer;
}

.iddd-shop-gallery-fab {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	border: 0;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.iddd-shop-gallery-fab:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.iddd-shop-gallery-fab.iddd-shop-gallery-fab--inline {
	position: relative;
	z-index: 3;
	display: flex;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	border-radius: 2px;
	border: 1px solid var(--mobile-color, HSL(var(--neutral-10)));
	box-shadow: none;
	background: var(--mobile-bg-color, transparent);
	color: var(--mobile-color, HSL(var(--neutral-10)));
	opacity: 0.45;
}

.rey-viewSelector-list-mb > li.iddd-shop-gallery-fab-item:hover .iddd-shop-gallery-fab--inline,
.rey-viewSelector-list-mb > li.iddd-shop-gallery-fab-item.is-active .iddd-shop-gallery-fab--inline {
	opacity: 1;
}

/* آیکن SVG داخل دکمه */
.iddd-shop-gallery-fab__svg {
	display: block;
	flex-shrink: 0;
}

.iddd-shop-gallery-fab.iddd-shop-gallery-fab--inline .iddd-shop-gallery-fab__svg {
	width: 82%;
	height: 82%;
	max-width: 17px;
	max-height: 17px;
}

.iddd-shop-gallery-fab.iddd-shop-gallery-fab--floating {
	position: fixed;
	z-index: 99998;
	bottom: max(14px, env(safe-area-inset-bottom, 0px));
	right: max(14px, env(safe-area-inset-right, 0px));
	left: auto;
	display: none;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: 0;
	opacity: 1;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
	background: var(--accent-color, #111);
	color: var(--accent-text-color, #fff);
}

.iddd-shop-gallery-fab.iddd-shop-gallery-fab--floating .iddd-shop-gallery-fab__svg {
	width: 24px;
	height: 24px;
	max-width: none;
	max-height: none;
}

.iddd-shop-gallery-fab.iddd-shop-gallery-fab--floating:hover {
	transform: scale(1.04);
	box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
}

.rtl .iddd-shop-gallery-fab.iddd-shop-gallery-fab--floating {
	right: auto;
	left: max(14px, env(safe-area-inset-left, 0px));
}

/* یک آیکن چهارخانه؛ حالت روشن = border پررنگ‌تر */
body.iddd-shop-gallery--active .iddd-shop-gallery-fab.iddd-shop-gallery-fab--inline {
	opacity: 1;
	border-color: var(--accent-color, HSL(var(--neutral-10)));
	box-shadow: inset 0 0 0 1px var(--accent-color, currentColor);
}

body.iddd-shop-gallery--active .iddd-shop-gallery-fab.iddd-shop-gallery-fab--floating {
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28), 0 0 0 2px var(--accent-text-color, rgba(255, 255, 255, 0.85));
}

@media (max-width: 782px) {
	.iddd-shop-gallery-fab.iddd-shop-gallery-fab--floating {
		display: flex;
	}

	body.iddd-shop-gallery--active ul.products {
		/* ستون‌ها از داشبورد با inline style (--woocommerce-grid-columns) */
		--iddd-gallery-tile-padding: 0px;
		--iddd-gallery-tile-radius: 10px;
		--iddd-gallery-aspect: 1 / 1;
		--iddd-gallery-img-fit: cover;
		--iddd-gallery-img-pos: center center;
		--iddd-gallery-tile-border: none;
		--iddd-gallery-tile-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
		--iddd-gallery-tile-shadow-hover: 0 10px 26px rgba(15, 23, 42, 0.12);
		--iddd-gallery-tile-ring: 0 0 0 1px rgba(15, 23, 42, 0.06);
	}

	body.iddd-shop-gallery--active ul.products li.product {
		box-sizing: border-box;
		padding: var(--iddd-gallery-tile-padding, 0px) !important;
		border: var(--iddd-gallery-tile-border, none);
		border-radius: var(--iddd-gallery-tile-radius, 10px);
		overflow: hidden;
		box-shadow: var(--iddd-gallery-tile-shadow), var(--iddd-gallery-tile-ring);
		background: HSL(var(--neutral-1, 220 14% 96%));
		isolation: isolate;
		transition:
			transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
			box-shadow 0.22s ease;
	}

	body.iddd-shop-gallery--active ul.products li.product:hover {
		transform: translateY(-2px);
		box-shadow: var(--iddd-gallery-tile-shadow-hover), var(--iddd-gallery-tile-ring);
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productEditLink {
		display: none !important;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productInner > *:not(.rey-productThumbnail):not(.iddd-gallery-price-below) {
		display: none !important;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productLoop-variationsForm {
		display: none !important;
	}

	/* لایه‌های کنترل روی تصویر */
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail svg {
		display: none !important;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail button,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .button,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail [type="button"],
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail i,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-icon {
		display: none !important;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-thPos,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-thPos-item,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail [class*="rey-thPos"],
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-discount,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .onsale,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .woocommerce-badge,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-new-badge,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-badge,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-loopProduct-badge,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .tinvwl_add_to_wishlist_button,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-quickviewBtn,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .rey-compareBtn,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .splide__arrows,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .splide__pagination,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .splide__progress {
		display: none !important;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail img,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail picture {
		display: block !important;
		visibility: visible !important;
		opacity: 1 !important;
		max-width: none !important;
	}

	/* Inner = قاب مربع یکدست؛ بندانگشتی کل ناحیه را پر کند */
	body.iddd-shop-gallery--active ul.products li.product .rey-productInner {
		padding: 0 !important;
		margin: 0 !important;
		border: none !important;
		border-radius: inherit;
		overflow: hidden;
		height: 100%;
		min-height: 0;
		display: flex;
		flex-direction: column;
		background: transparent !important;
		box-shadow: none !important;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail {
		position: relative;
		flex: 1 1 auto;
		width: 100%;
		min-height: 0;
		margin: 0 !important;
		aspect-ratio: var(--iddd-gallery-aspect, 1 / 1);
		border-radius: 0;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail a.woocommerce-loop-product__link {
		display: block;
		width: 100%;
		height: 100%;
		min-height: 0;
		line-height: 0;
		position: relative;
	}

	/* قیمت روی عکس: نوار شیشه‌ای با backdrop-blur (بدون گرادیان تیرهٔ قبلی) */
	body.iddd-shop-gallery--active ul.products li.product .iddd-gallery-price-onimg {
		display: block !important;
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 4;
		max-width: 100%;
		padding: 0.2rem 0.35rem 0.28rem;
		font-size: clamp(0.58rem, 1.9vw, 0.72rem);
		line-height: 1.2;
		font-weight: 700;
		text-align: center;
		color: rgba(15, 23, 42, 0.92);
		text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
		unicode-bidi: plaintext;
		background: rgba(255, 255, 255, 0.28);
		border-top: 1px solid rgba(255, 255, 255, 0.45);
		-webkit-backdrop-filter: blur(12px) saturate(140%);
		backdrop-filter: blur(12px) saturate(140%);
	}

	/* قیمت زیر بلوک تصویر */
	body.iddd-shop-gallery--active ul.products li.product .iddd-gallery-price-below {
		display: flex !important;
		flex-shrink: 0;
		align-items: center;
		justify-content: center;
		width: 100%;
		margin: 0;
		padding: 0.22rem 0.35rem 0.32rem;
		font-size: clamp(0.62rem, 2vw, 0.78rem);
		line-height: 1.2;
		font-weight: 700;
		text-align: center;
		color: rgba(15, 23, 42, 0.88);
		background: rgba(255, 255, 255, 0.55);
		border-top: 1px solid rgba(15, 23, 42, 0.08);
		unicode-bidi: plaintext;
	}

	body.iddd-shop-gallery--active ul.products li.product .iddd-gallery-price-below__text {
		display: block;
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .splide,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .splide__track,
	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail .splide__list {
		height: 100%;
		min-height: 0;
	}

	body.iddd-shop-gallery--active ul.products li.product .rey-productThumbnail img {
		width: 100%;
		height: 100%;
		object-fit: var(--iddd-gallery-img-fit, cover);
		object-position: var(--iddd-gallery-img-pos, center center);
		display: block;
		border-radius: 0;
	}

	/* انیمیشن ورود تک‌به‌تک کارت‌ها (data-iddd-enter از JS) */
	body.iddd-shop-gallery--active ul.products {
		--iddd-gallery-enter-duration: 0.48s;
	}

	@media (prefers-reduced-motion: reduce) {
		body.iddd-shop-gallery--active ul.products[data-iddd-enter] > li.product {
			animation: none !important;
			opacity: 1 !important;
			transform: none !important;
			filter: none !important;
		}
	}

	body.iddd-shop-gallery--active ul.products[data-iddd-enter] > li.product {
		animation-duration: var(--iddd-gallery-enter-duration, 0.48s);
		animation-delay: var(--iddd-enter-delay, 0s);
		animation-fill-mode: both;
	}

	body.iddd-shop-gallery--active ul.products[data-iddd-enter="fade_up"] > li.product {
		animation-name: iddd-gal-enter-fade-up;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	body.iddd-shop-gallery--active ul.products[data-iddd-enter="fade_scale"] > li.product {
		animation-name: iddd-gal-enter-fade-scale;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	body.iddd-shop-gallery--active ul.products[data-iddd-enter="slide_in"] > li.product {
		animation-name: iddd-gal-enter-slide-ltr;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	[dir="rtl"] body.iddd-shop-gallery--active ul.products[data-iddd-enter="slide_in"] > li.product {
		animation-name: iddd-gal-enter-slide-rtl;
	}

	body.iddd-shop-gallery--active ul.products[data-iddd-enter="blur_in"] > li.product {
		animation-name: iddd-gal-enter-blur;
		animation-timing-function: cubic-bezier(0.33, 1, 0.68, 1);
	}

	body.iddd-shop-gallery--active ul.products[data-iddd-enter="soft_pop"] > li.product {
		animation-name: iddd-gal-enter-soft-pop;
		animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
	}
}

@keyframes iddd-gal-enter-fade-up {
	from {
		opacity: 0;
		transform: translateY(14px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes iddd-gal-enter-fade-scale {
	from {
		opacity: 0;
		transform: scale(0.94);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes iddd-gal-enter-slide-ltr {
	from {
		opacity: 0;
		transform: translateX(-16px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes iddd-gal-enter-slide-rtl {
	from {
		opacity: 0;
		transform: translateX(16px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes iddd-gal-enter-blur {
	from {
		opacity: 0;
		filter: blur(10px);
	}
	to {
		opacity: 1;
		filter: blur(0);
	}
}

@keyframes iddd-gal-enter-soft-pop {
	0% {
		opacity: 0;
		transform: scale(0.88);
	}
	72% {
		opacity: 1;
		transform: scale(1.03);
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}
