/* 
 * Cinematic Video Player — Netflix Style
 * Deep fades, smooth control delays, glassmorphism elements
 */

 .cinematic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinematic-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Base Backdrop - The deep plunge to black */
.cinematic-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(8, 11, 18, 0.98);
    backdrop-filter: blur(8px);
}

/* Scaled Video Container */
.video-container {
    position: relative;
    width: 90vw;
    max-width: 1400px;
    height: auto;
    max-height: 85vh;
    aspect-ratio: 16/9;
    border-radius: 12px;
    box-shadow: 0 40px 100px -20px rgba(0,0,0,0.9);
    background: #000;
    overflow: hidden;
    
    /* Initially scaled down and invisible */
    opacity: 0;
    transform: scale(0.96) translateY(20px);
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

.cinematic-overlay.active .video-container {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 'contain' ensures no cropping/zooming pixel-loss, unlike 'cover' */
    display: block;
    
    /* Force Hardware Acceleration & Highest Rendering Quality */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Interactive Close Button */
.close-video-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    /* Inactivity fadeout (shares state with controls) */
    opacity: 0;
}

.video-container.active-ui .close-video-btn {
    opacity: 1;
}

.close-video-btn:hover {
    background: rgba(241, 201, 139, 0.2);
    border-color: var(--thruster);
    color: var(--thruster);
    transform: scale(1.1);
}

/* Custom UI Controls Bar */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 3rem 2rem 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0.6) 40%, transparent);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Netflix style: only show UI on hover/activity */
.video-container.active-ui .video-controls {
    opacity: 1;
}

/* Custom Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 5px; /* Slightly thicker base, closer to YouTube */
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    border-radius: 3px;
    transition: height 0.1s ease;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5); /* Adds depth to the track */
}

.progress-bar-container:hover {
    height: 8px; /* Expand on hover like YouTube */
}

/* The faint background pre-loaded buffer "tail" */
.progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    width: 0%;
    border-radius: 3px;
    z-index: 1;
    transition: width 0.2s ease;
}

/* This is the "Red Trail" equivalent using the theme's Thruster Gold */
.progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--thruster);
    width: 0%;
    border-radius: 3px;
    position: relative;
    box-shadow: 0 0 12px rgba(241, 201, 139, 0.8); /* Glow effect for visibility */
    transition: background 0.2s ease;
    z-index: 2;
}

/* The drag handle (circle) */
.progress-filled::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 16px;
    height: 16px;
    background: var(--thruster);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0,0,0,0.5), 0 0 10px var(--thruster);
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-container:hover .progress-filled::after {
    transform: translateY(-50%) scale(1); /* Pumping circle indicator */
}

/* Main Controls Flex */
.controls-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    transition: color 0.2s ease, transform 0.2s ease;
}

.control-btn:hover {
    color: var(--thruster);
    transform: scale(1.15);
}

.time-display {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    user-select: none;
}

/* Volume Slider Overlay */
.volume-container {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.volume-slider {
    width: 0px; /* Hidden default */
    opacity: 0;
    appearance: none;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    transition: width 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
}

.volume-container:hover .volume-slider,
.volume-slider:focus {
    width: 80px;
    opacity: 1;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--thruster);
    border-radius: 50%;
    cursor: pointer;
}

/* Buffering & Error States */
.video-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5;
}

.video-loader .spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--thruster);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: #ff4a4a;
    font-family: 'Space Mono', monospace;
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 74, 74, 0.3);
    z-index: 5;
}
