/* ==========================================
   MEDIA VIEWER / LIGHTBOX
   Full-screen gallery for project images/GIFs
   ========================================== */

/* Modal Overlay */
.media-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 10000;
	display: none; /* Hidden by default */
	align-items: center;
	justify-content: center;
	animation: fadeIn 0.3s ease-out;
}

.media-modal.active {
	display: flex;
}

/* Dark Backdrop */
.media-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.95);
	backdrop-filter: blur(10px);
	cursor: pointer;
}

/* Content Container */
.media-modal-content {
	position: relative;
	z-index: 10001;
	max-width: 95vw;
	max-height: 95vh;
	background: var(--terminal-bg);
	border: 2px solid var(--terminal-prompt);
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 20px 60px rgba(0, 255, 0, 0.3);
}

/* Header */
.media-header {
	background: linear-gradient(to bottom, #4b1e3d, var(--terminal-header));
	padding: 12px 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 2px solid var(--terminal-border);
	user-select: none;
}

.media-title {
	color: var(--terminal-text);
	font-size: 16px;
	font-weight: bold;
	font-family: 'Ubuntu Mono', 'Courier New', monospace;
}

.media-close {
	background: #ff5f57;
	color: #fff;
	border: none;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	line-height: 24px;
	text-align: center;
	transition: all 0.2s;
	font-weight: bold;
}

.media-close:hover {
	background: #ff3333;
	transform: scale(1.1);
}

/* Media Body */
.media-body {
	padding: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
	min-height: 400px;
	max-height: calc(95vh - 140px);
	overflow: hidden;
	position: relative;
}

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

/* Loading Spinner */
.media-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: var(--terminal-prompt);
	font-size: 24px;
}

.media-loading::after {
	content: '⣾⣽⣻⢿⡿⣟⣯⣷';
	animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
	0% { content: '⣾'; }
	12.5% { content: '⣽'; }
	25% { content: '⣻'; }
	37.5% { content: '⢿'; }
	50% { content: '⡿'; }
	62.5% { content: '⣟'; }
	75% { content: '⣯'; }
	87.5% { content: '⣷'; }
	100% { content: '⣾'; }
}

/* Controls */
.media-controls {
	background: var(--terminal-header);
	padding: 12px 20px;
	display: flex;
	gap: 10px;
	justify-content: space-between;
	align-items: center;
	border-top: 2px solid var(--terminal-border);
	flex-wrap: wrap;
}

.media-controls button {
	background: var(--terminal-prompt);
	color: var(--terminal-bg);
	border: none;
	padding: 8px 16px;
	border-radius: 4px;
	cursor: pointer;
	font-family: 'Ubuntu Mono', 'Courier New', monospace;
	font-size: 14px;
	font-weight: bold;
	transition: all 0.2s;
	white-space: nowrap;
}

.media-controls button:hover {
	background: var(--terminal-text);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 255, 0, 0.3);
}

.media-controls button:disabled {
	opacity: 0.3;
	cursor: not-allowed;
	transform: none;
}

/* Navigation Arrows */
.media-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 255, 0, 0.1);
	color: var(--terminal-prompt);
	border: 2px solid var(--terminal-prompt);
	width: 50px;
	height: 50px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s;
	user-select: none;
	z-index: 10002;
}

.media-nav:hover {
	background: var(--terminal-prompt);
	color: var(--terminal-bg);
	transform: translateY(-50%) scale(1.1);
}

.media-nav.prev {
	left: 20px;
}

.media-nav.next {
	right: 20px;
}

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

/* Image Counter */
.media-counter {
	color: var(--terminal-secondary);
	font-size: 14px;
	padding: 4px 12px;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 4px;
}

/* Fade Animation */
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Zoom Animation */
@keyframes zoomIn {
	from {
		transform: scale(0.8);
		opacity: 0;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}

.media-modal-content {
	animation: zoomIn 0.3s ease-out;
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
	.media-modal-content {
		max-width: 100vw;
		max-height: 100vh;
		border-radius: 0;
	}

	.media-body {
		padding: 10px;
		min-height: 300px;
	}

	.media-body img,
	.media-body video {
		max-height: 60vh;
	}

	.media-controls {
		padding: 10px;
		gap: 5px;
	}

	.media-controls button {
		padding: 6px 12px;
		font-size: 12px;
	}

	.media-nav {
		width: 40px;
		height: 40px;
		font-size: 20px;
	}

	.media-nav.prev {
		left: 10px;
	}

	.media-nav.next {
		right: 10px;
	}
}

@media screen and (max-width: 480px) {
	.media-header {
		padding: 10px 15px;
	}

	.media-title {
		font-size: 14px;
	}

	.media-close {
		width: 20px;
		height: 20px;
		font-size: 12px;
	}

	.media-body {
		padding: 5px;
	}

	.media-controls {
		flex-direction: column;
		gap: 8px;
	}

	.media-controls button {
		width: 100%;
	}
}

/* Touch Gestures Hint */
.touch-hint {
	position: absolute;
	bottom: 80px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.7);
	color: var(--terminal-secondary);
	padding: 8px 16px;
	border-radius: 20px;
	font-size: 12px;
	pointer-events: none;
	animation: fadeOut 3s forwards;
}

@keyframes fadeOut {
	0%, 70% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}

/* Fullscreen Mode */
.media-modal.fullscreen .media-modal-content {
	max-width: 100vw;
	max-height: 100vh;
	border-radius: 0;
	border: none;
}

.media-modal.fullscreen .media-body {
	max-height: calc(100vh - 100px);
}

/* Keyboard Shortcuts Help */
.keyboard-help {
	position: absolute;
	top: 10px;
	right: 10px;
	background: rgba(0, 0, 0, 0.8);
	padding: 10px;
	border-radius: 4px;
	font-size: 12px;
	color: var(--terminal-secondary);
	border: 1px solid var(--terminal-border);
}

.keyboard-help kbd {
	background: var(--terminal-bg);
	padding: 2px 6px;
	border-radius: 3px;
	border: 1px solid var(--terminal-prompt);
	font-family: monospace;
	color: var(--terminal-prompt);
	margin: 0 2px;
}
