/* ═══════════════ 论坛 · Twitter/X 风格 ═══════════════ */
/* 扁平卡片 · 纯白底色 · 细线分割 · 无圆角 · 无阴影 */

.forum-shell {
  height: 100%; display: flex; flex-direction: column;
  background: #ffffff; overflow: hidden;
}

/* ═══ Block 1: 顶部导航栏 ═══ */
.forum-nav {
  display: flex; align-items: center;
  padding: calc(8px + var(--sab, 0px)) 10px 6px;
  gap: 8px; background: #fff; flex-shrink: 0;
  border-bottom: 0.5px solid #eaeaea;
}
.forum-nav-back {
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; border: none;
  color: #0f1419; font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.forum-nav-back:active { background: #f0f0f0; }
.forum-search {
  flex: 1; height: 32px; border-radius: 16px;
  border: none; background: #eff3f4;
  color: #0f1419; padding: 0 14px;
  font-size: 12px; outline: none;
}
.forum-search::placeholder { color: #657786; }
.forum-nav-bell {
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; border: none;
  color: #0f1419; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ═══ Block 2: 分类标签 Tab ═══ */
.forum-tabs {
  display: flex; align-items: center;
  background: #fff; flex-shrink: 0;
  border-bottom: 0.5px solid #eaeaea;
  padding: 0 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.forum-tabs::-webkit-scrollbar { display: none; }
.forum-tab {
  padding: 12px 14px; font-size: 13px; color: #657786;
  cursor: pointer; white-space: nowrap; position: relative;
  font-weight: 400; letter-spacing: 0.3px;
  transition: color 0.15s; flex-shrink: 0;
}
.forum-tab.active {
  color: #0f1419; font-weight: 700;
}
.forum-tab.active::after {
  content: ''; position: absolute; bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: calc(100% - 28px); height: 3px;
  background: #1d9bf0; border-radius: 2px;
}

/* ═══ Block 4: 信息流主体 ═══ */
.forum-feed {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.forum-feed::-webkit-scrollbar { width: 0; }

/* 单条帖子 */
.forum-post {
  padding: 12px 14px; border-bottom: 0.5px solid #eaeaea;
  background: #fff;
}
.forum-post:active { background: #f8f8f8; }

.forum-post-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.forum-post-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #eff3f4; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 17px;
}
.forum-post-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.forum-post-user {
  font-size: 15px; font-weight: 700; color: #0f1419;
}
.forum-post-time {
  font-size: 11px; color: #657786; margin-left: auto; white-space: nowrap;
}
.forum-post-more {
  width: 24px; height: 24px; border-radius: 50%;
  background: none; border: none; color: #657786;
  font-size: 16px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}

/* 板块标签 — 淡化，不抢视觉 */
.forum-post-section {
  display: none;
}

/* 正文 */
.forum-post-body {
  font-size: 14px; line-height: 1.4; color: #0f1419;
  margin-bottom: 6px; word-break: break-word;
}

/* 交互按钮行 */
.forum-post-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; max-width: 360px;
}
.forum-post-action {
  display: flex; align-items: center; gap: 4px;
  font-size: 14px; color: #657786; cursor: pointer;
  background: none; border: none; padding: 4px 8px;
  border-radius: 14px; transition: all 0.15s;
}
.forum-post-action:hover { color: #1d9bf0; }
.forum-post-action:active { background: rgba(29,155,240,0.08); }
.forum-post-action svg {
  width: 16px; height: 16px; stroke: currentColor;
  fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* 空态 */
.forum-empty {
  padding: 60px 20px; text-align: center;
  color: #657786; font-size: 13px; letter-spacing: 1px;
}

/* ═══ Block 3: 浮动发帖按钮 ═══ */
.forum-fab {
  position: fixed; bottom: calc(80px + var(--sab, 0px)); right: 20px;
  width: 52px; height: 52px; border-radius: 50%;
  background: #1d9bf0; border: none;
  box-shadow: 0 4px 16px rgba(29,155,240,0.35);
  color: #fff; font-size: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 100; transition: transform 0.2s, box-shadow 0.2s;
}
.forum-fab:active { transform: scale(0.9); box-shadow: 0 2px 8px rgba(29,155,240,0.25); }

/* ═══ 发帖弹窗 ═══ */
.forum-compose-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-end; justify-content: center;
}
.forum-compose-card {
  width: 100%; max-width: 500px;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + var(--sab, 0px));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}
.forum-compose-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.forum-compose-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: none; border: none; font-size: 18px;
  color: #0f1419; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.forum-compose-input {
  width: 100%; min-height: 80px; border: none;
  font-size: 15px; color: #0f1419; outline: none;
  resize: none; line-height: 1.5; font-family: inherit;
}
.forum-compose-input::placeholder { color: #657786; }
.forum-compose-section {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-top: 0.5px solid #eaeaea;
}
.forum-compose-section-label {
  font-size: 11px; color: #657786; white-space: nowrap;
}
.forum-compose-section select {
  font-size: 12px; color: #0f1419; border: 0.5px solid #eaeaea;
  border-radius: 12px; padding: 4px 10px; outline: none; background: #fff;
}
.forum-compose-submit {
  width: 100%; padding: 10px; border-radius: 20px;
  border: none; background: #1d9bf0; color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  margin-top: 10px; letter-spacing: 1px;
}
.forum-compose-submit:active { opacity: 0.8; transform: scale(0.98); }
.forum-compose-submit:disabled { opacity: 0.4; }

/* ═══ 加载 ═══ */
.forum-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 20px; gap: 6px; color: #657786; font-size: 12px;
}

/* ═══ 设置面板 ═══ */
.forum-settings-panel {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-end; justify-content: center;
}
.forum-settings-card {
  width: 100%; max-width: 500px;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + var(--sab, 0px));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

/* ═══ 暗色模式 ═══ */
html.dark-mode .forum-shell { background: #15202b; }
html.dark-mode .forum-nav,
html.dark-mode .forum-tabs { background: #15202b; border-color: #38444d; }
html.dark-mode .forum-nav-back,
html.dark-mode .forum-nav-bell { color: #e7e9ea; }
html.dark-mode .forum-search { background: #253341; color: #e7e9ea; }
html.dark-mode .forum-tab { color: #8899a6; }
html.dark-mode .forum-tab.active { color: #e7e9ea; }
html.dark-mode .forum-post { background: #15202b; border-color: #38444d; }
html.dark-mode .forum-post-body { color: #e7e9ea; }
html.dark-mode .forum-post-user { color: #e7e9ea; }
html.dark-mode .forum-compose-card,
html.dark-mode .forum-settings-card { background: #1e2732; }
html.dark-mode .forum-compose-overlay,
html.dark-mode .forum-settings-panel { background: rgba(0,0,0,0.65); }
html.dark-mode .forum-compose-input { color: #e7e9ea; background: #253341; }
html.dark-mode .forum-compose-input::placeholder { color: #8899a6; }
html.dark-mode .forum-compose-header { color: #e7e9ea; }
html.dark-mode .forum-compose-close { color: #e7e9ea; }
html.dark-mode .forum-compose-section { border-color: #38444d; }
html.dark-mode .forum-compose-section-label { color: #8899a6; }
html.dark-mode .forum-compose-section select { color: #e7e9ea; background: #253341; border-color: #38444d; }
html.dark-mode .forum-settings-panel { background: rgba(0,0,0,0.6); }
html.dark-mode .forum-char-chip { background: #253341; color: #8899a6; }
html.dark-mode .forum-char-chip.selected { background: rgba(29,155,240,0.2); color: #1d9bf0; }
html.dark-mode .forum-compose-submit:disabled { opacity: 0.4; }

/* ─── 热点标签栏（非热点页顶部小标签） ─── */
.forum-hot-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 14px; border-bottom: 0.5px solid #eaeaea;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.forum-hot-tag {
  flex-shrink: 0; padding: 4px 10px; border-radius: 14px;
  background: #f7f9f9; font-size: 11px; color: #536471;
  cursor: pointer; white-space: nowrap;
}
.forum-hot-tag:active { background: #e8f5fd; }
html.dark-mode .forum-hot-tags { border-color: #38444d; }
html.dark-mode .forum-hot-tag { background: #1e2732; color: #8899a6; }

/* ─── 热点页竖排列表 ─── */
.forum-hot-list {
  padding: 0 0 8px;
  flex-shrink: 0;
}
.forum-hot-section-title {
  font-size: 14px; font-weight: 700; color: #0f1419;
  padding: 12px 14px 8px; letter-spacing: 0.5px;
}
.forum-hot-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 0.5px solid #f0f0f0;
  cursor: pointer; transition: background 0.15s;
}
.forum-hot-card:active { background: #f8f8f8; }
.forum-hot-rank {
  width: 22px; height: 22px; border-radius: 6px;
  background: #f0f0f0; color: #999;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.forum-hot-card:nth-child(2) .forum-hot-rank,
.forum-hot-card:nth-child(3) .forum-hot-rank,
.forum-hot-card:nth-child(4) .forum-hot-rank { background: #fef0f0; color: #ec4141; }
.forum-hot-card-info {
  flex: 1; min-width: 0;
}
.forum-hot-card-title {
  font-size: 13px; font-weight: 600; color: #0f1419;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.forum-hot-card-tags {
  font-size: 11px; color: #1d9bf0; margin-top: 2px;
}
.forum-hot-card-heat {
  font-size: 11px; color: #e8875b; font-weight: 500; flex-shrink: 0;
}
html.dark-mode .forum-hot-section-title { color: #e7e9ea; }
html.dark-mode .forum-hot-card { border-color: #253341; }
html.dark-mode .forum-hot-card:active { background: #1a2733; }
html.dark-mode .forum-hot-card-title { color: #e7e9ea; }
html.dark-mode .forum-hot-rank { background: #253341; color: #8899a6; }

/* ─── 设置页角色勾选行 ─── */
.forum-char-row {
  user-select: none; -webkit-user-select: none;
  outline: none !important; -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  -webkit-touch-callout: none;
}
.forum-char-row * {
  outline: none !important;
  user-select: none; -webkit-user-select: none;
}
.forum-char-row.selected {
  background: rgba(29,155,240,0.04);
}
/* ★ 只点方块才切换，方块有 cursor:pointer */
.forum-char-check {
  transition: border-color 0.15s, background 0.15s;
}
.forum-char-check:active { transform: scale(0.9); }
.forum-char-row.selected .forum-char-check {
  border-color: #1d9bf0 !important;
  background: #1d9bf0 !important;
}

/* ─── 热点筛选条 ─── */
.forum-hot-filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 0.5px solid #eaeaea;
}
.forum-hot-back {
  background: none; border: none; color: #1d9bf0;
  font-size: 13px; cursor: pointer; padding: 4px 8px;
  border-radius: 14px;
}
.forum-hot-back:active { background: #e8f5fd; }
.forum-hot-filter-label {
  font-size: 14px; font-weight: 700; color: #ec4141;
}
html.dark-mode .forum-hot-filter-bar { border-color: #38444d; }
html.dark-mode .forum-hot-back { color: #1d9bf0; }
html.dark-mode .forum-hot-filter-label { color: #f04a4a; }

/* ─── 帖子详情（全屏页面，推特风格） ─── */
.forum-detail-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: #fff;
  display: flex; flex-direction: column;
}
.forum-detail-page {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
}
.forum-detail-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--sab, 0px)) 10px 8px;
  flex-shrink: 0; border-bottom: 0.5px solid #eaeaea;
  min-height: 44px;
}
.forum-detail-back {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: none; font-size: 20px; color: #0f1419;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.forum-detail-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.forum-detail-content {
  padding: 12px 16px;
}
.forum-detail-author {
  display: flex; align-items: center;
}
.forum-detail-post-body {
  font-size: 17px; line-height: 1.6; color: #0f1419;
  padding: 12px 0;
}
/* ─── 评论区（推特风格：头像+名字+内容+操作图标） ─── */
.forum-detail-comments {
  margin-top: 4px;
}
.forum-detail-comment {
  display: flex; gap: 8px;
  padding: 12px 0; border-bottom: 0.5px solid #f0f0f0;
}
.forum-detail-comment-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #e1e8ed; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #657786;
  overflow: hidden;
}
.forum-detail-comment-right {
  flex: 1; min-width: 0;
}
.forum-detail-comment-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
}
.forum-detail-comment-name {
  font-size: 12px; font-weight: 600; color: #0f1419;
}
.forum-detail-comment-time {
  font-size: 11px; color: #657786;
}
.forum-detail-comment-body {
  font-size: 13px; color: #0f1419; line-height: 1.4;
  margin-bottom: 4px;
}
.forum-detail-comment-actions {
  display: flex; gap: 16px; margin-top: 4px;
}

/* ─── 底部评论输入 ─── */
.forum-detail-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px calc(max(10px, env(safe-area-inset-bottom, 10px)));
  border-top: 0.5px solid #eaeaea; flex-shrink: 0;
  background: #fff;
}
.forum-detail-input {
  flex: 1; border: 1px solid #e1e8ed; border-radius: 18px;
  outline: none; font-size: 14px; padding: 8px 14px;
  color: #0f1419; background: #f7f9f9;
}
.forum-detail-send {
  padding: 8px 16px; border-radius: 18px; border: none;
  background: #1d9bf0; color: #fff; font-size: 13px; cursor: pointer;
  flex-shrink: 0;
}

html.dark-mode .forum-detail-overlay { background: #15202b; }
html.dark-mode .forum-detail-nav { border-color: #38444d; }
html.dark-mode .forum-detail-back { color: #e7e9ea; }
html.dark-mode .forum-detail-post-body { color: #e7e9ea; }
html.dark-mode .forum-detail-comment { border-color: #253341; }
html.dark-mode .forum-detail-comment-name { color: #e7e9ea; }
html.dark-mode .forum-detail-comment-body { color: #d0d4d8; }
html.dark-mode .forum-detail-comment-avatar { background: #253341; color: #8899a6; }
html.dark-mode .forum-detail-input-row { background: #15202b; border-color: #38444d; }
html.dark-mode .forum-detail-input { background: #253341; color: #e7e9ea; border-color: #38444d; }

/* ─── 推荐区瀑布流布局 ─── */
.forum-recommend-feed {
  columns: 2; column-gap: 8px;
  padding: 8px 8px 60px;
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.forum-recommend-feed::-webkit-scrollbar { width: 0; }

.forum-rec-section-title {
  column-span: all;
  font-size: 13px; font-weight: 600; color: #333;
  padding: 10px 4px 6px; letter-spacing: 0.5px;
  break-inside: avoid;
}
.forum-rec-empty {
  column-span: all;
  text-align: center; padding: 60px 20px;
  color: #bbb; font-size: 14px; letter-spacing: 1px;
}
html.dark-mode .forum-rec-section-title { color: #e7e9ea; }
html.dark-mode .forum-rec-empty { color: #8899a6; }

.forum-recommend-card {
  break-inside: avoid;
  background: #fff;
  border-radius: 12px;
  border: 0.5px solid #eaeaea;
  margin-bottom: 8px;
  overflow: hidden;
  transition: transform 0.15s;
  display: inline-block;
  width: 100%;
}
.forum-recommend-card:active { transform: scale(0.98); }

.forum-recommend-card-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 10px 6px;
}
.forum-recommend-card-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: #f0f0f0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 12px; color: #666;
}
.forum-recommend-card-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.forum-recommend-card-name {
  font-size: 12px; font-weight: 600; color: #333;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.forum-recommend-card-body {
  padding: 4px 10px 10px;
  font-size: 13px; line-height: 1.5; color: #444;
  word-break: break-word;
}
.forum-recommend-card-tags {
  padding: 0 10px 8px;
  font-size: 10px; color: #1d9bf0;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.forum-recommend-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border-top: 0.5px solid #f5f5f5;
  font-size: 11px; color: #999;
}
.forum-recommend-card-footer span {
  display: flex; align-items: center; gap: 2px;
}
/* 推荐区暗色 */
html.dark-mode .forum-recommend-card { background: #1e2732; border-color: #38444d; }
html.dark-mode .forum-recommend-card-name { color: #e7e9ea; }
html.dark-mode .forum-recommend-card-body { color: #d0d4d8; }
html.dark-mode .forum-recommend-card-footer { border-color: #253341; color: #8899a6; }
html.dark-mode .forum-recommend-card-avatar { background: #253341; color: #8899a6; }
