/* ===================================================================
   频道卡片网格（频道首页 / 频道广场）
   对齐紧凑设计稿：小头像 40px、紧凑内边距、无线帖数/热度
   支持手机（2 列）→ 平板（3 列）→ 电脑（4 列）响应式适配
   =================================================================== */

.channel-grid-wrap {
    max-width: 1040px;
    margin: 0 auto;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 6px 12px 18px;
}

/* 卡片 */
.channel-card {
    display: flex;
    align-items: flex-start; /* 默认子项靠上：让频道名靠上，头像与按钮通过 align-self 独立控制 */
    gap: 8px;
    min-width: 0;
    padding: 7px 12px 6px; /* 顶部小让名称靠上、底部更小让按钮更贴下沿 */
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
}
.channel-card:hover,
.channel-card:active {
    border-color: var(--primary);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

/* 让名称更靠上 */
.channel-card .cc-name { padding-top: 0; margin-top: -3px; }

/* 头像 */
.cc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    align-self: center; /* 头像垂直居中 */
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* 无头像时的多彩占位（用频道名首字符） */
.cc-avatar.ph {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    user-select: none;
}
.cc-avatar.ph.ph-c0 { background: linear-gradient(135deg, #5ac8fa, #0a84ff); }
.cc-avatar.ph.ph-c1 { background: linear-gradient(135deg, #ffd60a, #ff9500); }
.cc-avatar.ph.ph-c2 { background: linear-gradient(135deg, #bf5af2, #5856d6); }
.cc-avatar.ph.ph-c3 { background: linear-gradient(135deg, #34c759, #28a745); }
.cc-avatar.ph.ph-c4 { background: linear-gradient(135deg, #ff6482, #ff2d55); }

/* 名称：占满中间并靠上；关注按钮固定在卡片右下角，所有卡片对齐 */
.cc-name {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* 关注 / 进入 按钮 */
.cc-action {
    flex-shrink: 0;
    align-self: flex-end; /* 固定在卡片右下角，避免因名称长短不一导致左右不齐 */
    margin-bottom: 0;
    padding: 3px 10px;
    min-height: 22px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #4A90E2, #5BA3F5); /* 设计稿关注按钮的蓝色渐变 */
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}
.cc-action.enter { background: linear-gradient(135deg, #4A90E2, #5BA3F5); color: #fff; border: none; }
.cc-action.pending { background: var(--warning); color: #fff; }
.cc-action.joined { background: var(--success); color: #fff; }
.cc-action:disabled { opacity: 0.6; cursor: default; }
.cc-action:not(:disabled):hover { opacity: 0.88; }

/* ---------------- 响应式断点（仅调列数与间距，字号/始终紧凑） ---------------- */
@media (min-width: 720px) {
    .channel-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
@media (min-width: 1000px) {
    .channel-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; padding-top: 10px; }
    .channel-card { padding: 8px 13px 7px; }
}

/* ---------------- 电脑端页面整体适配（把窄容器放宽并将页面头部/搜索居中） ---------------- */
@media (min-width: 1024px) {
    .channel-cards-page .container { max-width: 1100px; }
    .channel-cards-page .header,
    .channel-cards-page .bottom-nav { left: 50%; transform: translateX(-50%); }
    .channel-cards-page .channel-page-header,
    .channel-cards-page .search-bar,
    .channel-cards-page .section-title {
        max-width: 1040px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
}