/**
 * Woo & Custom Product Gallery for Elementor - Frontend Styles
 * Ultra-Responsive, Edge-to-Edge Cover & Security Hardened
 */

.wpg-gallery-wrapper {
	display: flex;
	position: relative;
	width: 100%;
	gap: 8px; /* Default compact gap */
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.wpg-gallery-wrapper *,
.wpg-gallery-wrapper *::before,
.wpg-gallery-wrapper *::after {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   Layout Configurations
   ========================================================================== */

/* Bottom Layout (Default) */
.wpg-gallery-wrapper.wpg-layout-bottom {
	flex-direction: column;
}

/* Top Layout */
.wpg-gallery-wrapper.wpg-layout-top {
	flex-direction: column;
}

/* Left Layout (Vertical Thumbs on Left) */
.wpg-gallery-wrapper.wpg-layout-left {
	flex-direction: row;
	align-items: stretch;
}

.wpg-gallery-wrapper.wpg-layout-left .wpg-thumbs-container {
	flex: 0 0 100px;
	max-width: 100px;
	width: 100px;
}

.wpg-gallery-wrapper.wpg-layout-left .wpg-main-stage {
	flex: 1 1 auto;
	min-width: 0;
}

/* Right Layout (Vertical Thumbs on Right) */
.wpg-gallery-wrapper.wpg-layout-right {
	flex-direction: row;
	align-items: stretch;
}

.wpg-gallery-wrapper.wpg-layout-right .wpg-thumbs-container {
	flex: 0 0 100px;
	max-width: 100px;
	width: 100px;
}

.wpg-gallery-wrapper.wpg-layout-right .wpg-main-stage {
	flex: 1 1 auto;
	min-width: 0;
}

/* ==========================================================================
   Main Image Stage - True Edge-to-Edge Fill & Cover
   ========================================================================== */

.wpg-main-stage {
	position: relative !important;
	width: 100% !important;
	height: 480px; /* Default height */
	background-color: transparent;
	border-radius: 16px;
	overflow: hidden !important;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
	touch-action: pan-y pinch-zoom;
	padding: 0 !important;
	margin: 0 !important;
	display: block !important;
}

.wpg-main-image-inner {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	height: 100% !important;
	overflow: hidden !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
}

.wpg-main-stage img.wpg-main-img,
.wpg-main-stage .wpg-main-image-inner img,
.wpg-main-stage .wpg-main-img {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	min-width: 100% !important;
	max-width: 100% !important;
	height: 100% !important;
	min-height: 100% !important;
	max-height: 100% !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	border-radius: inherit !important;
	transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
	will-change: transform, opacity;
}

.wpg-main-stage img.wpg-main-img.is-fading {
	opacity: 0.25 !important;
}

/* ==========================================================================
   Height & Aspect Ratio Modes
   ========================================================================== */

/* Fixed Standard Mode (Default) */
.wpg-gallery-wrapper.wpg-hm-fixed .wpg-main-stage {
	height: 480px;
}

/* Ratio 16:9 */
.wpg-gallery-wrapper.wpg-hm-ratio_16_9 .wpg-main-stage {
	aspect-ratio: 16 / 9 !important;
	height: auto !important;
}

/* Ratio 4:3 */
.wpg-gallery-wrapper.wpg-hm-ratio_4_3 .wpg-main-stage {
	aspect-ratio: 4 / 3 !important;
	height: auto !important;
}

/* Ratio 1:1 */
.wpg-gallery-wrapper.wpg-hm-ratio_1_1 .wpg-main-stage {
	aspect-ratio: 1 / 1 !important;
	height: auto !important;
}

/* Ratio 3:4 */
.wpg-gallery-wrapper.wpg-hm-ratio_3_4 .wpg-main-stage {
	aspect-ratio: 3 / 4 !important;
	height: auto !important;
}

/* Auto Mode (Variable height) */
.wpg-gallery-wrapper.wpg-hm-auto .wpg-main-stage {
	height: auto !important;
	display: flex !important;
}

.wpg-gallery-wrapper.wpg-hm-auto .wpg-main-image-inner {
	position: relative !important;
	height: auto !important;
}

.wpg-gallery-wrapper.wpg-hm-auto .wpg-main-img {
	position: relative !important;
	height: auto !important;
	max-height: 80vh !important;
	width: 100% !important;
}

/* Hover Zoom Effect (Desktop fine pointer only) */
@media (hover: hover) and (pointer: fine) {
	.wpg-main-image-inner.has-zoom {
		cursor: zoom-in;
	}

	.wpg-main-image-inner.has-zoom:hover .wpg-main-img {
		transform: scale(var(--wpg-zoom-scale, 1.3)) !important;
	}
}

/* Lightbox Trigger Button */
.wpg-lightbox-btn {
	position: absolute !important;
	top: 14px !important;
	right: 14px !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 40px !important;
	min-height: 40px !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.9) !important;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.6) !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
	color: #1e293b !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	opacity: 0.85 !important;
	transform: scale(1) !important;
	transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease !important;
	z-index: 20 !important;
	padding: 0 !important;
}

.wpg-main-stage:hover .wpg-lightbox-btn {
	opacity: 1 !important;
	transform: scale(1.05) !important;
}

.wpg-lightbox-btn:hover,
.wpg-lightbox-btn:focus-visible {
	background: #ffffff !important;
	transform: scale(1.1) !important;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18) !important;
}

/* ==========================================================================
   Thumbnails Slider Track & Native Touch Momentum
   ========================================================================== */

.wpg-thumbs-container {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	margin: 0;
	padding: 0;
}

/* Horizontal Layout */
.wpg-thumbs-container.is-horizontal {
	flex-direction: row;
	gap: 6px;
}

.wpg-thumbs-container.is-horizontal .wpg-thumbs-slider-track {
	flex: 1;
	width: 100%;
	overflow: hidden;
	position: relative;
}

.wpg-thumbs-container.is-horizontal .wpg-thumbs-wrapper {
	display: flex;
	flex-direction: row;
	gap: 10px;
	overflow-x: auto;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
	padding: 2px;
	margin: 0;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
}

.wpg-thumbs-container.is-horizontal .wpg-thumbs-wrapper::-webkit-scrollbar {
	display: none; /* Chrome, Safari, Edge */
}

/* Vertical Layout */
.wpg-thumbs-container.is-vertical {
	flex-direction: column;
	height: 100%;
	max-height: 100%;
	justify-content: space-between;
	gap: 6px;
}

.wpg-thumbs-container.is-vertical .wpg-thumbs-slider-track {
	flex: 1;
	height: 100%;
	width: 100%;
	overflow: hidden;
	position: relative;
}

.wpg-thumbs-container.is-vertical .wpg-thumbs-wrapper {
	display: flex;
	flex-direction: column;
	gap: 10px;
	height: 100%;
	overflow-y: auto;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding: 2px;
	margin: 0;
	scroll-snap-type: y mandatory;
	overscroll-behavior-y: contain;
}

.wpg-thumbs-container.is-vertical .wpg-thumbs-wrapper::-webkit-scrollbar {
	display: none;
}

/* Thumbnail Item */
.wpg-thumb-item {
	position: relative;
	flex: 0 0 auto;
	height: 80px;
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	overflow: hidden;
	cursor: pointer;
	border: 2px solid transparent;
	opacity: 0.85;
	transition: border-color 0.22s ease, opacity 0.22s ease, transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
	background-color: #f1f5f9;
	box-sizing: border-box;
	scroll-snap-align: start;
	touch-action: manipulation;
}

.wpg-thumb-item img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
	pointer-events: none;
	border-radius: inherit;
}

/* Hover State */
.wpg-thumb-item:hover {
	opacity: 1;
	border-color: #718096;
	transform: translateY(-1px);
}

/* Active State */
.wpg-thumb-item.is-active {
	opacity: 1 !important;
	border-color: #0f172a !important;
	border-width: 2.5px !important;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
	transform: scale(1.02);
}

/* ==========================================================================
   Navigation Arrows
   ========================================================================== */

.wpg-nav-arrow {
	width: 34px;
	height: 34px;
	min-width: 34px;
	min-height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	color: #1e293b;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: all 0.2s ease;
	z-index: 5;
	padding: 0;
	touch-action: manipulation;
}

.wpg-nav-arrow svg {
	stroke: currentColor;
}

.wpg-nav-arrow:hover {
	background: #ffffff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
	transform: scale(1.08);
}

.wpg-nav-arrow:active {
	transform: scale(0.92);
}

.wpg-nav-arrow.is-disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

/* ==========================================================================
   Pro Fullscreen Lightbox Modal (PhotoSwipe / Dark Cinema Gallery Style)
   ========================================================================== */

.wpg-lightbox-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.26s ease;
	background: #181b22;
	overflow: hidden;
	box-sizing: border-box;
}

.wpg-lightbox-modal.is-open {
	display: flex;
	opacity: 1;
}

.wpg-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(18, 22, 28, 0.96);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	touch-action: none;
}

/* --- Top Header Bar --- */
.wpg-lb-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 24px;
	z-index: 50;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 100%);
	pointer-events: auto;
}

.wpg-lb-counter {
	color: #e2e8f0;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.5px;
	user-select: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.wpg-lb-tools {
	display: flex;
	align-items: center;
	gap: 6px;
}

.wpg-lb-tool-btn {
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.06);
	color: #e2e8f0;
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
	padding: 0;
	touch-action: manipulation;
}

.wpg-lb-tool-btn:hover,
.wpg-lb-tool-btn:focus-visible {
	background: rgba(255, 255, 255, 0.22);
	color: #ffffff;
	transform: scale(1.06);
}

.wpg-lb-tool-btn:active {
	transform: scale(0.94);
}

/* --- Screen-Edge Navigation Arrows --- */
.wpg-lb-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	background: rgba(30, 34, 44, 0.85);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: #f8fafc;
	cursor: pointer;
	z-index: 40;
	transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
	padding: 0;
	touch-action: manipulation;
}

.wpg-lb-prev {
	left: 20px;
}

.wpg-lb-next {
	right: 20px;
}

.wpg-lb-nav:hover,
.wpg-lb-nav:focus-visible {
	background: rgba(45, 52, 68, 0.95);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	transform: translateY(-50%) scale(1.06);
}

.wpg-lb-nav:active {
	transform: translateY(-50%) scale(0.94);
}

/* --- Main Center Image Stage --- */
.wpg-lightbox-content {
	position: relative;
	z-index: 20;
	width: 82vw;
	max-width: 1200px;
	height: calc(100vh - 160px);
	max-height: 780px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	touch-action: pan-y pinch-zoom;
	transition: transform 0.28s ease, width 0.28s ease, height 0.28s ease;
}

.wpg-lightbox-content.is-zoomed {
	cursor: grab;
	transform: scale(1.6);
}

.wpg-lightbox-content.is-zoomed:active {
	cursor: grabbing;
}

.wpg-lightbox-img-wrapper {
	position: relative !important;
	width: 100% !important;
	height: 100% !important;
	border-radius: 10px !important;
	overflow: hidden !important;
	box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8) !important;
	background-color: transparent !important;
	display: block !important;
}

.wpg-lightbox-img {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	min-width: 100% !important;
	max-width: 100% !important;
	height: 100% !important;
	min-height: 100% !important;
	max-height: 100% !important;
	object-fit: cover !important;
	object-position: center center !important;
	display: block !important;
	border-radius: inherit !important;
	animation: wpgLbFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
	user-select: none !important;
	-webkit-user-drag: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
}

@keyframes wpgLbFadeIn {
	from {
		opacity: 0.3;
		transform: scale(0.98);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* --- Bottom Floating Thumbnails Bar --- */
.wpg-lb-thumbs-bar {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	max-width: 90vw;
	z-index: 50;
	background: rgba(18, 22, 30, 0.85);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	padding: 6px 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.wpg-lb-thumbs-bar.is-hidden {
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 20px);
	pointer-events: none;
}

.wpg-lb-thumbs-track {
	display: flex;
	align-items: center;
	gap: 6px;
	overflow-x: auto;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding: 2px;
	margin: 0;
}

.wpg-lb-thumbs-track::-webkit-scrollbar {
	display: none;
}

.wpg-lb-thumb-item {
	position: relative;
	flex: 0 0 54px;
	width: 54px;
	height: 44px;
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	border: 2px solid transparent;
	opacity: 0.55;
	transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
	background: #0f172a;
	box-sizing: border-box;
}

.wpg-lb-thumb-item img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block !important;
	pointer-events: none;
	border-radius: inherit;
}

.wpg-lb-thumb-item:hover {
	opacity: 0.9;
	border-color: rgba(255, 255, 255, 0.5);
}

.wpg-lb-thumb-item.is-active {
	opacity: 1 !important;
	border-color: #ffffff !important;
	box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
	transform: scale(1.04);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 1024px) {
	.wpg-main-stage,
	.wpg-gallery-wrapper.wpg-hm-fixed .wpg-main-stage {
		height: 380px;
	}

	.wpg-lightbox-content {
		width: 88vw !important;
		height: calc(100vh - 170px) !important;
	}

	.wpg-lb-prev {
		left: 10px;
	}

	.wpg-lb-next {
		right: 10px;
	}
}

@media (max-width: 767px) {
	/* Standard Fixed Height on Mobile */
	.wpg-main-stage,
	.wpg-gallery-wrapper.wpg-hm-fixed .wpg-main-stage {
		height: 280px;
	}

	/* Auto-adapt vertical (left/right) to bottom for smooth mobile reading */
	.wpg-gallery-wrapper.wpg-mobile-auto-bottom.wpg-layout-left,
	.wpg-gallery-wrapper.wpg-mobile-auto-bottom.wpg-layout-right {
		flex-direction: column !important;
	}

	.wpg-gallery-wrapper.wpg-mobile-auto-bottom.wpg-layout-left .wpg-thumbs-container,
	.wpg-gallery-wrapper.wpg-mobile-auto-bottom.wpg-layout-right .wpg-thumbs-container {
		flex: 1 1 100% !important;
		max-width: 100% !important;
		width: 100% !important;
		flex-direction: row !important;
	}

	.wpg-gallery-wrapper.wpg-mobile-auto-bottom.wpg-layout-left .wpg-thumbs-wrapper,
	.wpg-gallery-wrapper.wpg-mobile-auto-bottom.wpg-layout-right .wpg-thumbs-wrapper {
		flex-direction: row !important;
		overflow-x: auto !important;
		overflow-y: hidden !important;
		scroll-snap-type: x mandatory !important;
	}

	/* Hide navigation arrows if configured */
	.wpg-gallery-wrapper.wpg-mobile-hide-arrows .wpg-nav-arrow {
		display: none !important;
	}

	.wpg-thumb-item {
		height: 64px;
		border-radius: 8px;
	}

	.wpg-lb-header {
		padding: 0 12px;
		height: 48px;
	}

	.wpg-lightbox-content {
		width: 94vw !important;
		height: calc(100vh - 150px) !important;
	}

	.wpg-lb-nav {
		width: 38px;
		height: 44px;
		background: rgba(20, 24, 32, 0.7);
	}

	.wpg-lb-prev {
		left: 6px;
	}

	.wpg-lb-next {
		right: 6px;
	}

	.wpg-lb-thumbs-bar {
		bottom: 8px;
		padding: 4px 6px;
	}

	.wpg-lb-thumb-item {
		width: 44px;
		height: 36px;
		flex: 0 0 44px;
	}
}
