/* video-player.css - 多页面共享视频播放器样式 */

/* 删除视频卡片样式，这些应该由页面特定CSS处理 */

/* 视频弹窗样式 */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    /* 移除可能导致残影的过渡效果 */
    transition: opacity 0.3s ease;
}

.video-modal.active {
    opacity: 1;
    visibility: visible;
}

.video-modal-container {
    position: relative;
    width: 90%;
    max-width: 900px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    /* 简化过渡效果以避免残影 */
    transition: transform 0.3s ease;
    z-index: 10001;
}

.video-modal.active .video-modal-container {
    transform: scale(1);
}

/* 优化：合并重复的关闭按钮样式 */
.video-modal .close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10002;
    /* 移除可能导致残影的过渡效果 */
    border: none;
    outline: none;
}

.video-modal .close-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

.video-modal .close-button::before,
.video-modal .close-button::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: white;
    /* 添加will-change属性以优化渲染性能 */
    will-change: transform;
}

.video-modal .close-button::before {
    transform: rotate(45deg);
}

.video-modal .close-button::after {
    transform: rotate(-45deg);
}

.orientation-hint {
    color: white;
    text-align: center;
    padding: 10px;
    background: transparent;
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

/* 移除底部关闭按钮的样式 */
.close-video-button {
    display: none;
}

/* 视频容器通用样式 */
.video-js,
.iframe-container {
    width: 100%;
    height: 0;
    padding-top: 56.25%; /* 16:9 比例 */
    max-height: 80vh;
    margin-bottom: 0;
    position: relative;
    z-index: 10000;
}

.vjs-poster {
    background-size: cover;
}

/* 第三方平台 iframe 容器 */
.iframe-container {
    position: relative;
    display: none;
    z-index: 10001;
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 10002;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .video-modal-container {
        width: 95%;
        margin: 10px;
    }
    
    .video-js {
        max-height: 50vh;
    }
    
    /* 在移动设备上调整关闭按钮位置 */
    .video-modal .close-button {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
    }
    
    .video-modal .close-button::before,
    .video-modal .close-button::after {
        width: 15px;
        height: 1px;
    }
}

@media (max-width: 480px) {
    .video-modal-container {
        width: 98%;
        border-radius: 0;
        margin: 5px;
    }
    
    /* 在小屏幕上进一步调整关闭按钮 */
    .video-modal .close-button {
        top: 5px;
        right: 5px;
        width: 25px;
        height: 25px;
    }
    
    .video-modal .close-button::before,
    .video-modal .close-button::after {
        width: 12px;
        height: 1px;
    }
}

/* 横屏竖屏适配 */
@media (orientation: portrait) {
    .orientation-hint {
        display: none;
    }
}

/* Video.js 自定义皮肤 */
.video-js .vjs-big-play-button {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    z-index: 2;
    /* 添加will-change属性以优化渲染性能 */
    will-change: background;
}

.video-js .vjs-big-play-button .vjs-icon-placeholder:before {
    font-size: 2.5rem;
    line-height: 70px;
}

.video-js:hover .vjs-big-play-button {
    background: rgba(255, 255, 255, 0.3);
}

/* 加载动画 */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    display: none;
    z-index: 1000;
    /* 添加will-change属性以优化渲染性能 */
    will-change: transform;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 视频错误信息样式 */
.video-error-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.error-content {
    text-align: center;
    color: white;
    padding: 20px;
}

.error-content p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.retry-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.retry-button:hover {
    background: #2980b9;
}