/* GitBook 风格的CSS样式 - 网络安全课程 */

/* 基础重置和全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    background-color: #fafafa;
    overflow-x: hidden;
}

/* 链接样式 */
a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Book 主容器 */
.book {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏样式 */
.book-summary {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background: #fafafa;
    border-right: 1px solid #e7e7e7;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.25s ease;
}

.book-summary nav {
    padding: 0;
}

/* 搜索框样式 */
#book-search-input {
    padding: 15px;
    border-bottom: 1px solid #e7e7e7;
}

#book-search-input input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

#book-search-input input:focus {
    border-color: #3498db;
}

/* 目录样式 */
.summary {
    list-style: none;
    padding: 0;
    margin: 0;
}

.summary li {
    list-style: none;
}

.summary .divider {
    height: 1px;
    background: #e7e7e7;
    margin: 10px 0;
}

.summary .chapter {
    border: 0;
    outline: 0;
}

.summary .chapter a {
    display: block;
    padding: 10px 15px;
    color: #364149;
    background: transparent;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-left: 4px solid transparent;
}

.summary .chapter a:hover {
    background: #f3f3f3;
    text-decoration: none;
}

.summary .chapter.active > a {
    background: #008cff;
    color: #fff;
    border-left-color: #007acc;
}

.summary .articles {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.summary .articles .chapter a {
    padding-left: 30px;
    font-size: 14px;
}

.summary .articles .articles .chapter a {
    padding-left: 45px;
    font-size: 13px;
}

/* 主内容区域 */
.book-body {
    position: absolute;
    top: 0;
    left: 300px;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    background: #fff;
}

.body-inner {
    position: relative;
    min-height: 100vh;
}

/* 顶部导航条 */
.book-header {
    height: 50px;
    background: #f7f7f7;
    border-bottom: 1px solid #e7e7e7;
    padding: 0 20px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.book-header h1 {
    font-size: 18px;
    color: #364149;
    margin: 0;
    font-weight: normal;
}

.book-header .fa-spin {
    display: none;
}

/* 主内容页面 */
.page-wrapper {
    padding: 0;
    position: relative;
}

.page-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    position: relative;
}

/* Markdown 内容样式 */
.markdown-section {
    color: #333;
    line-height: 1.7;
    font-size: 16px;
}

.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4,
.markdown-section h5,
.markdown-section h6 {
    color: #2c3e50;
    margin: 1.5em 0 0.8em 0;
    font-weight: 600;
    line-height: 1.4;
}

.markdown-section h1 {
    font-size: 2.2em;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
    margin-top: 0;
}

.markdown-section h2 {
    font-size: 1.8em;
    border-bottom: 2px solid #bdc3c7;
    padding-bottom: 8px;
}

.markdown-section h3 {
    font-size: 1.5em;
}

.markdown-section h4 {
    font-size: 1.3em;
}

.markdown-section h5 {
    font-size: 1.1em;
}

.markdown-section h6 {
    font-size: 1em;
}

.markdown-section p {
    margin: 1em 0;
}

.markdown-section ul,
.markdown-section ol {
    margin: 1em 0;
    padding-left: 2em;
}

.markdown-section li {
    margin: 0.5em 0;
}

.markdown-section blockquote {
    margin: 1.5em 0;
    padding: 1em 1.5em;
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    color: #666;
    font-style: italic;
}

.markdown-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    border: 1px solid #ddd;
}

.markdown-section th,
.markdown-section td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.markdown-section th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.markdown-section tr:hover {
    background: #f5f5f5;
}

/* 代码样式 */
.markdown-section code {
    background: #f1f2f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.markdown-section pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1.5em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5em 0;
    border-left: 4px solid #3498db;
}

.markdown-section pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* 图片样式 */
.markdown-section img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin: 1em 0;
    display: block;
}

/* 分割线样式 */
.markdown-section hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, #3498db, #9b59b6);
    margin: 2em 0;
    border-radius: 1px;
}

/* 底部导航 */
.navigation {
    position: fixed;
    bottom: 20px;
    padding: 12px 20px;
    background: #3498db;
    color: white;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    z-index: 1000;
}

.navigation:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    color: white;
    text-decoration: none;
}

.navigation-prev {
    left: 20px;
}

.navigation-next {
    right: 20px;
}

.navigation .fa {
    margin: 0 5px;
}

/* 搜索结果样式 */
.search-results {
    padding: 20px;
    background: #fff;
}

.search-results-title {
    font-size: 1.5em;
    color: #2c3e50;
    margin-bottom: 1em;
}

.search-results-list {
    list-style: none;
}

.search-results-list li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

/* 页脚样式 */
.page-footer {
    border-top: 1px solid #e7e7e7;
    padding: 20px 0;
    margin-top: 40px;
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
    background: #f8f9fa;
}

.page-footer .copyright {
    display: block;
    margin-bottom: 5px;
}

.page-footer .footer-modification {
    font-size: 12px;
    color: #95a5a6;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .book-summary {
        transform: translateX(-300px);
    }
    
    .book-body {
        left: 0;
    }
    
    .page-inner {
        padding: 20px 15px 60px;
    }
}

@media (max-width: 768px) {
    .book-header h1 {
        font-size: 16px;
    }
    
    .page-inner {
        padding: 15px 10px 60px;
    }
    
    .markdown-section {
        font-size: 15px;
    }
    
    .markdown-section h1 {
        font-size: 1.8em;
    }
    
    .markdown-section h2 {
        font-size: 1.5em;
    }
    
    .navigation {
        padding: 10px 15px;
        bottom: 15px;
    }
    
    .navigation-prev {
        left: 15px;
    }
    
    .navigation-next {
        right: 15px;
    }
}

@media (max-width: 480px) {
    .markdown-section h1 {
        font-size: 1.6em;
    }
    
    .markdown-section h2 {
        font-size: 1.4em;
    }
    
    .markdown-section pre {
        padding: 1em;
        font-size: 13px;
    }
    
    .navigation {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* 自定义主题色彩 */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #3498db;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
}

/* 高亮提示框样式 */
.alert {
    padding: 15px;
    margin: 1.5em 0;
    border-radius: 6px;
    border-left: 4px solid;
}

.alert-info {
    background: #e8f4fd;
    border-left-color: var(--info-color);
    color: #2980b9;
}

.alert-success {
    background: #e8f5e8;
    border-left-color: var(--success-color);
    color: #27ae60;
}

.alert-warning {
    background: #fef5e7;
    border-left-color: var(--warning-color);
    color: #e67e22;
}

.alert-danger {
    background: #fdeaea;
    border-left-color: var(--danger-color);
    color: #c0392b;
}

/* 加载动画 */
.fa-spin {
    animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(359deg);
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 打印样式 */
@media print {
    .book-summary,
    .book-header,
    .navigation,
    .page-footer {
        display: none !important;
    }
    
    .book-body {
        left: 0 !important;
        position: static !important;
    }
    
    .page-inner {
        max-width: none !important;
        padding: 0 !important;
    }
    
    .markdown-section {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .markdown-section h1,
    .markdown-section h2,
    .markdown-section h3 {
        page-break-after: avoid;
    }
    
    .markdown-section pre,
    .markdown-section blockquote {
        page-break-inside: avoid;
    }
}
