/**
 * Nano Banana - Custom Video Player
 * Premium video player with gestures, PiP, speed control
 */

/* ============================================
   Container
   ============================================ */

.nb-player {
	position: relative;
	width: 100%;
	max-width: 100%;
	background: #000;
	border-radius: 16px;
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
}

.nb-player video {
	width: 100%;
	height: auto;
	display: block;
	max-height: 70vh;
	object-fit: contain;
	background: #000;
}

/* ============================================
   Big Play Button (center)
   ============================================ */

.nb-player-big-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(1);
	width: 80px;
	height: 80px;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 10;
	border: 2px solid rgba(255, 255, 255, 0.2);
}

.nb-player-big-play::before {
	content: '';
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 15px 0 15px 26px;
	border-color: transparent transparent transparent #fff;
	margin-left: 6px;
	transition: all 0.2s ease;
}

.nb-player-big-play:hover {
	transform: translate(-50%, -50%) scale(1.1);
	background: rgba(102, 126, 234, 0.8);
	border-color: rgba(255, 255, 255, 0.4);
}

.nb-player-big-play:active {
	transform: translate(-50%, -50%) scale(0.95);
}

.nb-player.playing .nb-player-big-play {
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, -50%) scale(0.5);
}

/* ============================================
   Controls Bar
   ============================================ */

.nb-player-controls {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
	padding: 40px 12px 12px;
	opacity: 1;
	transition: opacity 0.3s ease;
	z-index: 5;
}

.nb-player.playing.controls-hidden .nb-player-controls {
	opacity: 0;
	pointer-events: none;
}

.nb-player:hover .nb-player-controls,
.nb-player.controls-visible .nb-player-controls {
	opacity: 1;
	pointer-events: auto;
}

/* ============================================
   Progress Bar
   ============================================ */

.nb-player-progress {
	position: relative;
	width: 100%;
	height: 20px;
	cursor: pointer;
	display: flex;
	align-items: center;
	margin-bottom: 8px;
}

.nb-player-progress-track {
	position: absolute;
	left: 0;
	right: 0;
	height: 4px;
	background: rgba(255, 255, 255, 0.3);
	border-radius: 2px;
	overflow: hidden;
	transition: height 0.2s ease;
}

.nb-player-progress:hover .nb-player-progress-track {
	height: 6px;
}

.nb-player-progress-buffer {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	background: rgba(255, 255, 255, 0.4);
	border-radius: 2px;
	transition: width 0.1s ease;
}

.nb-player-progress-fill {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	background: linear-gradient(90deg, #667eea, #764ba2);
	border-radius: 2px;
	transition: width 0.1s ease;
}

.nb-player-progress-thumb {
	position: absolute;
	width: 14px;
	height: 14px;
	background: #fff;
	border-radius: 50%;
	top: 50%;
	transform: translate(-50%, -50%) scale(0);
	transition: transform 0.2s ease;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
	z-index: 2;
}

.nb-player-progress:hover .nb-player-progress-thumb {
	transform: translate(-50%, -50%) scale(1);
}

/* Progress Preview */
.nb-player-progress-preview {
	position: absolute;
	bottom: 100%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.9);
	color: #fff;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
	margin-bottom: 8px;
}

.nb-player-progress:hover .nb-player-progress-preview {
	opacity: 1;
}

/* ============================================
   Controls Row
   ============================================ */

.nb-player-controls-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.nb-player-controls-left,
.nb-player-controls-right {
	display: flex;
	align-items: center;
	gap: 4px;
}

.nb-player-controls-center {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ============================================
   Control Buttons
   ============================================ */

.nb-player-btn {
	width: 36px;
	height: 36px;
	background: transparent;
	border: none;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	padding: 0;
}

.nb-player-btn:hover {
	background: rgba(255, 255, 255, 0.15);
}

.nb-player-btn:active {
	transform: scale(0.9);
}

.nb-player-btn svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.nb-player-btn.active {
	color: #667eea;
}

/* Play/Pause Button */
.nb-player-btn-play svg.pause {
	display: none;
}

.nb-player.playing .nb-player-btn-play svg.play {
	display: none;
}

.nb-player.playing .nb-player-btn-play svg.pause {
	display: block;
}

/* ============================================
   Time Display
   ============================================ */

.nb-player-time {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.9);
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	min-width: 80px;
	text-align: center;
}

.nb-player-time-separator {
	margin: 0 2px;
	opacity: 0.6;
}

/* ============================================
   Speed Control
   ============================================ */

.nb-player-speed {
	position: relative;
}

.nb-player-speed-btn {
	width: auto;
	padding: 0 8px;
	font-size: 12px;
	font-weight: 600;
	min-width: 44px;
}

.nb-player-speed-menu {
	position: absolute;
	bottom: 100%;
	right: 0;
	background: rgba(20, 20, 30, 0.95);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-radius: 10px;
	padding: 6px;
	margin-bottom: 8px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: all 0.2s ease;
	z-index: 20;
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.nb-player-speed.open .nb-player-speed-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.nb-player-speed-option {
	display: block;
	width: 100%;
	padding: 8px 16px;
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.8);
	font-size: 13px;
	font-weight: 500;
	text-align: center;
	cursor: pointer;
	border-radius: 6px;
	transition: all 0.2s ease;
}

.nb-player-speed-option:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
}

.nb-player-speed-option.active {
	background: linear-gradient(135deg, #667eea, #764ba2);
	color: #fff;
}

/* ============================================
   Double Tap Indicator
   ============================================ */

.nb-player-skip-indicator {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 100px;
	height: 100px;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 50%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	z-index: 15;
}

.nb-player-skip-indicator.left {
	left: 15%;
}

.nb-player-skip-indicator.right {
	right: 15%;
}

.nb-player-skip-indicator.visible {
	opacity: 1;
	animation: skipPulse 0.5s ease;
}

.nb-player-skip-indicator svg {
	width: 32px;
	height: 32px;
	fill: #fff;
}

.nb-player-skip-indicator span {
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	margin-top: 4px;
}

@keyframes skipPulse {
	0% { transform: translateY(-50%) scale(0.8); opacity: 0; }
	50% { transform: translateY(-50%) scale(1.1); opacity: 1; }
	100% { transform: translateY(-50%) scale(1); opacity: 1; }
}

/* ============================================
   Loading Spinner
   ============================================ */

.nb-player-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 50px;
	height: 50px;
	opacity: 0;
	pointer-events: none;
	z-index: 8;
}

.nb-player.loading .nb-player-loading {
	opacity: 1;
}

.nb-player.loading .nb-player-big-play {
	opacity: 0;
}

.nb-player-loading-spinner {
	width: 100%;
	height: 100%;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: #667eea;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

/* ============================================
   Fullscreen
   ============================================ */

.nb-player.fullscreen {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	max-width: none;
	border-radius: 0;
	z-index: 9999;
}

.nb-player.fullscreen video {
	max-height: 100vh;
	height: 100%;
}

/* ============================================
   Mobile Optimizations
   ============================================ */

@media (max-width: 480px) {
	.nb-player-btn {
		width: 40px;
		height: 40px;
	}

	.nb-player-big-play {
		width: 70px;
		height: 70px;
	}

	.nb-player-controls {
		padding: 30px 10px 10px;
	}

	.nb-player-time {
		font-size: 11px;
		min-width: 70px;
	}

	.nb-player-speed-btn {
		font-size: 11px;
		min-width: 40px;
	}
}

/* ============================================
   PiP Badge
   ============================================ */

.nb-player-pip-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	background: linear-gradient(135deg, #667eea, #764ba2);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 12px;
	opacity: 0;
	pointer-events: none;
	z-index: 15;
	transition: opacity 0.3s ease;
}

.nb-player.pip-active .nb-player-pip-badge {
	opacity: 1;
}

/* ============================================
   Loop indicator
   ============================================ */

.nb-player-loop-badge {
	position: absolute;
	top: 12px;
	right: 12px;
	background: rgba(0, 0, 0, 0.6);
	color: #667eea;
	font-size: 11px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 12px;
	opacity: 0;
	pointer-events: none;
	z-index: 15;
	transition: opacity 0.3s ease;
	display: flex;
	align-items: center;
	gap: 4px;
}

.nb-player-loop-badge svg {
	width: 12px;
	height: 12px;
	fill: currentColor;
}

.nb-player.loop-active .nb-player-loop-badge {
	opacity: 1;
}

/* ============================================
   Video Modal
   ============================================ */

.video-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}

.video-modal.open {
	opacity: 1;
	visibility: visible;
}

.video-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.video-modal-content {
	position: relative;
	width: 95%;
	max-width: 900px;
	max-height: 90vh;
	z-index: 1;
	transform: scale(0.9);
	transition: transform 0.3s ease;
}

.video-modal.open .video-modal-content {
	transform: scale(1);
}

.video-modal-close {
	position: absolute;
	top: -40px;
	right: 0;
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.1);
	border: none;
	border-radius: 50%;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	z-index: 10;
}

.video-modal-close:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: scale(1.1);
}

.video-modal-player {
	width: 100%;
	border-radius: 16px;
	overflow: hidden;
}

@media (max-width: 480px) {
	.video-modal-content {
		width: 100%;
		max-width: none;
	}

	.video-modal-close {
		top: 10px;
		right: 10px;
		background: rgba(0, 0, 0, 0.6);
	}

	.video-modal-player {
		border-radius: 0;
	}
}
