/**
 * Product Gallery Widget Styles
 */

.ewpg-product-gallery {
	position: relative;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	box-sizing: border-box;
}

/* Ensure Elementor column containment */
.elementor-widget-ewpg-product-gallery {
	width: 100%;
}

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

/* Main Gallery */
.ewpg-gallery-main {
	position: relative;
	width: 100%;
	margin-bottom: 0;
	background: #fff;
	border-radius: 0;
	overflow: hidden;
	display: block;
	min-height: 400px;
	/* Ensure thumbnails are clipped if they overflow */
	contain: layout style paint;
}

.ewpg-gallery-main .swiper {
	width: 100% !important;
	height: 500px !important;
	min-height: 400px !important;
	max-height: 500px !important;
	position: relative !important;
	display: block !important;
	overflow: hidden !important;
	visibility: visible !important;
	clip-path: inset(0);
}

/* Prevent Swiper from overriding height with inline styles */
.ewpg-gallery-main .swiper[style] {
	height: 500px !important;
	min-height: 400px !important;
	max-height: 500px !important;
}

.ewpg-gallery-main .swiper-wrapper {
	position: relative;
	width: 100% !important;
	height: 100% !important;
	max-height: 100% !important;
	display: flex !important;
	align-items: flex-start;
	overflow: visible;
	visibility: visible !important;
	opacity: 1 !important;
	z-index: 1;
	will-change: transform;
}

.ewpg-gallery-main .swiper-slide {
	position: relative;
	width: 100%;
	height: 100% !important;
	max-height: 100% !important;
	max-width: 100% !important;
	display: block !important;
	flex-shrink: 0 !important;
	flex-grow: 0 !important;
	flex-basis: 100% !important;
	background: #fff;
	visibility: visible !important;
	opacity: 1 !important;
	z-index: 1;
	overflow: hidden;
	box-sizing: border-box;
}

.ewpg-gallery-main .swiper-slide img {
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	max-height: 100% !important;
	min-width: 100% !important;
	min-height: 100% !important;
	display: block !important;
	object-fit: cover;
	position: relative;
	top: 0;
	left: 0;
	z-index: 1;
	visibility: visible !important;
	opacity: 1 !important;
}

/* Video Embeds */
.ewpg-video-embed {
	position: absolute;
	top: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
	overflow: hidden;
	background: #000;
	max-height: 100% !important;
}

.ewpg-video-embed iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
	border: none;
	object-fit: cover;
	max-height: 100% !important;
	min-height: 100%;
}

.ewpg-video-upload {
	position: absolute;
	top: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
	background: #000;
	display: block;
	overflow: hidden;
	max-height: 100% !important;
	display: flex !important;
    justify-content: center;
    align-items: center;	
}

.ewpg-video-upload video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	max-height: 100% !important;
	min-width: 100%;
	min-height: 100%;
	display: block;
	object-fit: cover;
}

/* Thumbnails */
.ewpg-gallery-thumbnails {
	position: absolute;
	bottom: 15px;
	left: 0;
	right: 0;
	width: 100%;
	margin-top: 0;
	overflow: hidden;
	z-index: 5;
	padding: 0 15px;
	box-sizing: border-box;
	pointer-events: none;
	max-width: 100%;
}

.ewpg-gallery-thumbnails .swiper {
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	position: relative;
	box-sizing: border-box;
}

.ewpg-gallery-thumbnails .swiper-wrapper {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	/* Don't set width/max-width here - let Swiper calculate based on slidesPerView */
	/* overflow: hidden removed - wrapper needs to allow slides to move */
}

.ewpg-gallery-thumbnails .swiper-slide {
	width: 70px;
	height: 70px;
	min-width: 70px;
	max-width: 70px;
	flex-shrink: 0;
	flex-grow: 0;
	cursor: pointer;
	opacity: 0.7;
	transition: all 0.3s ease;
	border: 2px solid transparent;
	padding: 0;
	box-sizing: border-box;
	overflow: hidden;
	background: #fff;
	display: block !important;
	visibility: visible !important;
	position: relative;
	z-index: 1;
	pointer-events: auto;
	border-radius: 2px;
}

.ewpg-gallery-thumbnails .swiper-slide:last-child {
	margin-right: 0;
}

.ewpg-gallery-thumbnails .swiper-slide:hover {
	opacity: 1;
}

.ewpg-gallery-thumbnails .swiper-slide-thumb-active {
	opacity: 1;
	border-color: #4CAF50;
}

.ewpg-gallery-thumbnails .swiper-slide img {
	width: 70px;
	height: 70px;
	display: block;
	object-fit: cover;
	pointer-events: none; /* Allow clicks to pass through to slide */
}

.ewpg-thumbnail-placeholder {
	width: 100%;
	height: 100%;
	background: #f0f0f0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid transparent;
	pointer-events: none; /* Allow clicks to pass through to slide */
}

.ewpg-video-icon {
	font-size: 24px;
	color: #666;
}

/* Video thumbnail styling */
.ewpg-gallery-thumbnails .swiper-slide[data-item-type="youtube"] .ewpg-thumbnail-placeholder,
.ewpg-gallery-thumbnails .swiper-slide[data-item-type="vimeo"] .ewpg-thumbnail-placeholder,
.ewpg-gallery-thumbnails .swiper-slide[data-item-type="upload"] .ewpg-thumbnail-placeholder {
	background: #E3F2FD;
}

.ewpg-gallery-thumbnails .swiper-slide[data-item-type="youtube"] .ewpg-video-icon,
.ewpg-gallery-thumbnails .swiper-slide[data-item-type="vimeo"] .ewpg-video-icon,
.ewpg-gallery-thumbnails .swiper-slide[data-item-type="upload"] .ewpg-video-icon {
	color: #fff;
	font-size: 20px;
}

/* Navigation Arrows */
.ewpg-gallery-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 66px;
	height: 50px;
	background-color: #00794D;
	color: #fff;
	border: none;
	border-radius: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	transition: all 0.3s ease;
	box-shadow: none;
	margin: 0;
	background-image: url('../images/slider-arrow.svg');
	background-repeat: no-repeat;
	background-position: center;
	background-size: 36px 15px;
}

/* Hide navigation when setting is disabled */
.ewpg-product-gallery[data-show-navigation="no"] .ewpg-gallery-nav {
	display: none !important;
}

.ewpg-gallery-nav:hover {
	background-color: #006640;
}

.ewpg-gallery-nav.swiper-button-next {
	right: 0;
}

.ewpg-gallery-nav.swiper-button-prev {
	left: 0;
	transform: translateY(-50%) scaleX(-1);
}

.ewpg-gallery-nav::after {
	content: none;
	display: none;
}

/* Swiper Overrides */
.ewpg-product-gallery .swiper {
	width: 100%;
}

/* Main gallery swiper should maintain aspect ratio */
.ewpg-product-gallery .ewpg-gallery-main .swiper {
	height: 500px;
	min-height: 400px;
	position: relative;
}

.ewpg-product-gallery .swiper-button-next,
.ewpg-product-gallery .swiper-button-prev {
	width: 66px;
	height: 50px;
	background-color: #00794D;
	color: #fff;
	border-radius: 0;
	margin-top: 0;
	background-image: url('../images/slider-arrow.svg');
	background-repeat: no-repeat;
	background-position: center;
	background-size: 36px 15px;
}

.ewpg-product-gallery .swiper-button-prev {
	transform: translateY(-50%) scaleX(-1) !important;
}

.ewpg-product-gallery .swiper-button-next::after,
.ewpg-product-gallery .swiper-button-prev::after {
	content: none;
	display: none;
}

.ewpg-product-gallery .swiper-button-next:hover,
.ewpg-product-gallery .swiper-button-prev:hover {
	background-color: #006640;
}

.ewpg-product-gallery .swiper-button-disabled {
	opacity: 0;
	cursor: auto;
	pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
	.ewpg-gallery-main .swiper {
		height: 300px;
		min-height: 300px;
	}

	.ewpg-gallery-nav {
		width: 50px;
		height: 40px;
		font-size: 14px;
		background-size: 28px 12px;
	}

	.ewpg-gallery-nav.swiper-button-next {
		right: 5px;
	}

	.ewpg-gallery-nav.swiper-button-prev {
		left: 5px;
	}

	.ewpg-gallery-thumbnails .swiper-slide {
		opacity: 0.7;
	}
	
	.ewpg-gallery-thumbnails {
		position: relative;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		margin-top: 0;
		overflow: hidden;
		z-index: 5;
		padding: 10px 5px;
		box-sizing: border-box;
		pointer-events: none;
		max-width: 100%;
	}
}

/* Lightbox Support */
.ewpg-gallery-main .swiper-slide img {
	cursor: pointer;
}

.ewpg-gallery-main[data-enable-lightbox="yes"] .swiper-slide img {
	cursor: zoom-in;
}

/* Lightbox Modal - Using standard CSS only, no third-party dependencies */
.ewpg-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.98);
	z-index: 9999;
	display: none;
	align-items: center;
	justify-content: center;
	flex-direction: row;
	overflow: hidden;
}

.ewpg-lightbox.show {
	display: flex !important;
}

.ewpg-lightbox-swiper {
	width: 100%;
	height: 100%;
	max-width: 90%;
	max-height: 90%;
	position: relative;
	margin: auto;
}

.ewpg-lightbox-swiper .swiper {
	width: 100%;
	height: 100%;
}

.ewpg-lightbox-swiper .swiper-wrapper {
	align-items: center;
	display: flex;
}

.ewpg-lightbox-swiper .swiper-slide {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	width: 100%;
	flex-shrink: 0;
	position: relative;
}

.ewpg-lightbox-image {
	max-width: 90vw;
	max-height: 90vh;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
	margin: auto;
	user-select: none;
	box-shadow: 0 0 30px rgba(0, 0, 0, 0.3), 0 0 8px -5px rgba(0, 0, 0, 0.3);
	border-radius: 2px;
}

.ewpg-lightbox-item {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	padding: 70px;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	margin: auto;
}

.ewpg-lightbox-video {
	width: 90vw;
	max-width: 90vw;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	box-sizing: border-box;
}

/* YouTube/Vimeo embeds - landscape (16:9) */
.ewpg-lightbox-video.ewpg-youtube-embed,
.ewpg-lightbox-video.ewpg-vimeo-embed {
	width: 90vw;
	max-width: 90vw;
	min-width: 320px;
}

.ewpg-lightbox-video.ewpg-youtube-embed iframe,
.ewpg-lightbox-video.ewpg-vimeo-embed iframe {
	width: 100% !important;
	max-width: 100% !important;
	max-height: 90vh !important;
	aspect-ratio: 16 / 9;
	height: auto !important;
	border: 0;
	background-color: #000;
	display: block;
	margin: 0;
}

/* Uploaded videos */
.ewpg-lightbox-video.ewpg-video-upload {
	width: 90vw;
	max-width: 90vw;
	max-height: 90vh;
	min-width: 320px;
}

.ewpg-lightbox-video.ewpg-video-upload video {
	width: 100% !important;
	max-width: 100% !important;
	max-height: 90vh !important;
	height: auto !important;
	object-fit: contain;
	border: 0;
	background-color: #000;
	display: block;
	margin: 0;
}

@media (max-width: 767px) {
	.ewpg-lightbox-video {
		width: 95vw;
		max-width: 95vw;
	}
	
	.ewpg-lightbox-video.ewpg-youtube-embed iframe,
	.ewpg-lightbox-video.ewpg-vimeo-embed iframe,
	.ewpg-lightbox-video.ewpg-video-upload video {
		max-width: 100% !important;
	}
	
	.ewpg-lightbox-image {
		max-width: 95vw;
	}
	
	.ewpg-lightbox-item {
		padding: 70px 20px;
	}
	
	.ewpg-lightbox .swiper-button-next,
	.ewpg-lightbox .swiper-button-prev {
		width: 40px;
		height: 40px;
		background-size: 28px 12px;
	}
}

/* Navigation buttons - using custom SVG arrow */
.ewpg-lightbox .swiper-button-next,
.ewpg-lightbox .swiper-button-prev {
	width: 50px;
	height: 50px;
	margin-top: 0;
	background: none;
	border: none;
	background-image: url('../images/slider-arrow.svg');
	background-repeat: no-repeat;
	background-position: center;
	background-size: 36px 15px;
	transition: opacity 0.3s ease;
	z-index: 10;
	opacity: 0.9;
}

.ewpg-lightbox .swiper-button-next:hover,
.ewpg-lightbox .swiper-button-prev:hover {
	opacity: 1;
}

.ewpg-lightbox .swiper-button-prev {
	transform: translateY(-50%) scaleX(-1);
}

.ewpg-lightbox .swiper-button-next::after,
.ewpg-lightbox .swiper-button-prev::after {
	content: none;
	display: none;
}

.ewpg-lightbox-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: rgba(238, 238, 238, 0.9);
	font-size: 30px;
	cursor: pointer;
	line-height: 1;
	padding: 0;
	width: 40px;
	height: 40px;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.3s ease;
}

.ewpg-lightbox-close:hover {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}


