/* 博客页面 - 标签筛选 */
.tag-filter {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0 0 6px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 2px;
}

.tag-filter::-webkit-scrollbar {
    height: 3px;
}

.tag-filter::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.tag-btn {
    padding: 3px 12px;
    border: 1px solid #14867d;
    border-radius: 14px;
    background: transparent;
    color: #14867d;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    user-select: none;
}

.tag-btn:hover {
    background: #14867d10;
}

.tag-btn.active {
    background: #14867d;
    color: #fff;
    border-color: #14867d;
}

.tag-btn.active:hover {
    background: #0f6b63;
}

/* 搜索框 */
.search-bar {
    margin: 0;
}

.search-bar input {
    width: 200px;
    box-sizing: border-box;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85em;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease, width 0.25s ease, box-shadow 0.25s ease;
    background: #f9f9f9;
}

.search-bar input:focus {
    border-color: #14867d;
    background: #fff;
    width: 300px;
    box-shadow: 0 0 0 3px #14867d20;
}

.search-bar input::placeholder {
    color: #aaa;
}

/* 文章预览 */
.blog-post-preview {
    padding: 14px 0;
    border-bottom: 1px solid #eee;
    transition: opacity 0.15s ease;
}

.blog-post-preview:first-child {
    padding-top: 4px;
}

.blog-post-preview h2 {
    margin: 0 0 4px 0;
    font-size: 1.2em;
}

.blog-post-preview h2 a {
    color: #333;
    text-decoration: none;
}

.blog-post-preview h2 a:hover {
    color: #14867d;
}

.blog-meta {
    font-size: 0.82em;
    color: #888;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tags {
    display: inline-flex;
    gap: 6px;
}

.tag {
    display: inline-block;
    background: #f0f0f0;
    color: #555;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* 分类标签 */
.category-tag {
    display: inline-block;
    background: #14867d15;
    color: #14867d;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
}

.blog-summary {
    color: #555;
    line-height: 1.6;
    margin-bottom: 6px;
    font-size: 0.9em;
}

.blog-summary p {
    margin: 0;
}

.read-more {
    color: #14867d;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.read-more:hover {
    text-decoration: underline;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px 0;
    font-size: 1.1em;
}

/* 分页导航 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.pagination a {
    color: #14867d;
    text-decoration: none;
}

.pagination a:hover {
    text-decoration: underline;
}

.pagination span {
    color: #888;
    font-size: 0.9em;
}

/* ======= 两栏布局（目录栏 + 博客内容） ======= */

.blog-layout {
    display: flex;
    align-items: flex-start;
    gap: 48px;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 40px;
    flex: 1;
    min-width: 0;
}

.blog-page {
    flex: 1;
    min-width: 0;
    max-width: 1150px;
}

.blog-main {
    max-width: none;
    padding: 8px 0 40px 0;
}

.blog-sidebar {
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    width: 170px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    margin-top: 8px;
}

.blog-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 2px solid #14867d;
    padding-bottom: 6px;
    margin-bottom: 16px;
}

.blog-main .blog-title {
    margin: 0 !important;
    border-bottom: none !important;
    padding-bottom: 0;
    line-height: 1.3;
}

/* 侧边栏标题 */
.sidebar-title {
    font-size: 0.82em;
    color: #999;
    letter-spacing: 1px;
    margin: 0 0 8px 0;
    padding: 0 12px;
    text-transform: uppercase;
}

.sidebar-section {
    margin-bottom: 24px;
}

/* 分类按钮（竖排） */
.cat-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    cursor: pointer;
    border-radius: 6px;
    color: #333;
    font-size: 0.9em;
    transition: background 0.15s;
    user-select: none;
}

.cat-btn:hover {
    background: #14867d0d;
}

.cat-btn.active {
    background: #14867d;
    color: #fff;
}

.cat-count {
    font-size: 0.82em;
    color: #bbb;
    min-width: 20px;
    text-align: right;
}

.cat-btn.active .cat-count {
    color: rgba(255,255,255,0.7);
}

/* 标签（侧边栏版本，换行包裹） */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 12px;
}

.tag-list .tag-btn {
    padding: 3px 9px;
    font-size: 0.78em;
}

/* ======= 手机适配 ======= */
@media (max-width: 768px) {
    .blog-layout {
        flex-direction: column;
        gap: 0;
        padding: 0 16px;
    }

    .blog-main {
        padding-top: 0;
    }

    .blog-sidebar {
        position: static;
        width: auto;
        max-height: none;
        margin-bottom: 8px;
        margin-top: 0;
    }

    .sidebar-section {
        margin-bottom: 8px;
    }

    .sidebar-title {
        display: none;
    }

    /* 分类变回横向滚动 */
    #catFilter {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
        padding: 0 0 6px 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    #catFilter::-webkit-scrollbar {
        height: 3px;
    }

    #catFilter::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }

    .cat-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 4px 14px;
        border: 1px solid #14867d;
        border-radius: 14px;
        font-size: 0.85em;
    }

    .cat-btn.active {
        background: #14867d;
        color: #fff;
    }

    .cat-count {
        margin-left: 4px;
        min-width: auto;
    }

    /* 标签在手机上也横向滚动 */
    .tag-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding: 0 0 4px 0;
        -webkit-overflow-scrolling: touch;
    }

    .tag-list::-webkit-scrollbar {
        height: 3px;
    }

    .tag-list::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }

    /* 手机端字号和间距 */
    .blog-title {
        font-size: 1.5em;
    }

    .search-bar input {
        width: 140px;
        font-size: 0.8em;
        padding: 5px 10px;
    }

    .search-bar input:focus {
        width: 200px;
    }

    .blog-post-preview {
        padding: 10px 0;
    }

    .blog-post-preview h2 {
        font-size: 1em;
    }

    .blog-summary {
        font-size: 0.85em;
    }

    .blog-meta {
        font-size: 0.78em;
    }
}
