/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* ===== Header ===== */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 0 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 32px;
    margin-bottom: 5px;
}

header .subtitle {
    opacity: 0.9;
    font-size: 16px;
}

header nav {
    margin-top: 15px;
}

header nav a {
    color: white;
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    margin-right: 8px;
    transition: background 0.3s;
    font-size: 14px;
}

header nav a:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== 文章列表 ===== */
.post-list {
    margin: 30px 0;
}

.post-item {
    background: white;
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 25px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.12);
}

.post-item h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.post-item h2 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.post-item h2 a:hover {
    color: #667eea;
}

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

.post-meta span {
    margin-right: 15px;
}

.post-meta .category {
    background: #667eea;
    color: white;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.post-summary {
    color: #666;
    line-height: 1.8;
    margin-bottom: 12px;
}

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

.post-tags .tag {
    background: #f0f0f0;
    color: #666;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 12px;
    text-decoration: none;
    transition: background 0.3s;
}

.post-tags .tag:hover {
    background: #667eea;
    color: white;
}

.read-more {
    display: inline-block;
    margin-top: 12px;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

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

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

.pagination a, .pagination span {
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    color: #667eea;
    background: white;
    border: 1px solid #e0e0e0;
    transition: all 0.3s;
}

.pagination a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .current {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ===== 文章详情 ===== */
.post-detail {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin: 30px 0;
}

.post-detail h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.post-detail .post-meta {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.post-detail .post-content {
    font-size: 17px;
    line-height: 1.9;
    color: #444;
}

.post-detail .post-content h2 {
    font-size: 24px;
    margin: 25px 0 12px;
    color: #333;
}

.post-detail .post-content h3 {
    font-size: 20px;
    margin: 20px 0 10px;
    color: #333;
}

.post-detail .post-content p {
    margin-bottom: 16px;
}

.post-detail .post-content ul, 
.post-detail .post-content ol {
    margin: 12px 0 16px 24px;
}

.post-detail .post-content li {
    margin-bottom: 6px;
}

.post-detail .post-content blockquote {
    border-left: 4px solid #667eea;
    padding: 12px 20px;
    margin: 16px 0;
    background: #f8f9fa;
    color: #555;
}

.post-detail .post-content code {
    background: #f4f4f4;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.post-detail .post-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
}

.post-detail .post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.post-detail .post-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
}

.post-detail .post-tags {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #667eea;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* ===== 侧边栏 ===== */
.sidebar {
    margin: 30px 0;
}

.sidebar-widget {
    background: white;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.sidebar-widget h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #333;
}

.sidebar-widget ul {
    list-style: none;
}

.sidebar-widget ul li {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-widget ul li a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.sidebar-widget ul li a:hover {
    color: #667eea;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 30px 0;
    color: #999;
    font-size: 14px;
    border-top: 1px solid #e0e0e0;
    margin-top: 30px;
}

/* ===== 登录页面 ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 8px;
    color: #333;
}

.login-hint {
    text-align: center;
    font-size: 13px;
    color: #999;
    margin-bottom: 20px;
}

.login-box .form-group {
    margin-bottom: 16px;
}

.login-box label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 14px;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.login-box input:focus {
    border-color: #667eea;
    outline: none;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.error-msg {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    text-align: center;
}

/* ===== 后台管理 ===== */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 0;
}

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

.admin-header h1 {
    font-size: 22px;
}

.admin-header nav a {
    color: white;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    margin-left: 8px;
    transition: background 0.3s;
    font-size: 14px;
}

.admin-header nav a:hover {
    background: rgba(255,255,255,0.3);
}

.admin-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin: 30px 0;
}

.admin-content h2 {
    margin-bottom: 20px;
    font-size: 22px;
}

/* 后台表格 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    background: #f8f9fa;
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.admin-table tr:hover {
    background: #fafafa;
}

.admin-table .status-badge {
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.admin-table .status-published {
    background: #d4edda;
    color: #155724;
}

.admin-table .status-draft {
    background: #ffeaa7;
    color: #856404;
}

.btn {
    padding: 4px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline-block;
}

.btn:hover {
    opacity: 0.8;
}

.btn-edit {
    background: #667eea;
    color: white;
}

.btn-delete {
    background: #fee;
    color: #c33;
}

.btn-add {
    background: #28a745;
    color: white;
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
}

.btn-add:hover {
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255,70,70,0.3);
    color: white;
}

/* 表单 */
.admin-form .form-group {
    margin-bottom: 18px;
}

.admin-form label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
}

.admin-form input[type="text"],
.admin-form input[type="url"],
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    border-color: #667eea;
    outline: none;
}

.admin-form textarea {
    min-height: 300px;
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-form .btn-submit {
    padding: 10px 30px;
    font-size: 15px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 24px;
    }
    
    .post-item {
        padding: 18px 20px;
    }
    
    .post-item h2 {
        font-size: 20px;
    }
    
    .post-detail {
        padding: 20px;
    }
    
    .post-detail h1 {
        font-size: 24px;
    }
    
    .admin-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .admin-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-table {
        font-size: 12px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }
}