/**
 * ============================================
 * 教学视频页面优化样式 - 国风设计
 * 基于03_courses_教学视频页面优化.txt要求
 * ============================================
 */

/* ===== 页面全局背景：动态山水视频底纹 ===== */
.page-bg-video {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.page-bg-video::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(250, 248, 245, 0.3) 0%,
        rgba(250, 248, 245, 0.1) 50%,
        rgba(250, 248, 245, 0.4) 100%
    );
    pointer-events: none;
}

.page-bg-video-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.15; /* 控制在 15% 左右，保证内容清晰可读 */
    pointer-events: none;
    filter: sepia(10%) saturate(80%); /* 添加轻微复古色调 */
}

/* ===== 页面标题区 ===== */
.page-header {
    padding: 3rem 0 2rem;
    text-align: center;
}

.page-header h1 {
    font-family: 'Noto Serif SC', 'Source Han Serif SC', '思源宋体', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #5D3A1A;
    margin-bottom: 0.75rem;
}

.page-header p {
    font-family: 'Noto Serif SC', 'Source Han Serif SC', '思源宋体', serif;
    font-size: 1.1rem;
    color: #888;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== 分类导航区 ===== */
.category-nav-section {
    background: #E8E5E1;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid #8B4513;
    border-top: 1px solid rgba(139, 69, 19, 0.1);
}

/* 分类按钮组 */
.category-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* 国风分类按钮 */
.category-btn {
    font-family: 'Noto Serif SC', 'Source Han Serif SC', '思源宋体', serif;
    font-size: 15px;
    padding: 10px 24px;
    background: #FFFAF0;
    border: 1px solid #8B4513;
    border-radius: 8px;
    color: #5D3A1A;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-btn:hover {
    background: #8B4513;
    color: #FFFAF0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.2);
}

.category-btn.active {
    background: #8B4513;
    color: #FFFAF0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-btn i {
    font-size: 1rem;
}

/* ===== 视频卡片样式 ===== */
.video-card {
    background: #FFFAF0;
    border: 1px solid #8B4513;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(30px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.video-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* 视频封面区 */
.video-cover-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    cursor: pointer;
    background: #E8E5E1;
}

.video-cover-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
}

.video-card:hover .video-cover-wrapper img {
    transform: scale(1.05);
}

/* 居中国风播放按钮 */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(139, 69, 19, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.play-button::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 20px solid #FFFAF0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 5px;
}

.video-cover-wrapper:hover .play-button {
    background: #DC143C;
    transform: translate(-50%, -50%) scale(1.1);
}

/* 视频时长标签 */
.video-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #FFFAF0;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'Noto Serif SC', 'Source Han Serif SC', '思源宋体', serif;
    font-weight: 600;
}

/* 视频卡片内容区 */
.video-card .card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-card .card-title {
    font-family: 'Noto Serif SC', 'Source Han Serif SC', '思源宋体', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #8B4513;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* 关键词加粗 */
.video-card .card-title .keyword {
    color: #DC143C;
    font-weight: 700;
}

/* 视频元信息 */
.video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 0.75rem;
}

.video-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    padding: 3px 10px;
    background: rgba(220, 20, 60, 0.1);
    color: #DC143C;
    border-radius: 4px;
    font-weight: 600;
}

.video-meta-tag i {
    font-size: 0.85rem;
}

/* 视频简介 */
.video-card .card-text {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
    /* 文字截断 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 操作按钮组 */
.video-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.video-card .btn {
    font-family: 'Noto Serif SC', 'Source Han Serif SC', '思源宋体', serif;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.video-card .btn-outline-primary {
    border-color: #8B4513;
    color: #8B4513;
    background: transparent;
}

.video-card .btn-outline-primary:hover {
    background: #8B4513;
    border-color: #8B4513;
    color: #FFFAF0;
}

.video-card .btn-primary {
    background: #8B4513;
    border-color: #8B4513;
}

.video-card .btn-primary:hover {
    background: #6B340D;
    border-color: #6B340D;
}

/* 收藏按钮 */
.favorite-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #8B4513;
    border-radius: 8px;
    background: transparent;
    color: #8B4513;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.favorite-btn:hover {
    border-color: #DC143C;
    color: #DC143C;
}

.favorite-btn.active {
    background: #DC143C;
    border-color: #DC143C;
    color: #FFFAF0;
}

.favorite-btn i {
    font-size: 1rem;
}

/* ===== 视频播放区样式 ===== */
.video-player-container {
    background: #363636;
    padding: 20px;
    border-radius: 8px;
    position: relative;
}

/* 竹简纹装饰 - 降低z-index确保不遮挡视频控件 */
.video-player-container::before,
.video-player-container::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M2 2h16v2H2zm0 4h16v2H2zm0 4h16v2H2zm0 4h16v2H2z' fill='%238B4513' fill-opacity='0.1'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.3;
    z-index: 1;
    pointer-events: none;
}

.video-player-container::before {
    top: 10px;
    left: 10px;
}

.video-player-container::after {
    bottom: 10px;
    right: 10px;
}

/* 视频播放器 - 确保控件可交互 */
.video-player-container video {
    width: 100%;
    border-radius: 4px;
    display: block;
    position: relative;
    z-index: 2;
}

/* ===== 修复视频控件交互问题 ===== */
/* 确保模态框内的视频控件可以正常交互 */
.modal-dialog {
    pointer-events: auto;
}

.modal-content {
    pointer-events: auto;
}

.modal-body {
    pointer-events: auto;
}

/* 确保视频控件层级最高 */
video::-webkit-media-controls {
    z-index: 1000 !important;
}

video::-webkit-media-controls-panel {
    z-index: 1001 !important;
}

video::-webkit-media-controls-timeline {
    z-index: 1002 !important;
    cursor: pointer !important;
}

video::-webkit-media-controls-play-button {
    z-index: 1002 !important;
    cursor: pointer !important;
}

/* Firefox兼容性 */
video::-moz-range-track {
    cursor: pointer !important;
}

video::-moz-range-thumb {
    cursor: pointer !important;
}

/* 禁用可能影响视频控件的用户选择 */
.video-player-container * {
    user-select: none;
    -webkit-user-select: none;
}

/* 但允许视频控件本身的交互 */
.video-player-container video,
.video-player-container video * {
    pointer-events: auto !important;
}

/* ===== 加载动画 ===== */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.loading-spinner::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 2px solid rgba(139, 69, 19, 0.2);
    border-top-color: #8B4513;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 反馈弹窗 ===== */
.feedback-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #FFFAF0;
    border: 2px solid #8B4513;
    border-radius: 12px;
    padding: 24px 40px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    font-family: 'Noto Serif SC', 'Source Han Serif SC', '思源宋体', serif;
}

.feedback-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.feedback-toast i {
    font-size: 2.5rem;
    color: #DC143C;
    margin-bottom: 12px;
    display: block;
}

.feedback-toast p {
    font-size: 1.1rem;
    color: #5D3A1A;
    margin: 0;
    font-weight: 600;
}

/* ===== 响应式适配 ===== */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.8rem;
    }
    
    .category-btn-group {
        gap: 8px;
    }
    
    .category-btn {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .video-card .card-title {
        font-size: 1rem;
    }
    
    .video-actions {
        flex-wrap: wrap;
    }
    
    .video-card .btn {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .play-button {
        width: 50px;
        height: 50px;
    }
    
    .play-button::before {
        border-left-width: 16px;
        border-top-width: 10px;
        border-bottom-width: 10px;
    }
}

/* ===== 动画延迟类 ===== */
.video-card.delay-1 { transition-delay: 0.1s; }
.video-card.delay-2 { transition-delay: 0.2s; }
.video-card.delay-3 { transition-delay: 0.3s; }
.video-card.delay-4 { transition-delay: 0.4s; }
.video-card.delay-5 { transition-delay: 0.5s; }
.video-card.delay-6 { transition-delay: 0.6s; }

/* 修复视频封面区域布局 */
.video-cover-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #E8E5E1; /* 占位背景 */
    overflow: hidden;
}

/* 确保封面占位符完全覆盖父容器，且无额外间距 */
.cover-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 1px solid #8B4513;
    box-sizing: border-box; /* 关键：边框包含在宽高内 */
    background: linear-gradient(145deg, #F5E6D3 0%, #E8D4B8 100%);
    background-image: 
        linear-gradient(rgba(139,69,19,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139,69,19,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    display: block;
}

/* 内边框装饰，不影响实际占位 */
.cover-placeholder::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(139,69,19,0.3);
    pointer-events: none;
    box-sizing: border-box;
}

/* 文本居中显示 */
.cover-placeholder::before {
    content: attr(data-title);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    text-align: center;
    font-family: 'Noto Serif SC', serif;
    font-weight: 600;
    color: #5D3A1A;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}