/* ========== 社区论坛 ========== */
:root {
    --cm-surface: #ffffff;
    --cm-surface-soft: #f8fafc;
    --cm-line: #e8eef5;
    --cm-ink: #0f172a;
    --cm-muted: #64748b;
    --cm-accent: var(--primary, #0831cb);
    --cm-accent-soft: rgba(8, 49, 203, .08);
    --cm-radius: 14px;
    --cm-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.community-page {
    --page-pad-y: 36px;
}

.community-hero {
    padding: 28px 0 36px;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(8, 49, 203, .08), transparent 55%),
        linear-gradient(180deg, #f4f7fc 0%, #ffffff 100%);
}
.community-hero .breadcrumb {
    margin-bottom: 12px !important;
    font-size: 13px;
}
.community-hero-main {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.community-hero-copy {
    max-width: 640px;
}
.community-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--cm-accent);
    background: var(--cm-accent-soft);
    margin-bottom: 10px;
}
.community-hero-title {
    font-size: clamp(26px, 3.6vw, 36px);
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--cm-ink);
    margin: 0 0 8px;
    line-height: 1.25;
}
.community-hero-desc {
    margin: 0;
    color: var(--cm-muted);
    font-size: 15px;
    line-height: 1.65;
    max-width: 36em;
}
.community-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.community-page-wrap {
    padding: var(--page-pad-y) 0 64px;
}

/* 工具栏 */
.community-toolbar {
    position: sticky;
    top: 72px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius);
    box-shadow: 0 4px 18px rgba(15, 23, 42, .04);
    backdrop-filter: blur(10px);
}
.community-cat-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
    padding-bottom: 2px;
}
.community-cat-tabs::-webkit-scrollbar { display: none; }
.community-cat-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    background: var(--cm-surface-soft);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s, color .2s, border-color .2s;
}
.community-cat-tab:hover {
    background: var(--cm-accent-soft);
    color: var(--cm-accent);
}
.community-cat-tab.active {
    background: var(--cm-accent);
    color: #fff;
}
.community-cat-tab i { font-size: 14px; }
.community-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.community-search { width: 220px; max-width: 100%; }
.community-search .form-control {
    border-color: var(--cm-line);
    font-size: 13px;
}
.community-search .btn { min-width: 40px; }
.community-new-post-btn {
    white-space: nowrap;
    font-weight: 600;
}

/* 帖子列表 */
.community-post-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.community-post-item {
    position: relative;
    display: flex;
    gap: 18px;
    padding: 18px 18px 16px;
    background: var(--cm-surface);
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius);
    text-decoration: none;
    color: inherit;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
.community-post-item:hover {
    border-color: #c7d7f5;
    box-shadow: var(--cm-shadow);
    transform: translateY(-2px);
    color: inherit;
}
.community-post-item.is-top {
    background: linear-gradient(180deg, #fffaf5 0%, #fff 55%);
    border-color: #fde2c8;
}
.community-post-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.community-post-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.community-post-cat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cm-accent);
    background: var(--cm-accent-soft);
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.community-top-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #b45309;
    background: #ffedd5;
    padding: 3px 8px;
    border-radius: 6px;
}
.community-post-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 750;
    color: var(--cm-ink);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .2s;
}
.community-post-item:hover .community-post-title { color: var(--cm-accent); }
.community-post-summary {
    font-size: 14px;
    color: var(--cm-muted);
    line-height: 1.65;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.community-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: auto;
    font-size: 12px;
    color: #94a3b8;
}
.community-post-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.community-post-meta i { font-size: 13px; }
.community-post-thumb {
    flex-shrink: 0;
    width: 128px;
    height: 96px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--cm-surface-soft);
}
.community-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s;
}
.community-post-item:hover .community-post-thumb img { transform: scale(1.05); }

.community-empty {
    text-align: center;
    padding: 56px 20px;
    color: #94a3b8;
    background: var(--cm-surface);
    border: 1px dashed var(--cm-line);
    border-radius: var(--cm-radius);
}
.community-empty i {
    font-size: 42px;
    display: block;
    margin-bottom: 10px;
    opacity: .7;
}
.community-empty p { margin: 0 0 16px; }
.community-pagination {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

/* 侧边栏 */
.community-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 96px;
}
.community-side-card {
    background: var(--cm-surface);
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius);
    padding: 18px;
}
.community-side-head {
    font-size: 15px;
    font-weight: 750;
    color: var(--cm-ink);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.community-side-head i { color: var(--cm-accent); }

.community-stats-card {
    background: linear-gradient(160deg, #f5f8ff 0%, #fff 70%);
    border-color: #dbe7ff;
}
.community-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.community-stat-item { text-align: center; }
.community-stat-item strong {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--cm-accent);
    line-height: 1.2;
}
.community-stat-item span {
    font-size: 12px;
    color: var(--cm-muted);
}

.community-hot-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.community-hot-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid #f1f5f9;
}
.community-hot-list li:last-child { border-bottom: none; }
.community-hot-rank {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.community-hot-rank.top {
    background: var(--cm-accent);
    color: #fff;
}
.community-hot-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: #334155;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.community-hot-title:hover { color: var(--cm-accent); }
.community-hot-views {
    font-size: 12px;
    color: #94a3b8;
    flex-shrink: 0;
}

.community-side-cta {
    background: linear-gradient(145deg, #0b2bb8 0%, #2563eb 100%);
    border-radius: var(--cm-radius);
    padding: 22px 18px;
    text-align: center;
    color: #fff;
}
.community-side-cta h3 {
    font-size: 16px;
    font-weight: 750;
    margin: 0 0 8px;
}
.community-side-cta p {
    font-size: 13px;
    color: rgba(255, 255, 255, .78);
    margin: 0 0 14px;
    line-height: 1.55;
}
.community-side-cta .btn-light {
    font-weight: 600;
}
.community-side-cta a.text-white:hover { opacity: .9; }

/* 详情页 */
.community-detail-hero {
    background: linear-gradient(180deg, #f4f7fc 0%, #fff 100%);
    padding: 18px 0;
}
.community-detail-wrap { padding: 28px 0 64px; }
.community-article-card {
    padding: 28px 30px;
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius);
    background: var(--cm-surface);
    box-shadow: var(--cm-shadow);
}
.community-article-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.community-article-title {
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 800;
    color: var(--cm-ink);
    line-height: 1.35;
    margin: 0 0 14px;
    letter-spacing: -.02em;
}
.community-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--cm-muted);
    padding-bottom: 18px;
    border-bottom: 1px solid var(--cm-line);
    margin-bottom: 22px;
}
.community-article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.community-article-cover {
    margin-bottom: 22px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--cm-surface-soft);
}
.community-article-cover img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}
.community-article-body {
    font-size: 15.5px;
    line-height: 1.9;
    color: #334155;
}
.community-article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 12px auto;
}
.community-article-body p { margin-bottom: 1em; }

/* 回复区 */
.community-reply-section {
    padding: 24px 28px;
    margin-top: 18px;
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius);
    background: var(--cm-surface);
}
.community-reply-head h3 {
    font-size: 17px;
    font-weight: 750;
    color: var(--cm-ink);
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--cm-line);
}
.community-reply-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.community-reply-item {
    display: flex;
    gap: 12px;
}
.community-reply-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1d4ed8, #3b82f6);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.community-reply-avatar.sm {
    width: 30px;
    height: 30px;
    font-size: 13px;
}
.community-reply-body { flex: 1; min-width: 0; }
.community-reply-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.community-reply-author {
    font-size: 14px;
    font-weight: 700;
    color: var(--cm-ink);
}
.community-reply-floor {
    font-size: 11px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 999px;
}
.community-reply-time {
    font-size: 12px;
    color: #94a3b8;
    margin-left: auto;
}
.community-reply-content {
    font-size: 14px;
    line-height: 1.8;
    color: #334155;
    background: var(--cm-surface-soft);
    border-radius: 10px;
    padding: 12px 14px;
    word-break: break-word;
}
.community-reply-empty {
    text-align: center;
    padding: 36px 16px;
    color: #94a3b8;
}
.community-reply-empty i {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
}

.community-reply-form-wrap {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--cm-line);
}
.community-reply-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}
.community-reply-form-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cm-ink);
}
.community-reply-textarea {
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    min-height: 110px;
    border-color: var(--cm-line);
}
.community-reply-textarea:focus {
    border-color: var(--cm-accent);
    box-shadow: 0 0 0 3px var(--cm-accent-soft);
}
.community-reply-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    gap: 10px;
}
.community-reply-auth-gate {
    text-align: center;
    padding: 28px 18px;
    border-radius: 12px;
    background: var(--cm-surface-soft);
    border: 1px dashed #cbd5e1;
}
.community-reply-auth-gate i {
    font-size: 32px;
    color: var(--cm-accent);
    display: block;
    margin-bottom: 8px;
}
.community-reply-auth-gate p {
    font-size: 14px;
    color: var(--cm-muted);
    margin-bottom: 14px;
}

.community-nav-link {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
}
.community-nav-link:last-child { border-bottom: none; }
.community-nav-label {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 2px;
}
.community-nav-title {
    display: block;
    font-size: 14px;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.community-nav-link:hover .community-nav-title { color: var(--cm-accent); }

/* 认证门槛 / 发帖页 */
.community-auth-gate {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 420px;
    padding: 40px 0;
}
.community-auth-card {
    max-width: 480px;
    width: 100%;
    padding: 40px 32px;
    border-radius: var(--cm-radius);
    border: 1px solid var(--cm-line);
    background: #fff;
    box-shadow: var(--cm-shadow);
}
.community-auth-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--cm-accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--cm-accent);
}
.community-auth-card h2 {
    font-size: 20px;
    font-weight: 750;
    color: var(--cm-ink);
    margin-bottom: 8px;
}
.community-auth-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.community-post-page { padding: 28px 0 64px; }
.community-post-form {
    padding: 28px 30px;
    border: 1px solid var(--cm-line);
    border-radius: var(--cm-radius);
    background: #fff;
    box-shadow: var(--cm-shadow);
}
.community-post-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cm-line);
    gap: 12px;
    flex-wrap: wrap;
}
.community-post-form-head h2 {
    font-size: 20px;
    font-weight: 750;
    color: var(--cm-ink);
    margin: 0;
}
.community-post-form-user {
    font-size: 13px;
    color: var(--cm-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.community-cat-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.community-cat-option { cursor: pointer; }
.community-cat-option input { position: absolute; opacity: 0; pointer-events: none; }
.community-cat-option span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--cm-line);
    background: var(--cm-surface-soft);
    font-size: 13px;
    color: #475569;
    transition: all .2s;
}
.community-cat-option input:checked + span,
.community-cat-option:hover span {
    border-color: var(--cm-accent);
    background: var(--cm-accent-soft);
    color: var(--cm-accent);
    font-weight: 600;
}
.community-editor {
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    min-height: 220px;
    border-color: var(--cm-line);
}
.community-editor:focus {
    border-color: var(--cm-accent);
    box-shadow: 0 0 0 3px var(--cm-accent-soft);
}
.community-post-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.community-post-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.community-post-tips li {
    font-size: 13px;
    color: #64748b;
    line-height: 1.8;
    padding-left: 18px;
    position: relative;
}
.community-post-tips li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 11px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cm-accent);
}

/* 移动端悬浮发帖 */
.community-fab {
    display: none;
    position: fixed;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--cm-accent);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 10px 24px rgba(8, 49, 203, .35);
    text-decoration: none;
}
.community-fab:hover { color: #fff; }
body.has-h5-tabbar .community-fab {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 991.98px) {
    .community-sidebar { position: static; }
    .community-toolbar { top: 60px; }
}

@media (max-width: 768px) {
    .community-hero { padding: 20px 0 24px; }
    .community-hero-main { align-items: stretch; }
    .community-hero-actions { width: 100%; }
    .community-hero-actions .btn { flex: 1; }
    .community-page-wrap,
    .community-detail-wrap,
    .community-post-page { padding-top: 20px; padding-bottom: 88px; }

    .community-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        top: 56px;
    }
    .community-toolbar-right {
        width: 100%;
        flex-direction: column;
    }
    .community-search,
    .community-new-post-btn { width: 100%; }
    .community-toolbar .community-new-post-btn { display: none; }

    .community-post-item {
        flex-direction: column;
        padding: 14px;
        gap: 12px;
    }
    .community-post-thumb {
        width: 100%;
        height: 160px;
        order: -1;
    }
    .community-post-title { font-size: 16px; }

    .community-article-card,
    .community-reply-section,
    .community-post-form { padding: 18px 16px; }
    .community-stats-grid { gap: 4px; }
    .community-stat-item strong { font-size: 18px; }

    .community-post-form-actions { flex-direction: column; }
    .community-post-form-actions .btn { width: 100%; }
    .community-reply-form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .community-reply-form-actions .btn { width: 100%; }
    .community-reply-time { margin-left: 0; width: 100%; }

    .community-fab { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
    .community-post-item,
    .community-post-thumb img { transition: none; }
}
