/* Custom Elementor Widgets Pack — Single Product Dynamic Gallery & Video */

:root {
	--cewp-pg-gap: 12px;
	--cewp-pg-speed: 350ms;
	--cewp-pg-zoom-scale: 1.5;
	--cewp-pg-thumb-size: 80px;
}

.cewp-gallery-wrap {
	position: relative;
	width: 100%;
	box-sizing: border-box;
}

/* Base Media Box */
.cewp-gallery-media-box {
	position: relative;
	overflow: hidden;
	background-color: #f7f7f7;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.cewp-gallery-media-box img,
.cewp-gallery-media-box video,
.cewp-gallery-media-box iframe {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform var(--cewp-pg-speed) ease, opacity var(--cewp-pg-speed) ease;
}

/* Hover Zoom */
.cewp-gallery-media-box.cewp-zoom-active:hover img {
	transform: scale(var(--cewp-pg-zoom-scale));
	cursor: zoom-in;
}

/* Layout: Slider Horizontal (Bottom / Top) */
.cewp-gallery--slider-bottom,
.cewp-gallery--slider-top {
	display: flex;
	flex-direction: column;
	gap: var(--cewp-pg-gap);
}

.cewp-gallery--slider-top {
	flex-direction: column-reverse;
}

/* Layout: Slider Vertical (Left / Right) */
.cewp-gallery--slider-left,
.cewp-gallery--slider-right {
	display: flex;
	flex-direction: row;
	gap: var(--cewp-pg-gap);
}

.cewp-gallery--slider-right {
	flex-direction: row-reverse;
}

.cewp-gallery--slider-left .cewp-gallery-thumbs,
.cewp-gallery--slider-right .cewp-gallery-thumbs {
	display: flex;
	flex-direction: column;
	width: var(--cewp-pg-thumb-size);
	flex-shrink: 0;
	gap: var(--cewp-pg-gap);
	max-height: 550px;
	overflow-y: auto;
	scrollbar-width: thin;
}

.cewp-gallery--slider-left .cewp-gallery-main,
.cewp-gallery--slider-right .cewp-gallery-main {
	flex: 1;
	min-width: 0;
}

/* Thumbnails Track (Horizontal) */
.cewp-gallery-thumbs-horizontal {
	display: flex;
	flex-direction: row;
	gap: var(--cewp-pg-gap);
	overflow-x: auto;
	scrollbar-width: thin;
	padding-bottom: 4px;
}

.cewp-gallery-thumb {
	position: relative;
	width: var(--cewp-pg-thumb-size);
	height: var(--cewp-pg-thumb-size);
	flex-shrink: 0;
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	border: 2px solid transparent;
	opacity: 0.7;
	transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
	box-sizing: border-box;
}

.cewp-gallery-thumb:hover {
	opacity: 1;
	transform: translateY(-2px);
}

.cewp-gallery-thumb.is-active {
	opacity: 1;
	border-color: #111111;
}

.cewp-gallery-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Layout: Stacked (1-Column) */
.cewp-gallery--stacked,
.cewp-gallery--stacked .cewp-gallery-grid-container {
	display: flex;
	flex-direction: column;
	gap: var(--cewp-pg-gap);
}

/* Layout: 2-Column Grid */
.cewp-gallery--grid-2,
.cewp-gallery--grid-2 .cewp-gallery-grid-container {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--cewp-pg-gap);
}

/* Layout: 2-1 Mixed Grid (Featured Image Span 2) */
.cewp-gallery--grid-2-1,
.cewp-gallery--grid-2-1 .cewp-gallery-grid-container {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--cewp-pg-gap);
}

.cewp-gallery--grid-2-1 .cewp-gallery-media-box:first-child,
.cewp-gallery--grid-2-1 .cewp-gallery-grid-container .cewp-gallery-media-box:first-child {
	grid-column: 1 / -1;
}

/* Layout: 3-Column Grid */
.cewp-gallery--grid-3,
.cewp-gallery--grid-3 .cewp-gallery-grid-container {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--cewp-pg-gap);
}

/* Layout: 4-Column Grid */
.cewp-gallery--grid-4,
.cewp-gallery--grid-4 .cewp-gallery-grid-container {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--cewp-pg-gap);
}

/* Video Badge & Overlay */
.cewp-gallery-video-badge {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 48px;
	height: 48px;
	background: rgba(0, 0, 0, 0.65);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	font-size: 20px;
	pointer-events: none;
	transition: background 0.2s ease, transform 0.2s ease;
	z-index: 2;
}

.cewp-gallery-thumb .cewp-gallery-video-badge {
	width: 28px;
	height: 28px;
	font-size: 12px;
}

.cewp-gallery-media-box:hover .cewp-gallery-video-badge {
	background: rgba(0, 0, 0, 0.85);
	transform: translate(-50%, -50%) scale(1.1);
}

.cewp-gallery-video-embed {
	position: relative;
	width: 100%;
	height: 100%;
	background: #000;
}

.cewp-gallery-video-embed iframe,
.cewp-gallery-video-embed video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Product Badges */
.cewp-gallery-badge {
	position: absolute;
	z-index: 10;
	padding: 6px 12px;
	font-size: 12px;
	font-weight: 700;
	border-radius: 4px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1.2;
	pointer-events: none;
	box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.cewp-gallery-badge--top-left { top: 12px; left: 12px; }
.cewp-gallery-badge--top-right { top: 12px; right: 12px; }
.cewp-gallery-badge--bottom-left { bottom: 12px; left: 12px; }
.cewp-gallery-badge--bottom-right { bottom: 12px; right: 12px; }

.cewp-gallery-badge--sale {
	background-color: #e74c3c;
	color: #ffffff;
}

.cewp-gallery-badge--outofstock {
	background-color: #333333;
	color: #ffffff;
}

/* Fullscreen Lightbox Modal */
.cewp-gallery-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: rgba(0, 0, 0, 0.92);
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.cewp-gallery-lightbox.is-open {
	display: flex;
	opacity: 1;
}

.cewp-gallery-lightbox-content {
	position: relative;
	max-width: 90vw;
	max-height: 85vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cewp-gallery-lightbox-content img {
	max-width: 90vw;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.cewp-gallery-lightbox-content video,
.cewp-gallery-lightbox-content iframe {
	width: 80vw;
	height: 70vh;
	max-width: 1000px;
	border: 0;
	border-radius: 4px;
}

.cewp-gallery-lightbox-close {
	position: absolute;
	top: 20px;
	right: 25px;
	font-size: 32px;
	color: #ffffff;
	cursor: pointer;
	background: none;
	border: none;
	line-height: 1;
	z-index: 100000;
	padding: 8px;
	transition: color 0.2s ease;
}

.cewp-gallery-lightbox-close:hover {
	color: #e74c3c;
}

.cewp-gallery-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	font-size: 28px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.15);
	border: none;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 100000;
	transition: background 0.2s ease;
}

.cewp-gallery-lightbox-nav:hover {
	background: rgba(255, 255, 255, 0.35);
}

.cewp-gallery-lightbox-prev { left: 20px; }
.cewp-gallery-lightbox-next { right: 20px; }

.cewp-gallery-lightbox-counter {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	color: #ffffff;
	font-size: 14px;
	font-weight: 500;
	background: rgba(0, 0, 0, 0.6);
	padding: 4px 12px;
	border-radius: 12px;
}

/* Mobile Pagination Dots */
.cewp-gallery-dots {
	display: none;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin-top: 14px;
	width: 100%;
}

.cewp-gallery-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: #cccccc;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	outline: none;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.cewp-gallery-dot.is-active {
	width: 22px !important;
	border-radius: 4px !important;
	background-color: #111111 !important;
	opacity: 1 !important;
}

/* Mobile Responsive Adjustments & Carousel Mode */
@media (max-width: 1024px) {
	.cewp-gallery-wrap {
		display: -webkit-box !important;
		display: -webkit-flex !important;
		display: flex !important;
		-webkit-box-orient: vertical !important;
		-webkit-box-direction: normal !important;
		-webkit-flex-direction: column !important;
		flex-direction: column !important;
		width: 100% !important;
		max-width: 100% !important;
	}

	.cewp-gallery-main {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 100% !important;
		-webkit-flex: 0 0 100% !important;
		flex: 0 0 100% !important;
		-webkit-order: 1 !important;
		order: 1 !important;
	}

	.cewp-gallery-grid-container {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 100% !important;
		-webkit-order: 1 !important;
		order: 1 !important;
	}

	.cewp-gallery-dots {
		display: -webkit-box !important;
		display: -webkit-flex !important;
		display: flex !important;
		-webkit-box-pack: center !important;
		-webkit-justify-content: center !important;
		justify-content: center !important;
		-webkit-box-align: center !important;
		-webkit-align-items: center !important;
		align-items: center !important;
		width: 100% !important;
		min-width: 100% !important;
		-webkit-flex: 0 0 100% !important;
		flex: 0 0 100% !important;
		clear: both !important;
		margin-top: 14px !important;
		-webkit-order: 2 !important;
		order: 2 !important;
	}

	.cewp-gallery-thumbs {
		width: 100% !important;
		min-width: 100% !important;
		-webkit-flex: 0 0 100% !important;
		flex: 0 0 100% !important;
		margin-top: 10px !important;
		-webkit-order: 3 !important;
		order: 3 !important;
	}

	.cewp-gallery--slider-left,
	.cewp-gallery--slider-right,
	.cewp-gallery--slider-bottom,
	.cewp-gallery--slider-top {
		-webkit-flex-direction: column !important;
		flex-direction: column !important;
	}

	.cewp-gallery--slider-left .cewp-gallery-thumbs,
	.cewp-gallery--slider-right .cewp-gallery-thumbs {
		-webkit-flex-direction: row !important;
		flex-direction: row !important;
		width: 100% !important;
		max-height: none !important;
		overflow-x: auto !important;
	}

	/* Force Stacked & Grid Layouts into Horizontal Touch Carousel on Mobile */
	.cewp-gallery-wrap[data-mobile-carousel="yes"] .cewp-gallery-grid-container {
		display: -webkit-box !important;
		display: -webkit-flex !important;
		display: flex !important;
		-webkit-box-orient: horizontal !important;
		-webkit-box-direction: normal !important;
		-webkit-flex-direction: row !important;
		flex-direction: row !important;
		overflow-x: auto !important;
		scroll-snap-type: x mandatory !important;
		-webkit-overflow-scrolling: touch !important;
		gap: 0 !important;
		padding-bottom: 0;
		scrollbar-width: none;
		width: 100% !important;
	}

	.cewp-gallery-wrap[data-mobile-carousel="yes"] .cewp-gallery-grid-container::-webkit-scrollbar {
		display: none;
	}

	.cewp-gallery-wrap[data-mobile-carousel="yes"] .cewp-gallery-grid-container .cewp-gallery-media-box {
		-webkit-flex: 0 0 100% !important;
		flex: 0 0 100% !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 100% !important;
		scroll-snap-align: start !important;
		grid-column: auto !important;
	}
}
