/*
 * استایل گالری اصلی توسط قالب کنترل می‌شود.
 * این فایل فقط استایل‌های ضروری زوم و مودال را دارد.
 */

 .vgm-product-gallery {
	--vgm-main-zoom: 2.8;
}

/* جلوگیری از اسکرول صفحه هنگام بازبودن مودال */
body.vgm-modal-open {
	overflow: hidden;
}

/* دکمه تصویر اصلی */
.vgm-main-trigger {
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	cursor: zoom-in;
}

/* محدوده زوم فقط برای تصویر اصلی */
.vgm-main-image-container {
	--vgm-zoom-x: 50%;
	--vgm-zoom-y: 50%;

	overflow: hidden;
}

.vgm-main-image {
	display: block;
	max-width: 100%;
	height: auto;
	transform: scale(1);
	transform-origin: var(--vgm-zoom-x) var(--vgm-zoom-y);
	transition: transform 0.2s ease;
	will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
	.vgm-main-image-container.is-zooming .vgm-main-image {
		transform: scale(var(--vgm-main-zoom));
	}
}

/* فقط حذف استایل پیش‌فرض button از Thumbnailهای صفحه */
.vgm-page-thumbnail {
	display: block;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

/* مودال */

.vgm-modal {
	display: none;
	align-items: center;
	justify-content: center;
	position: fixed;
	inset: 0;
	z-index: 999999;
	padding: 20px;
	background: rgba(0, 0, 0, 0.92);
}

.vgm-modal.is-open {
	display: flex;
}

.vgm-modal__dialog {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	position: relative;
}

.vgm-modal__image-area {
	display: flex;
	align-items: center;
	justify-content: center;
	width: min(1100px, calc(100vw - 150px));
	height: calc(100vh - 155px);
	position: relative;
	overflow: hidden;
}

.vgm-modal__image {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transform: scale(1);
	transform-origin: center center;
	transition: transform 0.2s ease;
	cursor: zoom-in;
	user-select: none;
	-webkit-user-drag: none;
	will-change: transform;
}

.vgm-modal__image.is-zoomed {
	transform: scale(2);
	cursor: zoom-out;
}

/* دکمه‌های مودال */

.vgm-modal__close,
.vgm-modal__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	z-index: 20;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	color: #fff;
	background: rgba(0, 0, 0, 0.65);
	cursor: pointer;
}

.vgm-modal__close {
	width: 46px;
	height: 46px;
	top: 15px;
	right: 15px;
	font-size: 32px;
	line-height: 1;
}

.vgm-modal__nav {
	width: 50px;
	height: 50px;
	top: 45%;
	font-size: 25px;
	transform: translateY(-50%);
}

.vgm-modal__nav--prev {
	left: 15px;
}

.vgm-modal__nav--next {
	right: 15px;
}

.vgm-modal__counter {
	position: absolute;
	left: 50%;
	bottom: 10px;
	z-index: 20;
	padding: 5px 11px;
	border-radius: 20px;
	color: #fff;
	background: rgba(0, 0, 0, 0.65);
	font-size: 13px;
	line-height: 1.4;
	transform: translateX(-50%);
	pointer-events: none;
}

/* Thumbnailهای داخل مودال */

.vgm-modal__thumbnails {
	display: flex;
	align-items: center;
	gap: 8px;
	width: min(900px, calc(100vw - 40px));
	min-height: 76px;
	margin-top: 10px;
	padding: 2px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
}

.vgm-modal__thumbnail {
	flex: 0 0 68px;
	width: 68px;
	height: 68px;
	padding: 3px;
	margin: 0;
	border: 2px solid transparent;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.1);
	cursor: pointer;
	overflow: hidden;
	opacity: 0.6;
	transition:
		opacity 0.2s ease,
		border-color 0.2s ease;
}

.vgm-modal__thumbnail:hover,
.vgm-modal__thumbnail.is-active {
	opacity: 1;
}

.vgm-modal__thumbnail.is-active {
	border-color: #fff;
}

.vgm-modal__thumbnail img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	border-radius: 4px;
	user-select: none;
	-webkit-user-drag: none;
}

/* دسترسی‌پذیری */

.vgm-modal__close:focus-visible,
.vgm-modal__nav:focus-visible,
.vgm-modal__thumbnail:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* موبایل */

@media (max-width: 767px) {
	.vgm-modal {
		padding: 8px;
	}

	.vgm-modal__image-area {
		width: calc(100vw - 16px);
		height: calc(100vh - 150px);
	}

	.vgm-modal__close {
		width: 42px;
		height: 42px;
		top: 8px;
		right: 8px;
		font-size: 29px;
	}

	.vgm-modal__nav {
		width: 42px;
		height: 42px;
		top: 43%;
		font-size: 21px;
	}

	.vgm-modal__nav--prev {
		left: 8px;
	}

	.vgm-modal__nav--next {
		right: 8px;
	}

	.vgm-modal__thumbnails {
		width: calc(100vw - 16px);
		min-height: 64px;
		margin-top: 6px;
	}

	.vgm-modal__thumbnail {
		flex-basis: 56px;
		width: 56px;
		height: 56px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vgm-main-image,
	.vgm-modal__image,
	.vgm-modal__thumbnail {
		transition: none;
	}
}
/* نمایش افقی Thumbnailهای زیر تصویر اصلی */
.vgm-page-thumbnails {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: center;
	gap: 10px;

	width: 100%;
	margin: 12px 0 0 !important;
	padding: 0 !important;

	list-style: none !important;
	overflow-x: auto;
	overflow-y: hidden;
}

/* جلوگیری از زیر هم قرارگرفتن Thumbnailها */
.vgm-page-thumbnails > li {
	display: block !important;
	flex: 0 0 auto !important;

	width: auto !important;
	margin: 0 !important;
	padding: 0 !important;

	list-style: none !important;
}

/* حذف کامل شماره‌های 1، 2، 3 */
.vgm-page-thumbnails > li::marker {
	content: "";
	font-size: 0;
}

/* جلوگیری از کشیده‌شدن دکمه Thumbnail */
.vgm-page-thumbnails .vgm-page-thumbnail {
	display: block;
	width: auto;
	flex: none;
}

/* اصلاح نمایش تصویر داخل Thumbnail */
.vgm-page-thumbnails .vgm-page-thumbnail img {
	display: block;
	max-width: none;
}

.single-product-bb button.vgm-page-thumbnail {
    padding: 0 !important;
}