/* ===== 字幕功能样式 ===== */

/* 字幕控制按钮容器 */
.subtitle-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 鼠标悬停时显示控制按钮 */
.highlight-video-wrapper:hover .subtitle-controls {
    opacity: 1;
}

/* 移动端始终显示 */
@media (max-width: 768px) {
    .subtitle-controls {
        opacity: 1;
    }
}

/* 字幕切换按钮 */
.subtitle-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.subtitle-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* 字幕激活状态 */
.subtitle-toggle-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.subtitle-toggle-btn.active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.subtitle-toggle-btn i {
    font-size: 18px;
    pointer-events: none;
}

/* 视频字幕样式自定义 */
/* Webkit浏览器（Chrome, Safari, Edge） */
video::-webkit-media-text-track-display {
    background: transparent !important;
    margin-bottom: 50px; /* 避免遮挡控制条 */
}

video::-webkit-media-text-track-container {
    position: relative;
}

/* 字幕文本样式 */
video::cue {
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.4;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', sans-serif;
    white-space: pre-line;
}

/* Firefox字幕样式 */
video::cue(:not(:future)) {
    background: rgba(0, 0, 0, 0.75);
}

/* 响应式字幕大小 */
@media (max-width: 1200px) {
    video::cue {
        font-size: 14px;
        padding: 3px 6px;
    }
}

@media (max-width: 768px) {
    video::cue {
        font-size: 12px;
        padding: 2px 4px;
    }
}

/* 确保视频容器正确定位 */
.highlight-video-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 比例，可根据需要调整 */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.highlight-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 字幕加载失败提示（可选） */
.subtitle-error-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 193, 7, 0.9);
    color: #333;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    animation: fadeInOut 3s ease;
    z-index: 11;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* 视频操作按钮优化 */
.highlight-video-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.highlight-video-actions .btn-ghost {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.highlight-video-actions .btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* 加载状态样式 */
.subtitle-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    pointer-events: none;
}

/* 全屏模式下的字幕样式 */
video:fullscreen::cue {
    font-size: 24px;
    padding: 6px 12px;
}

/* 美化视频控制条（可选） */
video::-webkit-media-controls-panel {
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.5));
}

video::-webkit-media-controls-play-button,
video::-webkit-media-controls-mute-button,
video::-webkit-media-controls-fullscreen-button {
    filter: brightness(1.2);
}

/* 确保字幕按钮在视频上方 */
.highlight-video-section {
    position: relative;
}

.subtitle-controls {
    pointer-events: auto;
}

