/* ==========================================================================
   多数派 dspai.com - 前台样式
   设计灵感来自 sspai.com 的简洁内容社区风格
   ========================================================================== */

:root {
    --brand: #ff2e4d;
    --brand-dark: #e62642;
    --brand-light: #ff6b81;
    --text: #2c2c2c;
    --text-light: #666;
    --text-muted: #999;
    --border: #e8e8e8;
    --bg: #fff;
    --bg-gray: #f7f7f7;
    --radius: 6px;
    --shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部导航 ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    height: 60px;
    gap: 28px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text);
    flex-shrink: 0;
}
.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--brand);
    color: #fff;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 800;
}
.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow: hidden;
}
.main-nav a {
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--text-light);
    font-size: 15px;
    white-space: nowrap;
}
.main-nav a:hover { color: var(--brand); background: #fff5f6; }
.main-nav a.active { color: var(--brand); font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.search-form { position: relative; }
.search-form input {
    width: 180px;
    height: 34px;
    padding: 0 12px 0 32px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--bg-gray) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center;
    outline: none;
    transition: all .2s;
}
.search-form input:focus { background-color: #fff; border-color: var(--brand); width: 220px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 18px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    transition: all .2s;
    white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-outline { background: transparent; border-color: var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--brand); color: #fff; }
.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn-danger { border-color: #f2d8dc; color: #c0392b; }
.btn-danger:hover { border-color: var(--brand); }
.btn-block { width: 100%; }

/* 用户菜单 */
.user-menu { position: relative; }
.user-menu > .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid var(--border);
    object-fit: cover;
}
.user-menu .dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 44px;
    width: 160px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px 0;
    z-index: 120;
}
.user-menu.open .dropdown { display: block; }
.user-menu .dropdown a,
.user-menu .dropdown button {
    display: block;
    width: 100%;
    padding: 9px 16px;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
}
.user-menu .dropdown a:hover,
.user-menu .dropdown button:hover { background: var(--bg-gray); color: var(--brand); }
.user-menu .dropdown .divider { border-top: 1px solid var(--border); margin: 5px 0; }

/* ---------- 提示 ---------- */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin: 16px auto;
    font-size: 14px;
    max-width: 1120px;
}
.alert-success { background: #eafaf1; color: #0a7a3e; border: 1px solid #b8eccb; }
.alert-error, .alert-danger { background: #fdf0f1; color: #c0392b; border: 1px solid #f5c6cb; }
.alert ul { list-style: none; }

/* ---------- 页面布局 ---------- */
.page-layout { display: grid; grid-template-columns: 1fr 300px; gap: 30px; padding: 24px 0 40px; align-items: start; }
.main-col { min-width: 0; }

/* ---------- 首页 Banner ---------- */
.featured-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 28px;
    color: #fff;
    display: block;
    box-shadow: var(--shadow);
}
.featured-card .cover { position: absolute; inset: 0; }
.featured-card .featured-content {
    position: relative;
    padding: 90px 30px 26px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .55));
}
.featured-card .featured-tag {
    display: inline-block;
    background: var(--brand);
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    margin-bottom: 10px;
}
.featured-card h2 { font-size: 26px; font-weight: 700; margin-bottom: 8px; line-height: 1.3; }
.featured-card p { font-size: 14px; opacity: .9; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.featured-card .featured-meta { font-size: 13px; opacity: .85; }

/* ---------- 文章列表 ---------- */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--text);
}
.section-head h2 { font-size: 18px; font-weight: 700; }
.section-head .more { font-size: 13px; color: var(--text-muted); }

.article-list { display: flex; flex-direction: column; gap: 18px; }
.article-card {
    display: flex;
    gap: 18px;
    background: #fff;
    border-radius: var(--radius);
    transition: box-shadow .2s;
}
.article-card:hover { box-shadow: var(--shadow); }
.article-card .thumb {
    width: 200px;
    height: 126px;
    flex-shrink: 0;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    font-weight: 800;
}
.article-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.article-card h3 { font-size: 17px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; }
.article-card h3 a:hover { color: var(--brand); }
.article-card .summary {
    font-size: 13.5px;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: auto;
}
.article-card .meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 10px;
}
.article-card .meta .cat { color: var(--brand); font-weight: 500; }
.article-card .meta .avatar {
    width: 20px; height: 20px; border-radius: 50%; object-fit: cover; vertical-align: middle;
}
.article-card .meta a.user:hover { color: var(--brand); }

/* ---------- 侧边栏 ---------- */
.sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 80px; }
.widget {
    background: var(--bg-gray);
    border-radius: 8px;
    padding: 18px;
}
.widget h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.widget h3::before {
    content: "";
    width: 4px;
    height: 16px;
    background: var(--brand);
    border-radius: 2px;
}
.hot-list li {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13.5px;
    line-height: 1.5;
}
.hot-list li:last-child { border-bottom: none; }
.hot-list .rank { color: var(--brand); font-weight: 700; font-size: 15px; }
.hot-list a:hover { color: var(--brand); }
.hot-list .sub { display: block; color: var(--text-muted); font-size: 12px; }

.nl-mini {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: linear-gradient(135deg, #2d7dfa, #7a5cff);
    border-radius: 8px;
    color: #fff;
    transition: transform .2s;
}
.nl-mini:hover { transform: translateY(-2px); color: #fff; }
.nl-mini-issue { font-size: 12px; opacity: .85; }
.nl-mini-title { font-size: 14px; font-weight: 700; line-height: 1.5; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
    padding: 4px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 13px;
    color: var(--text-light);
}
.tag-cloud a:hover { border-color: var(--brand); color: var(--brand); }
.widget p.about { font-size: 13.5px; color: var(--text-light); line-height: 1.8; }

/* ---------- 文章详情 ---------- */
.article-detail { max-width: 760px; margin: 0 auto; padding: 30px 0 50px; }
.article-detail .cat { color: var(--brand); font-size: 14px; font-weight: 600; }
.article-detail h1 { font-size: 30px; font-weight: 700; line-height: 1.35; margin: 12px 0 18px; }
.article-detail .meta-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13.5px;
}
.article-detail .meta-row .avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.article-detail .meta-row .author { color: var(--text); font-weight: 600; }
.article-detail .meta-row .author:hover { color: var(--brand); }

.article-cover { border-radius: 10px; overflow: hidden; margin-bottom: 26px; height: 300px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 60px; font-weight: 800; }
.article-cover img { width: 100%; height: 100%; object-fit: cover; }

.article-content { font-size: 16px; line-height: 1.9; color: #3d3d3d; }
.article-content p { margin-bottom: 1.2em; }
.article-content h2 { font-size: 22px; margin: 1.5em 0 .7em; }
.article-content h3 { font-size: 18px; margin: 1.4em 0 .6em; }
.article-content ul, .article-content ol { margin: 1em 0 1.2em 1.6em; }
.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }
.article-content blockquote {
    border-left: 4px solid var(--brand);
    background: var(--bg-gray);
    padding: 12px 18px;
    margin: 1.2em 0;
    color: var(--text-light);
    border-radius: 0 4px 4px 0;
}
.article-content img { border-radius: 6px; margin: 1em 0; }
.article-content code { background: var(--bg-gray); padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.article-content a { color: var(--brand); border-bottom: 1px solid rgba(255, 46, 77, .3); }
.article-content pre { background: #2d2d2d; color: #eee; padding: 16px; border-radius: 6px; overflow-x: auto; margin: 1.2em 0; }
.article-content pre code { background: none; padding: 0; color: inherit; font-size: 13.5px; line-height: 1.7; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14px; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 9px 14px; text-align: left; }
.article-content th { background: var(--bg-gray); font-weight: 600; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.article-content .hljs, .article-content .language-mermaid { background: transparent; }
.article-content .footnote-ref, .article-content .footnote-item { font-size: 13px; }
.article-content img { max-width: 100%; }
.article-content strong { color: var(--text); }
.article-content del { color: var(--text-muted); }

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0; }
.article-tags a { padding: 4px 12px; background: var(--bg-gray); border-radius: 14px; font-size: 13px; color: var(--text-light); }
.article-tags a:hover { color: var(--brand); background: #fff0f2; }

.article-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 22px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 26px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    color: var(--text);
    transition: all .2s;
}
.action-btn:hover { border-color: var(--brand); color: var(--brand); }
.action-btn.active { border-color: var(--brand); color: var(--brand); background: #fff0f2; }
.action-btn .count { font-size: 14px; }

/* 相关推荐 */
.related { margin-top: 30px; }
.related h3 { font-size: 16px; margin-bottom: 14px; }
.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.related-item .r-thumb { height: 80px; border-radius: 6px; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; font-weight: 700; }
.related-item .r-title { font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 评论 ---------- */
.comments { margin-top: 34px; }
.comments h3 { font-size: 17px; margin-bottom: 18px; }
.comment-form { margin-bottom: 24px; }
.comment-form textarea {
    width: 100%;
    min-height: 90px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    outline: none;
    font-size: 14.5px;
}
.comment-form textarea:focus { border-color: var(--brand); }
.comment-form .form-foot { display: flex; justify-content: flex-end; margin-top: 10px; gap: 10px; align-items: center; }
.comment-list .comment-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-list .c-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-list .c-body { flex: 1; min-width: 0; }
.comment-list .c-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 13px; color: var(--text-muted); }
.comment-list .c-head .c-author { color: var(--text); font-weight: 600; }
.comment-list .c-content { font-size: 14.5px; line-height: 1.7; }
.comment-list .c-reply { font-size: 12.5px; color: var(--brand); cursor: pointer; background: none; border: none; margin-top: 6px; }
.comment-list .replies { margin-top: 12px; padding-left: 50px; }
.comment-list .replies .comment-item { background: var(--bg-gray); border-radius: 6px; padding: 12px; border-bottom: none; }
.reply-form { margin-top: 10px; }
.reply-form textarea { width: 100%; min-height: 60px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; resize: vertical; }

/* ---------- 认证页 ---------- */
.auth-wrap {
    min-height: calc(100vh - 220px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 0;
    background: var(--bg-gray);
}
.auth-card {
    width: 400px;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 36px 34px;
}
.auth-card .auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.auth-card .auth-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13.5px; margin-bottom: 6px; color: var(--text-light); }
.form-control {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: none;
    transition: border-color .2s;
    background: #fff;
}
.form-control:focus { border-color: var(--brand); }
textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; }
.form-error { color: var(--brand); font-size: 12.5px; margin-top: 4px; }
.form-hint { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--text-muted); }
.auth-foot a { color: var(--brand); }

/* ---------- 用户主页 ---------- */
.profile-card {
    display: flex;
    align-items: center;
    gap: 22px;
    background: var(--bg-gray);
    border-radius: 10px;
    padding: 28px 30px;
    margin-bottom: 26px;
}
.profile-card .big-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; }
.profile-card .p-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.profile-card .p-bio { color: var(--text-light); font-size: 14px; }
.profile-card .p-meta { display: flex; gap: 20px; margin-top: 10px; font-size: 13px; color: var(--text-muted); }
.profile-card .p-meta strong { color: var(--text); font-size: 15px; }
.profile-card .p-right { margin-left: auto; }

/* ---------- 个人中心 ---------- */
.account-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 30px; padding: 26px 0 50px; align-items: start; }
.account-nav { background: var(--bg-gray); border-radius: 8px; padding: 12px 0; position: sticky; top: 80px; }
.account-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: var(--text-light);
    font-size: 14px;
    border-left: 3px solid transparent;
}
.account-nav a:hover { color: var(--brand); background: #fff; }
.account-nav a.active { color: var(--brand); background: #fff; border-left-color: var(--brand); font-weight: 600; }
.account-main { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 26px 28px; }
.account-main h2 { font-size: 18px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }

/* 头像上传 */
.avatar-upload { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar-upload .preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }

/* 表格（个人中心通用） */
.table-mini { width: 100%; font-size: 13.5px; }
.table-mini td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-mini tr:hover td { background: #fafafa; }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.status-published { background: #eafaf1; color: #0a7a3e; }
.status-review { background: #fff8e6; color: #b8860b; }
.status-draft { background: #f0f0f0; color: #666; }
.status-rejected { background: #fdf0f1; color: #c0392b; }

/* ---------- 分页 ---------- */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 30px; }
.pagination a, .pagination span {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13.5px;
    color: var(--text);
}
.pagination .active span, .pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .disabled span { color: #ccc; cursor: not-allowed; }

/* ---------- 页脚 ---------- */
.site-footer {
    background: #1e1e20;
    color: #999;
    padding: 30px 0;
    margin-top: 40px;
    font-size: 13px;
}
.site-footer .footer-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }
.site-footer .footer-brand { color: #fff; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .page-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
    .main-nav { display: none; }
    .account-wrap { grid-template-columns: 1fr; }
    .article-card .thumb { width: 130px; height: 90px; }
    .featured-card h2 { font-size: 20px; }
}
