/* Custom Video Player Styles - 2025 */

.custom-video-player {
    position: relative;
    width: 100%;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background: #000;
    box-shadow: var(--glow-shadow-lg);
    border: 2px solid rgba(110, 66, 229, 0.1);
    transition: all 0.3s ease;
}

.custom-video-player:hover {
    border-color: rgba(110, 66, 229, 0.3);
    box-shadow: 0 0 40px rgba(110, 66, 229, 0.2);
}

/* Base video styles */
.custom-video-player video {
    width: 100%;
    max-height: 70vh;
    height: auto;
    display: block;
    outline: none;
    transition: all 0.3s ease;
}

/* FULLSCREEN - COMPLETE OVERRIDE */
.custom-video-player:fullscreen,
.custom-video-player:-webkit-full-screen,
.custom-video-player:-moz-full-screen,
.custom-video-player:-ms-fullscreen,
.custom-video-player.fullscreen-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    z-index: 2147483647 !important;
    background: #000 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    overflow: hidden !important;
}

/* FULLSCREEN VIDEO - NUCLEAR OPTION */
.custom-video-player:fullscreen video,
.custom-video-player:-webkit-full-screen video,
.custom-video-player:-moz-full-screen video,
.custom-video-player:-ms-fullscreen video,
.custom-video-player.fullscreen-active video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    object-fit: cover !important;
    z-index: 1 !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
}

/* OVERRIDE ALL RESET RULES - HIGHEST SPECIFICITY */
.custom-video-player:fullscreen:not(.exiting-fullscreen) video,
.custom-video-player:-webkit-full-screen:not(.exiting-fullscreen) video,
.custom-video-player:-moz-full-screen:not(.exiting-fullscreen) video,
.custom-video-player:-ms-fullscreen:not(.exiting-fullscreen) video,
.custom-video-player.fullscreen-active:not(.exiting-fullscreen) video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    object-fit: cover !important;
}

/* Transition helper class for smooth exit */
.custom-video-player.exiting-fullscreen {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    top: auto !important;
    left: auto !important;
    z-index: auto !important;
    background: #000 !important;
    display: block !important;
    border-radius: var(--border-radius-lg) !important;
    overflow: hidden !important;
    border: 2px solid rgba(110, 66, 229, 0.1) !important;
    box-shadow: var(--glow-shadow-lg) !important;
}

.custom-video-player.exiting-fullscreen video {
    width: 100% !important;
    height: auto !important;
    max-height: 70vh !important;
    max-width: 100% !important;
    object-fit: initial !important;
    position: static !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .custom-video-player video {
        max-height: 60vh;
    }

    .custom-video-player:not(.fullscreen-active):not(:fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) video,
    .custom-video-player.exiting-fullscreen video {
        max-height: 60vh !important;
    }

    /* Mobile fullscreen adjustments */
    .custom-video-player:fullscreen video,
    .custom-video-player:-webkit-full-screen video,
    .custom-video-player:-moz-full-screen video,
    .custom-video-player:-ms-fullscreen video,
    .custom-video-player.fullscreen-active video {
        object-fit: cover !important; /* Better mobile experience */
    }
}

/* Force immediate reset - highest specificity */
.custom-video-player:not(.fullscreen-active):not(.exiting-fullscreen):not(:fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    top: auto !important;
    left: auto !important;
    z-index: auto !important;
}

.custom-video-player:not(.fullscreen-active):not(.exiting-fullscreen):not(:fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) video {
    width: 100% !important;
    height: auto !important;
    max-height: 70vh !important;
    max-width: 100% !important;
    object-fit: initial !important;
}

/* Hide native controls */
.custom-video-player video::-webkit-media-controls {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-panel {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-play-button {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-volume-slider {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-mute-button {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-timeline {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-current-time-display {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-time-remaining-display {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-fullscreen-button {
    display: none !important;
}

.custom-video-player video::-webkit-media-controls-overlay-play-button {
    display: none !important;
}

/* Custom Controls - FIXED */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 20px 15px 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 10;
    opacity: 1;
    visibility: visible;
}

/* Show controls on hover or when .show class is present */
.custom-video-player:hover .video-controls,
.video-controls.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Hide controls when .hide class is present */
.video-controls.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* CRITICAL: Fullscreen controls positioning - SIMPLIFIED */
.custom-video-player.fullscreen-active .video-controls,
.custom-video-player:fullscreen .video-controls,
.custom-video-player:-webkit-full-screen .video-controls,
.custom-video-player:-moz-full-screen .video-controls,
.custom-video-player:-ms-fullscreen .video-controls {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    z-index: 2147483647 !important;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9)) !important;
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Fullscreen controls hover behavior */
.custom-video-player.fullscreen-active:hover .video-controls,
.custom-video-player:fullscreen:hover .video-controls,
.custom-video-player:-webkit-full-screen:hover .video-controls,
.custom-video-player:-moz-full-screen:hover .video-controls,
.custom-video-player:-ms-fullscreen:hover .video-controls {
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Center play button fullscreen positioning */
.custom-video-player.fullscreen-active .center-play-btn,
.custom-video-player:fullscreen .center-play-btn,
.custom-video-player:-webkit-full-screen .center-play-btn,
.custom-video-player:-moz-full-screen .center-play-btn,
.custom-video-player:-ms-fullscreen .center-play-btn {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    z-index: 2147483646 !important;
}

/* Loading spinner fullscreen positioning */
.custom-video-player.fullscreen-active .video-loading,
.custom-video-player:fullscreen .video-loading,
.custom-video-player:-webkit-full-screen .video-loading,
.custom-video-player:-moz-full-screen .video-loading,
.custom-video-player:-ms-fullscreen .video-loading {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    z-index: 2147483645 !important;
}

/* Control Button Styles */
.video-controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.play-pause-btn {
    background: rgba(110, 66, 229, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: white;
}

.play-pause-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.play-pause-btn svg {
    width: 18px;
    height: 18px;
}

.progress-container {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease;
}

.progress-container:hover .progress-bar {
    background: var(--primary-light);
}

.time-display {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-mono);
    min-width: 80px;
    text-align: center;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mute-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: var(--transition);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mute-btn:hover {
    color: white;
}

.volume-slider {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    appearance: none;
}

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

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.fullscreen-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: var(--transition);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn:hover {
    color: white;
}

/* Loading Spinner */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-color);
    z-index: 5;
}

.video-loading svg {
    animation: spin 1s linear infinite;
}

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

/* Center Play Button */
.center-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(110, 66, 229, 0.9);
    border: none;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: white;
    z-index: 5;
    opacity: 0;
    visibility: hidden;
}

.custom-video-player:not(.playing) .center-play-btn {
    opacity: 1;
    visibility: visible;
}

.center-play-btn:hover {
    background: var(--primary-color);
    transform: translate(-50%, -50%) scale(1.1);
}

.center-play-btn svg {
    width: 32px;
    height: 32px;
    margin-left: 4px; /* Slight offset for play icon */
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .video-controls {
        padding: 15px 10px 10px;
    }
    
    .video-controls-row {
        gap: 8px;
    }
    
    .play-pause-btn {
        width: 36px;
        height: 36px;
    }
    
    .volume-control {
        display: none; /* Hide volume controls on mobile */
    }
    
    .time-display {
        min-width: 70px;
        font-size: 11px;
    }
    
    .center-play-btn {
        width: 60px;
        height: 60px;
    }
    
    .center-play-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* Touch devices - always show controls briefly */
@media (hover: none) and (pointer: coarse) {
    .video-controls {
        transform: translateY(0);
        transition: opacity 0.3s ease;
    }
    
    .video-controls.hide {
        opacity: 0;
        pointer-events: none;
    }
}