/* ========== 全局重置 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    background: #f8f9fa;
}
a { color: #0066cc; text-decoration: none; }
a:hover { color: #004499; text-decoration: underline; }
img { max-width: 100%; height: auto; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ========== 顶部导航 ========== */
.site-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .container {
    display: flex;
    align-items: center;
    gap: 30px;
    height: 60px;
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: #333; text-decoration: none; }
.logo-icon { font-size: 24px; }
.nav { display: flex; gap: 20px; flex: 1; }
.nav a { color: #555; padding: 8px 0; font-weight: 500; }
.nav a:hover { color: #0066cc; text-decoration: none; }
.nav-dropdown { position: relative; }
.nav-dropdown > span { cursor: pointer; color: #555; padding: 8px 0; font-weight: 500; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 8px 0;
    min-width: 160px;
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 8px 16px; color: #555; font-weight: normal; }
.dropdown-menu a:hover { background: #f0f6ff; color: #0066cc; }
.search-form { display: flex; border: 1px solid #ddd; border-radius: 20px; overflow: hidden; }
.search-form input { border: none; padding: 6px 12px; outline: none; width: 180px; font-size: 13px; }
.search-form button { background: #0066cc; color: #fff; border: none; padding: 6px 12px; cursor: pointer; }

/* ========== 主体布局 ========== */
.site-main { padding: 30px 0; }
.content-wrap { display: flex; gap: 30px; }
.content-area { flex: 1; min-width: 0; }
.sidebar { width: 280px; flex-shrink: 0; }

/* ========== 文章列表 ========== */
.post-list { display: flex; flex-direction: column; gap: 20px; }
.post-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 24px;
    transition: all 0.2s;
}
.post-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }
.post-card h2 { margin-bottom: 10px; }
.post-card h2 a { color: #222; font-size: 20px; }
.post-card h2 a:hover { color: #0066cc; text-decoration: none; }
.post-meta { color: #888; font-size: 13px; margin-bottom: 12px; }
.post-meta span { margin-right: 15px; }
.post-excerpt { color: #666; margin-bottom: 12px; }
.post-tags a {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    margin-right: 6px;
    background: #f0f6ff;
    color: #0066cc;
    border-radius: 3px;
}
.post-tags a:hover { background: #0066cc; color: #fff; text-decoration: none; }

/* ========== 文章详情 ========== */
.post-detail {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 40px;
}
.post-detail h1 { font-size: 26px; margin-bottom: 15px; line-height: 1.4; }
.post-detail .post-meta { padding-bottom: 15px; border-bottom: 1px solid #eee; margin-bottom: 25px; }
.post-content { font-size: 16px; line-height: 1.9; color: #333; }
.post-content p { margin-bottom: 16px; }
.post-content h2, .post-content h3 { margin: 24px 0 12px; }
.post-content h2 { font-size: 20px; border-left: 4px solid #0066cc; padding-left: 12px; }
.post-content h3 { font-size: 17px; }
.post-content ul, .post-content ol { padding-left: 24px; margin-bottom: 16px; }
.post-content li { margin-bottom: 6px; }
.post-content blockquote {
    border-left: 4px solid #ddd;
    padding: 12px 20px;
    margin: 16px 0;
    background: #f9f9f9;
    color: #666;
}
.post-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
    font-size: 14px;
}
.post-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 14px;
}
.post-content pre code { background: none; padding: 0; }
.post-content img { border-radius: 4px; margin: 12px 0; }

/* 上一篇下一篇 */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.post-nav a {
    flex: 1;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #555;
    font-size: 14px;
}
.post-nav a:hover { background: #f0f6ff; color: #0066cc; text-decoration: none; }
.post-nav .nav-title { display: block; font-weight: 500; color: #333; margin-top: 4px; }

/* ========== 侧边栏 ========== */
.widget {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.widget h3 { font-size: 15px; margin-bottom: 14px; color: #333; padding-bottom: 10px; border-bottom: 2px solid #f0f6ff; }
.widget ul { list-style: none; }
.widget li { padding: 6px 0; border-bottom: 1px dashed #eee; font-size: 14px; }
.widget li:last-child { border-bottom: none; }
.widget li .count { color: #999; font-size: 12px; }

/* 标签云 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud a {
    display: inline-block;
    padding: 3px 10px;
    background: #f0f6ff;
    color: #0066cc;
    border-radius: 12px;
    font-size: 12px;
}
.tag-cloud .tag-1 { font-size: 16px; padding: 4px 12px; }
.tag-cloud .tag-2 { font-size: 14px; padding: 4px 10px; }
.tag-cloud .tag-3 { font-size: 13px; }
.tag-cloud .tag-4 { font-size: 12px; }
.tag-cloud .tag-5 { font-size: 11px; }
.tag-cloud a:hover { background: #0066cc; color: #fff; text-decoration: none; }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    color: #555;
}
.pagination a:hover { background: #f0f6ff; border-color: #0066cc; color: #0066cc; text-decoration: none; }
.pagination .current { background: #0066cc; color: #fff; border-color: #0066cc; }
.pagination .disabled { color: #ccc; pointer-events: none; }

/* ========== 页脚 ========== */
.site-footer {
    background: #2d2d2d;
    color: #aaa;
    padding: 30px 0;
    margin-top: 40px;
    text-align: center;
    font-size: 14px;
}
.site-footer a { color: #ccc; }
.site-footer a:hover { color: #fff; }
.site-footer p { margin-bottom: 6px; }
.footer-links { font-size: 13px; }

/* ========== 搜索页 ========== */
.search-box {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.search-box form { display: flex; gap: 10px; }
.search-box input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
}
.search-box input:focus { border-color: #0066cc; }
.search-box button {
    padding: 10px 24px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}

/* ========== 后台 ========== */
.admin-body { background: #f0f2f5; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 220px;
    background: #1f2937;
    color: #ccc;
    padding-top: 20px;
    flex-shrink: 0;
}
.admin-sidebar .brand {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    padding: 0 20px 20px;
    border-bottom: 1px solid #374151;
    margin-bottom: 16px;
}
.admin-sidebar a {
    display: block;
    padding: 12px 20px;
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: #374151;
    color: #fff;
}
.admin-main { flex: 1; padding: 30px; overflow-x: auto; }
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-header h1 { font-size: 22px; }
.admin-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 20px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.stat-card .num { font-size: 32px; font-weight: 700; color: #0066cc; }
.stat-card .label { color: #888; font-size: 14px; margin-top: 6px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}
.admin-table th { background: #f8f9fa; font-weight: 600; color: #555; }
.admin-table tr:hover { background: #f8f9fa; }
.admin-btn {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    border: none;
}
.admin-btn-primary { background: #0066cc; color: #fff; }
.admin-btn-success { background: #28a745; color: #fff; }
.admin-btn-warning { background: #ffc107; color: #333; }
.admin-btn-danger { background: #dc3545; color: #fff; }
.admin-btn:hover { opacity: 0.9; text-decoration: none; color: #fff; }
.admin-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
}
.admin-tag-publish { background: #d4edda; color: #155724; }
.admin-tag-draft { background: #fff3cd; color: #856404; }

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-box h2 { text-align: center; margin-bottom: 30px; color: #333; }
.login-box .form-group { margin-bottom: 16px; }
.login-box label { display: block; margin-bottom: 6px; color: #555; font-size: 14px; }
.login-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
}
.login-box input:focus { border-color: #0066cc; }
.login-box button {
    width: 100%;
    padding: 12px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 10px;
}
.login-box button:hover { background: #004499; }
.login-box .error {
    background: #fde8e8;
    color: #dc3545;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    text-align: center;
}

/* 表单 */
.admin-form .form-group { margin-bottom: 16px; }
.admin-form label { display: block; margin-bottom: 6px; color: #555; font-size: 14px; font-weight: 500; }
.admin-form input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}
.admin-form input[type="text"]:focus { border-color: #0066cc; }
.inline-form { display: inline-flex; gap: 6px; }
.inline-form input { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; width: 140px; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .content-wrap { flex-direction: column; }
    .sidebar { width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .site-header .container { flex-wrap: wrap; height: auto; padding: 12px 20px; }
    .nav { order: 3; width: 100%; margin-top: 10px; }
    .search-form input { width: 120px; }
    .post-detail { padding: 24px 20px; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; padding-top: 10px; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .search-form { display: none; }
}
