/* 全局字体优化 - 更现代的无衬线字体栈 */
body, .book-summary, .book-body, .book-header, h1, h2, h3, h4, h5, h6 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif !important;
    color: #2c3e50;
}

/* 侧边栏美化 */
.book-summary {
    background: #f8f9fa !important;
    border-right: 1px solid #eaecef;
}

.book-summary ul.summary li a, .book-summary ul.summary li span {
    color: #5c6b7f !important;
    padding: 10px 15px !important;
    transition: all 0.2s ease;
}

.book-summary ul.summary li.active > a {
    color: #0366d6 !important;
    background: #e6f7ff !important;
    border-left: 4px solid #0366d6;
    padding-left: 11px !important; /* 补偿 border 宽度 */
    font-weight: 500;
}

.book-summary ul.summary li a:hover {
    color: #0366d6 !important;
    background: rgba(3, 102, 214, 0.05);
}

/* 侧边栏标题 */
.book-summary ul.summary li.header {
    color: #8590a6 !important;
    text-transform: uppercase;
    font-size: 0.75em;
    padding: 15px 15px 5px !important;
    letter-spacing: 1px;
}

/* 内容区域优化 */
.book-body {
    background: #ffffff;
}

.markdown-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
    font-size: 16px;
    line-height: 1.7;
}

/* 标题样式 */
.markdown-section h1 {
    font-size: 2.2em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
    margin-top: 0;
}

.markdown-section h2 {
    font-size: 1.75em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
    margin-top: 1.5em;
}

/* 链接样式 */
.markdown-section a {
    color: #0366d6;
    font-weight: 500;
}

/* 代码块美化 */
.markdown-section pre {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
}

.markdown-section code {
    color: #e83e8c;
    background-color: rgba(27,31,35,0.05);
    border-radius: 3px;
    padding: 0.2em 0.4em;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
.markdown-section pre code {
    color: inherit;
    background-color: transparent;
    padding: 0;
}

/* 表格样式 */
.markdown-section table {
    display: block;
    width: 100%;
    overflow: auto;
    border-spacing: 0;
    border-collapse: collapse;
}

.markdown-section table tr {
    background-color: #fff;
    border-top: 1px solid #c6cbd1;
}

.markdown-section table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

.markdown-section table th, .markdown-section table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

/* 引用块 */
.markdown-section blockquote {
    border-left: 4px solid #dfe2e5;
    color: #6a737d;
    padding: 0 1em;
    margin-left: 0;
}

/* 搜索框美化 - 保持在右上角但更精致 */
@media (min-width: 600px) {
    #book-search-input {
        position: fixed;
        top: 20px;
        right: 30px;
        z-index: 1000;
        width: 260px;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid #eaecef;
        border-radius: 20px; /* 圆角更大 */
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        padding: 0;
        margin: 0;
        transition: all 0.3s ease;
        backdrop-filter: blur(5px);
    }

    #book-search-input:hover, #book-search-input:focus-within {
        width: 320px; /* 聚焦时变宽 */
        box-shadow: 0 6px 16px rgba(0,0,0,0.12);
        border-color: #0366d6;
    }

    #book-search-input input {
        padding: 10px 20px;
        font-size: 14px;
        border: none;
        background: transparent;
        width: 100%;
        box-sizing: border-box;
        color: #24292e;
        border-radius: 20px;
    }

    #book-search-input input::placeholder {
        color: #999;
    }

    #book-search-input input:focus {
        outline: none;
    }
    
    /* 调整 header 防止遮挡 */
    .book-header {
        background: transparent !important; /* 让 header 透明，减少视觉干扰 */
        border-bottom: none !important;
    }
    
    /* 隐藏 header 里原本的搜索图标（如果存在） */
    .book-header .btn.pull-left[aria-label="Search"] {
        display: none;
    }
}

/* 滚动条美化 (Chrome/Safari) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
::-webkit-scrollbar-thumb {
    background: #c1c1c1; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8; 
}
