/**
 * Solvexa R2 Live Gallery Frontend Styling
 */

.solvexa-gallery-container {
	margin: 24px 0;
	width: 100%;
}

.solvexa-gallery-grid {
	display: grid;
	grid-template-columns: repeat(var(--gallery-cols, 3), 1fr);
	gap: var(--gallery-gap, 12px);
}

.solvexa-gallery-item {
	margin: 0;
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
	background: #f1f5f9;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.solvexa-gallery-item:hover {
	box-shadow: 0 8px 24px -4px rgba(168, 85, 247, 0.25), 0 0 0 1px rgba(168, 85, 247, 0.4);
	transform: translateY(-2px);
}

.solvexa-image-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: 4/3;
	overflow: hidden;
}

.solvexa-gallery-item img.solvexa-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.solvexa-gallery-item:hover img.solvexa-img {
	transform: scale(1.05);
}

.solvexa-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(15, 23, 42, 0.2) 0%, rgba(124, 58, 237, 0.45) 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.2s ease;
}

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

.solvexa-zoom-icon {
	color: #ffffff;
	font-size: 24px;
	transform: scale(0.8);
	transition: transform 0.2s ease;
}

.solvexa-gallery-item:hover .solvexa-zoom-icon {
	transform: scale(1);
}

.solvexa-caption {
	padding: 8px 12px;
	font-size: 13px;
	color: #475569;
	background: #ffffff;
	border-top: 1px solid #f1f5f9;
	margin: 0;
}

/* Layout: Masonry */
.solvexa-gallery-container.layout-masonry .solvexa-gallery-grid {
	display: block;
	column-count: var(--gallery-cols, 3);
	column-gap: var(--gallery-gap, 12px);
}

.solvexa-gallery-container.layout-masonry .solvexa-gallery-item {
	break-inside: avoid;
	margin-bottom: var(--gallery-gap, 12px);
}

.solvexa-gallery-container.layout-masonry .solvexa-image-wrap {
	aspect-ratio: auto;
}

/* Layout: Horizontal Row / Scroll */
.solvexa-gallery-container.layout-row .solvexa-gallery-grid {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 12px;
}

.solvexa-gallery-container.layout-row .solvexa-gallery-item {
	flex: 0 0 280px;
	scroll-snap-align: start;
}

/* Responsive */
@media (max-width: 768px) {
	.solvexa-gallery-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
	.solvexa-gallery-container.layout-masonry .solvexa-gallery-grid {
		column-count: 2 !important;
	}
}

@media (max-width: 480px) {
	.solvexa-gallery-grid {
		grid-template-columns: 1fr !important;
	}
	.solvexa-gallery-container.layout-masonry .solvexa-gallery-grid {
		column-count: 1 !important;
	}
}

/* ── Lightbox Modal ───────────────────────────────────────────── */
.solvexa-frontend-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.9);
	backdrop-filter: blur(8px);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	animation: solvexaFade 0.2s ease-out;
}

@keyframes solvexaFade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.solvexa-lightbox-content {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
	text-align: center;
}

.solvexa-lightbox-content img {
	max-width: 90vw;
	max-height: 80vh;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.solvexa-lightbox-caption {
	color: #e2e8f0;
	font-size: 14px;
	margin-top: 12px;
	font-weight: 500;
}

.solvexa-lightbox-close {
	position: absolute;
	top: -40px;
	right: 0;
	color: #ffffff;
	font-size: 32px;
	cursor: pointer;
	background: none;
	border: none;
	line-height: 1;
}

.solvexa-lightbox-prev, .solvexa-lightbox-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	color: #ffffff;
	border: 1px solid rgba(255, 255, 255, 0.2);
	width: 50px;
	height: 50px;
	border-radius: 50%;
	font-size: 24px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.solvexa-lightbox-prev:hover, .solvexa-lightbox-next:hover {
	background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
	border-color: #a855f7;
	box-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
	transform: translateY(-50%) scale(1.08);
}

.solvexa-lightbox-prev { left: 24px; }
.solvexa-lightbox-next { right: 24px; }

