/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "Arial", sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 顶部导航栏（修复后核心样式） */
header {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

/* Logo核心样式（统一主标题+图标） */
.navbar .logo {
    display: flex;
    align-items: center;
    gap: 8px; /* 图标和主标题的间距 */
    font-size: 24px; /* 主标题字号 */
    font-weight: 700;
    color: #6a5acd; /* 主标题紫色 */
    cursor: pointer;
    white-space: nowrap; /* 防止换行 */
}

/* Logo图标样式 */
.navbar .logo i.fas.fa-star {
    color: #ba55d3; /* 图标深紫色 */
    font-size: 1.2em; /* 图标略小于主标题 */
    margin-right: 5px; /* 图标和CMJE Star的小间距 */
}

/* 副标题专属样式（强制生效） */
.navbar .logo .sub-title {
    font-size: 0.6rem !important; /* 极小字号 */
    font-weight: normal !important; /* 取消加粗 */
    color: rgba(120, 120, 120, 0.5) !important; /* 透明灰色 */
    margin-left: 15px !important; /* 和CMJE Star拉开间距 */
    line-height: 1.4 !important; /* 垂直对齐自然 */
    white-space: nowrap; /* 防止换行 */
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: #212529;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #6a5acd;
}

/* 资源库页面顶部header样式 */
.header {
    background-color: #6a5acd; /* 主站紫色 */
    color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}
.header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.download-tips {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 主体容器：三栏布局 */
.main-container {
    max-width: 1400px;
    margin: 30px auto;
    display: flex;
    gap: 20px;
    padding: 0 20px;
}

/* 左侧分类导航 */
.category-sidebar {
    width: 220px;
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.category-sidebar h3 {
    font-size: 1.1rem;
    color: #2d3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.category-list {
    list-style: none;
}

.category-item {
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.category-item.active {
    background-color: #6a5acd; /* 选中态紫色 */
    color: #fff;
}

.category-item:hover:not(.active) {
    background-color: #f0f0f5;
}

/* 中间预览区域 */
.preview-area {
    flex: 1;
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.preview-loading {
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 1.2rem;
    color: #6a5acd;
    gap: 10px;
}

.preview-empty {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #999;
    gap: 15px;
}

.preview-empty i {
    font-size: 3rem;
    color: #ddd;
}

.preview-content {
    display: none;
    height: 100%;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.preview-header h2 {
    font-size: 1.3rem;
    color: #2d3e50;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn {
    padding: 8px 15px;
    background-color: #6a5acd;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.download-btn:hover {
    background-color: #5a4bc8;
}

#previewBody {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* 不同文件类型预览样式 */
.docx-preview pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.8;
    color: #333;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.pptx-preview, .default-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #666;
    text-align: center;
    padding: 20px;
}

.pptx-preview i, .default-preview i {
    color: #3498db;
    margin-bottom: 20px;
}

.pptx-preview h3, .default-preview h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #2d3e50;
}

.tip {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 10px;
}

.xlsx-preview {
    padding: 10px;
}

.xlsx-preview h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #2d3e50;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 12px 15px;
    text-align: left;
}

table th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #2d3e50;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.preview-error {
    color: #ff4444;
    text-align: center;
    padding: 20px;
    font-size: 1rem;
}

/* 右侧文件目录 */
.file-sidebar {
    width: 300px;
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.file-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.file-sidebar-header h3 {
    font-size: 1.1rem;
    color: #2d3e50;
}

.file-count {
    font-size: 0.9rem;
    color: #999;
}

.file-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.file-item.active {
    border-color: #6a5acd;
    background-color: rgba(106, 90, 205, 0.05);
}

.file-item:hover:not(.active) {
    border-color: #ddd;
    background-color: #f9f9f9;
}

.file-icon {
    color: #6a5acd;
    font-size: 1.2rem;
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-size: 0.95rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.file-category {
    font-size: 0.8rem;
    color: #999;
    background-color: #f5f5f5;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

/* 页脚 */
footer {
    background: #212529;
    color: white;
    padding: 80px 0 40px;
    margin-top: 50px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 50px;
    margin-bottom: 50px;
}

.footer-column {
    flex: 1;
}

.footer-column h3 {
    font-size: 1.4rem;
    margin-bottom: 25px;
    color: #ba55d3;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #ba55d3;
}

.copyright {
    text-align: center;
    padding-top: 40px;
    border-top: 1px solid #444;
    color: #999;
    font-size: 1rem;
}

/* 响应式适配 */
@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 220px 1fr 280px;
    }
}

@media (max-width: 992px) {
    .main-container {
        grid-template-columns: 200px 1fr;
    }
    .file-sidebar {
        display: none; /* 平板端隐藏右侧目录 */
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 20px;
    }
    .navbar .logo {
        font-size: 20px; /* 主标题缩小 */
    }
    .navbar .logo .sub-title {
        font-size: 0.55rem !important; /* 副标题进一步缩小 */
        margin-left: 10px !important; /* 减小间距 */
    }
    .nav-links {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .main-container {
        grid-template-columns: 1fr;
    }
    .category-sidebar {
        display: none; /* 手机端隐藏左侧分类 */
    }
    .header-container {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .preview-header h2 {
        max-width: 100%;
        margin-bottom: 10px;
    }
}

/* 适配主站container类 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 全局重置补充 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
/* 六大课程子页面 - 交互动效补充 */
.tab-btn:hover:not(.active) {
    background-color: #f0f0f5;
}

.video-item:hover {
    transform: translateX(3px);
    transition: transform 0.2s ease;
}

.video-action:hover {
    background-color: #5a4bc8;
    transition: background-color 0.2s ease;
}

/* 六大课程子页面 - 移动端适配 */
@media (max-width: 768px) {
    .video-item {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .video-cover {
        width: 150px;
        height: 90px;
    }

    .video-info p {
        flex-direction: column;
        gap: 5px;
    }

    .video-action {
        width: 100%;
        text-align: center;
    }

    .course-tabs {
        flex-wrap: wrap;
    }
}
/* 通用按钮样式 */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary {
    background-color: #6a5acd;
    color: #fff;
}

.btn-primary:hover {
    background-color: #5a4bc8;
}

.btn-secondary {
    background-color: #f0f0f5;
    color: #2d3e50;
}

.btn-secondary:hover {
    background-color: #e0e0eb;
}

/* 六大课程子页面 - 动效补充 */
.tab-btn:hover:not(.active) {
    background-color: #f0f0f5;
}

.video-item:hover {
    transform: translateX(3px);
    transition: transform 0.2s ease;
}

.video-action:hover {
    background-color: #5a4bc8;
    transition: background-color 0.2s ease;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .courses {
        grid-template-columns: 1fr;
    }

    .video-item {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .video-cover {
        width: 150px;
        height: 90px;
    }

    .video-info p {
        flex-direction: column;
        gap: 5px;
    }

    .video-action {
        width: 100%;
        text-align: center;
    }

    .course-tabs {
        flex-wrap: wrap;
    }

    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 10px 20px;
    }

    .nav-links {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
}