/**
 * Gallery Widget Styles
 *
 * Professional gallery widget with multiple layouts and effects
 *
 * @package Local_Garage_Elementor_Addon
 * @since 1.0.0
 */

/* =====================================
   1. BASE STYLES
   ===================================== */

.lg-gallery {
	position: relative;
	width: 100%;
}

.lg-gallery-placeholder {
	padding: 60px 20px;
	text-align: center;
	color: #999;
	background: #f5f5f5;
	border-radius: 8px;
	font-size: 16px;
}

/* =====================================
   2. GRID LAYOUT
   ===================================== */

.lg-gallery-grid {
	display: grid;
	gap: 20px;
}

/* Column classes */
.lg-gallery-cols-1 { grid-template-columns: repeat(1, 1fr); }
.lg-gallery-cols-2 { grid-template-columns: repeat(2, 1fr); }
.lg-gallery-cols-3 { grid-template-columns: repeat(3, 1fr); }
.lg-gallery-cols-4 { grid-template-columns: repeat(4, 1fr); }
.lg-gallery-cols-5 { grid-template-columns: repeat(5, 1fr); }
.lg-gallery-cols-6 { grid-template-columns: repeat(6, 1fr); }
.lg-gallery-cols-7 { grid-template-columns: repeat(7, 1fr); }
.lg-gallery-cols-8 { grid-template-columns: repeat(8, 1fr); }

/* =====================================
   3. MASONRY LAYOUT
   ===================================== */

.lg-gallery-masonry {
	column-count: 3;
	column-gap: 20px;
}

.lg-gallery-masonry .lg-gallery-item {
	break-inside: avoid;
	margin-bottom: 20px;
	page-break-inside: avoid;
}

/* =====================================
   4. SLIDER LAYOUT
   ===================================== */

.lg-gallery-slider {
	position: relative;
	width: 100%;
}

.lg-gallery-slider .swiper-wrapper {
	align-items: stretch;
}

.lg-gallery-slider .swiper-slide {
	height: auto;
	display: flex;
}

.lg-gallery-slider .swiper-slide .lg-gallery-item {
	width: 100%;
	height: 100%;
}

/* Navigation Arrows */
.lg-gallery-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 50px;
	height: 50px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.3s ease;
	z-index: 10;
	font-size: 24px;
	border: none;
}

.lg-gallery-arrow:hover {
	background: rgba(0, 0, 0, 0.8);
	transform: translateY(-50%) scale(1.1);
}

.lg-gallery-arrow-prev {
	left: 20px;
}

.lg-gallery-arrow-next {
	right: 20px;
}

.lg-gallery-arrow.swiper-button-disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

/* Slider Wrapper - contains slider + pagination */
.lg-gallery-slider-wrapper {
	position: relative;
	width: 100%;
}

/* Pagination - positioned OUTSIDE the swiper, below images */
.lg-gallery-slider-wrapper .swiper-pagination,
.lg-gallery-slider-wrapper .lg-gallery-pagination {
	position: relative !important;
	bottom: auto !important;
	top: auto !important;
	margin-top: 20px;
	width: 100%;
	text-align: center;
	display: flex;
	justify-content: center;
	gap: 8px;
}

.swiper-pagination-bullet {
	width: 12px;
	height: 12px;
	background: #999;
	opacity: 1;
	transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
	background: #007bff;
	transform: scale(1.2);
}

.swiper-pagination-fraction {
	color: #333;
	font-size: 16px;
	font-weight: 500;
}

.swiper-pagination-progressbar {
	background: #e9ecef;
	height: 4px;
	border-radius: 2px;
}

.swiper-pagination-progressbar .swiper-pagination-progressbar-fill {
	background: #007bff;
	border-radius: 2px;
}

/* =====================================
   5. JUSTIFIED LAYOUT
   ===================================== */

.lg-gallery-justified {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
}

.lg-gallery-justified .lg-gallery-item {
	flex: 1 1 auto;
	min-width: 200px;
	max-width: 350px;
}

/* =====================================
   6. METRO LAYOUT
   ===================================== */

.lg-gallery-metro {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 20px;
	grid-auto-rows: 250px;
}

.lg-gallery-metro .lg-gallery-item {
	grid-column: span 1;
	grid-row: span 1;
}

.lg-gallery-metro .lg-gallery-item.lg-size-large {
	grid-column: span 2;
	grid-row: span 2;
}

.lg-gallery-metro .lg-gallery-item.lg-size-wide {
	grid-column: span 2;
	grid-row: span 1;
}

.lg-gallery-metro .lg-gallery-item.lg-size-tall {
	grid-column: span 1;
	grid-row: span 2;
}

/* =====================================
   7. GALLERY ITEM
   ===================================== */

.lg-gallery-item {
	position: relative;
	overflow: hidden;
	display: block;
	background: #f5f5f5;
}

.lg-gallery-item a {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
}

.lg-gallery-item-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

/* Aspect Ratios */
.lg-aspect-1-1 {
	aspect-ratio: 1 / 1;
}

.lg-aspect-4-3 {
	aspect-ratio: 4 / 3;
}

.lg-aspect-3-4 {
	aspect-ratio: 3 / 4;
}

.lg-aspect-16-9 {
	aspect-ratio: 16 / 9;
}

.lg-aspect-21-9 {
	aspect-ratio: 21 / 9;
}

/* =====================================
   8. OVERLAY & CONTENT
   ===================================== */

.lg-gallery-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.lg-gallery-item:hover .lg-gallery-overlay {
	opacity: 1;
}

.lg-gallery-content {
	padding: 20px;
	text-align: center;
	color: #fff;
	pointer-events: none;
}

.lg-gallery-title {
	font-size: 18px;
	font-weight: 600;
	margin-bottom: 8px;
	line-height: 1.4;
}

.lg-gallery-caption {
	font-size: 14px;
	line-height: 1.5;
	opacity: 0.9;
}

/* =====================================
   9. HOVER EFFECTS
   ===================================== */

/* Zoom In */
.lg-hover-zoom .lg-gallery-item:hover .lg-gallery-item-image {
	transform: scale(1.1);
}

/* Zoom Out */
.lg-hover-zoom-out .lg-gallery-item-image {
	transform: scale(1.1);
}

.lg-hover-zoom-out .lg-gallery-item:hover .lg-gallery-item-image {
	transform: scale(1);
}

/* Rotate */
.lg-hover-rotate .lg-gallery-item:hover .lg-gallery-item-image {
	transform: rotate(3deg) scale(1.05);
}

/* Lift */
.lg-hover-lift .lg-gallery-item {
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lg-hover-lift .lg-gallery-item:hover {
	transform: translateY(-8px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* =====================================
   10. ENTRANCE ANIMATIONS
   ===================================== */

/* Fade In */
.lg-entrance-fade-in .lg-gallery-item {
	opacity: 0;
	transition: opacity 0.6s ease;
}

.lg-entrance-fade-in .lg-gallery-item.lg-animated {
	opacity: 1;
}

/* Slide Up */
.lg-entrance-slide-up .lg-gallery-item {
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.lg-entrance-slide-up .lg-gallery-item.lg-animated {
	opacity: 1;
	transform: translateY(0);
}

/* Zoom In */
.lg-entrance-zoom-in .lg-gallery-item {
	opacity: 0;
	transform: scale(0.8);
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.lg-entrance-zoom-in .lg-gallery-item.lg-animated {
	opacity: 1;
	transform: scale(1);
}

/* =====================================
   11. FILTERS
   ===================================== */

.lg-gallery-filters {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 30px;
}

.lg-filter-btn {
	padding: 10px 20px;
	background: #f5f5f5;
	color: #333;
	border: 2px solid transparent;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.3s ease;
}

.lg-filter-btn:hover {
	background: #e9ecef;
	transform: translateY(-2px);
}

.lg-filter-btn.active {
	background: #007bff;
	color: #fff;
	border-color: #007bff;
}

/* =====================================
   12. LOAD MORE BUTTON
   ===================================== */

.lg-load-more-wrapper {
	text-align: center;
	margin-top: 40px;
}

.lg-load-more-btn {
	padding: 12px 30px;
	background: #007bff;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 16px;
	font-weight: 500;
	transition: all 0.3s ease;
}

.lg-load-more-btn:hover {
	background: #0056b3;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.lg-load-more-btn:disabled {
	background: #6c757d;
	cursor: not-allowed;
	opacity: 0.6;
}

/* =====================================
   13. RESPONSIVE
   ===================================== */

@media (max-width: 1024px) {
	.lg-gallery-arrow {
		width: 40px;
		height: 40px;
		font-size: 20px;
	}

	.lg-gallery-arrow-prev {
		left: 10px;
	}

	.lg-gallery-arrow-next {
		right: 10px;
	}
}

@media (max-width: 768px) {
	.lg-gallery-arrow {
		width: 35px;
		height: 35px;
		font-size: 18px;
	}

	.lg-gallery-arrow-prev {
		left: 5px;
	}

	.lg-gallery-arrow-next {
		right: 5px;
	}

	.lg-gallery-title {
		font-size: 16px;
	}

	.lg-gallery-caption {
		font-size: 13px;
	}

	.swiper-pagination-bullet {
		width: 10px;
		height: 10px;
	}

	/* Mobile slider pagination - ensure it's below images */
	.lg-gallery-slider {
		padding-bottom: 35px;
	}

	.lg-gallery-slider .swiper-pagination {
		bottom: 0;
	}
}

/* =====================================
   14. RTL SUPPORT
   ===================================== */

[dir="rtl"] .lg-gallery-arrow-prev {
	left: auto;
	right: 20px;
}

[dir="rtl"] .lg-gallery-arrow-next {
	right: auto;
	left: 20px;
}

[dir="rtl"] .lg-gallery-masonry {
	direction: ltr;
}

[dir="rtl"] .lg-gallery-masonry .lg-gallery-item {
	direction: rtl;
}

/* =====================================
   15. GLIGHTBOX CUSTOMIZATION
   ===================================== */

.glightbox-clean .gslide-description {
	background: rgba(0, 0, 0, 0.75);
	padding: 15px 20px;
	border-radius: 8px;
}

.glightbox-clean .gdesc-inner {
	color: #fff;
}

.glightbox-clean .gslide-title {
	font-size: 18px;
	font-weight: 600;
	margin-bottom: 8px;
}

/* =====================================
   16. LOADING STATES
   ===================================== */

.lg-gallery-item.loading {
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* =====================================
   17. PRINT STYLES
   ===================================== */

@media print {
	.lg-gallery-arrow,
	.swiper-pagination,
	.lg-gallery-filters,
	.lg-load-more-wrapper {
		display: none !important;
	}

	.lg-gallery-grid,
	.lg-gallery-masonry,
	.lg-gallery-slider {
		page-break-inside: avoid;
	}

	.lg-gallery-item {
		page-break-inside: avoid;
		break-inside: avoid;
	}
}

/* =====================================
   18. ACCESSIBILITY
   ===================================== */

.lg-gallery-item:focus-visible {
	outline: 3px solid #007bff;
	outline-offset: 3px;
}

.lg-gallery-arrow:focus-visible,
.lg-filter-btn:focus-visible,
.lg-load-more-btn:focus-visible {
	outline: 3px solid #007bff;
	outline-offset: 2px;
}

/* Screen reader only text */
.lg-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* =====================================
   19. HIGH CONTRAST MODE
   ===================================== */

@media (prefers-contrast: high) {
	.lg-gallery-overlay {
		background: rgba(0, 0, 0, 0.8);
	}

	.lg-filter-btn {
		border-width: 2px;
		border-color: currentColor;
	}

	.lg-gallery-arrow {
		border: 2px solid #fff;
	}
}

/* =====================================
   20. REDUCED MOTION
   ===================================== */

@media (prefers-reduced-motion: reduce) {
	.lg-gallery-item,
	.lg-gallery-item-image,
	.lg-gallery-overlay,
	.lg-gallery-arrow,
	.lg-filter-btn,
	.lg-load-more-btn {
		transition: none !important;
		animation: none !important;
	}

	.lg-entrance-fade-in .lg-gallery-item,
	.lg-entrance-slide-up .lg-gallery-item,
	.lg-entrance-zoom-in .lg-gallery-item {
		opacity: 1 !important;
		transform: none !important;
	}
}
