/**
 * Scoped styles for Custom Product Gallery
 * Slug: egnitech-one/product-gallery
 */

.egnitech-custom-gallery,
.egnitech-custom-gallery *,
.egnitech-custom-gallery *::before,
.egnitech-custom-gallery *::after {
	box-sizing: border-box;
}

.egnitech-custom-gallery {
	display: flex;
	flex-direction: column;
	width: 100%;
	margin-bottom: var(--wp--preset--spacing--40);
	min-width: 0;
}

/* Main Image Wrapper */
.egnitech-gallery-main-wrapper {
	position: relative;
	width: 100%;
	background: light-dark(rgba(0, 0, 0, 0.02), rgba(255, 255, 255, 0.02));
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.02);
	aspect-ratio: 1 / 1;
}

.egnitech-gallery-main {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE and Edge */
	width: 100%;
	height: 100%;
}

.egnitech-gallery-main::-webkit-scrollbar {
	display: none; /* Chrome, Safari, Opera */
}

.egnitech-gallery-slide {
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	scroll-snap-align: start;
}

.egnitech-gallery-trigger {
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	background: transparent;
	border: none;
	cursor: zoom-in;
	outline: none;
	position: relative;
}

.egnitech-gallery--no-lightbox-icon .egnitech-gallery-trigger::after {
	display: none !important;
}

.egnitech-gallery-trigger::after {
	content: '';
	position: absolute;
	top: 16px;
	left: 16px;
	width: 36px;
	height: 36px;
	background: #ffffff;
	border-radius: 50%;
	opacity: 1;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3Cline x1='11' y1='8' x2='11' y2='14'%3E%3C/line%3E%3Cline x1='8' y1='11' x2='14' y2='11'%3E%3C/line%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	pointer-events: none;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	z-index: 5;
}

.egnitech-gallery-trigger:hover::after {
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.egnitech-gallery-trigger img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.egnitech-gallery-trigger:hover img {
	transform: scale(1.02);
}

/* Navigation arrows for main image */
.egnitech-gallery-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: light-dark(rgba(255, 255, 255, 0.85), rgba(0, 0, 0, 0.65));
	backdrop-filter: blur(4px);
	border: 1px solid light-dark(rgba(0,0,0,0.05), rgba(255,255,255,0.05));
	color: light-dark(var(--wp--preset--color--contrast), #ffffff);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.25s ease, background 0.2s ease, transform 0.2s ease;
	z-index: 2;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.egnitech-gallery-main-wrapper:hover .egnitech-gallery-arrow {
	opacity: 1;
}

.egnitech-gallery-arrow:hover {
	background: light-dark(#ffffff, #000000);
	transform: translateY(-50%) scale(1.05);
}

.egnitech-gallery-arrow--prev {
	left: 16px;
}

.egnitech-gallery-arrow--next {
	right: 16px;
}

/* Bottom Thumbnails */
.egnitech-gallery-thumbs-container {
	margin-top: 16px;
	width: 100%;
	overflow: hidden;
	min-width: 0;
}

.egnitech-gallery-thumbs {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none;  /* IE and Edge */
	padding: 4px 2px;
	width: 100%;
}

.egnitech-gallery-thumbs::-webkit-scrollbar {
	display: none; /* Chrome, Safari, Opera */
}

.egnitech-gallery-thumb-btn {
	flex: 0 0 76px;
	width: 76px;
	height: 76px;
	padding: 0;
	border-radius: 8px;
	border: 2px solid transparent;
	background: light-dark(rgba(0, 0, 0, 0.02), rgba(255, 255, 255, 0.02));
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.25s ease, opacity 0.25s ease, transform 0.2s ease;
	scroll-snap-align: start;
	opacity: 0.65;
	box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.egnitech-gallery-thumb-btn:hover {
	opacity: 0.9;
	transform: translateY(-2px);
}

.egnitech-gallery-thumb-btn.is-active {
	border-color: var(--wp--preset--color--accent, #00D4AA);
	opacity: 1;
	transform: translateY(-2px);
	box-shadow: 0 4px 10px rgba(0, 212, 170, 0.15);
}

.egnitech-gallery-thumb-btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 6px;
}

/* Lightbox Modal */
.egnitech-gallery-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.egnitech-gallery-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.egnitech-lightbox-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.92);
	backdrop-filter: blur(10px);
}

.egnitech-lightbox-content {
	position: relative;
	width: 100%;
	max-width: 90vw;
	height: 100%;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 10;
}

.egnitech-lightbox-close {
	position: absolute;
	top: 20px;
	right: 0;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.25s ease, transform 0.25s ease;
	z-index: 12;
}

.egnitech-lightbox-close:hover {
	background: rgba(255, 255, 255, 0.15);
	transform: rotate(90deg);
}

.egnitech-lightbox-image-wrapper {
	width: 100%;
	height: 80%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.egnitech-lightbox-image {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transform: scale(0.95);
	transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.egnitech-gallery-lightbox.is-open .egnitech-lightbox-image {
	opacity: 1;
	transform: scale(1);
}

/* Lightbox Navigation */
.egnitech-lightbox-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 50px;
	height: 50px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.25s ease, transform 0.2s ease;
	z-index: 11;
}

.egnitech-lightbox-arrow:hover {
	background: rgba(255, 255, 255, 0.18);
	transform: translateY(-50%) scale(1.05);
}

.egnitech-lightbox-arrow--prev {
	left: 0;
}

.egnitech-lightbox-arrow--next {
	right: 0;
}

.egnitech-lightbox-caption {
	margin-top: 20px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.95rem;
	font-family: var(--wp--preset--font-family--inter), sans-serif;
	letter-spacing: -0.01em;
	text-align: center;
	max-width: 600px;
	line-height: 1.4;
}

/* Mobile fraction pagination */
.egnitech-gallery-mobile-pagination {
	display: none; /* Hidden on desktop */
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-top: 16px;
	width: 100%;
}

.egnitech-gallery-mobile-arrow {
	background: transparent;
	border: none;
	color: light-dark(#666666, #cccccc);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
	transition: color 0.2s ease, transform 0.2s ease;
}

.egnitech-gallery-mobile-arrow:hover {
	color: light-dark(#000000, #ffffff);
	transform: scale(1.1);
}

.egnitech-gallery-mobile-fraction {
	font-family: var(--wp--preset--font-family--inter), sans-serif;
	font-size: 0.95rem;
	font-weight: 500;
	color: light-dark(#333333, #ffffff);
	user-select: none;
}

/* Responsive adjustments */
@media (max-width: 767px) {
	.egnitech-gallery-main-wrapper {
		overflow: visible;
		box-shadow: none;
		background: transparent;
		aspect-ratio: auto;
	}
	
	.egnitech-gallery-main {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scroll-behavior: smooth;
		scrollbar-width: none;
		-ms-overflow-style: none;
		padding-left: 0;
		padding-right: var(--wp--preset--spacing--50, 24px);
		gap: 12px;
	}

	.egnitech-gallery-main::-webkit-scrollbar {
		display: none;
	}
	
	.egnitech-gallery-slide {
		flex: 0 0 86%; /* Active slide width so the next one peeks in */
		scroll-snap-align: start;
		height: auto;
	}

	.egnitech-gallery-slide img {
		border-radius: 20px; /* Modern rounded corners matching Image 2 */
		width: 100%;
		height: auto;
		aspect-ratio: 1 / 1;
		object-fit: cover;
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
	}
	
	.egnitech-gallery-arrow {
		display: none !important; /* Hide overlay arrows on mobile */
	}
	
	.egnitech-gallery-thumbs-container {
		display: none !important; /* Hide thumbnails on mobile */
	}

	.egnitech-gallery-mobile-pagination {
		display: flex; /* Show fraction pagination on mobile */
		margin-right: var(--wp--preset--spacing--50, 24px);
	}
	
	.egnitech-lightbox-arrow {
		width: 44px;
		height: 44px;
	}
	
	.egnitech-lightbox-arrow--prev {
		left: 0;
	}

	.egnitech-lightbox-arrow--next {
		right: 0;
	}
	
	.egnitech-lightbox-close {
		top: 10px;
		right: 10px;
		width: 40px;
		height: 40px;
	}
}

/* ==========================================================================
   Modern product gallery layout options
   ========================================================================== */

/* --- Option A: Bottom Horizontal Carousel (Crawler) --- */
.egnitech-custom-gallery--bottom-carousel .egnitech-gallery-thumbs-container {
	position: relative;
	padding: 0 36px;
	margin-top: 16px;
}

.egnitech-thumbs-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: light-dark(rgba(255, 255, 255, 0.95), rgba(30, 30, 30, 0.9));
	border: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.1));
	color: light-dark(var(--wp--preset--color--contrast), #ffffff);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 5;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
	transition: all 0.2s ease;
	padding: 0;
}

.egnitech-thumbs-arrow:hover:not(:disabled) {
	background: light-dark(#ffffff, #000000);
	transform: translateY(-50%) scale(1.08);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

.egnitech-thumbs-arrow:disabled {
	opacity: 0.25;
	cursor: not-allowed;
}

.egnitech-thumbs-arrow--prev {
	left: 0;
}

.egnitech-thumbs-arrow--next {
	right: 0;
}

.egnitech-gallery-thumbs-scrollbar {
	height: 2px;
	width: 100%;
	background: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.05));
	margin-top: 12px;
	border-radius: 2px;
	overflow: hidden;
}

.egnitech-gallery-thumbs-scrollbar-bar {
	height: 100%;
	width: 0%;
	background: var(--wp--preset--color--accent, #00D4AA);
	transition: width 0.1s ease;
}

/* --- Option B: Left Vertical Strip --- */
@media (min-width: 768px) {
	.egnitech-custom-gallery--left-vertical {
		display: grid;
		grid-template-columns: 76px 1fr;
		gap: 16px;
		align-items: start;
	}

	.egnitech-custom-gallery--left-vertical .egnitech-gallery-main-wrapper {
		grid-column: 2;
		grid-row: 1;
	}

	.egnitech-custom-gallery--left-vertical .egnitech-gallery-thumbs-container {
		grid-column: 1;
		grid-row: 1;
		margin-top: 0;
		height: 100%;
		max-height: 100%;
		min-height: 0;
	}

	.egnitech-custom-gallery--left-vertical .egnitech-gallery-thumbs {
		flex-direction: column;
		overflow-y: auto;
		overflow-x: hidden;
		max-height: 480px;
		padding: 2px;
	}

	.egnitech-custom-gallery--left-vertical .egnitech-gallery-thumbs::-webkit-scrollbar {
		width: 3px;
		display: block;
	}

	.egnitech-custom-gallery--left-vertical .egnitech-gallery-thumbs::-webkit-scrollbar-track {
		background: transparent;
	}

	.egnitech-custom-gallery--left-vertical .egnitech-gallery-thumbs::-webkit-scrollbar-thumb {
		background: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
		border-radius: 3px;
	}

	.egnitech-custom-gallery--left-vertical .egnitech-gallery-thumb-btn {
		flex: 0 0 76px;
		width: 76px;
		height: 76px;
	}
}

/* --- Option C: Minimalist Dot Navigation --- */
.egnitech-custom-gallery--minimal-dots {
	position: relative;
}

.egnitech-custom-gallery--minimal-dots .egnitech-gallery-thumbs-container {
	position: relative;
	margin-top: 16px;
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
}

.egnitech-custom-gallery--minimal-dots .egnitech-gallery-thumbs {
	background: light-dark(rgba(0, 0, 0, 0.03), rgba(255, 255, 255, 0.03));
	padding: 8px 16px;
	border-radius: 30px;
	border: 1px solid light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.08));
	display: flex;
	justify-content: center;
	gap: 8px;
	width: auto;
	overflow: visible;
}

.egnitech-custom-gallery--minimal-dots .egnitech-gallery-thumb-btn {
	flex: 0 0 8px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	border: none;
	background: light-dark(#222222, #ffffff);
	opacity: 0.3;
	padding: 0;
	position: relative;
	overflow: visible;
	transform: none;
	box-shadow: none;
}

.egnitech-custom-gallery--minimal-dots .egnitech-gallery-thumb-btn img {
	display: none !important;
}

.egnitech-custom-gallery--minimal-dots .egnitech-gallery-thumb-btn.is-active {
	opacity: 1;
	background: var(--wp--preset--color--accent, #00D4AA);
	transform: scale(1.25);
	box-shadow: 0 0 8px rgba(0, 212, 170, 0.4);
}

/* Micro-Image Hover Tooltip Preview */
.egnitech-custom-gallery--minimal-dots .egnitech-gallery-thumb-btn::before {
	content: '';
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%) scale(0.85);
	width: 48px;
	height: 48px;
	background-image: var(--thumb-img);
	background-size: cover;
	background-position: center;
	border-radius: 6px;
	border: 2px solid light-dark(#ffffff, #333333);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 20;
}

.egnitech-custom-gallery--minimal-dots .egnitech-gallery-thumb-btn:hover::before {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) scale(1);
}

/* --- Option D: Bottom Wrapped Grid --- */
.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumbs-container {
	margin-top: 16px;
	padding: 0 24px; /* Indent thumbnails slightly from the edges */
	width: 100%;
	overflow: visible;
}

.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
	overflow: visible;
	width: 100%;
	padding: 4px 0;
}

.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumb-btn {
	flex: 0 0 calc((100% - 5 * 12px) / 6);
	width: calc((100% - 5 * 12px) / 6);
	height: auto;
	aspect-ratio: 1 / 1;
	opacity: 0.65;
	border: 2px solid transparent;
	border-radius: 8px;
	padding: 2px;
	background: transparent;
	transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
	transform: none;
	box-shadow: none;
}

.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumb-btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 6px;
}

.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumb-btn:hover {
	opacity: 0.95;
	transform: translateY(-2px);
	border-color: light-dark(rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0.25));
}

.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumb-btn.is-active {
	opacity: 1;
	border-color: var(--wp--preset--color--accent, #00D4AA);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 212, 170, 0.2);
}

@media (max-width: 768px) {
	.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumbs-container {
		padding: 0 16px;
	}
	.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumbs {
		gap: 10px;
	}
	.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumb-btn {
		flex: 0 0 calc((100% - 4 * 10px) / 5);
		width: calc((100% - 4 * 10px) / 5);
	}
}

@media (max-width: 480px) {
	.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumbs-container {
		padding: 0 12px;
	}
	.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumbs {
		gap: 8px;
	}
	.egnitech-custom-gallery--bottom-grid .egnitech-gallery-thumb-btn {
		flex: 0 0 calc((100% - 3 * 8px) / 4);
		width: calc((100% - 3 * 8px) / 4);
	}
}

