/* ============================================================
 * community.css — 热门圈子 / 热门话题 的列表页与详情页专用样式
 * 与 news.css 同链使用（.info-main-header / .info-cat-tabs /
 * .db-adcol / .product-grid 等类沿用 news.css，这里只补新模块）。
 * 间距遵守首页三级规范：模块 24 / 网格 16 / 卡片内部 8。
 * ============================================================ */

/* ===== 1. 列表项：话题 ===== */
.topic-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #f0f2f5;
    transition: 0.2s;
}
.topic-item:last-child {
    border-bottom: none;
}
.topic-item:hover {
    padding-left: 6px;
}
.topic-item .topic-thumb {
    flex: 0 0 auto;
    width: 108px;
    height: 72px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-gray);
}
.topic-item .topic-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.topic-item .topic-thumb-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary-blue);
    background: var(--primary-light);
}
.topic-item .topic-item-main {
    flex: 1 1 auto;
    min-width: 0;
}
.topic-item .topic-item-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}
.topic-item .topic-item-title a {
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.topic-item .topic-item-title a:hover {
    color: var(--primary-blue);
}
.topic-item .topic-item-summary {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.topic-item .topic-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.topic-item .topic-item-meta i {
    color: var(--primary-blue);
    margin-right: 4px;
}

/* ===== 2. 列表项：圈子 ===== */
.circle-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: 0.2s;
}
.circle-row:last-child {
    margin-bottom: 0;
}
.circle-row:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
}
.circle-row .circle-row-thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-gray);
}
.circle-row .circle-row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.circle-row .circle-row-thumb-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}
.circle-row .circle-row-main {
    flex: 1 1 auto;
    min-width: 0;
}
.circle-row .circle-row-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}
.circle-row .circle-row-name a:hover {
    color: var(--primary-blue);
}
.circle-row .circle-row-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.circle-row .circle-row-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.circle-row .circle-row-stats i {
    color: var(--primary-blue);
    margin-right: 4px;
}
.circle-row .circle-row-arrow {
    flex: 0 0 auto;
    color: var(--border-color);
    font-size: 1.1rem;
    transition: 0.2s;
}
.circle-row:hover .circle-row-arrow {
    color: var(--primary-blue);
    transform: translateX(4px);
}

/* ===== 3. 圈子详情页头部 ===== */
.circle-hero {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
    margin-bottom: 24px;
    background: #fff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.circle-hero .circle-hero-cover {
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-gray);
}
.circle-hero .circle-hero-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.circle-hero .circle-hero-cover-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
}
.circle-hero .circle-hero-main {
    flex: 1 1 auto;
    min-width: 0;
}
.circle-hero .circle-hero-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.3;
    margin: 0 0 8px 0;
}
.circle-hero .circle-hero-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin: 0 0 16px 0;
}
.circle-hero .circle-hero-bottom {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
}
.circle-hero .circle-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}
.circle-hero .circle-stat-num {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.2;
}
.circle-hero .circle-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.circle-join-btn {
    display: inline-block;
    padding: 8px 32px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary-blue);
    border: none;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}
.circle-join-btn:hover {
    background: var(--accent-orange);
}

/* ===== 4. 圈子帖子卡片 ===== */
.post-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}
.post-list-head .post-count {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}
.post-card {
    padding: 16px 0;
    border-bottom: 1px solid #f0f2f5;
}
.post-card:last-child {
    border-bottom: none;
}
.post-card .post-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.post-card .post-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}
.post-card .post-author {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
}
.post-card .post-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.post-card .post-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent-orange);
    padding: 2px 10px;
}
.post-card .post-badge.top {
    background: #ff4757;
}
.post-card .post-text {
    font-size: 0.98rem;
    line-height: 1.85;
    color: #2c3e50;
    margin-bottom: 12px;
}
.post-card .post-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.post-card .post-images img {
    width: 100%;
    height: 108px;
    object-fit: cover;
    display: block;
    border: 1px solid var(--border-color);
    background: var(--bg-gray);
}
.post-card .post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.post-card .post-actions span i {
    margin-right: 6px;
    color: var(--primary-blue);
}

/* ===== 5. 右栏推荐面板（其他话题 / 其他圈子） ===== */
.side-panel {
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.side-panel .side-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
    background: linear-gradient(90deg, #f5b62f, #f6d089);
}
.side-panel .side-panel-body {
    padding: 8px 16px 16px 16px;
}
.side-panel .side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.9rem;
    color: var(--text-dark);
}
.side-panel .side-link:last-child {
    border-bottom: none;
}
.side-panel .side-link:hover {
    color: var(--primary-blue);
}
.side-panel .side-link .side-rank {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-gray);
}
.side-panel .side-link:nth-child(-n + 3) .side-rank {
    color: #fff;
    background: var(--accent-orange);
}
.side-panel .side-link .side-link-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 品类入口用的是接口品类图标（无图时 FA 兜底），不是榜单序号 */
.side-panel .side-link .side-cat-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    object-fit: contain;
}
.side-panel .side-link .side-cat-icon--ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.side-panel .side-link .side-link-num {
    flex: 0 0 auto;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== 6. 推荐设备卡片里的真实图片 =====
 * news.css 只给了占位 div（.card-img-ph）的样式，没有 .card-img-wrap 里真实 img 的规则；
 * 这几条与 home_cont.css 的「热门机型」卡片同一套尺寸，保证窄屏不会按图片原始宽度撑破容器。
 */
.product-grid .product-card .card-img-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    transition: transform 0.4s ease;
}
.product-grid .product-card:hover .card-img-wrap img {
    transform: scale(1.04);
}
.product-grid .product-card img {
    display: block;
}

/* ===== 7. 话题详情正文补充（正文封面图与接口 HTML 归一化） ===== */
.article-detail-wrap .article-cover {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.article-detail-wrap .article-body a {
    color: var(--primary-blue);
    text-decoration: underline;
}
.article-detail-wrap .comment-wrap {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}
.article-detail-wrap .comment-wrap .comment-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
}

/* ===== 8. 加载 / 空态 ===== */
.community-loading,
.community-empty {
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.community-loading i,
.community-empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--border-color);
}

/* ===== 9. 圈子/帖子徽标配色 =====
 * news.css 的 .badge-status.* 是白字大色块（推荐=橙底、top=蓝底），压在圈子名后面偏重，
 * 这里只覆盖圈子列表与圈子详情用到的那几种，改成浅底 + 同色描边的胶囊。
 * 文字色均按 WCAG 核算过：#926738/#fff7e6=4.67、#0052a4/#e8f0fe=6.68、#b0451d/#fdeee6=4.99，都过 AA。
 */
.circle-row .circle-row-name .badge-status,
.circle-hero .circle-hero-name .badge-status,
.post-card .post-badge {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.6;
    padding: 1px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
    letter-spacing: 0.2px;
}
/* 官方推荐：与金条标题同色系（#f5b62f→#f6d089，文字取金条「更多」的 #926738） */
.circle-row .circle-row-name .badge-status.recommend,
.circle-hero .circle-hero-name .badge-status.recommend,
.post-card .post-badge.hot {
    color: #926738;
    background: #fff7e6;
    border-color: #f0c46a;
}
/* 机型圈子：主蓝浅底 */
.circle-row .circle-row-name .badge-status.top,
.circle-hero .circle-hero-name .badge-status.top {
    color: #0052a4;
    background: #e8f0fe;
    border-color: #b9d0f0;
}
/* 帖子「置顶」：暖红浅底，和热帖区分但不刺眼 */
.post-card .post-badge.top {
    color: #b0451d;
    background: #fdeee6;
    border-color: #f3c3a5;
}

/* ===== 10. 缩略图全屏预览（js/img-preview.js） =====
 * 层级要盖过导航(1050)、二维码弹层(999)与首页广告层(10050)，取 10500。
 */
.topic-item,
.circle-row {
    cursor: pointer;
}
.topic-thumb img,
.circle-row-thumb img {
    cursor: zoom-in;
}
.img-preview {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px 24px 24px 24px;
    background: rgba(10, 26, 46, 0.86);
}
.img-preview[hidden] {
    display: none;
}
.img-preview-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}
.img-preview-img {
    max-width: min(92vw, 1160px);
    max-height: 76vh;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.06);
}
.img-preview-caption {
    margin: 12px 0 0 0;
    max-width: 80vw;
    text-align: center;
    font-size: 0.95rem;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.img-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s;
}
.img-preview-close:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: #1a2332;
}
.img-preview-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
/* 预览打开时锁背景滚动 */
html.img-preview-open,
html.img-preview-open body {
    overflow: hidden;
}
@media (max-width: 768px) {
    .img-preview {
        padding: 56px 12px 12px 12px;
    }
    .img-preview-img {
        max-height: 70vh;
    }
    .img-preview-caption {
        font-size: 0.85rem;
        max-width: 92vw;
    }
    .img-preview-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
}

/* ===== 11. 窄屏 ===== */
@media (max-width: 768px) {
    .topic-item .topic-thumb {
        width: 84px;
        height: 60px;
    }
    .topic-item .topic-item-title {
        font-size: 0.98rem;
    }
    .circle-row .circle-row-thumb {
        width: 56px;
        height: 56px;
    }
    .circle-row .circle-row-name {
        font-size: 1rem;
    }
    .circle-hero {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    .circle-hero .circle-hero-name {
        font-size: 1.3rem;
    }
    .circle-hero .circle-hero-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
    .post-card .post-images {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .topic-item {
        gap: 12px;
    }
    .topic-item .topic-thumb {
        width: 64px;
        height: 48px;
    }
    .topic-item .topic-item-meta {
        gap: 4px 12px;
        font-size: 0.75rem;
    }
    .circle-row .circle-row-arrow {
        display: none;
    }
    .circle-hero .circle-hero-cover {
        width: 72px;
        height: 72px;
    }
}
