/* ============================================
   科技前沿 - 编辑风格主题
   ============================================ */

/* 字体 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
    --primary: #c0392b;
    --primary-dark: #962d22;
    --primary-light: #e74c3c;
    --accent: #2c3e50;
    --bg: #f5f0eb;
    --bg-warm: #faf7f2;
    --white: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #555;
    --text-light: #888;
    --border: #e0d8cf;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --radius: 2px;
    --font-serif: 'Noto Serif SC', 'Songti SC', Georgia, serif;
    --font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-sans); color: var(--text); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── 头部 ── */
.site-header {
    background: var(--accent);
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 56px;
}
.site-logo {
    color: var(--white);
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
}
.site-logo:hover { color: #fff; opacity: 0.9; }

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.main-nav a {
    color: rgba(255,255,255,0.7);
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 400;
    border-radius: 2px;
    transition: all 0.15s;
}
.main-nav a:hover { color: #fff; background: rgba(255,255,255,0.1); }

.search-form {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}
.search-form input {
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-right: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 13px;
    border-radius: 2px 0 0 2px;
    width: 160px;
    outline: none;
    font-family: var(--font-sans);
}
.search-form input::placeholder { color: rgba(255,255,255,0.4); }
.search-form input:focus { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.4); }
.search-form button {
    padding: 6px 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 13px;
    cursor: pointer;
    border-radius: 0 2px 2px 0;
    font-family: var(--font-sans);
}
.search-form button:hover { background: var(--primary-dark); }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

/* ── 内容布局 ── */
.site-main { padding: 28px 0 0; }
.home-page, .search-page { display: flex; gap: 28px; }
.content-area { flex: 1; min-width: 0; }
.sidebar { width: 280px; flex-shrink: 0; }

/* ── 文章卡片 ── */
.article-list { display: flex; flex-direction: column; gap: 0; }

.article-card {
    display: flex;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    gap: 20px;
    transition: background 0.15s;
}
.article-card:hover { background: var(--bg-warm); }

.article-thumb {
    width: 180px;
    min-height: 120px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 2px;
}
.article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.article-card:hover .article-thumb img { transform: scale(1.03); }

.article-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.article-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 8px;
}
.article-title a {
    color: var(--text);
    text-decoration: none;
}
.article-title a:hover { color: var(--primary); }

.article-summary {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
}
.article-source { color: var(--primary); font-weight: 500; }

/* ── 文章详情 ── */
.article-detail {
    background: var(--white);
    padding: 40px 48px;
    border: 1px solid var(--border);
}

.article-detail .article-title {
    font-family: var(--font-serif);
    font-size: 28px;
    line-height: 1.4;
    margin-bottom: 16px;
}

.article-detail .article-meta {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.article-content {
    font-size: 16px;
    line-height: 1.9;
    color: #333;
}
.article-content p { margin-bottom: 18px; text-indent: 2em; }
.article-content h2 { margin: 28px 0 14px; font-size: 20px; font-family: var(--font-serif); text-indent: 0; }
.article-content h3 { margin: 22px 0 10px; font-size: 17px; text-indent: 0; }
.article-content img { max-width: 100%; height: auto; margin: 16px 0; }
.article-content a { color: var(--primary); border-bottom: 1px solid rgba(192,57,43,0.3); }
.article-content a:hover { border-bottom-color: var(--primary); }
.article-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 12px 20px;
    background: var(--bg-warm);
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
}
.article-content pre { background: #1a1a2e; color: #e0e0e0; padding: 20px; border-radius: 2px; overflow-x: auto; margin: 20px 0; font-size: 14px; }
.article-content code { font-size: 14px; }
.article-content ul, .article-content ol { margin: 12px 0; padding-left: 2em; }
.article-content li { margin-bottom: 4px; }

.article-original { margin-top: 28px; font-size: 13px; color: var(--text-light); }

/* 推荐阅读 */
.anchor-recommend {
    margin-top: 28px;
    padding: 16px 20px;
    background: var(--bg-warm);
    border-left: 3px solid var(--primary);
    font-size: 14px;
    line-height: 2;
}
.anchor-recommend strong { color: var(--text); font-family: var(--font-serif); }
.anchor-recommend a { color: var(--primary); }
.anchor-recommend a:hover { text-decoration: underline; }

/* 面包屑 */
.breadcrumb { font-size: 13px; color: var(--text-light); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }

/* 相关文章 */
.related-articles {
    background: var(--white);
    padding: 24px;
    margin-top: 24px;
    border: 1px solid var(--border);
}
.related-articles h2 {
    font-family: var(--font-serif);
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}
.related-articles ul { list-style: none; }
.related-articles li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 14px;
}
.related-articles li:last-child { border: none; }
.related-articles time { font-size: 12px; color: var(--text-light); white-space: nowrap; margin-left: 12px; }

/* ── 侧栏 ── */
.widget {
    background: var(--white);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.widget h3 {
    font-family: var(--font-serif);
    font-size: 16px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}
.widget ol, .widget ul { list-style: none; }
.widget ol { counter-reset: hot; }
.widget ol li { counter-increment: hot; padding: 7px 0; font-size: 14px; display: flex; align-items: baseline; }
.widget ol li::before {
    content: counter(hot);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    margin-right: 10px;
    flex-shrink: 0;
}
.widget ol li:nth-child(n+4)::before { background: var(--border); color: var(--text-light); }
.widget ul li { padding: 6px 0; font-size: 14px; }
.widget ul li::before { content: "\203A"; margin-right: 8px; color: var(--primary); font-weight: 700; }

/* ── 分页 ── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    padding: 20px 0;
}
.pagination a, .pagination .current {
    padding: 6px 14px;
    font-size: 14px;
    border-radius: 2px;
}
.pagination a { background: var(--white); border: 1px solid var(--border); color: var(--text); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { color: var(--text-light); }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); font-family: var(--font-serif); }

/* 分类/搜索页 */
.category-page h1, .search-page h1 { font-family: var(--font-serif); margin-bottom: 8px; }
.category-desc { color: var(--text-light); margin-bottom: 24px; font-size: 14px; }
.search-info { color: var(--text-light); margin-bottom: 16px; font-size: 14px; }

/* ── 底部 ── */
.site-footer {
    background: var(--accent);
    color: rgba(255,255,255,0.6);
    padding: 28px 0;
    margin-top: 48px;
    border-top: 3px solid var(--primary);
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.footer-nav { display: flex; gap: 20px; }
.footer-nav a { color: rgba(255,255,255,0.6); font-size: 13px; }
.footer-nav a:hover { color: #fff; }
.friend-links {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
}
.friend-links-label { color: rgba(255,255,255,0.8); font-weight: 500; }
.friend-links a { color: rgba(255,255,255,0.5); }
.friend-links a:hover { color: #fff; }

/* ── 后台样式 ── */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 220px;
    background: #1a1a2e;
    color: var(--white);
    padding: 20px 0;
    flex-shrink: 0;
}
.admin-sidebar .admin-logo { padding: 0 20px 20px; font-size: 17px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.08); }
.admin-sidebar nav a,
.admin-sidebar nav .nav-item {
    display: block;
    padding: 10px 20px;
    color: #8892b0;
    text-decoration: none;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    font-size: 14px;
}
.admin-sidebar nav a:hover,
.admin-sidebar nav .nav-item:hover,
.admin-sidebar nav .nav-item.active {
    color: #ccd6f6;
    background: rgba(255,255,255,0.04);
    border-left-color: var(--primary);
}
.nav-group { margin-top: 4px; }
.nav-group-title {
    padding: 8px 20px 4px;
    font-size: 10px;
    color: #495670;
    letter-spacing: 2px;
    font-weight: 600;
    text-transform: uppercase;
}
.nav-group .nav-item { padding-left: 28px; font-size: 13px; }
.nav-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.nav-footer a {
    display: block;
    padding: 8px 20px;
    color: #495670;
    text-decoration: none;
    font-size: 13px;
}
.nav-footer a:hover { color: #8892b0; }
.admin-main { flex: 1; background: #f0f0f0; padding: 24px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h1 { font-size: 22px; font-family: var(--font-serif); }

.admin-table { width: 100%; background: var(--white); border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #e8e8e8; }
.admin-table th { background: #fafafa; font-weight: 600; color: var(--text-secondary); font-size: 13px; }
.admin-table tr:hover { background: #fafafa; }

.btn { display: inline-block; padding: 7px 16px; border-radius: 2px; font-size: 14px; cursor: pointer; border: none; transition: all 0.15s; font-family: var(--font-sans); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #e74c3c; color: var(--white); }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid #ddd; }
.btn-secondary:hover { border-color: #999; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.admin-form { background: var(--white); padding: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 2px; font-size: 14px; font-family: var(--font-sans);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); outline: none; }
.form-group textarea { min-height: 200px; }

.status { display: inline-block; padding: 2px 8px; border-radius: 2px; font-size: 12px; }
.status-published { background: #e8f5e9; color: #2e7d32; }
.status-draft { background: #fff8e1; color: #f57f17; }
.status-archived { background: #f5f5f5; color: #616161; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); padding: 18px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--primary); font-family: var(--font-serif); }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--accent); }
.login-form { background: var(--white); padding: 48px; width: 100%; max-width: 380px; border-top: 3px solid var(--primary); }
.login-form h1 { text-align: center; margin-bottom: 28px; font-size: 22px; font-family: var(--font-serif); }

/* ── 响应式 ── */
@media (max-width: 768px) {
    .home-page, .search-page { flex-direction: column; }
    .sidebar { width: 100%; }
    .article-card { flex-direction: column; }
    .article-thumb { width: 100%; min-height: 180px; }
    .main-nav { display: none; }
    .mobile-menu-btn { display: block; }
    .main-nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--accent);
        padding: 16px;
        border-bottom: 2px solid var(--primary);
    }
    .header-inner { flex-wrap: wrap; }
    .search-form { width: 100%; order: 3; }
    .search-form input { flex: 1; }
    .article-detail { padding: 20px; }
    .article-detail .article-title { font-size: 22px; }
    .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
    .admin-wrap { flex-direction: column; }
    .admin-sidebar { width: 100%; }
}
