/* Ahrefs风格博客样式 */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 容器 */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.content-container {
    max-width: 1280px; /* 与头部容器一致 */
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
.header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #007cba;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover,
.nav a.active {
    color: #007cba;
}

/* 主要内容区域 */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* 分类导航 */
.category-nav {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-nav h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.category-tag:hover,
.category-tag.active {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
}

.category-tag i {
    margin-right: 0.5rem;
}

.category-count {
    margin-left: 0.5rem;
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
}

/* 文章列表 */
.articles-grid {
    display: grid;
    gap: 2rem;
}

.article-card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-decoration: none;
    color: inherit;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.article-category {
    background: #007cba;
    color: #fff;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.article-date {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.article-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
    line-height: 1.3;
}

.article-excerpt {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background: #f8f9fa;
    color: #666;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    text-decoration: none;
}

.tag:hover {
    background: #e9ecef;
    color: #333;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.9rem;
    color: #666;
}

.read-more {
    color: #007cba;
    font-weight: 500;
    text-decoration: none;
}

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

/* 文章详情页 */
.article-header {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.article-content {
    background: #fff;
    border-radius: 8px;
    padding: 1rem; /* 减少内边距，充分利用宽度 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    line-height: 1.8;
}

/* Markdown内容样式 */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin: 2rem 0 1rem 0;
    color: #333;
    font-weight: 600;
}

.article-content h1 { font-size: 2rem; }
.article-content h2 { font-size: 1.7rem; }
.article-content h3 { font-size: 1.4rem; }
.article-content h4 { font-size: 1.2rem; }

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0 1.5rem 2rem;
}

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

.article-content blockquote {
    border-left: 4px solid #007cba;
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
}

.article-content code {
    background: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.article-content pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.article-content th,
.article-content td {
    border: 1px solid #e9ecef;
    padding: 0.8rem;
    text-align: left;
}

.article-content th {
    background: #f8f9fa;
    font-weight: 600;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
}

.article-content a {
    color: #007cba;
    text-decoration: none;
}

.article-content a:hover {
    text-decoration: underline;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
}

.pagination .current {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
}

/* 页脚 */
.footer {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 2rem 0;
    margin-top: 3rem;
}

.copyright-bar {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.copyright-bar a {
    color: #007cba;
    text-decoration: none;
}

.copyright-bar a:hover {
    text-decoration: underline;
}

/* 响应式设计 */
/* 搜索框 */
.search-box {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #007cba;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-state i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #999;
}

@media (max-width: 768px) {
    .container,
    .content-container {
        padding: 0 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        gap: 1rem;
    }

    .category-list {
        justify-content: center;
    }

    .article-card {
        padding: 1.5rem;
    }

    .article-title {
        font-size: 1.3rem;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* 文章详情页布局样式 */
.article-layout {
    display: flex;
    gap: 2rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px; /* 只保留最小边距 */
}

.article-content-wrapper {
    flex: 0 0 70%; /* 固定70%宽度 */
    min-width: 0; /* 防止flex子项溢出 */
    padding: 0; /* 移除内边距，充分利用宽度 */
}

.article-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 2rem 0;
    color: #212529;
}

/* 目录样式 */
.toc-wrapper {
    flex: 0 0 30%; /* 固定30%宽度 */
    max-width: 350px; /* 最大宽度限制 */
}

.toc-container {
    position: sticky;
    top: 2rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.toc-title {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-list {
    font-size: 0.875rem;
}

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

.toc-list li {
    margin: 0;
    padding: 0;
}

.toc-list a {
    display: block;
    padding: 0.5rem 0;
    color: #6c757d;
    text-decoration: none;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    transition: all 0.2s ease;
}

.toc-list a:hover {
    color: #007cba;
    border-left-color: #007cba;
    background: rgba(0, 124, 186, 0.05);
}

.toc-list a.active {
    color: #007cba;
    border-left-color: #007cba;
    background: rgba(0, 124, 186, 0.1);
    font-weight: 500;
}

/* 嵌套标题缩进 */
.toc-list .toc-h3 a { padding-left: 1.5rem; }
.toc-list .toc-h4 a { padding-left: 2.25rem; }
.toc-list .toc-h5 a { padding-left: 3rem; }
.toc-list .toc-h6 a { padding-left: 3.75rem; }

/* 微信二维码样式 */
.wechat-qr-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
}

.wechat-qr-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    border: 1px solid #dee2e6;
}

.wechat-qr-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    max-width: 400px;
    margin: 0 auto;
}

.wechat-qr-image {
    flex-shrink: 0;
}

.wechat-qr-image img {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    border: 2px solid #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.wechat-qr-text {
    text-align: left;
}

.wechat-qr-text h4 {
    margin: 0 0 0.5rem 0;
    color: #07c160;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wechat-qr-text h4 i {
    font-size: 1.4rem;
}

.wechat-qr-text p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 文章详情页响应式设计 */
@media (max-width: 768px) {
    .article-layout {
        flex-direction: column;
        gap: 1rem;
    }

    .article-content-wrapper {
        flex: 1; /* 移动端恢复为flex: 1 */
    }

    .toc-wrapper {
        flex: 1; /* 移动端恢复为flex: 1 */
        max-width: none;
        order: -1; /* 移动端目录显示在文章上方 */
    }

    .toc-container {
        position: static;
        max-height: 200px;
    }

    .article-title {
        font-size: 2rem;
    }

    /* 微信二维码移动端样式 */
    .wechat-qr-content {
        flex-direction: column;
        gap: 1rem;
    }

    .wechat-qr-text {
        text-align: center;
    }

    .wechat-qr-image img {
        width: 100px;
        height: 100px;
    }
}
