/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #e1e8ed;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

/* 导航栏 */
.navbar {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.nav-brand a {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav-menu li a {
    color: var(--text-color);
    font-weight: 500;
    font-size: 15px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.nav-menu li a:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

/* 主内容区 */
.main-content {
    padding: 60px 0;
    min-height: calc(100vh - 300px);
}

/* 文章网格 */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    margin-bottom: 60px;
}

/* 文章卡片 */
.post-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.post-thumbnail {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-light);
}

.post-category {
    color: var(--primary-color);
    font-weight: 500;
}

.post-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
}

.post-title a {
    color: var(--text-color);
}

.post-title a:hover {
    color: var(--primary-color);
}

.post-excerpt {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 16px;
    flex: 1;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.read-more {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.page-list {
    display: flex;
    list-style: none;
    gap: 8px;
}

.page-list li {
    min-width: 40px;
    height: 40px;
}

.page-list a,
.page-list span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.3s ease;
}

.page-list a:hover {
    background: var(--primary-color);
    color: white;
}

.page-list .active span {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

/* 侧边栏 */
.sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    align-self: flex-start;
}

.sidebar .container {
    padding: 0;
}

.widget {
    margin-bottom: 30px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.recent-posts,
.category-list {
    list-style: none;
}

.recent-posts li,
.category-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.recent-posts li:last-child,
.category-list li:last-child {
    border-bottom: none;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    padding: 6px 14px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
}

/* 文章详情页 */
.post-detail {
    padding: 60px 0;
}

.post-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.post-detail .post-title {
    font-size: 36px;
    margin-bottom: 20px;
    line-height: 1.3;
}

.post-detail .post-meta {
    justify-content: center;
    font-size: 14px;
}

.post-body {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    line-height: 1.8;
    font-size: 16px;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
    margin: 30px 0 15px;
    font-weight: 600;
}

.post-body h2 {
    font-size: 28px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.post-body h3 {
    font-size: 22px;
}

.post-body p {
    margin: 15px 0;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 20px 0;
}

.post-body code {
    background: #f5f7fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.post-body pre {
    background: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 20px 0;
}

.post-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.post-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-light);
    font-style: italic;
}

.post-body ul,
.post-body ol {
    margin: 15px 0;
    padding-left: 30px;
}

.post-body li {
    margin: 8px 0;
}

.post-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 30px;
}

/* 评论区 */
.comments-section {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-top: 40px;
}

.comments-title {
    font-size: 22px;
    margin-bottom: 30px;
    font-weight: 600;
}

.comment-list {
    list-style: none;
}

.comment-item {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.fn {
    font-weight: 600;
    font-style: normal;
    color: var(--text-color);
}

.comment-time {
    color: var(--text-lighter);
    font-size: 13px;
    margin-left: auto;
}

.comment-content {
    padding-left: 60px;
    color: var(--text-light);
    line-height: 1.7;
}

.comment-reply {
    padding-left: 60px;
    margin-top: 10px;
}

.comment-reply a {
    font-size: 13px;
    color: var(--primary-color);
}

/* 评论表单 */
.respond {
    margin-top: 40px;
}

.comment-form-title {
    font-size: 20px;
    margin-bottom: 25px;
    font-weight: 600;
}

#comment-form p {
    margin-bottom: 20px;
}

#comment-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

#comment-form input[type="text"],
#comment-form input[type="email"],
#comment-form input[type="url"],
#comment-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

#comment-form input:focus,
#comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

#comment-form textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.required {
    color: #e74c3c;
}

/* 页面内容 */
.page-content {
    padding: 60px 0;
}

.page-article {
    background: var(--card-bg);
    padding: 60px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.page-title {
    font-size: 36px;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 600;
}

.page-body {
    line-height: 1.8;
    font-size: 16px;
}

/* 页脚 */
.footer {
    background: var(--card-bg);
    padding: 40px 0;
    text-align: center;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

.footer p {
    margin: 8px 0;
    font-size: 14px;
}

.footer a {
    color: var(--primary-color);
}

/* 搜索弹窗 */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.search-modal.active {
    display: flex;
}

.search-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    margin-bottom: 20px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.close-search {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-search:hover {
    color: var(--text-color);
}

/* 搜索结果 */
.search-results {
    margin-top: 30px;
    max-height: 500px;
    overflow-y: auto;
}

.search-result-count {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.search-result-item h3 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.search-result-item h3 a:hover {
    color: var(--primary-color);
}

.search-result-item p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

.search-result-item mark {
    background: rgba(102, 126, 234, 0.2);
    color: var(--primary-color);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.no-results {
    text-align: center;
    color: var(--text-light);
    padding: 40px;
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        margin-top: 40px;
    }

    .sidebar .container {
        padding: 0 20px;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 16px;
    }

    .nav-menu {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .post-detail .post-title {
        font-size: 28px;
    }

    .post-body,
    .page-article {
        padding: 30px 20px;
    }

    .comments-section {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .nav-brand a {
        font-size: 20px;
    }

    .nav-menu li a {
        font-size: 14px;
        padding: 6px 10px;
    }

    .post-title {
        font-size: 18px;
    }

    .main-content {
        padding: 30px 0;
    }
}
