/* ========================================== */
/* PROFESSIONAL UNIFIED LIST STYLES          */
/* Desktop and Mobile - Same Exact Styling   */
/* ========================================== */

:root {
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-color: #4a90e2;
    --text-color: #ffffff;
    --hover-bg: rgba(255, 255, 255, 0.1);
    --playing-bg: rgba(74, 144, 226, 0.1);
}

/* FIX: Ensure video player is clickable */
#mainVideoPlayer,
#mainVideoPlayerContainer,
#videoPlayerSection,
.main-video-player,
.video-player-container {
    pointer-events: auto !important;
}

/* Ensure iframe is on top and clickable */
#mainVideoPlayer {
    position: relative !important;
    z-index: 1 !important;
}

/* ========================================== */
/* DESKTOP LIST STYLES                       */
/* ========================================== */

.video-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.video-list-item {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    /* backdrop-filter only for list items, not affecting iframe */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.video-list-item:hover {
    background: var(--hover-bg);
    transform: translateX(8px);
    border-color: var(--primary-color);
}

.video-list-item.current-playing {
    border-color: #4a90e2;
    background: var(--playing-bg);
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.2);
}

/* Desktop Thumbnail */
.video-thumbnail-small {
    position: relative;
    width: 120px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 16px;
}

.video-thumbnail-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1a1a1a;
    transition: opacity 0.3s ease;
}

/* Play Icon */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
}

.video-list-item:hover .play-icon {
    opacity: 1;
    background: rgba(74, 144, 226, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Desktop Details */
.video-details {
    flex: 1;
    min-width: 0;
}

.video-list-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.video-meta {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Desktop Status */
.video-status {
    flex-shrink: 0;
    margin-left: 16px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    display: inline-block;
}

.status-badge.playing {
    background: linear-gradient(45deg, #4a90e2, #357abd);
    color: white;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(74, 144, 226, 0.3); }
    50% { box-shadow: 0 0 20px rgba(74, 144, 226, 0.6); }
}

/* ========================================== */
/* MOBILE LIST STYLES - EXACT SAME AS DESKTOP */
/* ========================================== */

.video-list-mobile {
    display: none; /* Hidden by default, shown on mobile */
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

/* Mobile Video Item - Exact Same Style as Desktop */
.mobile-video-item {
    display: flex;
    align-items: center;
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 16px !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
}

.mobile-video-item:hover {
    background: var(--hover-bg) !important;
    transform: translateX(8px) !important;
    border-color: var(--primary-color) !important;
}

.mobile-video-item.active,
.mobile-video-item.current-playing {
    border-color: #4a90e2 !important;
    background: var(--playing-bg) !important;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.2) !important;
}

/* Mobile Thumbnail - Exact Same as Desktop */
.mobile-video-thumbnail {
    position: relative !important;
    width: 120px !important;
    height: 68px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    margin-right: 16px !important;
    background: #1a1a1a !important;
}

.mobile-video-thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    background: #1a1a1a !important;
    transition: opacity 0.3s ease !important;
    display: block !important;
}

/* Duration Badge on Thumbnail */
.duration-badge {
    position: absolute !important;
    bottom: 4px !important;
    right: 4px !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    z-index: 1;
}

/* Play Icon for Mobile (Hidden by default, shown on hover) */
.mobile-video-thumbnail::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.mobile-video-item:hover .mobile-video-thumbnail::after {
    opacity: 1;
    background: rgba(74, 144, 226, 0.9);
}

/* Mobile Video Info - Exact Same as Desktop */
.mobile-video-info {
    flex: 1 !important;
    min-width: 0 !important;
}

.mobile-video-title {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: var(--text-color) !important;
    margin: 0 0 6px 0 !important;
    line-height: 1.3 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mobile-video-meta {
    font-size: 0.9rem !important;
    color: rgba(255, 255, 255, 0.7) !important;
    margin: 0 !important;
}

/* Mobile Status Badge - Add if not present */
.mobile-video-status {
    flex-shrink: 0;
    margin-left: 16px;
}

.mobile-video-item .status-badge {
    padding: 6px 12px !important;
    border-radius: 20px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-color) !important;
    display: inline-block !important;
}

.mobile-video-item .status-badge.playing {
    background: linear-gradient(45deg, #4a90e2, #357abd) !important;
    color: white !important;
    animation: pulseGlow 2s ease-in-out infinite;
}

/* ========================================== */
/* RESPONSIVE MEDIA QUERIES                  */
/* ========================================== */

/* Mobile View */
@media (max-width: 768px) {
    /* Hide desktop list */
    .video-list {
        display: none !important;
    }
    
    /* Show mobile list */
    .video-list-mobile {
        display: flex !important;
    }
    
    /* Hide grid always */
    .video-grid {
        display: none !important;
    }
    
    /* Adjust sizes for smaller screens */
    .mobile-video-item {
        padding: 14px !important;
    }
    
    .mobile-video-thumbnail {
        width: 110px !important;
        height: 62px !important;
        margin-right: 14px !important;
    }
    
    .mobile-video-title {
        font-size: 1rem !important;
    }
    
    .mobile-video-meta {
        font-size: 0.85rem !important;
    }
    
    /* Adjust hover effect for touch */
    .mobile-video-item:hover {
        transform: translateX(4px) !important;
    }
}

/* Very Small Screens */
@media (max-width: 480px) {
    .mobile-video-item {
        padding: 12px !important;
    }
    
    .mobile-video-thumbnail {
        width: 100px !important;
        height: 56px !important;
        margin-right: 12px !important;
    }
    
    .mobile-video-title {
        font-size: 0.95rem !important;
    }
    
    .mobile-video-meta {
        font-size: 0.8rem !important;
    }
    
    .mobile-video-item .status-badge {
        padding: 4px 10px !important;
        font-size: 0.75rem !important;
    }
}

/* Desktop View */
@media (min-width: 769px) {
    /* Show desktop list */
    .video-list {
        display: flex !important;
    }
    
    /* Hide mobile list */
    .video-list-mobile {
        display: none !important;
    }
    
    /* Hide grid always */
    .video-grid {
        display: none !important;
    }
}

/* ========================================== */
/* ADDITIONAL ENHANCEMENTS                   */
/* ========================================== */

/* Smooth scrolling for lists */
.video-list,
.video-list-mobile {
    scroll-behavior: smooth;
}

/* Loading state for thumbnails */
.video-thumbnail-small img:not([src]),
.mobile-video-thumbnail img:not([src]),
.video-thumbnail-small img[src=""],
.mobile-video-thumbnail img[src=""] {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Focus styles for accessibility */
.video-list-item:focus,
.mobile-video-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Watched state */
.video-list-item.watched,
.mobile-video-item.watched {
    opacity: 0.7;
}

.video-list-item.watched .status-badge,
.mobile-video-item.watched .status-badge {
    background: rgba(76, 175, 80, 0.2) !important;
    color: #4caf50 !important;
}

/* ========================================== */
/* DARK MODE SUPPORT (if needed)             */
/* ========================================== */

@media (prefers-color-scheme: light) {
    :root {
        --text-color: #2c3e50;
        --glass-bg: rgba(255, 255, 255, 0.95);
        --glass-border: rgba(0, 0, 0, 0.1);
        --hover-bg: rgba(74, 144, 226, 0.05);
    }
    
    .video-meta,
    .mobile-video-meta {
        color: #6c757d !important;
    }
}

/* ========================================== */
/* END OF UNIFIED STYLES                     */
/* ========================================== */