/**
 * Galleria Lightbox Styles
 * Stili per la visualizzazione a pieno schermo delle immagini
 */

@import (reference) "variables.less";
@import "evento.less";

// Variables
@lightbox-overlay-bg: rgba(0, 0, 0, 0.95);
@lightbox-text-color: #ffffff;
@lightbox-btn-color: #ffffff;
@lightbox-btn-hover: #007bff;
@transition-speed: 0.3s;

// Stili griglia galleria (come home.less)
body {
	.downloads-grid {
		.badge {
			background-position: center;
			background-size: cover;
			width: 100%;
			text-align: left;
			padding: 0;
			overflow-wrap: anywhere;
			overflow: hidden;
			height: 20rem;
			white-space: initial;
		}

		.band {
			display: block;
			width: 100%;
			backdrop-filter: contrast(2) blur(4px);

			&.dark {
				background-color: rgba(var(--bs-body-color-rgb), 0.75);
				color: rgb(var(--bs-body-bg-rgb));
			}

			&.light {
				background-color: rgba(var(--bs-body-bg-rgb), 0.75);
				color: rgb(var(--bs-body-color-rgb));
			}

			&.text_light, &.text_dark, &.text_red {
				p {
					margin: 1rem;
					display: block;
					font-size: 1rem;
					font-weight: 100;
				}
			}

			&.text_red {
				color: rgb(var(--bs-primary-rgb));
			}
		}
	}
}

// downloads Item Hover
.downloads-item {
	position: relative;
	cursor: pointer;
	transition: transform @transition-speed ease;

	&:hover {
		transform: translateY(-5px);

		.card {
			box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
		}
	}

	.downloads-link {
		position: relative;
		display: block;
		overflow: hidden;
		text-decoration: none;

		img {
			transition: transform @transition-speed ease;
		}

		&:hover img {
			transform: scale(1.05);
		}
	}
}

// downloads Overlay (appare al hover)
.downloads-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
	display: none;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	color: white;
	z-index: 10;
	pointer-events: none;

	i {
		font-size: 3rem;
		margin-bottom: 0.5rem;
	}

	span {
		font-size: 0.9rem;
		font-weight: 500;
		text-transform: uppercase;
		letter-spacing: 1px;
	}
}

// Lightbox Overlay (fullscreen)
.lightbox-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: @lightbox-overlay-bg;
	z-index: 9999;
	overflow: auto;
	animation: fadeIn @transition-speed ease;
}

// Lightbox Container
.lightbox-container {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	padding: 2rem;

	@media (max-width: 768px) {
		padding: 1rem;
	}
}

// Lightbox Content
.lightbox-content {
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	animation: zoomIn @transition-speed ease;

	img {
		max-width: 100%;
		max-height: 70vh;
		object-fit: contain;
		border-radius: 4px;
		box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);

		@media (max-width: 768px) {
			max-height: 60vh;
		}
	}
}

// Lightbox Info
.lightbox-info {
	margin-top: 1.5rem;
	text-align: center;
	color: @lightbox-text-color;
	max-width: 600px;

	h3 {
		font-size: 1.5rem;
		margin-bottom: 0.5rem;
		font-weight: 600;
	}

	p {
		font-size: 1rem;
		margin-bottom: 0.5rem;
		opacity: 0.9;
	}

	.text-muted {
		color: rgba(255, 255, 255, 0.7) !important;
		font-size: 0.875rem;
	}

	@media (max-width: 768px) {
		margin-top: 1rem;

		h3 {
			font-size: 1.2rem;
		}

		p {
			font-size: 0.9rem;
		}
	}
}

// Lightbox Counter
.lightbox-counter {
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.8);
	margin-top: 0.5rem;
	font-weight: 500;
}

// Lightbox Buttons
.lightbox-close,
.lightbox-prev,
.lightbox-next {
	position: fixed;
	background: transparent;
	border: none;
	color: @lightbox-btn-color;
	font-size: 2.5rem;
	cursor: pointer;
	z-index: 10000;
	transition: all @transition-speed ease;
	padding: 1rem;
	line-height: 1;

	&:hover {
		color: @lightbox-btn-hover;
		transform: scale(1.1);
	}

	&.disabled {
		opacity: 0.3;
		cursor: not-allowed;
		pointer-events: none;
	}

	@media (max-width: 768px) {
		font-size: 2rem;
		padding: 0.5rem;
	}
}

.lightbox-close {
	top: 1rem;
	right: 1rem;

	span {
		font-size: 3rem;
		font-weight: 300;
	}

	&:hover {
		transform: rotate(90deg) scale(1.1);
	}
}

.lightbox-prev {
	left: 2rem;
	top: 50%;
	transform: translateY(-50%);

	&:hover {
		transform: translateY(-50%) translateX(-5px);
	}

	@media (max-width: 768px) {
		left: 0.5rem;
	}
}

.lightbox-next {
	right: 2rem;
	top: 50%;
	transform: translateY(-50%);

	&:hover {
		transform: translateY(-50%) translateX(5px);
	}

	@media (max-width: 768px) {
		right: 0.5rem;
	}
}

// Lightbox Thumbnails
.lightbox-thumbnails {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: 0.5rem;
	padding: 1rem;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
	overflow-x: auto;
	z-index: 10000;

	&::-webkit-scrollbar {
		height: 6px;
	}

	&::-webkit-scrollbar-track {
		background: rgba(255, 255, 255, 0.1);
	}

	&::-webkit-scrollbar-thumb {
		background: rgba(255, 255, 255, 0.3);
		border-radius: 3px;

		&:hover {
			background: rgba(255, 255, 255, 0.5);
		}
	}

	@media (max-width: 768px) {
		padding: 0.5rem;
		gap: 0.25rem;
	}
}

.lightbox-thumb {
	width: 80px;
	height: 60px;
	background-size: cover;
	background-position: center;
	border: 2px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	transition: all @transition-speed ease;
	flex-shrink: 0;
	opacity: 0.6;

	&:hover {
		opacity: 1;
		transform: scale(1.05);
		border-color: @lightbox-btn-hover;
	}

	&.active {
		opacity: 1;
		border-color: @lightbox-btn-hover;
		box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
	}

	@media (max-width: 768px) {
		width: 60px;
		height: 45px;
	}
}

// Animations
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes zoomIn {
	from {
		opacity: 0;
		transform: scale(0.9);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

// Loading state (opzionale)
.lightbox-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: white;
	font-size: 2rem;

	&::after {
		content: '';
		display: inline-block;
		width: 40px;
		height: 40px;
		border: 4px solid rgba(255, 255, 255, 0.3);
		border-top-color: white;
		border-radius: 50%;
		animation: spin 1s linear infinite;
	}
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

// Bootstrap Icons fallback (se non hai Bootstrap Icons)
.bi-zoom-in::before {
	content: '🔍';
	font-style: normal;
}
