/* 参考资料详情页样式 */

/* 主内容区 */
.main-content {
    background-color: #f8f9fa;
    min-height: calc(100vh - 200px);
}

/* 面包屑导航 */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

/* 详情页容器 */
.reference-detail {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* 左右布局 */
.detail-container {
    display: flex;
    flex-wrap: wrap;
}

/* 左侧章节树 */
.chapter-tree {
    flex: 0 0 300px;
    max-width: 300px;
    background-color: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
    position: sticky;
    top: 20px;
}

.chapter-tree h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.chapter-tree h3 i {
    margin-right: 0.5rem;
    color: #007bff;
}

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

.chapter-item {
    margin-bottom: 0.5rem;
}

.chapter-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.chapter-link:hover {
    background-color: #e9ecef;
    color: #2c3e50;
    text-decoration: none;
}

.chapter-link.active {
    background-color: #007bff;
    color: white;
    font-weight: 500;
}

/* 二级章节样式 */
.chapter-list .chapter-list {
    margin-left: 1rem;
    margin-top: 0.5rem;
}

.chapter-list .chapter-list .chapter-link {
    font-size: 0.9rem;
    padding-left: 1.5rem;
}

/* 右侧内容区域 */
.content-area {
    flex: 1;
    padding: 2rem;
    min-width: 0;
}

/* 内容标题 */
.content-area h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

/* 内容元信息 */
.content-meta {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.meta-item {
    margin-right: 1.5rem;
    display: inline-block;
}

.meta-item i {
    margin-right: 0.375rem;
    color: #007bff;
}

/* 内容正文 */
.content-body {
    line-height: 1.8;
    color: #333;
    font-size: 1rem;
}

.content-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #2c3e50;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.content-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.content-body p {
    margin-bottom: 1rem;
    text-align: justify;
}

.content-body ul,
.content-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.content-body li {
    margin-bottom: 0.5rem;
}

.content-body strong {
    font-weight: 600;
    color: #2c3e50;
}

.content-body em {
    font-style: italic;
}

.content-body code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #dc3545;
}

.content-body pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

.content-body pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.875rem;
}

.content-body blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #6c757d;
}

.content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    display: block;
}

/* 内容标签 */
.content-tags {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.content-tags h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.tag-item {
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.tag-link {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.tag-link:hover {
    background-color: #007bff;
    color: white;
    text-decoration: none;
}

/* 返回按钮 */
.back-btn {
    margin-top: 2rem;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .chapter-tree {
        flex: 0 0 100%;
        max-width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .content-area {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .content-area h1 {
        font-size: 1.5rem;
    }
    
    .content-area h2 {
        font-size: 1.3rem;
    }
    
    .content-area h3 {
        font-size: 1.1rem;
    }
    
    .chapter-tree {
        padding: 1rem;
    }
}

/* 章节树动画效果 */
.chapter-link {
    transition: all 0.3s ease;
}

.chapter-link:hover {
    transform: translateX(5px);
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 高亮当前章节 */
.chapter-link.active {
    position: relative;
}

.chapter-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background-color: white;
    border-radius: 0 2px 2px 0;
}

/* 章节树折叠/展开功能 */
.chapter-toggle {
    cursor: pointer;
    user-select: none;
}

.chapter-toggle::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.chapter-toggle.expanded::before {
    transform: rotate(90deg);
}

.chapter-list.collapsed {
    display: none;
}

/* 内容区域阴影效果 */
.content-area {
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.03);
}

/* 打印样式 */
@media print {
    .chapter-tree {
        display: none;
    }
    
    .content-area {
        flex: 1;
        padding: 0;
        box-shadow: none;
    }
    
    .reference-detail {
        box-shadow: none;
        border: none;
    }
    
    .back-btn {
        display: none;
    }
}