/* 课程章节导航样式 - 通用深绿色主题 */

/* 顶部章节导航栏 */
.chapter-navigation {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 60px;
    z-index: 999;
    margin-bottom: 2rem;
}

/* 教学容器布局 */
.teaching-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* 确保body布局正确 */
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 确保头部导航不被侧边栏遮挡 */
header {
    position: relative;
    z-index: 999;
    margin-left: 0;
}

/* 左侧导航栏 - 深绿色风格 */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #0d4f3c 0%, #083529 100%);
    color: #20c997;
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    position: fixed;
    height: calc(100vh - 80px);
    overflow-y: auto;
    z-index: 998;
    top: 80px;
    left: 0;
}

.sidebar-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(32, 201, 151, 0.3);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: #40e0d0;
}

.sidebar-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
    color: #17a2b8;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li {
    margin-bottom: 8px;
}

.nav-links a {
    color: #20c997;
    text-decoration: none;
    display: block;
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.nav-links a:hover {
    background: rgba(32, 201, 151, 0.2);
    transform: translateX(5px);
    color: #40e0d0;
}

.nav-links a.active {
    background: rgba(64, 224, 208, 0.3);
    font-weight: bold;
    color: #40e0d0;
    border-left: 4px solid #28a745;
}

.nav-links .chapter-divider {
    padding: 15px 15px 5px 15px;
    font-size: 0.8rem;
    color: #17a2b8;
    border-top: 1px solid rgba(32, 201, 151, 0.2);
    margin-top: 10px;
    font-weight: 600;
}

.nav-links .chapter-divider:first-of-type {
    border-top: none;
    margin-top: 0;
}

.nav-links i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    color: #28a745;
}

/* 主要内容区域 */
.content {
    margin-left: 280px !important;
    margin-top: 80px;
    flex: 1;
    padding: 30px;
    min-height: calc(100vh - 80px);
    background: #0d1117;
}

.main-content {
    margin-left: 280px !important;
    margin-top: 80px;
    flex: 1;
    padding: 30px;
    min-height: calc(100vh - 80px);
    background: #0d1117;
}

.chapter-page {
    background: #161b22;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    padding: 30px;
    color: #20c997;
    border: 1px solid #30363d;
}

/* 移动端菜单按钮 */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 90px;
    left: 20px;
    z-index: 1001;
    background: #28a745;
    color: #0d1117;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.mobile-nav-toggle:hover {
    background: #34ce57;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        top: 80px;
        height: calc(100vh - 80px);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content, .main-content {
        margin-left: 0 !important;
        margin-top: 80px;
        padding: 20px;
        min-height: calc(100vh - 160px);
    }
}

/* 滚动条样式 */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(8, 53, 41, 0.5);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(32, 201, 151, 0.3);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(32, 201, 151, 0.5);
}

/* 确保页面内容不被导航栏遮挡 */
body.has-sidebar {
    margin: 0;
    padding: 0;
}

/* 章节内容样式适配 */
.chapter-page h1,
.chapter-page h2,
.chapter-page h3,
.chapter-page h4,
.chapter-page h5,
.chapter-page h6 {
    color: #40e0d0 !important;
}

.chapter-page p,
.chapter-page li,
.chapter-page div,
.chapter-page span {
    color: #20c997 !important;
}

.chapter-page a {
    color: #28a745 !important;
}

.chapter-page a:hover {
    color: #34ce57 !important;
}

/* 代码块适配 */
.chapter-page pre,
.chapter-page code {
    background: #0d1117 !important;
    color: #20c997 !important;
    border: 1px solid #30363d !important;
}

/* 表格适配 */
.chapter-page table {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
}

.chapter-page th,
.chapter-page td {
    border: 1px solid #30363d !important;
    background: transparent !important;
}

/* 提示框适配 */
.chapter-page .info,
.chapter-page .warning,
.chapter-page .tip,
.chapter-page .note {
    background: rgba(32, 201, 151, 0.1) !important;
    border: 1px solid rgba(32, 201, 151, 0.3) !important;
    border-radius: 8px !important;
}

/* 按钮适配 */
.chapter-page button,
.chapter-page .btn {
    background: #28a745 !important;
    color: #0d1117 !important;
    border: 1px solid #28a745 !important;
}

.chapter-page button:hover,
.chapter-page .btn:hover {
    background: #34ce57 !important;
    border-color: #34ce57 !important;
}

/* 隐藏原来的顶部章节导航 */
.chapter-navigation {
    display: none !important;
}

/* 移除原来的padding-top */
body.has-chapter-nav {
    padding-top: 0 !important;
}

/* 新的顶部章节导航栏样式 */
.chapter-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.course-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.course-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.course-details h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333 !important;
    font-weight: 600;
}

.course-details p {
    margin: 0;
    font-size: 0.9rem;
    color: #666 !important;
}

.chapter-nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chapter-dropdown {
    position: relative;
}

.chapter-dropdown-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #495057 !important;
    transition: all 0.2s;
}

.chapter-dropdown-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.chapter-dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    min-width: 300px;
    z-index: 1000;
    display: none;
}

.chapter-dropdown.active .chapter-dropdown-content {
    display: block;
}

.chapter-section {
    border-bottom: 1px solid #f0f0f0;
}

.chapter-section:last-child {
    border-bottom: none;
}

.section-header {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #495057 !important;
    font-size: 0.9rem;
    border-bottom: 1px solid #e9ecef;
}

.chapter-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #495057 !important;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.chapter-item:hover {
    background: #f8f9fa;
    color: #007bff !important;
    text-decoration: none;
}

.chapter-item.current {
    background: #e7f3ff;
    color: #007bff !important;
    border-left-color: #007bff;
    font-weight: 600;
}

.chapter-number {
    font-weight: 600;
    min-width: 35px;
    text-align: center;
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.chapter-item.current .chapter-number {
    background: #007bff;
    color: white !important;
}

.chapter-title {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.3;
}

.chapter-status {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    background: #e9ecef;
    color: #6c757d !important;
}

.chapter-status.completed {
    background: #d4edda;
    color: #155724 !important;
}

.chapter-status.current {
    background: #cce5ff;
    color: #004085 !important;
}

.progress-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d !important;
}

.progress-track {
    width: 80px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #28a745, #20c997);
    border-radius: 2px;
    transition: width 0.3s;
}

.nav-arrows {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-arrow {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057 !important;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s;
    font-size: 1rem;
}

.nav-arrow:hover {
    background: #007bff;
    border-color: #007bff;
    color: white !important;
    text-decoration: none;
}

.nav-arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chapter-nav-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .course-info {
        justify-content: center;
        text-align: center;
    }
    
    .chapter-nav-controls {
        justify-content: center;
    }
    
    .chapter-dropdown-content {
        left: 0;
        right: 0;
        min-width: auto;
    }
    
    .progress-bar {
        justify-content: center;
    }
    
    .progress-track {
        width: 120px;
    }
}

@media (max-width: 480px) {
    .course-details h3 {
        font-size: 1rem;
    }
    
    .course-details p {
        font-size: 0.8rem;
    }
    
    .chapter-dropdown-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .chapter-item {
        padding: 0.6rem 0.8rem;
        gap: 0.5rem;
    }
    
    .chapter-title {
        font-size: 0.85rem;
    }
}

/* 侧边栏导航组样式增强 */
.chapter-group {
    margin-bottom: 20px;
}

.chapter-group h3 {
    color: #40e0d0 !important;
    font-size: 1.1rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(32, 201, 151, 0.3);
}

.chapter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chapter-list li {
    margin-bottom: 5px;
}

.chapter-list a {
    color: #20c997 !important;
    text-decoration: none;
    display: block;
    padding: 8px 15px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.chapter-list a:hover {
    background: rgba(32, 201, 151, 0.2);
    transform: translateX(5px);
    color: #40e0d0 !important;
}

.chapter-list a.active {
    background: rgba(64, 224, 208, 0.3);
    font-weight: bold;
    color: #40e0d0 !important;
    border-left: 4px solid #28a745;
}

.chapter-list i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    color: #28a745;
}