/**
 * CannaGreen Product Gallery Elementor widget.
 */

.cgx-product-gallery-widget {
	width: 100%;
}

.cgx-product-gallery {
	display: flex;
	gap: var(--cgx-gallery-gap, 10px);
	width: 100%;
	height: var(--cgx-gallery-height, 546px);
}

.cgx-product-gallery__thumbs {
	flex: 0 0 var(--cgx-gallery-thumb-size, 96px);
	width: var(--cgx-gallery-thumb-size, 96px);
	height: var(--cgx-gallery-height, 546px);
}

.cgx-product-gallery__thumb {
	position: relative;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: var(--cgx-gallery-thumb-size, 96px) !important;
	height: var(--cgx-gallery-thumb-size, 96px) !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
	border: 1px solid rgba(22, 63, 46, 0.10);
	border-radius: var(--cgx-gallery-radius, 12px);
	background: #fff;
	cursor: pointer;
	opacity: 0.62;
	transition: opacity 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.cgx-product-gallery__thumb.swiper-slide-thumb-active,
.cgx-product-gallery__thumb:hover {
	opacity: 1;
	border-color: rgba(22, 63, 46, 0.26);
	box-shadow: 0 8px 18px rgba(16, 45, 33, 0.08);
}

.cgx-product-gallery__thumb img {
	display: block !important;
	width: 85% !important;
	height: 85% !important;
	max-width: 85% !important;
	max-height: 85% !important;
	object-fit: contain !important;
	object-position: center !important;
	margin: 0 !important;
}

.cgx-product-gallery__thumb--more img {
	filter: brightness(58%);
}

.cgx-product-gallery__more {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	background: rgba(16, 45, 33, 0.56);
	color: #F7F3EA;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.05;
	pointer-events: none;
}

.cgx-product-gallery__more small {
	margin-top: 2px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.cgx-product-gallery__main {
	position: relative;
	flex: 1;
	height: var(--cgx-gallery-height, 546px);
	overflow: hidden;
	border-radius: var(--cgx-gallery-radius, 12px);
	background: #fff;
}

.cgx-product-gallery__main .swiper-slide,
.cgx-product-gallery__modal-main .swiper-slide {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	cursor: zoom-in;
}

.cgx-product-gallery__main img {
	display: block !important;
	width: auto !important;
	max-width: 90% !important;
	height: auto !important;
	max-height: 90% !important;
	object-fit: contain !important;
	object-position: center !important;
	margin: 0 !important;
}

.cgx-product-gallery__prev,
.cgx-product-gallery__next,
.cgx-product-gallery__modal-prev,
.cgx-product-gallery__modal-next {
	position: absolute;
	top: 50%;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 2px 10px rgba(16, 45, 33, 0.12);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background 180ms ease, box-shadow 180ms ease;
}

.cgx-product-gallery__prev,
.cgx-product-gallery__modal-prev {
	left: 22px;
}

.cgx-product-gallery__next,
.cgx-product-gallery__modal-next {
	right: 22px;
}

.cgx-product-gallery__prev svg,
.cgx-product-gallery__modal-prev svg {
	transform: rotate(180deg);
}

.cgx-product-gallery__prev svg,
.cgx-product-gallery__next svg,
.cgx-product-gallery__modal-prev svg,
.cgx-product-gallery__modal-next svg {
	display: block;
	width: 18px;
	height: 18px;
	fill: #163F2E;
}

.cgx-product-gallery__prev.swiper-button-disabled,
.cgx-product-gallery__next.swiper-button-disabled,
.cgx-product-gallery__modal-prev.swiper-button-disabled,
.cgx-product-gallery__modal-next.swiper-button-disabled {
	display: none;
}

.cgx-product-gallery,
.cgx-product-gallery * {
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.cgx-product-gallery img {
	-webkit-user-drag: none;
	user-drag: none;
}

.cgx-product-gallery__modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: none;
	background: rgba(16, 45, 33, 0.62);
}

.cgx-product-gallery__modal.is-active {
	display: block;
}

.cgx-product-gallery__modal-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
}

.cgx-product-gallery__modal-content {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	width: min(1440px, calc(100vw - 40px));
	height: min(780px, calc(100vh - 40px));
	padding: 30px;
	overflow: hidden;
	border-radius: 14px;
	background: #fff;
	box-sizing: border-box;
	transform: translate(-50%, -50%);
}

.cgx-product-gallery__modal-close {
	position: absolute;
	top: 18px;
	right: 22px;
	z-index: 50;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: #F7F3EA;
	color: #1D1D1B;
	font-size: 24px;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
}

.cgx-product-gallery__modal-grid {
	display: flex;
	gap: 34px;
	height: 100%;
	box-sizing: border-box;
}

.cgx-product-gallery__modal-left {
	flex: 0 0 250px;
	min-width: 0;
	height: 100%;
	overflow: hidden;
	border-radius: 12px;
	background: #F7F3EA;
	padding: 16px;
	box-sizing: border-box;
}

.cgx-product-gallery__modal-title {
	position: relative;
	margin-bottom: 24px;
	color: #1D1D1B;
	font-size: 16px;
	font-weight: 800;
	line-height: 1.2;
	text-align: center;
}

.cgx-product-gallery__modal-title::after {
	position: absolute;
	right: 0;
	bottom: -10px;
	left: 0;
	display: block;
	height: 4px;
	border-radius: 999px;
	background: #163F2E;
	content: '';
}

.cgx-product-gallery__modal-thumbs {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	max-height: calc(100% - 46px);
	overflow-y: auto;
	padding-right: 2px;
}

.cgx-product-gallery__modal-thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border: 2px solid rgba(22, 63, 46, 0.08);
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
	box-sizing: border-box;
}

.cgx-product-gallery__modal-thumb.is-active,
.cgx-product-gallery__modal-thumb:hover {
	border-color: #163F2E;
}

.cgx-product-gallery__modal-thumb img {
	display: block !important;
	width: 85% !important;
	height: 85% !important;
	object-fit: contain !important;
	margin: 0 !important;
}

.cgx-product-gallery__modal-main {
	position: relative;
	flex: 1;
	height: 100%;
	overflow: hidden;
	border-radius: 12px;
	background: #fff;
}

.cgx-product-gallery__modal-main img {
	display: block !important;
	width: auto !important;
	max-width: 88% !important;
	height: auto !important;
	max-height: 88% !important;
	object-fit: contain !important;
	object-position: center !important;
	margin: 0 !important;
}

.cgx-product-gallery__modal-prev {
	left: 24px;
}

.cgx-product-gallery__modal-next {
	right: 24px;
}

@media (max-width: 1024px) {
	.cgx-product-gallery {
		height: auto;
	}

	.cgx-product-gallery__main {
		height: auto;
		aspect-ratio: 1 / 1;
	}

	.cgx-product-gallery__modal-grid {
		gap: 20px;
	}

	.cgx-product-gallery__modal-left {
		flex-basis: 210px;
	}
}

@media (max-width: 767px) {
	.cgx-product-gallery {
		flex-direction: column-reverse;
		gap: 10px;
	}

	.cgx-product-gallery__thumbs {
		width: 100%;
		height: auto;
		flex-basis: auto;
	}

	.cgx-product-gallery__thumb {
		width: 72px !important;
		height: 72px !important;
		border-radius: 10px;
	}

	.cgx-product-gallery__main {
		width: 100%;
		border-radius: 12px;
	}

	.cgx-product-gallery__prev,
	.cgx-product-gallery__next {
		width: 36px;
		height: 36px;
	}

	.cgx-product-gallery__prev {
		left: 12px;
	}

	.cgx-product-gallery__next {
		right: 12px;
	}

	.cgx-product-gallery__modal-content {
		width: calc(100vw - 20px);
		height: calc(100vh - 20px);
		padding: 14px;
	}

	.cgx-product-gallery__modal-grid {
		flex-direction: column-reverse;
		gap: 12px;
	}

	.cgx-product-gallery__modal-left {
		flex: 0 0 auto;
		width: 100%;
		height: auto;
		max-height: 168px;
		padding: 12px;
	}

	.cgx-product-gallery__modal-title {
		display: none;
	}

	.cgx-product-gallery__modal-thumbs {
		display: flex;
		gap: 8px;
		max-height: none;
		overflow-x: auto;
		overflow-y: hidden;
		padding: 0;
	}

	.cgx-product-gallery__modal-thumb {
		flex: 0 0 72px;
		width: 72px;
		height: 72px;
	}

	.cgx-product-gallery__modal-main {
		flex: 1 1 auto;
		min-height: 0;
	}

	.cgx-product-gallery__modal-close {
		top: 12px;
		right: 12px;
	}
}


/* Gallery thumbnail gap + modal close tuning 1.1.02 */
.cgx-product-gallery__thumbs .swiper-wrapper {
	gap: var(--cgx-gallery-thumb-gap, 10px) !important;
}

.cgx-product-gallery__modal-left {
	background: #f9f9f9 !important;
}

.cgx-product-gallery__modal-close {
	width: 44px !important;
	height: 44px !important;
	border-radius: 999px !important;
	background: #f9f9f9 !important;
	color: #1D1D1B !important;
	box-shadow: 0 6px 18px rgba(16, 45, 33, 0.10);
	transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.cgx-product-gallery__modal-close:hover {
	background: #F7F3EA !important;
	transform: scale(1.04);
	box-shadow: 0 8px 24px rgba(16, 45, 33, 0.14);
}

.cgx-product-gallery__modal-close svg {
	display: block;
	width: 20px;
	height: 20px;
	fill: currentColor;
}


/* Gallery thumbnail shadow tuning 1.1.03 */
.cgx-product-gallery__thumb.swiper-slide-thumb-active,
.cgx-product-gallery__thumb:hover {
	box-shadow: 0 2px 12px rgba(16, 45, 33, 0.08) !important;
}


/* Gallery thumbnails below main image 1.1.05 */
.cgx-product-gallery {
	display: flex !important;
	flex-direction: column !important;
	gap: var(--cgx-gallery-gap, 10px) !important;
	height: auto !important;
}

.cgx-product-gallery__main {
	width: 100% !important;
	height: var(--cgx-gallery-height, 546px) !important;
	flex: 0 0 auto !important;
}

.cgx-product-gallery__thumbs {
	width: 100% !important;
	height: var(--cgx-gallery-thumb-size, 96px) !important;
	flex: 0 0 var(--cgx-gallery-thumb-size, 96px) !important;
}

.cgx-product-gallery__thumbs .swiper-wrapper {
	flex-direction: row !important;
	gap: var(--cgx-gallery-thumb-gap, 10px) !important;
}

.cgx-product-gallery__thumb {
	flex: 0 0 var(--cgx-gallery-thumb-size, 96px) !important;
	width: var(--cgx-gallery-thumb-size, 96px) !important;
	height: var(--cgx-gallery-thumb-size, 96px) !important;
}

@media (max-width: 1024px) {
	.cgx-product-gallery__main {
		height: auto !important;
		aspect-ratio: 1 / 1;
	}
}

@media (max-width: 767px) {
	.cgx-product-gallery {
		flex-direction: column !important;
	}

	.cgx-product-gallery__thumbs {
		height: 72px !important;
		flex-basis: 72px !important;
	}
}


/* Gallery thumbnails below order fix 1.1.06 */
.cgx-product-gallery {
	flex-direction: column-reverse !important;
}

@media (max-width: 767px) {
	.cgx-product-gallery {
		flex-direction: column-reverse !important;
	}
}
