/**
 * Enhanced Gallery and Lightbox Styles
 * Includes optimizations for large photo galleries
 */

/* Gallery Section */
.gallery {
	background-color: var(--secondary-color);
	padding: 60px 0;
}

/* Gallery Tab Navigation */
.gallery-tabs {
	display: flex;
	justify-content: center;
	margin-bottom: 40px;
	flex-wrap: wrap;
	gap: 10px;
}

.gallery-tab {
	background-color: transparent;
	border: 1px solid var(--primary-color);
	color: var(--primary-color);
	padding: 10px 20px;
	cursor: pointer;
	font-weight: 500;
	border-radius: 25px;
	transition: all 0.3s ease;
}

.gallery-tab.active, 
.gallery-tab:hover {
	background-color: var(--primary-color);
	color: var(--light-color);
}

/* Gallery Grid Layout */
.gallery-container {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 20px;
	display: none;
}

.gallery-container.active {
	display: grid;
}

/* Gallery Items and Images */
.gallery-item {
	height: 250px;
	border-radius: 10px;
	overflow: hidden;
	position: relative;
	cursor: pointer;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
	transform: translateY(-5px);
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.gallery-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.gallery-item:hover .gallery-image {
	transform: scale(1.1);
}

/* Gallery Overlay Effect */
.gallery-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
	opacity: 1;
}

.gallery-icon {
	color: var(--light-color);
	font-size: 2rem;
}

/* Lightbox Styles */
.lightbox {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.9);
	z-index: 2000;
	justify-content: center;
	align-items: center;
	padding: 40px;
	box-sizing: border-box;
}

.lightbox.active {
	display: flex;
	animation: lightbox-fade-in 0.3s ease;
}

@keyframes lightbox-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.lightbox-content {
	position: relative;
	max-width: 90%;
	max-height: 90%;
}

.lightbox-img {
	display: block;
	max-width: 100%;
	max-height: 90vh;
	margin: 0 auto;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
	border-radius: 5px;
	opacity: 0;
	transition: opacity 0.5s ease;
}

.lightbox-img.loaded {
	opacity: 1;
}

.lightbox-close {
	position: absolute;
	top: 20px;
	right: 20px;
	color: #fff;
	font-size: 30px;
	cursor: pointer;
	z-index: 2001;
	background-color: rgba(0, 0, 0, 0.5);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.3s ease;
}

.lightbox-close:hover {
	background-color: rgba(255, 255, 255, 0.2);
}

/* Loading Indicator */
.lightbox-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: white;
	font-size: 18px;
	text-align: center;
}

.spinner {
	border: 5px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top: 5px solid white;
	width: 40px;
	height: 40px;
	margin: 0 auto 10px;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Navigation Controls for Lightbox */
.lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	color: white;
	font-size: 30px;
	cursor: pointer;
	background-color: rgba(0, 0, 0, 0.5);
	width: 50px;
	height: 50px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.3s ease;
	z-index: 2001;
}

.lightbox-nav:hover {
	background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
	left: 20px;
}

.lightbox-next {
	right: 20px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
	.gallery-container {
		grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
		gap: 15px;
	}
	
	.gallery-item {
		height: 200px;
	}
	
	.lightbox-nav {
		width: 40px;
		height: 40px;
		font-size: 24px;
	}
}

@media (max-width: 480px) {
	.gallery-container {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 10px;
	}
	
	.gallery-item {
		height: 150px;
	}
	
	.lightbox-close {
		top: 10px;
		right: 10px;
		width: 35px;
		height: 35px;
	}
	
	.lightbox-nav {
		width: 35px;
		height: 35px;
	}
	
	.lightbox-prev {
		left: 10px;
	}
	
	.lightbox-next {
		right: 10px;
	}
}

/* Lazy Loading Support */
.gallery-image.lazy-load {
	opacity: 0;
	transition: opacity 0.5s ease;
}

.gallery-image.lazy-load.loaded {
	opacity: 1;
}