/* FIX CLS: CSS tối ưu cho Video Playlist */
.video-playlist-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	background-color: #1a1a1a;
	padding: 10px;
	max-width: 1280px;
	margin: 0 auto;
	max-height: 90vh;
	overflow-y: auto;
	/* FIX CLS: Đặt chiều cao tối thiểu để tránh layout shift */
	min-height: 500px;
}   

/* FIX CLS: Container video chính với aspect ratio cố định */
.main-video-container {
	width: 100%;
	position: relative;
	background-color: black;
	/* margin-bottom: 10px; */
	/* FIX CLS: Sử dụng aspect ratio và override max-height */
	aspect-ratio: 16/9;
	max-height: none !important;
	height: auto;
}

/* FIX CLS: Video chính responsive với kích thước cố định */
#main-video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	/* FIX CLS: Đảm bảo video không thay đổi layout khi load */
	display: block;
	box-sizing: border-box;
	aspect-ratio: 16/9;
}

#play-button {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background-color: rgba(0, 0, 0, 0.5);
	color: white;
	border: none;
	font-size: 24px;
	padding: 10px 20px;
	cursor: pointer;
	display: none;
	/* FIX CLS: Đảm bảo button không ảnh hưởng layout */
	z-index: 10;
	border-radius: 5px;
}

/* FIX CLS: Container playlist với chiều cao cố định */
.video-playlist-container {
	width: 100%;
	/* max-width: 720px; */
	/* FIX CLS: Đặt chiều cao tối thiểu cố định */
	min-height: 76px; /* 60px video + 16px padding */
	position: relative;
}

/* NEW: Playlist wrapper for scroll overlay */
.playlist-wrapper {
	position: relative;
	overflow: hidden;
	width: 100%;
}

/* NEW: Scroll indicator overlay */
.scroll-indicator {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 40px;
	background: linear-gradient(to right, transparent, rgba(0,0,0,0.8));
	color: white;
	font-size: 16px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.3s ease;
	z-index: 10;
	border-radius: 0 4px 4px 0;
	position: absolute;
}

/* Hiện khi cần */
.scroll-indicator.show {
	opacity: 1;
}

/* CSS riêng cho icon fa-angles-right */
.scroll-indicator .fa-angles-right {
	position: absolute;
	top: 40%;
	left: 50%;
	transform: translate(-50%, -50%);
	animation: slideRight 1s ease-in-out infinite;
	text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

@keyframes slideRight {
	0%, 100% {
		transform: translateX(0);
	}
	50% {
		transform: translateX(5px);
	}
}

/* FIX CLS: Playlist với chiều cao cố định và scroll horizontal */
.video-playlist {
	display: flex;
	gap: 10px;
	padding: 8px;
	margin: 0;
	list-style: none;
	/* FIX CLS: Đặt chiều cao cố định để tránh layout shift */
	min-height: 60px;
	align-items: center;
	/* NEW: Horizontal scroll */
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: thin;
	scrollbar-color: #888 #1a1a1a;
}

/* NEW: Enhanced scrollbar styling for playlist */
.video-playlist::-webkit-scrollbar {
	height: 4px;
}

.video-playlist::-webkit-scrollbar-track {
	background: #1a1a1a;
	border-radius: 2px;
}

.video-playlist::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 2px;
	transition: background 0.3s ease;
}

.video-playlist::-webkit-scrollbar-thumb:hover {
	background: #555;
}

/* FIX CLS: Items playlist với kích thước cố định */
.video-playlist li {
	position: relative;
	cursor: pointer;
	/* NEW: Flex shrink để không bị co lại */
	flex-shrink: 0;
	/* FIX CLS: Kích thước cố định để tránh layout shift */
	width: 120px;
	height: 60px;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	border: 2px solid transparent;
	/* FIX CLS: Box-sizing để tính toán chính xác */
	box-sizing: border-box;
	border-radius: 4px;
	overflow: hidden;
	/* NEW: Min-width để đảm bảo không bị co */
	min-width: 120px;
}

/* FIX CLS: Hover effect không ảnh hưởng layout */
.video-playlist li:hover {
	/* FIX CLS: Chỉ dùng transform, không thay đổi kích thước */
	transform: translateY(-2px) scale(1.02);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
	border-color: #555;
	z-index: 1;
	/* FIX CLS: Optimize rendering */
	will-change: transform;
}

/* FIX CLS: Video duration label - tương thích với script của bạn */
.video-playlist li .video-duration {
	position: absolute;
	top: 2px;
	right: 2px;
	background-color: rgba(0, 0, 0, 0.8);
	color: #ffffffb0;
	padding: 2px 6px;
	font-size: 12px;
	font-weight: bold;
	border-radius: 3px;
	/* FIX CLS: Đảm bảo duration label không ảnh hưởng layout */
	pointer-events: none;
	z-index: 2;
	/* FIX CLS: Đặt min-width để tránh text shifting */
	min-width: 32px;
	text-align: center;
	/* FIX CLS: Smooth transition khi duration load */
	opacity: 0;
	transition: opacity 0.3s ease;
}

/* FIX CLS: Hiển thị duration sau khi load */
.video-playlist li .video-duration:not(:empty) {
	opacity: 1;
}

/* FIX CLS: Video thumbnail với kích thước cố định */
.video-playlist li video {
	width: 120px;
	height: 60px;
	background-color: black;
	display: block;
	object-fit: cover;
	/* FIX CLS: Ngăn video thay đổi layout khi load */
	box-sizing: border-box;
	border-radius: 2px;
}

/* FIX CLS: Thumbnail container */
.thumbnail-container {
	width: 120px;
	height: 60px;
	position: relative;
	overflow: hidden;
	border-radius: 2px;
}

/* FIX CLS: Placeholder khi video chưa load */
.video-playlist li .video-placeholder {
	width: 120px;
	height: 60px;
	background-color: #333;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #888;
	font-size: 12px;
	position: absolute;
	top: 0;
	left: 0;
}

/* FIX CLS: Loading state cho video */
.video-loading {
	opacity: 1;
	transition: opacity 0.3s ease;
}

.video-loaded {
	opacity: 1;
}

/* Overlay playing không ảnh hưởng layout */
.video-playlist li .overlay-playing {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.6);
	color: white;
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 14px;
	font-weight: bold;
	opacity: 0;
	transition: opacity 0.3s ease;
	/* FIX CLS: Không ảnh hưởng layout */
	pointer-events: none;
	border-radius: 2px;
}

.video-playlist li.playing .overlay-playing {
	opacity: 1;
}

/* Enhanced scrollbar styling for container */
.video-playlist-container::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

.video-playlist-container::-webkit-scrollbar-track {
	background-color: #1a1a1a;
	border-radius: 10px;
}

.video-playlist-container::-webkit-scrollbar-thumb {
	background-color: #555;
	border-radius: 10px;
	border: 2px solid #1a1a1a;
	transition: background-color 0.3s ease;
}

.video-playlist-container::-webkit-scrollbar-thumb:hover {
	background-color: #3498db;
	border-width: 1px;
}

/* Enhanced scrollbar for Firefox */
.video-playlist-container {
	scrollbar-width: thin;
	scrollbar-color: #838383 #000000;
	background: #1f1f1f;
}

/* FIX CLS: Responsive styles với kích thước cố định */
@media (max-width: 768px) {
	.video-playlist-wrapper {
		flex-direction: column;
		padding: 5px;
		/* FIX CLS: Chiều cao tối thiểu cho mobile */
		min-height: 300px;
	}

	/* FIX CLS: Video chính mobile với aspect ratio */
	.main-video-container {
		aspect-ratio: 16/9;
		max-height: none !important;
		height: auto;
	}

	#main-video {
		aspect-ratio: 16/9;
	}

	/* FIX CLS: Container playlist mobile */
	.video-playlist-container {
		/* FIX CLS: Chiều cao tối thiểu cho mobile */
		min-height: 66px; /* 56px video + 10px padding */
	}

	/* NEW: Scroll indicator mobile */
	.scroll-indicator {
		width: 30px;
		font-size: 14px;
	}

	/* FIX CLS: Items playlist mobile với kích thước cố định */
	.video-playlist li {
		width: 100px;
		height: 56px;
		min-width: 100px;
	}

	/* FIX CLS: Container thumbnail mobile */
	.thumbnail-container {
		width: 100px;
		height: 56px;
	}

	/* FIX CLS: Video thumbnail mobile */
	.video-playlist li video {
		width: 100px;
		height: 56px;
	}

	/* FIX CLS: Placeholder mobile */
	.video-playlist li .video-placeholder {
		width: 100px;
		height: 56px;
	}

	/* FIX CLS: Duration label mobile */
	.video-playlist li .video-duration {
		font-size: 10px;
		padding: 1px 4px;
		min-width: 28px;
	}
}

/* FIX CLS: Tablet responsive */
@media (max-width: 1024px) and (min-width: 769px) {
	.video-playlist-wrapper {
		max-width: 100%;
		padding: 8px;
	}

	.main-video-container {
		max-height: none !important;
		height: auto;
	}

	#main-video {
		aspect-ratio: 16/9;
	}

	/* NEW: Scroll indicator tablet */
	.scroll-indicator {
		width: 35px;
		font-size: 15px;
	}
}

/* FIX CLS: Large screen optimization */
@media (min-width: 1281px) {
	.video-playlist-wrapper {
		max-width: 1400px;
	}
}

/* FIX CLS: Preload skeleton cho better UX */
.video-skeleton {
	width: 120px;
	height: 60px;
	background: linear-gradient(90deg, #333 25%, #555 50%, #333 75%);
	background-size: 200% 100%;
	animation: skeleton-loading 1.5s infinite;
}

@media (max-width: 768px) {
	.video-skeleton {
		width: 100px;
		height: 56px;
	}
}

@keyframes skeleton-loading {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* FIX CLS: Focus states for accessibility */
.video-playlist li:focus {
	outline: 2px solid #3498db;
	outline-offset: 2px;
}

#play-button:focus {
	outline: 2px solid #3498db;
	outline-offset: 2px;
}

/* NEW: Hover effect for scroll indicator */
.scroll-indicator:hover {
	background: linear-gradient(to right, transparent, rgba(0,0,0,0.9));
}

/* NEW: Smooth scroll behavior */
.video-playlist {
	scroll-behavior: smooth;
}

/* NEW: Better visual feedback for scrollable content */
.playlist-wrapper:hover .scroll-indicator.show {
	opacity: 0.8;
}

/* NEW: Pulse animation for scroll indicator when first shown */
.scroll-indicator.show.pulse {
	animation: pulse-scroll 1s ease-in-out;
}

@keyframes pulse-scroll {
	0%, 100% {
		opacity: 0.8;
		transform: scale(1);
	}
	50% {
		opacity: 1;
		transform: scale(1.05);
	}
}