/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: #333;
    background: #f9f9f9;
}

a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 16px 0;
    margin-bottom: 40px;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #111;
}

.site-title a { color: inherit; }
.site-title a:hover { text-decoration: none; }

.site-nav a {
    margin-left: 20px;
    color: #555;
    font-size: 0.9rem;
}

/* Footer */
.site-footer {
    margin-top: 60px;
    padding: 24px 0;
    border-top: 1px solid #e8e8e8;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

/* Article List */
.post-list { list-style: none; }

.post-item {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 24px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s;
}

.post-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.post-item-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.post-item-title a { color: #111; }
.post-item-title a:hover { color: #0066cc; text-decoration: none; }

.post-meta {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 10px;
}

.post-meta .tags { margin-left: 12px; }

.tag {
    display: inline-block;
    background: #f0f4ff;
    color: #0066cc;
    border-radius: 3px;
    padding: 1px 8px;
    font-size: 0.8rem;
    margin-right: 4px;
}

.tag:hover { background: #dce8ff; text-decoration: none; }

/* Article Detail */
.post-header { margin-bottom: 32px; }

.post-title {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
    color: #111;
}

.post-content {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 32px;
}

.post-content img { max-width: 100%; height: auto; border-radius: 4px; }
.post-content h1, .post-content h2, .post-content h3 { margin: 1.2em 0 0.6em; }
.post-content p { margin-bottom: 1em; }
.post-content ul, .post-content ol { margin: 0.8em 0 0.8em 1.5em; }
.post-content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 16px;
    color: #666;
    margin: 1em 0;
}
.post-content pre {
    background: #f4f4f4;
    padding: 16px;
    border-radius: 4px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 480px;
    font-size: 0.9em;
}
.post-content code {
    background: #f4f4f4;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}
.post-content pre code { background: none; padding: 0; }
.post-content table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.post-content table th,
.post-content table td { border: 1px solid #ddd; padding: 8px 12px; text-align: left; }
.post-content table th { background: #f7f7f7; font-weight: 600; }
.post-content table tr:nth-child(odd) td { background: #fafafa; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #555;
    background: #fff;
}

.pagination a:hover { background: #f0f4ff; text-decoration: none; }
.pagination .current { background: #0066cc; color: #fff; border-color: #0066cc; }

/* Page Title */
.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: #111;
}

/* Back Link */
.back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: #999;
    font-size: 0.9rem;
}

/* Empty State */
.empty { text-align: center; color: #999; padding: 60px 0; }

/* Admin */
.admin-bar {
    background: #222;
    color: #ccc;
    padding: 10px 0;
    font-size: 0.85rem;
    margin-bottom: 0;
}

.admin-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-bar a { color: #aaa; margin-left: 16px; }
.admin-bar a:hover { color: #fff; text-decoration: none; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
}

.admin-table th, .admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.admin-table th { background: #f7f7f7; font-weight: 600; color: #555; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafafa; }

.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary { background: #0066cc; color: #fff; }
.btn-danger  { background: #e53e3e; color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }

/* Form */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: #0066cc; }

/* Login */
.login-box {
    max-width: 360px;
    margin: 80px auto;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 36px;
}

.login-box h2 { margin-bottom: 24px; font-size: 1.2rem; }

.alert {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error { background: #fff0f0; color: #c0392b; border: 1px solid #f5c6cb; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #c3e6cb; }

/* Editor area */
#toolbar-container {
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}
#editor-container {
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    height: 720px;
    overflow-y: auto;
}
