/**
 * NRD Elementor - Image Gallery Styles
 * 
 * Performance-optimized image gallery with progressive loading
 * 
 * @package NRD_Elementor
 * @version 1.0.0
 */

/* ==========================================================================
   Gallery Container
   ========================================================================== */

.nrd-gallery-wrapper {
	position: relative;
	width: 100%;
	height: 500px;
	overflow: hidden;
	background-color: #f0f0f0;
	border-radius: 8px;
}

/* ==========================================================================
   Gallery Track & Slides
   ========================================================================== */

.nrd-gallery-track {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.nrd-gallery-slides {
	position: relative;
	width: 100%;
	height: 100%;
}

.nrd-gallery-slide {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.5s ease-in-out;
}

/* Active slide */
.nrd-gallery-slide.active {
	opacity: 1;
	pointer-events: auto;
	z-index: 1;
}

/* Slide transition for fade effect */
.nrd-gallery-wrapper[data-transition="fade"] .nrd-gallery-slide {
	transition: opacity 0.5s ease-in-out;
}

/* Slide transition for slide effect - keep fully visible during transition */
.nrd-gallery-wrapper[data-transition="slide"] .nrd-gallery-slide {
	transition: transform 0.5s ease-in-out;
	transform: translateX(0);
}

/* Keep slides visible during slide transition */
.nrd-gallery-wrapper[data-transition="slide"] .nrd-gallery-slide.active,
.nrd-gallery-wrapper[data-transition="slide"] .nrd-gallery-slide.transitioning {
	opacity: 1;
}

/* Transitioning slide should be above background but below active */
.nrd-gallery-wrapper[data-transition="slide"] .nrd-gallery-slide.transitioning {
	z-index: 0;
	pointer-events: none;
}

/* Active slide during transition */
.nrd-gallery-wrapper[data-transition="slide"] .nrd-gallery-slide.active {
	z-index: 1;
}

/* Image styling */
.nrd-gallery-slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	border-radius: inherit;
}

/* Linked images */
.nrd-gallery-slide a {
	display: block;
	width: 100%;
	height: 100%;
	cursor: pointer;
}

.nrd-gallery-slide a img {
	transition: transform 0.3s ease;
}

.nrd-gallery-slide a:hover img {
	/* No transform - keep clean */
}

/* ==========================================================================
   Navigation Buttons
   ========================================================================== */

.nrd-gallery-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: rgba(0, 0, 0, 0.5);
	color: #ffffff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
	z-index: 10;
	padding: 0;
	font-size: 18px;
	line-height: 1;
}

/* Centered navigation group */
.nrd-gallery-nav-center {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 12px;
	z-index: 10;
}

/* Centered arrow buttons - smaller, inline */
.nrd-gallery-nav.center-position {
	position: static;
	transform: none !important;
	width: 32px;
	height: 32px;
	font-size: 14px;
}

.nrd-gallery-nav.center-position:hover,
.nrd-gallery-nav.center-position:active {
	transform: none !important;
}

/* Counter in center layout - no transform needed */
.nrd-gallery-nav-center .nrd-gallery-counter {
	position: static;
	transform: none;
	margin: 0;
}

/* Hide default counter when arrows are centered */
.nrd-gallery-wrapper[data-arrow-position="center"] > .nrd-gallery-counter {
	display: none;
}

.nrd-gallery-nav svg {
	width: 100%;
	height: 100%;
	padding: 8px;
}

.nrd-gallery-nav:hover {
	background-color: rgba(0, 0, 0, 0.8);
	/* Keep positioning transform for side arrows only */
}

/* Side arrows keep their vertical centering */
.nrd-gallery-nav-prev:hover,
.nrd-gallery-nav-next:hover {
	transform: translateY(-50%);
}

.nrd-gallery-nav-prev:active,
.nrd-gallery-nav-next:active {
	transform: translateY(-50%);
}

.nrd-gallery-nav:focus {
	outline: 3px solid #4a90e2;
	outline-offset: 2px;
}

.nrd-gallery-nav:focus:not(:focus-visible) {
	outline: none;
}

.nrd-gallery-nav:focus-visible {
	outline: 3px solid #4a90e2;
	outline-offset: 2px;
}

.nrd-gallery-nav:active {
	opacity: 0.8;
}

/* Previous button positioning */
.nrd-gallery-nav-prev {
	left: 16px;
}

/* Next button positioning */
.nrd-gallery-nav-next {
	right: 16px;
}

/* Hide navigation when not loaded */
.nrd-gallery-wrapper[data-gallery-loaded="false"] .nrd-gallery-nav {
	opacity: 0;
	pointer-events: none;
}

/* ==========================================================================
   Arrow Icons (Elementor Icons Manager)
   ========================================================================== */

/* Icon elements from Elementor Icons Manager */
.nrd-gallery-nav i,
.nrd-gallery-nav svg {
	pointer-events: none;
	transition: color 0.3s ease, fill 0.3s ease;
}

/* Icon sizing */
.nrd-gallery-nav i {
	font-size: inherit;
	line-height: 1;
}

.nrd-gallery-nav svg {
	width: 1em;
	height: 1em;
	display: inline-block;
	vertical-align: middle;
}

/* Custom uploaded SVG - inline rendering */
.nrd-gallery-nav svg.custom-arrow-svg {
	display: block;
	width: 100%;
	height: 100%;
	pointer-events: none;
	max-width: 100%;
	max-height: 100%;
	padding: 8px;
}

/* Custom uploaded SVG - fallback img tag (editor preview) */
.nrd-gallery-nav img.custom-arrow-svg {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
	max-width: 100%;
	max-height: 100%;
	padding: 8px;
}

/* Allow full CSS control of inline SVG elements */
.nrd-gallery-nav svg.custom-arrow-svg * {
	pointer-events: none;
}

/* ==========================================================================
   Counter
   ========================================================================== */

.nrd-gallery-counter {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	padding: 8px 16px;
	background-color: rgba(0, 0, 0, 0.5);
	color: #ffffff;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	z-index: 10;
	transition: opacity 0.3s ease;
	white-space: nowrap;
	user-select: none;
}

.nrd-gallery-counter-separator {
	margin: 0 4px;
}

/* Hide counter when not loaded */
.nrd-gallery-wrapper[data-gallery-loaded="false"] .nrd-gallery-counter {
	opacity: 0;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

/* Skeleton/shimmer effect for loading images */
.nrd-gallery-slide.loading {
	background: linear-gradient(
		90deg,
		#f0f0f0 0%,
		#e0e0e0 20%,
		#f0f0f0 40%,
		#f0f0f0 100%
	);
	background-size: 200% 100%;
	animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablets and smaller */
@media (max-width: 1024px) {
	.nrd-gallery-nav {
		width: 40px;
		height: 40px;
		font-size: 16px;
	}

	.nrd-gallery-nav-prev {
		left: 12px;
	}

	.nrd-gallery-nav-next {
		right: 12px;
	}

	.nrd-gallery-counter {
		bottom: 12px;
		font-size: 13px;
		padding: 6px 14px;
	}
}

/* Mobile devices */
@media (max-width: 767px) {
	.nrd-gallery-wrapper {
		height: 400px;
	}

	.nrd-gallery-nav {
		width: 36px;
		height: 36px;
		font-size: 14px;
	}

	.nrd-gallery-nav-prev {
		left: 8px;
	}

	.nrd-gallery-nav-next {
		right: 8px;
	}

	.nrd-gallery-counter {
		bottom: 8px;
		font-size: 12px;
		padding: 6px 12px;
	}

	/* Centered navigation adjustments for mobile */
	.nrd-gallery-nav-center {
		bottom: 8px;
		gap: 8px;
	}

	.nrd-gallery-nav.center-position {
		width: 28px;
		height: 28px;
		font-size: 12px;
	}

	/* Disable hover effects on touch devices */
	.nrd-gallery-slide a:hover img {
		transform: none;
	}
}

/* Extra small devices */
@media (max-width: 480px) {
	.nrd-gallery-wrapper {
		height: 300px;
	}

	.nrd-gallery-nav {
		width: 32px;
		height: 32px;
	}
}

/* ==========================================================================
   Accessibility - Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.nrd-gallery-slide,
	.nrd-gallery-nav,
	.nrd-gallery-slide a img {
		transition: none !important;
		animation: none !important;
	}

	.nrd-gallery-nav:hover {
		transform: translateY(-50%);
	}

	.nrd-gallery-nav:active {
		transform: translateY(-50%);
	}

	.nrd-gallery-slide a:hover img {
		transform: none;
	}
}

/* ==========================================================================
   High Contrast Mode (accessibility)
   ========================================================================== */

@media (prefers-contrast: high) {
	.nrd-gallery-nav:focus-visible {
		outline: 4px solid currentColor;
		outline-offset: 2px;
	}

	.nrd-gallery-nav {
		background-color: rgba(0, 0, 0, 0.9);
		border: 2px solid #ffffff;
	}

	.nrd-gallery-counter {
		background-color: rgba(0, 0, 0, 0.9);
		border: 2px solid #ffffff;
	}
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	.nrd-gallery-nav,
	.nrd-gallery-counter {
		display: none !important;
	}

	.nrd-gallery-slide {
		position: static !important;
		opacity: 1 !important;
	}

	.nrd-gallery-slide:not(:first-child) {
		page-break-before: always;
	}
}

/* ==========================================================================
   Elementor Editor Specific
   ========================================================================== */

.elementor-editor-active .nrd-gallery-wrapper {
	/* Show all controls immediately in editor */
}

.elementor-editor-active .nrd-gallery-nav {
	opacity: 1 !important;
	pointer-events: auto !important;
}

.elementor-editor-active .nrd-gallery-counter {
	opacity: 1 !important;
}

/* ==========================================================================
   Single Image Mode (No navigation needed)
   ========================================================================== */

.nrd-gallery-wrapper[data-total-images="1"] .nrd-gallery-nav,
.nrd-gallery-wrapper[data-total-images="1"] .nrd-gallery-counter {
	display: none;
}

