/* === 基础 === */
* { 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;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Header === */
.header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    padding: 20px 0 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-top { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.logo { font-size: 24px; font-weight: 700; color: #fff; text-decoration: none; }
.logo:hover { text-decoration: none; opacity: 0.9; }
.subtitle { font-size: 14px; opacity: 0.85; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.nav-link {
    color: rgba(255,255,255,0.85);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.2); color: #fff; text-decoration: none; }
.search-form { display: flex; gap: 8px; }
.search-input {
    flex: 1;
    padding: 8px 14px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    outline: none;
    transition: background 0.2s;
}
.search-input::placeholder { color: rgba(255,255,255,0.6); }
.search-input:focus { background: rgba(255,255,255,0.3); }
.search-btn {
    padding: 8px 16px;
    border: none;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}
.search-btn:hover { background: rgba(255,255,255,0.3); }

/* === Main === */
.main-content { padding: 24px 0; min-height: 60vh; }

/* === Filter === */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-group label { font-size: 14px; color: #666; }
.filter-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    outline: none;
}
.filter-select:focus { border-color: #1a73e8; }

/* === Article Grid === */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.article-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    text-decoration: none;
}
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    background: #eef2ff;
    color: #4f46e5;
}
.tag-cat { background: #fce7f3; color: #be185d; }
.tag-grade { background: #dbeafe; color: #1d4ed8; }
.tag-subject { background: #d1fae5; color: #059669; }
.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #1a1a1a;
}
.card-summary { font-size: 14px; color: #666; flex: 1; margin-bottom: 12px; }
.card-meta { font-size: 12px; color: #999; }

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}
.page-link {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 14px;
    text-decoration: none;
}
.page-link:hover { background: #f0f4ff; border-color: #1a73e8; text-decoration: none; }
.page-info { font-size: 14px; color: #666; }

/* === Article Detail === */
.breadcrumb { font-size: 13px; color: #666; margin-bottom: 16px; }
.breadcrumb a { color: #1a73e8; }
.breadcrumb a:hover { text-decoration: underline; }
.article-title { font-size: 28px; color: #1a1a1a; margin-bottom: 12px; }
.article-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.article-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.article-date { font-size: 14px; color: #999; }
.article-content {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-size: 16px;
    line-height: 1.8;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: #1a1a1a;
}
.markdown-body h1 { font-size: 24px; border-bottom: 2px solid #eef2ff; padding-bottom: 8px; }
.markdown-body h2 { font-size: 20px; }
.markdown-body h3 { font-size: 18px; }
.markdown-body p { margin-bottom: 16px; }
.markdown-body ul, .markdown-body ol { margin-bottom: 16px; padding-left: 24px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}
.markdown-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
}
.markdown-body pre code { background: none; color: inherit; padding: 0; }
.markdown-body blockquote {
    border-left: 4px solid #1a73e8;
    padding-left: 16px;
    color: #555;
    margin: 16px 0;
    background: #f8faff;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
}
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}
.markdown-body th, .markdown-body td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}
.markdown-body th { background: #f8faff; }
.related-articles {
    margin-top: 24px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.related-articles h3 { margin-bottom: 12px; font-size: 16px; }
.related-articles li { margin-bottom: 6px; }
.related-articles a { font-size: 14px; }

/* === Empty State === */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}
.search-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

/* === Footer === */
.footer {
    background: #1e293b;
    color: #94a3b8;
    text-align: center;
    padding: 24px 0;
    margin-top: 40px;
    font-size: 14px;
}

/* === Admin === */
.admin-body { background: #f0f2f5; }
.admin-header {
    background: #1e293b;
    color: #fff;
    padding: 12px 0;
}
.admin-header .logo { font-size: 18px; }
.admin-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.admin-nav .nav-link { color: rgba(255,255,255,0.8); font-size: 13px; }
.admin-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.admin-main { padding: 24px 0; min-height: 80vh; }

.admin-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea, #764ba2);
}
.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    width: 360px;
}
.login-box h1 { font-size: 20px; margin-bottom: 20px; text-align: center; }
.error-msg { color: #dc2626; font-size: 14px; margin-bottom: 12px; text-align: center; }

.input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
}
.input:focus { border-color: #1a73e8; }
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
    color: #333;
}
.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { color: #dc2626; border-color: #dc2626; }
.btn-danger:hover { background: #fef2f2; }
.btn-small { padding: 4px 12px; font-size: 13px; border-radius: 6px; }

.stats-grid { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    flex: 1;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-number { font-size: 36px; font-weight: 700; color: #2563eb; }
.stat-label { font-size: 14px; color: #666; margin-top: 4px; }
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.table th, .table td { padding: 10px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
.table th { background: #f8faff; font-weight: 600; color: #555; }
.table tr:hover td { background: #fafbff; }
.empty-cell { text-align: center; padding: 40px !important; color: #999; }
.action-cell { white-space: nowrap; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-header h1 { font-size: 20px; }

.article-form { background: #fff; padding: 24px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.form-row { margin-bottom: 12px; }
.form-row.three-col { display: flex; gap: 12px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; color: #444; margin-bottom: 4px; }
.textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    resize: vertical;
    font-family: 'SFMono-Regular', Consolas, monospace;
}
.textarea:focus { border-color: #1a73e8; }
.textarea-lg { min-height: 400px; }
.form-actions { display: flex; gap: 12px; align-items: center; }
.checkbox-label { font-size: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; }

.grade-chart { background: #fff; padding: 16px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.grade-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.grade-name { font-size: 13px; color: #666; min-width: 70px; }
.bar-container { flex: 1; }
.bar-fill { background: #2563eb; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 13px; white-space: nowrap; }

/* === Responsive === */
@media (max-width: 768px) {
    .article-grid { grid-template-columns: 1fr; }
    .stats-grid { flex-direction: column; }
    .form-row.three-col { flex-direction: column; }
    .article-content { padding: 20px; }
}
