/**
 * 自定义视频播放器样式
 * 
 * @package WP_LMS
 */

.lms-custom-video-player {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.lms-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    background: #000;
}

.lms-video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    outline: none;
    cursor: pointer;
}

.lms-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

.lms-play-button {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.lms-play-button:hover {
    background: rgba(255,255,255,1);
    transform: scale(1.1);
}

.lms-play-button .dashicons {
    font-size: 32px;
    color: #0073aa;
    margin-left: 4px; /* 调整播放按钮的视觉中心 */
}

/* 视频控制栏 */
.lms-video-controls {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.8);
    padding: 10px 15px;
    color: #fff;
    gap: 10px;
}

.lms-video-controls button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lms-video-controls button:hover {
    background: rgba(255,255,255,0.2);
}

.lms-video-controls .dashicons {
    font-size: 20px;
}

/* 进度条容器 */
.lms-progress-container {
    flex: 1;
    margin: 0 10px;
    position: relative;
}

.lms-progress-track {
    height: 6px;
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.lms-progress-watched {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255,255,255,0.6);
    border-radius: 3px;
    transition: width 0.1s ease;
}

.lms-progress-current {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #0073aa;
    border-radius: 3px;
    transition: width 0.1s ease;
}

.lms-progress-handle {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: #0073aa;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.lms-progress-container:hover .lms-progress-handle {
    opacity: 1;
}

.lms-progress-track:hover {
    height: 8px;
    margin-top: -1px;
}

/* 时间显示 */
.lms-time-display {
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
    font-family: monospace;
}

.lms-time-display span {
    display: inline-block;
}

.lms-current-time::after {
    content: " / ";
    margin: 0 2px;
}

/* 音量和全屏按钮 */
.lms-volume-btn,
.lms-fullscreen-btn {
    margin-left: 5px;
}

/* 全屏状态样式 */
.lms-custom-video-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
}

.lms-custom-video-player:-moz-full-screen {
    width: 100vw;
    height: 100vh;
}

.lms-custom-video-player:fullscreen {
    width: 100vw;
    height: 100vh;
}

.lms-custom-video-player:fullscreen .lms-video-container {
    padding-bottom: 0;
    height: calc(100vh - 50px);
}

.lms-custom-video-player:fullscreen .lms-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

/* 禁用默认的视频控制 */
.lms-custom-video-player video::-webkit-media-controls {
    display: none !important;
}

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

/* 控制栏hover效果 */
.lms-custom-video-player:hover .lms-video-controls {
    opacity: 1;
}

.lms-video-controls {
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

/* 加载状态 */
.lms-video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 18px;
    z-index: 3;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .lms-video-controls {
        padding: 8px 10px;
        gap: 8px;
    }
    
    .lms-video-controls .dashicons {
        font-size: 18px;
    }
    
    .lms-progress-container {
        margin: 0 8px;
    }
    
    .lms-time-display {
        font-size: 10px;
    }
    
    .lms-play-button {
        width: 60px;
        height: 60px;
    }
    
    .lms-play-button .dashicons {
        font-size: 24px;
    }
}

/* 进度限制提示 */
.lms-progress-restriction-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lms-progress-restriction-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0,0,0,0.8);
}

.lms-progress-restriction-tooltip.show {
    opacity: 1;
}

/* 观看进度指示器 */
.lms-progress-marker {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 150%;
    background: rgba(255,255,255,0.8);
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 2;
}

/* YouTube视频提示样式 */
.lms-youtube-notice {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.lms-notice-content {
    padding: 20px;
    text-align: center;
}

.lms-notice-content h3 {
    margin: 0 0 15px 0;
    color: #d63638;
    font-size: 18px;
}

.lms-notice-content p {
    margin: 0 0 10px 0;
    color: #666;
    line-height: 1.6;
}

.lms-youtube-fallback {
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
}

.lms-youtube-fallback iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 自定义视频加载状态 */
.lms-custom-video-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #f0f0f0;
    border-radius: 8px;
}

.lms-custom-video-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* YouTube自定义播放器样式 - 纯净方案 */
.lms-youtube-custom-player {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* 视频容器 - 纯净的YouTube embed */
.lms-youtube-custom-player .lms-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

/* YouTube iframe容器 - 简洁设置 */
.lms-youtube-custom-player .youtube-player-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}


/* YouTube的外部控制栏样式 */
.lms-youtube-controls {
    background: rgba(0,0,0,0.95);
    border-radius: 8px;
    margin-top: 10px; /* 与视频间隙 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.lms-youtube-controls:hover {
    background: rgba(0,0,0,0.98);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}


/* YouTube iframe本身 - 基本设置 */
.lms-youtube-custom-player iframe {
    border: none;
    background: #000;
    width: 100%;
    height: 100%;
}


/* YouTube播放覆盖层 - 简洁设置 */
.lms-youtube-custom-player .lms-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    border-radius: 8px;
}



/* 进度限制提示 */
.lms-restriction-notice {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.9);
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* YouTube播放器全屏状态 */
.lms-youtube-custom-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
}

.lms-youtube-custom-player:-moz-full-screen {
    width: 100vw;
    height: 100vh;
}

.lms-youtube-custom-player:fullscreen {
    width: 100vw;
    height: 100vh;
}

.lms-youtube-custom-player:fullscreen .lms-video-container {
    padding-bottom: 0;
    height: 100vh;
    border-radius: 0;
}

.lms-youtube-custom-player:fullscreen video {
    border-radius: 0;
}

.lms-youtube-custom-player:fullscreen .lms-youtube-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-radius: 0;
    border: none;
}

.lms-video-controls .lms-control-btn:hover {
    background: rgba(74, 144, 226, 0.8);
}

.lms-video-controls .lms-control-btn.active {
    background: #4a90e2;
    color: #fff;
}

.lms-video-controls .lms-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lms-video-controls .lms-control-btn:disabled:hover {
    background: rgba(74, 144, 226, 0.3);
}

/* Video.js进度条限制样式 */
.video-js .vjs-progress-control .vjs-progress-holder {
    position: relative;
}

/* 为Video.js播放器添加进度限制指示器 */
.video-js .vjs-progress-control .vjs-progress-holder::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    pointer-events: none;
    z-index: 2;
    transition: width 0.3s ease;
}

/* 限制区域的鼠标样式 */
.video-js .vjs-progress-control .vjs-seek-to-live {
    cursor: not-allowed !important;
}

/* 自定义播放器限制提示 */
.lms-seek-restriction-notice {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 59, 48, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: lmsSeekWarning 2.5s ease-in-out forwards;
    pointer-events: none;
}

@keyframes lmsSeekWarning {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.8); 
    }
    15% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1.05); 
    }
    25% { 
        transform: translate(-50%, -50%) scale(1); 
    }
    85% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.8); 
    }
}

/* 强制隐藏YouTube原生控制器 */
.video-js .vjs-tech {
    pointer-events: none;
}

.video-js .vjs-tech iframe {
    pointer-events: none;
}

/* 隐藏YouTube iframe中的控制元素 */
.video-js iframe[src*="youtube.com"] {
    pointer-events: none !important;
}

/* 确保Video.js控制栏正常工作 */
.video-js .vjs-control-bar {
    pointer-events: auto !important;
    z-index: 1000 !important;
}

.video-js .vjs-control-bar * {
    pointer-events: auto !important;
}

/* Video.js进度条样式增强 */
.video-js .vjs-progress-control .vjs-progress-holder {
    position: relative !important;
    background: rgba(120, 120, 120, 0.3) !important; /* 未观看部分的背景 - 深灰色 */
    border-radius: 2px !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
}

/* 已观看进度的背景层 */
.video-js .vjs-progress-control .vjs-progress-holder::before {
    content: '';
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    height: 100% !important;
    background: linear-gradient(90deg, 
        rgba(40, 180, 99, 0.7) 0%,   /* 绿色渐变 - 已观看 */
        rgba(46, 204, 113, 0.8) 50%, 
        rgba(39, 174, 96, 0.9) 100%) !important;
    z-index: 1 !important;
    transition: width 0.3s ease !important;
    border-radius: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 当前播放进度条 */
.video-js .vjs-progress-control .vjs-play-progress {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 255, 255, 1) 100%) !important;
    z-index: 3 !important;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 进度条覆盖层样式优化 */
.lms-progress-overlay {
    background: linear-gradient(90deg, 
        rgba(231, 76, 60, 0.5) 0%,    /* 红色渐变 - 禁止区域 */
        rgba(192, 57, 43, 0.6) 50%, 
        rgba(231, 76, 60, 0.7) 100%) !important;
    border-left: 3px solid rgba(231, 76, 60, 1) !important;
    backdrop-filter: blur(1px);
    z-index: 5 !important;
    position: absolute !important;  /* 确保使用绝对定位对齐 */
    top: 0 !important;              /* 顶部对齐 */
    bottom: 0 !important;           /* 底部对齐 */
    margin: 0 !important;           /* 移除所有外边距 */
    padding: 0 !important;          /* 移除所有内边距 */
    border-radius: inherit !important; /* 继承父元素圆角 */
    transition: opacity 0.2s ease;
    box-sizing: border-box !important;  /* 确保盒模型一致 */
}

/* 覆盖层悬停效果 */
.lms-progress-overlay:hover {
    opacity: 0.9;
    background: linear-gradient(90deg, 
        rgba(231, 76, 60, 0.6) 0%, 
        rgba(192, 57, 43, 0.7) 50%, 
        rgba(231, 76, 60, 0.8) 100%) !important;
}

/* 移除禁止图标 - 保持简洁 */

/* 进度条整体容器优化 */
.video-js .vjs-progress-control {
    position: relative;
}

/* 进度条hover效果增强 */
.video-js .vjs-progress-control:hover .vjs-progress-holder {
    height: 6px !important;
    transform: scaleY(1.2);
    transition: all 0.2s ease;
}

/* 进度条手柄优化 */
.video-js .vjs-progress-control .vjs-play-progress .vjs-time-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 11px;
}