:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

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

/* Header */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.site-title:hover { text-decoration: none; }
.site-nav { display: flex; gap: 20px; align-items: center; }
.site-nav a { color: var(--text-muted); font-size: .95rem; }
.site-nav a:hover { color: var(--primary); text-decoration: none; }

/* Main content */
.main-content { padding: 30px 0; min-height: calc(100vh - 160px); }

/* Article list */
.article-list { display: flex; flex-direction: column; gap: 20px; }
.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: box-shadow .2s;
}
.article-card.has-cover {
    display: flex;
    gap: 20px;
    padding: 16px;
}
.article-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.article-card h2 { font-size: 1.3rem; margin-bottom: 8px; }
.article-card h2 a { color: var(--text); }
.article-meta { font-size: .85rem; color: var(--text-muted); margin-bottom: 10px; }
.article-summary { color: var(--text-muted); font-size: .95rem; }

/* Article cover image */
.article-cover {
    flex-shrink: 0;
    width: 200px;
    height: 140px;
    border-radius: 6px;
    overflow: hidden;
    display: block;
}
.article-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.article-cover:hover img { transform: scale(1.05); }
.article-info { flex: 1; min-width: 0; padding: 4px 0; }

@media (max-width: 600px) {
    .article-card.has-cover { flex-direction: column; }
    .article-cover { width: 100%; height: 180px; }
}

/* Article detail */
.article-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.article-content h1 { font-size: 2rem; margin-bottom: 12px; }
.article-content img { max-width: 100%; height: auto; border-radius: 4px; }
.article-body { margin-top: 24px; font-size: 1.05rem; }
.article-body p { margin-bottom: 16px; }
.article-body h2, .article-body h3 { margin-top: 24px; margin-bottom: 12px; }
.article-body pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: 6px; overflow-x: auto; }
.article-body code { font-family: "JetBrains Mono", Consolas, monospace; font-size: .9em; }
.article-body blockquote { border-left: 4px solid var(--primary); padding-left: 16px; margin: 16px 0; color: var(--text-muted); }

/* Sidebar links */
.sidebar { margin-top: 30px; }
.sidebar-block {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.sidebar-block h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text); }
.sidebar-block ul { list-style: none; }
.sidebar-block li { padding: 4px 0; }
.sidebar-block a { font-size: .9rem; }

/* Pagination */
.pagination { display: flex; gap: 8px; margin-top: 30px; justify-content: center; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 4px;
    font-size: .9rem;
    border: 1px solid var(--border);
}
.pagination a { background: var(--card-bg); }
.pagination a:hover { background: var(--primary); color: #fff; text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Footer */
.site-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: .85rem;
    border-top: 1px solid var(--border);
}

/* Flash messages */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .9rem; }
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Login page */
.login-box {
    max-width: 400px;
    margin: 60px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.login-box h1 { text-align: center; margin-bottom: 24px; font-size: 1.5rem; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: 4px; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .95rem;
    transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-check { display: flex; align-items: center; gap: 8px; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: background .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }

/* Admin layout */
.admin-layout { display: flex; min-height: calc(100vh - 64px); }
.admin-sidebar {
    width: 220px;
    background: #1e293b;
    padding: 20px 0;
    flex-shrink: 0;
}
.admin-sidebar a {
    display: block;
    padding: 10px 24px;
    color: #94a3b8;
    font-size: .9rem;
}
.admin-sidebar a:hover { background: #334155; color: #fff; text-decoration: none; }
.admin-sidebar a.active { color: #fff; background: var(--primary); }
.admin-main { flex: 1; padding: 30px; }
.admin-main h1 { font-size: 1.6rem; margin-bottom: 24px; }

/* Admin table */
.data-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
.data-table th { background: #f1f5f9; font-weight: 600; }
.data-table tr:hover { background: #f8fafc; }
.actions { display: flex; gap: 8px; }

/* Badge */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: .75rem; font-weight: 500; }
.badge-success { background: #ecfdf5; color: #065f46; }
.badge-muted { background: #f1f5f9; color: #64748b; }

/* Dashboard cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); text-align: center; }
.stat-card .number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: .9rem; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; display: flex; overflow-x: auto; padding: 10px; }
    .admin-sidebar a { padding: 8px 16px; white-space: nowrap; }
    .article-content { padding: 20px; }
}
