/**
 * YPB 页面视频播放器样式
 * 
 * @version 1.0.0
 * @date 2025-01-31
 */

/* ========== 视频容器 ========== */
.ypb-local-video-container {
    position: relative;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: inline-block;
}

/* 横屏容器 - 16:9 比例 */
.ypb-local-video-container.landscape-container {
    width: 400px;
}

/* 竖屏容器 - 9:16 比例 */
.ypb-local-video-container.portrait-container {
    width: 225px;
}

/* ========== 视频预览图 ========== */
.ypb-video-poster {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #000;
}

/* 竖屏预览图：9:16 比例 */
.ypb-video-poster.portrait-poster {
    width: 225px;
    height: 400px; /* 225 * 16 / 9 = 400 */
}

.ypb-video-poster.portrait-poster .ypb-poster-image,
.ypb-video-poster.portrait-poster video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

/* 横屏预览图：16:9 比例 */
.ypb-video-poster.landscape-poster {
    width: 400px;
    height: 225px; /* 400 * 9 / 16 = 225 */
}

.ypb-video-poster.landscape-poster .ypb-poster-image,
.ypb-video-poster.landscape-poster video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

/* 取消视频缩略图的悬停缩放效果 */

/* ========== 播放按钮遮罩 ========== */
.ypb-play-button-overlay {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: all 0.3s ease;
}

.ypb-video-poster:hover .ypb-play-button-overlay {
    background: transparent;
}

/* ========== 播放按钮 ========== */
.ypb-play-button {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4169E1;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ypb-video-poster:hover .ypb-play-button {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.ypb-play-button svg {
    width: 36px;
    height: 36px;
    margin-left: 3px; /* 视觉居中 */
}

/* ========== 视频播放器 ========== */
.ypb-video-player-wrapper {
    position: relative;
    width: 100%;
    background: #000;
}

.ypb-video-player-wrapper video {
    width: 100%;
    height: auto;
    display: block;
    outline: none;
}

/* 横屏视频样式 */
.ypb-video-player-wrapper.landscape {
    aspect-ratio: 16 / 9;
}

/* 竖屏视频样式 */
.ypb-video-player-wrapper.portrait {
    max-width: 450px;
    margin: 0 auto;
    aspect-ratio: 9 / 16;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .ypb-local-video-container {
        max-width: 100%;
        border-radius: 8px;
    }
    
    .ypb-play-button {
        width: 60px;
        height: 60px;
    }
    
    .ypb-play-button svg {
        width: 36px;
        height: 36px;
    }
    
    .ypb-video-player-wrapper.portrait {
        max-width: 100%;
    }
}

/* ========== 加载动画 ========== */
.ypb-video-player-wrapper video:not([src]) {
    background: #000 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="%23fff" stroke-width="3" opacity="0.3"/><circle cx="25" cy="25" r="20" fill="none" stroke="%234169E1" stroke-width="3" stroke-dasharray="31.4 31.4" stroke-dashoffset="0"><animateTransform attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="1s" repeatCount="indefinite"/></circle></svg>') center center no-repeat;
    background-size: 50px 50px;
}

/* ========== 深色模式适配 ========== */
@media (prefers-color-scheme: dark) {
    .ypb-local-video-container {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
}
