/* Modern Custom Video Player Styles */

.custom-video-player {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-video-player video {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
}

/* Video Controls Container */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 20px 15px 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translateY(100%);
    transition: all 0.3s ease;
}

.custom-video-player:hover .video-controls,
.custom-video-player.controls-visible .video-controls {
    opacity: 1;
    transform: translateY(0);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    margin-bottom: 15px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-container:hover .progress-bar::after {
    opacity: 1;
}

/* Controls Row */
.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Control Buttons */
.control-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn i {
    font-size: 16px;
    pointer-events: none;
}

/* Play/Pause Button */
.play-btn {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 44px;
    height: 44px;
}

.play-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.play-btn i {
    font-size: 18px;
}

/* Volume Control */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.volume-slider {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.volume-container:hover .volume-slider {
    opacity: 1;
}

.volume-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 100%;
    transition: width 0.1s ease;
}

/* Time Display */
.time-display {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    min-width: 100px;
    text-align: center;
}

/* Fullscreen Button */
.fullscreen-btn {
    margin-left: auto;
}

/* Video Info Overlay */
.video-info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.6), transparent);
    padding: 20px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-video-player:hover .video-info-overlay {
    opacity: 1;
}

.video-title-overlay {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.video-meta-overlay {
    font-size: 14px;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Loading Spinner */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-loading.show {
    opacity: 1;
}

/* Buffering Indicator */
.buffering-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.buffering-indicator.show {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Quality Selector */
.quality-selector {
    position: relative;
    display: inline-block;
}

.quality-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.quality-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quality-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 6px;
    padding: 8px 0;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.quality-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quality-option {
    padding: 8px 16px;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.quality-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.quality-option.active {
    background: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    .video-controls {
        padding: 15px 10px 10px;
    }
    
    .controls-row {
        gap: 10px;
    }
    
    .controls-left,
    .controls-right {
        gap: 10px;
    }
    
    .control-btn {
        min-width: 32px;
        height: 32px;
        padding: 6px;
    }
    
    .play-btn {
        width: 40px;
        height: 40px;
    }
    
    .volume-slider {
        width: 40px;
    }
    
    .time-display {
        font-size: 12px;
        min-width: 80px;
    }
    
    .video-title-overlay {
        font-size: 16px;
    }
    
    .video-meta-overlay {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .volume-container {
        display: none;
    }
    
    .time-display {
        min-width: 60px;
        font-size: 11px;
    }
}

/* Fullscreen fixes for mobile */
.custom-video-player:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
}

.custom-video-player:fullscreen video {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

.custom-video-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
}

.custom-video-player:-webkit-full-screen video {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

/* Ensure controls align at bottom with safe area */
.custom-video-player:fullscreen .video-controls,
.custom-video-player:-webkit-full-screen .video-controls {
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
}

/* Prevent half-height issues by making root container fill fullscreen */
.custom-video-player:fullscreen .custom-video-player,
.custom-video-player:-webkit-full-screen .custom-video-player {
    width: 100vw;
    height: 100vh;
}

/* Keyboard Shortcuts Indicator */
.shortcuts-hint {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.shortcuts-hint.show {
    opacity: 1;
}

/* Error State */
.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 8px;
    max-width: 300px;
}

.video-error i {
    font-size: 32px;
    margin-bottom: 10px;
    color: #ff6b6b;
}

.video-error h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.video-error p {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

/* Custom Scrollbar for Volume */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
