/**
 * HTML5播放器完全独立样式文件
 * 包含HTML5原生播放器的所有样式，不依赖任何外部CSS
 */

.html5-player {
    position: relative;
    width: 100%;
    background-color: #000;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 16/9; /* 现代浏览器支持的宽高比 */
}

/* 向后兼容不支持aspect-ratio的浏览器 */
@supports not (aspect-ratio: 16/9) {
    .html5-player {
        height: 0;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
    }
}

.html5-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
    display: block;
}

/* 确保.player-content正确显示 */
.html5-player .player-content {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 暂停状态覆盖层 */
.html5-pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.html5-pause-overlay.html5-paused {
    display: flex;
    opacity: 1;
}

.html5-play-icon {
    width: 80px;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 32px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.html5-play-icon:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.8);
}

/* 自定义控件样式 */
.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 10px;
    display: flex;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* PC端强制显示控件 - 最高优先级 */
.custom-controls.pc-controls,
.custom-controls.pc-force-visible,
.custom-controls.pc-controls-force {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)) !important;
    padding: 15px !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* 紧急修复样式 - 红色背景用于调试 */
.custom-controls.pc-controls-force {
    background: rgba(255, 0, 0, 0.5) !important;
    border: 2px solid #ff0000 !important;
}

/* PC设备媒体查询强制显示 */
@media (min-width: 769px) {
    .custom-controls {
        opacity: 1 !important;
        visibility: visible !important;
        display: flex !important;
    }
}

.html5-player:hover .custom-controls {
    opacity: 1;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    padding: 8px;
    cursor: pointer;
    margin: 0 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.control-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.progress-bar {
    flex: 1;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0 10px;
    cursor: pointer;
    position: relative;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #ff0000;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.time-display {
    color: white;
    font-size: 12px;
    font-family: monospace;
    margin: 0 10px;
}

/* 自动播放警告样式 */
.autoplay-warning {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 10000;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* 移动端适配 - 确保视频画面填满容器 */
@media (max-width: 768px) {
    .html5-player {
        width: 100% !important;
        height: 0 !important;
        padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
        position: relative !important;
        background-color: #000 !important;
        overflow: hidden !important;
    }
    
    .html5-player video {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        background-color: #000 !important;
    }
    
    /* 确保播放器容器正确显示 */
    .html5-player .player-content {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .html5-play-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 24px !important;
    }
    
    .custom-controls {
        padding: 8px !important;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)) !important;
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
    }
    
    .control-btn {
        font-size: 14px !important;
        padding: 6px !important;
    }
    
    .time-display {
        font-size: 11px !important;
    }
    
    .autoplay-warning {
        font-size: 12px !important;
        top: 10px !important;
        padding: 8px 12px !important;
        z-index: 10000 !important;
    }
    
    /* 移动端全屏控制按钮 */
    .mobile-fullscreen-btn {
        display: block !important;
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        background: rgba(0, 0, 0, 0.6) !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
        z-index: 10001 !important;
        cursor: pointer !important;
    }
    
    /* 强制移除任何可能影响视频尺寸的样式 */
    .video-player, 
    .video-player-placeholder,
    .player-container {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
}

/* 针对超小屏幕设备的额外优化 */
@media (max-width: 480px) {
    .html5-player {
        padding-bottom: 75% !important; /* 4:3 aspect ratio for very small screens */
    }
    
    .html5-player video {
        object-fit: cover !important;
    }
    
    .html5-play-icon {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }
    
    .custom-controls {
        padding: 6px !important;
    }
    
    .control-btn {
        font-size: 12px !important;
        padding: 4px !important;
        margin: 0 3px !important;
    }
    
    .time-display {
        font-size: 10px !important;
        margin: 0 5px !important;
    }
}

/* 加载状态 */
.html5-player.loading video {
    opacity: 0.5;
}

.html5-player.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    z-index: 1000;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 错误状态 */
.html5-player.error .html5-pause-overlay {
    display: flex;
    background-color: rgba(0, 0, 0, 0.7);
}

.html5-player.error .html5-play-icon::before {
    content: '⚠️';
    font-size: 24px;
}

/* 全屏样式 */
.html5-player:fullscreen {
    width: 100vw;
    height: 100vh;
    padding-bottom: 0;
    border-radius: 0;
}

.html5-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    padding-bottom: 0;
    border-radius: 0;
}

.html5-player:-moz-full-screen {
    width: 100vw;
    height: 100vh;
    padding-bottom: 0;
    border-radius: 0;
}

.html5-player:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
    padding-bottom: 0;
    border-radius: 0;
}

