/* === 全局与基础样式 === */
:root { 
    --primary-color: #003366; 
    --accent-color: #d19a66; 
    --text-color: #333333; 
    --light-gray: #f8f9fa; 
    --white: #ffffff; 
    --header-height: 70px; 
    --serif-font: 'Noto Serif SC', serif; 
    --sans-font: 'Lato', sans-serif; 
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { 
    font-family: var(--sans-font); 
    margin: 0; 
    background-color: var(--light-gray); 
    color: var(--text-color); 
}
h1, h2, h3, h4 { font-family: var(--serif-font); }
a { 
    text-decoration: none; 
    color: var(--primary-color); 
    transition: color 0.3s; 
}
a:hover { color: var(--accent-color); }
.main-container { 
    max-width: 1400px; 
    margin: 0 auto; 
    padding: 60px 30px; 
}

/* === 导航栏 (Header) === */
.site-header { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: var(--header-height); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 0 20px; 
    z-index: 1000; 
    transition: all 0.4s; 
}
.navbar { 
    width: 100%; 
    max-width: 1400px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 15px; 
}
.logo { 
    display: flex; 
    align-items: center; 
    font-size: 24px; 
    font-weight: 700; 
    color: var(--white); 
    transition: color 0.4s; 
    flex-shrink: 0; 
}
.logo img { 
    max-height: 40px; 
    margin-right: 10px; 
}
.nav-links { display: flex; align-items: center; }
.nav-links a { 
    color: var(--white); 
    padding: 10px 15px; 
    font-size: 16px; 
    font-weight: 700; 
    transition: color 0.4s; 
}
.user-actions { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    margin-left: auto; 
}
.welcome-user { 
    color: var(--white); 
    white-space: nowrap; 
    font-weight: bold; 
}
.auth-link { 
    font-weight: bold; 
    padding: 8px 16px; 
    border: 2px solid var(--white); 
    border-radius: 5px; 
    color: var(--white); 
}
.menu-toggle { display: none; cursor: pointer; }
.menu-toggle span { 
    display: block; 
    width: 25px; 
    height: 3px; 
    background-color: var(--white); 
    margin: 5px 0; 
    transition: all 0.3s; 
}
/* 滚动后 或 初始白色背景 时的样式 */
.site-header.scrolled, 
.site-header.site-header-solid { 
    background-color: var(--white); 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}
.site-header.scrolled .logo, 
.site-header.site-header-solid .logo { color: var(--primary-color); }
.site-header.scrolled .nav-links a, 
.site-header.site-header-solid .nav-links a { color: var(--text-color); }
.site-header.scrolled .welcome-user, 
.site-header.site-header-solid .welcome-user { color: var(--text-color); }
.site-header.scrolled .auth-link, 
.site-header.site-header-solid .auth-link { 
    color: var(--primary-color); 
    border-color: var(--primary-color); 
}
.site-header.scrolled .menu-toggle span, 
.site-header.site-header-solid .menu-toggle span { background-color: var(--primary-color); }

/* === 首页专属 (Hero Slideshow) === */
.hero-slideshow {
    height: 85vh; 
    min-height: 500px; 
    position: relative; 
    overflow: hidden; 
    background-color: #333;
}

.hero-slide {
    width: 100%; 
    height: 100%; 
    position: absolute; 
    top: 0; 
    left: 0;
    background-size: cover; 
    background-position: center;
    opacity: 0; 
    transition: opacity 1.2s ease-in-out;
    
    /* 【核心修改】将 slide 自身变为 flex 容器 */
    display: flex;
    /* 垂直方向：对齐到底部 */
    align-items: flex-end; 
    /* 水平方向：对齐到右侧 */
    justify-content: flex-end; 
    
    /* 为内容留出一些边距，避免紧贴边缘 */
    padding: 5vh 5vw; 
}
.hero-slide.active { 
    opacity: 1; 
}
.hero-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* --- 【方案三】渐变透明过渡 --- */
    /* 从顶部40%位置的半透明黑色，渐变到底部的全透明 */
    background: linear-gradient(to bottom, 
        rgba(0,0,0,0.22) 40%, 
        rgba(0,0,0,0) 100%
    );
    
    /* 同时，在整个轮播图的底部增加一个微妙的内阴影来分割 */
    box-shadow: inset 0 -5px 10px -5px rgba(0,0,0,0.3);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 500px; /* 限制内容最大宽度 */
    
    /* 【核心修改】确保内容也是右对齐 */
    text-align: right; 
}

.hero-title { 
    font-size: 48px; 
    margin-bottom: 20px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5); 
    color: var(--white); 
}
.hero-button { 
    font-size: 18px; 
    color: var(--white); 
    background-color: var(--primary-color); 
    padding: 15px 35px; 
    border-radius: 5px; 
    display: inline-block; 
}
.slide-dots { 
    position: absolute; 
    bottom: 30px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 5; 
}
.dot { 
    display: inline-block; 
    width: 12px; 
    height: 12px; 
    margin: 0 5px; 
    background-color: rgba(255,255,255,0.5); 
    border-radius: 50%; 
    cursor: pointer; 
}
.dot.active { background-color: var(--white); }

/* === 视频卡片 (通用) === */
.section-title { 
    font-size: 36px; 
    text-align: center; 
    margin-bottom: 40px; 
}
.video-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 30px; 
}
.video-card { 
    background-color: var(--white); 
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    transition: all 0.3s; 
}
.video-card:hover { transform: translateY(-8px); }
.video-thumbnail { 
    width: 100%; 
    padding-top: 56.25%; 
    background-size: cover; 
    background-position: center; 
}
.video-info { padding: 20px; }
.video-title { font-size: 18px; }
.video-category { font-size: 14px; color: #888; }

/* === 分类页/搜索页专属 === */
.page-header { 
    padding: 80px 30px; 
    text-align: center; 
    margin-top: var(--header-height); 
    background-color: var(--light-gray); 
    position: relative; 
    color: var(--primary-color); 
}
/* 有背景图片时的特殊样式 */
.page-header.has-bg-image {
    min-height: 40vh; 
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--white);
}
/* 添加一个遮罩层，让文字更清晰 */
.page-header.has-bg-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.0); 
}
.page-header-content {
    position: relative;
    z-index: 2;
}
.page-title { 
    font-size: 42px; 
    color: var(--primary-color); 
    margin: 0; 
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* === 【核心】播放页专属样式 === */
.watch-layout { 
    display: grid; 
    grid-template-columns: 3fr 1fr; 
    gap: 30px; 
    max-width: 1600px; 
    margin: 0 auto; 
    padding: 40px 30px; 
    margin-top: var(--header-height); 
}
.main-column { 
    background: var(--white); 
    padding: 20px; 
    border-radius: 8px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
}
.video-player-wrapper { 
    width: 100%; 
    background: #000; 
    position: relative; 
    padding-top: 56.25%; 
}
.video-player { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
}
.video-details { 
    padding-top: 25px; 
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}
.video-info-main { flex-grow: 1; }
.video-meta { 
    display: flex; 
    gap: 20px; 
    color: #777; 
    font-size: 14px; 
    margin-bottom: 25px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 15px; 
}
.video-navigation-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.prev-video-btn,
.next-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: var(--primary-color);
    color: white !important;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s;
}
.prev-video-btn:hover,
.next-video-btn:hover {
    background-color: var(--accent-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
.prev-video-btn svg,
.next-video-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}
.video-description { 
    line-height: 1.8; 
    color: #555; 
    clear: both;
    width: 100%;
}
.video-description img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.video-description-scrollable {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    margin-top: 10px;
    background: #f9f9f9;
}
.video-description-scrollable img {
    max-width: 100%;
    height: auto;
}
.courseware-section { 
    margin-top: 30px; 
    padding-top: 30px; 
    border-top: 1px solid #eee; 
    width: 100%;
    flex-basis: 100%;
}
.courseware-section h3 { font-size: 20px; }
.download-buttons { 
    display: flex; 
    gap: 15px; 
    flex-wrap: wrap; 
}
.download-btn { 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    padding: 12px 25px; 
    border-radius: 5px; 
    text-decoration: none; 
    font-weight: bold; 
    font-size: 16px; 
    color: white !important; 
}
.download-btn.pdf { background-color: #e74c3c; }
.download-btn.ppt { background-color: #e67e22; }
.download-btn svg { 
    width: 20px; 
    height: 20px; 
    fill: currentColor; 
}
.related-videos {
    max-height: calc(80vh - 100px);
    overflow-y: auto;
    padding-right: 10px;
    transition: all 0.3s;
}
.related-videos h3 { font-size: 22px; }
.related-video-card { 
    display: flex; 
    gap: 15px; 
    margin-bottom: 15px; 
    background: var(--white); 
}
.related-thumbnail { 
    width: 120px; 
    height: 67px; 
    object-fit: cover; 
}

/* === 页脚 (Footer) === */
.site-footer { 
    background-color: #222529; 
    color: #a9b3c1; 
    padding: 60px 30px; 
}
.footer-grid { 
    max-width: 1400px; 
    margin: 0 auto; 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 40px; 
}
.footer-column h4 { color: var(--white); }
.footer-column ul { list-style: none; padding: 0; }
.footer-column a { color: #a9b3c1; }
.footer-bottom { 
    text-align: center; 
    margin-top: 50px; 
    padding-top: 30px; 
    border-top: 1px solid #393e46; 
}

/* === 导航栏下拉菜单样式 === */
.nav-links > ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}
.nav-links > ul > li {
    position: relative;
}
.nav-links a {
    display: block;
}
.nav-links ul ul {
    list-style: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 0 0 5px 5px;
    padding: 10px 0;
    min-width: 180px;
    display: none;
    z-index: 1001;
}
.nav-links ul ul a {
    padding: 10px 20px;
    color: var(--text-color);
    white-space: nowrap;
}
.nav-links ul ul a:hover {
    background-color: var(--light-gray);
}
.nav-links ul > li:hover > ul {
    display: block;
}

/* === 悬浮课程简介窗口样式 === */
.floating-description {
    position: fixed;
    width: 600px;
    height: 500px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    right: 30px;
    bottom: 30px;
    transition: all 0.3s ease;
}
.floating-header {
    padding: 15px;
    background: #3498db;
    color: white;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.floating-title {
    font-size: 16px;
    font-weight: 600;
}
.floating-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}
.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
}
.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.floating-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}
.floating-content img {
    max-width: 100%;
    border-radius: 5px;
    margin: 10px 0;
}
.floating-footer {
    padding: 10px 15px;
    background: #f8f9fa;
    text-align: center;
    font-size: 12px;
    color: #6c757d;
}
/* 最小化状态 */
.floating-description.minimized {
    height: 40px;
    width: 200px;
}
.floating-description.minimized .floating-content,
.floating-description.minimized .floating-footer {
    display: none;
}

/* === 缩放控制按钮样式 === */
.zoom-controls {
    display: flex;
    gap: 5px;
    margin-left: 10px;
    align-items: center;
}
.zoom-btn {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}
.zoom-level {
    font-size: 12px;
    color: white;
    margin: 0 5px;
    min-width: 40px;
    text-align: center;
}
/* 修复后的缩放容器 */
.zoom-container {
    overflow: auto;
    height: 100%;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
}
.zoom-content {
    transition: transform 0.3s ease;
    transform-origin: 0 0;
    width: 100%;
    min-height: 100%;
}

/* === 浮动按钮样式 === */
.toggle-floating-btn {
    position: fixed;
    right: 30px;
    bottom: 80px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 999;
    border: none;
    font-size: 20px;
}
.toggle-floating-btn:hover {
    background: #2980b9;
}

/* === 滚动条样式 === */
.video-description-scrollable::-webkit-scrollbar,
.floating-content::-webkit-scrollbar,
.zoom-container::-webkit-scrollbar,
.related-videos::-webkit-scrollbar {
    width: 8px;
}
.video-description-scrollable::-webkit-scrollbar-track,
.floating-content::-webkit-scrollbar-track,
.zoom-container::-webkit-scrollbar-track,
.related-videos::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.video-description-scrollable::-webkit-scrollbar-thumb,
.floating-content::-webkit-scrollbar-thumb,
.zoom-container::-webkit-scrollbar-thumb,
.related-videos::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}
.video-description-scrollbar-thumb:hover,
.floating-content::-webkit-scrollbar-thumb:hover,
.zoom-container::-webkit-scrollbar-thumb:hover,
.related-videos::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
/* 推荐视频滚动条美化 */
.related-videos::-webkit-scrollbar {
    width: 8px;
}
.related-videos::-webkit-scrollbar-track {
    background: transparent;
}
.related-videos::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 10px;
}
.related-videos:hover::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.related-videos:hover::-webkit-scrollbar-thumb {
    background: #ccc;
}
.related-videos::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* === 响应式设计 === */
@media (max-width: 992px) {
    .nav-links, .user-actions { display: none; }
    .menu-toggle { display: block; }
    .nav-links.active { 
        display: flex; 
        flex-direction: column; 
        width: 100%; 
        background-color: var(--white); 
        position: absolute; 
        top: var(--header-height); 
        left: 0; 
        padding: 10px 0; 
        box-shadow: 0 5px 10px rgba(0,0,0,0.1); 
    }
    .nav-links.active a { 
        color: var(--text-color); 
        width: 100%; 
        text-align: center; 
        padding: 15px 0; 
    }
    .floating-description {
        width: 300px;
        right: 20px;
        bottom: 20px;
    }
}
@media (max-width: 1024px) {
    .watch-layout { grid-template-columns: 1fr; }
    .sidebar-column { margin-top: 40px; }
}
@media (max-width: 576px) {
    .floating-description {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
    .zoom-controls {
        display: none;
    }
}
@media (max-height: 800px) {
    .video-description-scrollable {
        max-height: 250px;
    }
}
@media (max-height: 600px) {
    .video-description-scrollable {
        max-height: 200px;
    }
}

/* === 悬浮窗 - 指引提示样式 === */
.floating-tooltip {
    position: fixed;
    bottom: 85px; /* 放在切换按钮的上方 */
    right: 20px;
    background-color: var(--primary-color, #003366);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 2001; /* 确保在最顶层 */
    opacity: 0; /* 默认透明 */
    transform: translateY(10px); /* 默认在下方一点 */
    pointer-events: none; /* 防止它阻挡鼠标点击 */
    white-space: nowrap;
    
    /* 入场和出场动画 */
    animation: tooltip-fade-in-out 6s forwards; 
}
/* 指引提示的小箭头 */
.floating-tooltip::after {
    content: '';
    position: absolute;
    top: 100%; /* 箭头在底部 */
    right: 25px; /* 对准按钮的位置 */
    margin-left: -5px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--primary-color, #003366) transparent transparent transparent;
}
/* 定义动画关键帧 */
@keyframes tooltip-fade-in-out {
    0% { opacity: 0; transform: translateY(10px); }
    10% { opacity: 1; transform: translateY(0); } /* 快速淡入并上移 */
    80% { opacity: 1; transform: translateY(0); } /* 保持显示 */
    100% { opacity: 0; transform: translateY(10px); } /* 缓慢淡出并下移 */
}

/* === 悬浮窗 - 缩放功能专属样式 === */
.floating-controls .zoom-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 10px;
}
.zoom-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}
.zoom-level {
    font-size: 14px;
    padding: 0 5px;
    min-width: 50px;
    text-align: center;
}
.zoom-container {
    flex-grow: 1;
    overflow: auto; /* 当内容缩放后超出时，显示滚动条 */
    padding: 10px;
    transition: padding 0.3s;
}
.zoom-content {
    transform-origin: top left; /* 设置缩放的原点为左上角 */
    transition: transform 0.2s ease-out;
}
