/**
 * Barami Lightbox Styles
 * Modern, mobile-friendly lightbox matching Barami template
 */

/* Backdrop */
.barami-lightbox-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, rgba(10, 37, 64, 0.98) 0%, rgba(0, 0, 0, 0.98) 100%);
	z-index: 999999;
	opacity: 0;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.barami-lightbox-backdrop.active {
	opacity: 1;
}

/* Container */
.barami-lightbox-container {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Content */
.barami-lb-content {
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

.barami-lb-content.loading::after {
	content: '';
	position: absolute;
	width: 50px;
	height: 50px;
	border: 4px solid rgba(255, 255, 255, 0.3);
	border-top-color: var(--primary, #0066FF);
	border-radius: 50%;
	animation: barami-spin 0.8s linear infinite;
}

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

/* Media */
.barami-lb-media {
	max-width: 100%;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	transform-origin: center center;
	/* Transition controlled by JavaScript for better touch feedback */
}

.barami-lb-media[src$=".mp4"],
.barami-lb-media[src$=".webm"],
video.barami-lb-media {
	max-width: 90vw;
	max-height: 85vh;
}

iframe.barami-lb-media {
	width: 90vw;
	height: 50.625vw; /* 16:9 aspect ratio */
	max-width: 1200px;
	max-height: 675px;
	border-radius: 8px;
}

img.barami-lb-media {
	cursor: default; /* Cursor controlled by JavaScript based on zoom level */
	user-select: none;
	-webkit-user-drag: none;
	touch-action: none; /* Disable browser default zoom for iOS-style custom zoom */
	-webkit-touch-callout: none; /* Disable iOS callout */
}

/* Navigation Buttons */
.barami-lb-btn {
	position: absolute;
	width: 56px;
	height: 56px;
	background: rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 16px;
	color: white;
	font-size: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	z-index: 10;
}

.barami-lb-btn:hover {
	background: var(--primary, #0066FF);
	border-color: var(--primary, #0066FF);
	transform: scale(1.1) translateY(-2px);
	box-shadow: 0 12px 48px rgba(0, 102, 255, 0.4);
}

.barami-lb-close {
	top: 24px;
	right: 24px;
}

.barami-lb-close:hover {
	background: #ef4444;
	border-color: #ef4444;
	box-shadow: 0 12px 48px rgba(239, 68, 68, 0.4);
}

.barami-lb-prev {
	left: 24px;
	top: 50%;
	transform: translateY(-50%);
}

.barami-lb-prev:hover {
	transform: translateY(-50%) scale(1.1) translateX(-4px);
}

.barami-lb-next {
	right: 24px;
	top: 50%;
	transform: translateY(-50%);
}

.barami-lb-next:hover {
	transform: translateY(-50%) scale(1.1) translateX(4px);
}

/* Counter */
.barami-lb-counter {
	position: fixed;
	top: 32px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	color: white;
	padding: 12px 24px;
	border-radius: 100px;
	font-size: 16px;
	font-weight: 700;
	border: 1px solid rgba(255, 255, 255, 0.2);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	z-index: 10;
	font-family: var(--font-bold, 'Inter', sans-serif);
	text-transform: uppercase;
	letter-spacing: 1px;
	animation: barami-slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes barami-slideDown {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(-20px);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

/* Toolbar */
.barami-lb-toolbar {
	position: fixed;
	bottom: 32px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 8px;
	background: rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	padding: 12px 16px;
	border-radius: 20px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	z-index: 10;
	animation: barami-slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes barami-slideUp {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

.barami-lb-toolbar-btn {
	width: 48px;
	height: 48px;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 12px;
	color: white;
	font-size: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
}

.barami-lb-toolbar-btn:hover {
	background: var(--primary, #0066FF);
	border-color: var(--primary, #0066FF);
	transform: translateY(-4px) scale(1.05);
	box-shadow: 0 12px 24px rgba(0, 102, 255, 0.4);
}

.barami-lb-toolbar-btn:active {
	transform: translateY(-2px) scale(1.02);
}

/* Tooltip */
.barami-lb-toolbar-btn::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(-8px);
	background: rgba(0, 0, 0, 0.9);
	color: white;
	padding: 6px 12px;
	border-radius: 8px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s, transform 0.2s;
	font-family: var(--font-sans, 'Inter', sans-serif);
}

.barami-lb-toolbar-btn:hover::after {
	opacity: 1;
	transform: translateX(-50%) translateY(-12px);
}

/* Divider */
.barami-lb-divider {
	width: 1px;
	height: 48px;
	background: rgba(255, 255, 255, 0.2);
	margin: 0 4px;
}

/* Thumbnails */
.barami-lb-thumbnails {
	position: fixed;
	bottom: 120px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 12px;
	background: rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	padding: 12px;
	border-radius: 16px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	max-width: 90%;
	overflow-x: auto;
	z-index: 10;
	animation: barami-slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.1s backwards;
}

.barami-lb-thumbnails::-webkit-scrollbar {
	height: 6px;
}

.barami-lb-thumbnails::-webkit-scrollbar-track {
	background: rgba(255, 255, 255, 0.1);
	border-radius: 3px;
}

.barami-lb-thumbnails::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.3);
	border-radius: 3px;
}

.barami-lb-thumbnails::-webkit-scrollbar-thumb:hover {
	background: var(--primary, #0066FF);
}

.barami-lb-thumb {
	width: 80px;
	height: 80px;
	border-radius: 12px;
	cursor: pointer;
	opacity: 0.4;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	border: 3px solid transparent;
	flex-shrink: 0;
	overflow: hidden;
	position: relative;
	background: rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
}

.barami-lb-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.barami-lb-thumb i {
	font-size: 32px;
	color: white;
}

.barami-lb-thumb:hover {
	opacity: 0.7;
	transform: translateY(-4px) scale(1.05);
}

.barami-lb-thumb.active {
	opacity: 1;
	border-color: var(--primary, #0066FF);
	transform: translateY(-4px) scale(1.1);
	box-shadow: 0 8px 24px rgba(0, 102, 255, 0.4);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
	.barami-lb-btn {
		width: 48px;
		height: 48px;
		font-size: 20px;
	}

	.barami-lb-close {
		top: 16px;
		right: 16px;
	}

	.barami-lb-prev {
		left: 16px;
	}

	.barami-lb-next {
		right: 16px;
	}

	.barami-lb-counter {
		top: 16px;
		padding: 10px 20px;
		font-size: 14px;
	}

	.barami-lb-toolbar {
		bottom: 16px;
		padding: 8px 12px;
		gap: 6px;
		max-width: 95%;
		overflow-x: auto;
	}

	.barami-lb-toolbar-btn {
		width: 44px;
		height: 44px;
		font-size: 18px;
	}

	.barami-lb-thumbnails {
		bottom: 90px;
		padding: 8px;
		gap: 8px;
	}

	.barami-lb-thumb {
		width: 60px;
		height: 60px;
	}

	.barami-lb-media {
		max-height: 70vh;
	}

	iframe.barami-lb-media {
		width: 95vw;
		height: 53.4375vw;
	}

	/* Hide tooltips on mobile */
	.barami-lb-toolbar-btn::after {
		display: none;
	}
}

/* Zoom Indicator */
.barami-lb-zoom-indicator {
	position: fixed;
	top: 100px;
	right: 32px;
	background: rgba(0, 0, 0, 0.85);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	color: white;
	padding: 16px 24px;
	border-radius: 12px;
	font-size: 28px;
	font-weight: 800;
	font-family: var(--font-bold, 'Inter', sans-serif);
	border: 2px solid var(--primary, #0066FF);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
	z-index: 10;
	opacity: 0;
	transform: translateX(20px);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	pointer-events: none;
}

.barami-lb-zoom-indicator.visible {
	opacity: 1;
	transform: translateX(0);
}

@media (max-width: 768px) {
	.barami-lb-zoom-indicator {
		top: 80px;
		right: 16px;
		padding: 12px 20px;
		font-size: 24px;
	}
}

/* Prevent scrolling when lightbox is open */
body.barami-lightbox-open {
	overflow: hidden;
}
