/* =============================================================================
   NDV Custom Product Gallery — ndv-gallery.css
   Version: 1.0.0
   Uses CSS custom properties so Elementor widget controls take effect
   without touching this file.
   ============================================================================= */

/* ---- CSS Variable defaults (overridden by Elementor inline styles) ---- */
.ndv-gallery {
	--ndv-radius:             6px;
	--ndv-gap:                10px;
	--ndv-thumb-active-color: #333333;
	--ndv-thumb-opacity:      0.45;
	--ndv-thumb-gap:          8px;
	--ndv-arrow-color:        #ffffff;
	--ndv-arrow-color-hover:  #ffffff;
	--ndv-arrow-bg:           rgba(0, 0, 0, 0.45);
	--ndv-arrow-bg-hover:     rgba(0, 0, 0, 0.75);

	position: relative;
	max-width: 100%;
}

/* ---- Main image area ---- */
.ndv-gallery__main {
	margin-bottom: var(--ndv-gap);
	border-radius: var(--ndv-radius);
	overflow: hidden;
}

.ndv-gallery__main img {
	display: block;
	width: 100%;
	height: auto;
}

.ndv-gallery__thumbs img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ---- Zoom ---- */
.ndv-gallery__zoom {
	position: relative;
	background-repeat: no-repeat;
	background-size: 200%;
	cursor: crosshair;
}

.ndv-gallery__zoom.is-zooming img {
	opacity: 0;
}

/* ---- Thumbnails ---- */
.ndv-gallery__thumbs .swiper-slide {
	opacity: var(--ndv-thumb-opacity);
	cursor: pointer;
	border: 2px solid transparent;
	border-radius: var(--ndv-radius);
	overflow: hidden;
	transition: opacity 0.2s ease, border-color 0.2s ease;
	flex-shrink: 0;
	box-sizing: border-box;
}

.ndv-gallery--left .ndv-gallery__thumbs .swiper-slide,
.ndv-gallery--right .ndv-gallery__thumbs .swiper-slide {
	width: 100% !important;
	height: var(--ndv-thumb-strip-width, 140px) !important;
}

.ndv-gallery__thumbs .swiper-slide-thumb-active {
	opacity: 1;
	border-color: var(--ndv-thumb-active-color);
}

/* ---- Layout: Left Thumbs (ndv-gallery--left) ---- */
.ndv-gallery--left {
	display: flex;
	flex-direction: row-reverse;
	gap: var(--ndv-gap);
	align-items: stretch;
}

.ndv-gallery--left .ndv-gallery__main {
	flex: 1;
	min-width: 0;
	margin-bottom: 0;
}

.ndv-gallery--left .ndv-gallery__thumbs {
	width: var(--ndv-thumb-strip-width, 140px) !important;
	flex: 0 0 var(--ndv-thumb-strip-width, 140px) !important;
	max-width: var(--ndv-thumb-strip-width, 140px) !important;
}

/* ---- Layout: Right Thumbs (ndv-gallery--right) ---- */
.ndv-gallery--right {
	display: flex;
	flex-direction: row;
	gap: var(--ndv-gap);
	align-items: stretch;
}

.ndv-gallery--right .ndv-gallery__main {
	flex: 1;
	min-width: 0;
	margin-bottom: 0;
}

.ndv-gallery--right .ndv-gallery__thumbs {
	width: var(--ndv-thumb-strip-width, 140px) !important;
	flex: 0 0 var(--ndv-thumb-strip-width, 140px) !important;
	max-width: var(--ndv-thumb-strip-width, 140px) !important;
}

/* ---- Layout: Grid Tiles (ndv-gallery--tiles) ---- */
.ndv-gallery--tiles .ndv-gallery__main .swiper-wrapper {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--ndv-gap);
	transform: none !important;
}

.ndv-gallery--tiles .ndv-gallery__main .swiper-slide {
	width: auto !important;
}

.ndv-gallery--tiles .ndv-gallery__thumbs {
	display: none;
}

/* ---- Video slides ---- */
.ndv-gallery__video {
	position: relative;
	cursor: pointer;
}

.ndv-gallery__video iframe,
.ndv-gallery__video video {
	width: 100%;
	aspect-ratio: 16 / 9;
	border: 0;
	display: block;
}

.ndv-gallery__play {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 62px;
	height: 62px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	pointer-events: none;
}

.ndv-gallery__play::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	border-left: 18px solid #fff;
	border-top: 11px solid transparent;
	border-bottom: 11px solid transparent;
}

/* ---- Lightbox expand button ---- */
.ndv-gallery__lightbox-btn {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 5;
	width: 34px;
	height: 34px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.9);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease;
}

.ndv-gallery__lightbox-btn:hover {
	background: #ffffff;
	transform: scale(1.08);
}

.ndv-gallery__lightbox-btn::before {
	content: '';
	position: absolute;
	inset: 10px;
	border: 2px solid #333;
	border-radius: 2px;
}

/* ---- Lightbox overlay ---- */
.ndv-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.92);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: zoom-out;
	animation: ndv-lb-fade 0.2s ease;
}

@keyframes ndv-lb-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.ndv-lightbox img {
	max-width: 92vw;
	max-height: 92vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.ndv-lightbox__close {
	position: absolute;
	top: 18px;
	right: 26px;
	font-size: 42px;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	transition: color 0.15s ease, transform 0.15s ease;
}

.ndv-lightbox__close:hover {
	color: #e0e0e0;
	transform: rotate(90deg);
}

/* ---- Navigation Arrows ---- */
.ndv-gallery__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 38px;
	height: 38px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.ndv-gallery__main:hover .ndv-gallery__arrow:not(.swiper-button-disabled) {
	opacity: 1;
	pointer-events: auto;
}

.ndv-gallery__arrow:hover {
	background: rgba(0, 0, 0, 0.85);
}

/* Swiper's own button-prev/next classes handle left/right; we just override colors */
.ndv-gallery__arrow.swiper-button-prev,
.ndv-gallery__arrow.swiper-button-next {
	margin-top: 0; /* reset Swiper default */
}

.ndv-gallery__arrow.swiper-button-disabled {
	opacity: 0.3;
	pointer-events: none;
}

.ndv-gallery__arrow.swiper-button-prev::after,
.ndv-gallery__arrow.swiper-button-next::after {
	color: var(--ndv-arrow-color);
	font-size: 16px;
	font-weight: 700;
	transition: color 0.2s ease;
}

.ndv-gallery__arrow:hover::after {
	color: var(--ndv-arrow-color-hover);
}

/* Hide arrows when not requested (JS adds .ndv-arrows-hidden) */
.ndv-gallery.ndv-arrows-hidden .ndv-gallery__arrow {
	display: none;
}

/* ---- Thumbnail Navigation Arrows ---- */
.ndv-thumb-arrow {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	width: 36px;
	height: 36px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.65);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, background 0.2s ease;
}

.ndv-gallery__thumbs:hover .ndv-thumb-arrow:not(.swiper-button-disabled) {
	opacity: 1;
	pointer-events: auto;
}

.ndv-thumb-arrow:hover {
	background: rgba(0, 0, 0, 0.88);
}

.ndv-thumb-arrow::after {
	content: '';
	width: 10px;
	height: 10px;
	border-right: 2px solid #ffffff;
	border-bottom: 2px solid #ffffff;
}

.ndv-thumb-arrow--prev {
	top: 0;
}
.ndv-thumb-arrow--prev::after {
	transform: translateY(3px) rotate(-135deg);
}

.ndv-thumb-arrow--next {
	bottom: 0;
}
.ndv-thumb-arrow--next::after {
	transform: translateY(-3px) rotate(45deg);
}

.ndv-thumb-arrow.swiper-button-disabled {
	display: none;
}

/* ---- Swiper disabled state (tiles layout) ---- */
.ndv-gallery--tiles .ndv-gallery__arrow {
	display: none;
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
	/* Left/Right thumb layouts collapse to vertical on mobile */
	.ndv-gallery--left,
	.ndv-gallery--right {
		flex-direction: column;
	}

	.ndv-gallery--left .ndv-gallery__thumbs,
	.ndv-gallery--right .ndv-gallery__thumbs {
		width: 100%;
		flex: none;
		max-height: none;
	}

	.ndv-gallery--left .ndv-gallery__thumbs .swiper-wrapper,
	.ndv-gallery--right .ndv-gallery__thumbs .swiper-wrapper {
		flex-direction: row;
	}

	/* Disable zoom on mobile (touch already handles pinch) */
	.ndv-gallery__zoom {
		cursor: default;
	}

	.ndv-gallery__zoom.is-zooming img {
		opacity: 1;
	}

	.ndv-gallery__zoom.is-zooming {
		background-image: none !important;
	}
}
