/* ========== 基础样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.8;
    color: #333;
    background: #f5f7fa;
    -webkit-font-smoothing: antialiased;
}

a { color: #007bff; text-decoration: none; transition: color .2s; }
a:hover { color: #0056b3; text-decoration: underline; }

img { max-width: 100%; height: auto; }

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

/* ========== 头部 ========== */
.site-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    height: 70px;
    gap: 30px;
}

.site-logo h1 {
    font-size: 24px;
    color: #007bff;
    margin: 0;
}

.site-logo h1:hover { text-decoration: none; }

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 5px;
}

.main-nav li { position: relative; }

.main-nav a {
    display: block;
    padding: 8px 16px;
    color: #555;
    border-radius: 6px;
}

.main-nav a:hover { background: #f0f7ff; color: #007bff; text-decoration: none; }

.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    border-radius: 6px;
    padding: 8px 0;
    min-width: 180px;
}

.has-dropdown:hover .dropdown { display: block; }

.dropdown li a { padding: 8px 16px; white-space: nowrap; }

.header-search { margin-left: auto; }

.header-search form {
    display: flex;
    background: #f5f7fa;
    border-radius: 20px;
    overflow: hidden;
}

.header-search input {
    border: none;
    padding: 8px 16px;
    background: transparent;
    width: 200px;
    outline: none;
}

.header-search button {
    border: none;
    padding: 0 14px;
    background: transparent;
    color: #666;
    cursor: pointer;
}

/* ========== 主体布局 ========== */
.site-main { padding: 30px 0; }

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
}

/* ========== 文章卡片 ========== */
.post-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    margin-bottom: 20px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    display: flex;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
}

.post-thumb {
    width: 240px;
    min-height: 180px;
    background: #f5f7fa;
    overflow: hidden;
    flex-shrink: 0;
}

.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

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

.post-info { padding: 20px; flex: 1; }

.post-title { font-size: 20px; margin-bottom: 10px; }
.post-title a { color: #222; }
.post-title a:hover { color: #007bff; text-decoration: none; }

.post-meta {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.post-meta a { color: #888; }
.post-meta a:hover { color: #007bff; }

.post-excerpt {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

.read-more {
    font-size: 14px;
    font-weight: 500;
}

/* ========== 文章详情 ========== */
.post-detail {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    padding: 40px;
}

.post-header { margin-bottom: 30px; }
.post-header .post-title { font-size: 32px; margin-bottom: 15px; line-height: 1.4; }

.post-meta-detail {
    display: flex;
    gap: 20px;
    color: #888;
    font-size: 14px;
    flex-wrap: wrap;
}

.post-meta-detail a { color: #888; }
.post-meta-detail a:hover { color: #007bff; }

.breadcrumb {
    margin-top: 20px;
    font-size: 13px;
    color: #888;
}

.breadcrumb a { color: #888; }
.breadcrumb a:hover { color: #007bff; }

.post-featured-image {
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
}

.post-content {
    font-size: 16px;
    line-height: 1.9;
    color: #333;
}

.post-content img {
    border-radius: 6px;
    margin: 15px 0;
}

.post-content p { margin-bottom: 18px; }
.post-content h2, .post-content h3 { margin: 30px 0 15px; }
.post-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}
.post-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

/* 文章标签 */
.post-tags {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.tags-label { color: #666; margin-right: 10px; }
.post-tags .tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f7ff;
    color: #007bff;
    border-radius: 15px;
    font-size: 13px;
    margin-right: 8px;
    margin-bottom: 8px;
}

/* 文章导航 */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.nav-prev, .nav-next {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #555;
}

.nav-prev i { margin-right: 10px; }
.nav-next i { margin-left: 10px; }

.nav-text { display: flex; flex-direction: column; overflow: hidden; }
.nav-label { font-size: 12px; color: #999; }
.nav-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 相关文章 */
.related-posts {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.related-posts h3 { margin-bottom: 15px; font-size: 18px; }
.related-posts ul { list-style: none; }
.related-posts li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #ddd;
}
.related-posts li:last-child { border-bottom: none; }
.related-date { color: #999; font-size: 13px; }

/* ========== 评论区 ========== */
.comments-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.comments-section h3 { margin-bottom: 20px; }
.comment-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.comment-meta { margin-bottom: 8px; font-size: 13px; color: #888; }
.comment-time { margin-left: 10px; }

.comment-form { margin-top: 30px; }
.comment-form h4 { margin-bottom: 15px; }
.comment-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }
.comment-form input, .comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.comment-form textarea { resize: vertical; }
.comment-form button {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 10px 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.comment-form button:hover { background: #0056b3; }

/* ========== 侧边栏 ========== */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.sidebar-widget {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}

.sidebar-widget h3 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-widget ul { list-style: none; }
.sidebar-widget li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #eee;
}
.sidebar-widget li:last-child { border-bottom: none; }

.sidebar-widget .count, .tag-count {
    color: #999;
    font-size: 12px;
    background: #f0f7ff;
    padding: 1px 8px;
    border-radius: 10px;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-link {
    padding: 3px 10px;
    background: #f0f7ff;
    color: #007bff;
    border-radius: 12px;
    font-size: 13px;
}

.search-widget form { display: flex; }
.search-widget input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px 0 0 6px;
}
.search-widget button {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 0 15px;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
}

.page-num, .page-btn {
    display: inline-block;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #555;
}

.page-num.active {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
}

.page-btn { background: #f5f7fa; }

/* ========== 页面头部 ========== */
.page-header {
    background: #fff;
    padding: 30px 40px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}

.page-header h1 { font-size: 24px; margin-bottom: 10px; }
.page-desc { color: #888; }

/* ========== 归档页 ========== */
.archive-year {
    font-size: 18px;
    color: #007bff;
    margin: 20px 0 10px;
    padding-left: 10px;
    border-left: 4px solid #007bff;
}

.archive-month {
    padding: 8px 15px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.month-count { color: #888; font-size: 14px; }

/* ========== 搜索页 ========== */
.search-form {
    display: flex;
    max-width: 500px;
    margin: 30px auto;
}

.search-form input {
    flex: 1;
    padding: 12px;
    border: 2px solid #007bff;
    border-radius: 25px 0 0 25px;
    outline: none;
}

.search-form button {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 0 25px;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
}

mark { background: #fff3cd; padding: 0 3px; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    background: #fff;
    border-radius: 10px;
}

/* ========== 页脚 ========== */
.site-footer {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0 20px;
    margin-top: 50px;
}

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

.footer-desc { color: #95a5a6; font-size: 14px; margin-top: 5px; }

.footer-links a {
    color: #ecf0f1;
    margin-left: 15px;
    font-size: 20px;
}

.footer-links a:hover { color: #3498db; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .content-wrapper { grid-template-columns: 1fr; }
    .header-inner { flex-wrap: wrap; height: auto; padding: 15px 0; }
    .main-nav { order: 3; width: 100%; margin-top: 10px; }
    .main-nav ul { flex-wrap: wrap; }
    .header-search { margin-left: 0; }
    .post-card { flex-direction: column; }
    .post-thumb { width: 100%; min-height: 200px; }
    .post-detail { padding: 20px; }
    .post-navigation { grid-template-columns: 1fr; }
    .footer-inner { flex-direction: column; gap: 15px; text-align: center; }
}
