/* forum-theme.css - 社区专用主题样式 */

:root {
  /* 社区专用配色变量 */
  --forum-primary: #00aceb;
  --forum-primary-hover: #6fd4f4;
  --forum-bg: #f7fafc;
  --forum-card-bg: rgba(255,255,255,.94);
  --forum-border: rgba(148,163,184,.16);
  --forum-text-1: #1e293b;
  --forum-text-2: #0a4a63;
  --forum-text-3: #2a5f7a;
  --forum-success: #10b981;
  --forum-warning: #f59e0b;
  --forum-danger: #ef4444;
}

/* 使用更高权重的选择器，替代 !important */
body[data-page="forum"] .layout {
  grid-template-columns: minmax(0, 1fr);
}

/* Follow the existing desktop hero rail; mobile keeps its shared page gutters. */
@media (min-width: 769px) {
  body[data-page="forum"]:not(.mobile-page) .layout {
    width: min(1280px, calc(100vw - 96px));
    max-width: 1280px;
    margin-inline: auto;
  }
}

body[data-page="forum"] .comment-action {
  border: 1px solid #cfeeff;
  background: #fff;
  color: #003b52;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body[data-page="forum"] .comment-action:hover {
  border-color: #99dcf0;
  background: #f5fbff;
}

body[data-page="forum"] .comment-action:focus {
  border-color: var(--forum-primary);
  outline: 2px solid rgba(0,172,235,0.2);
  outline-offset: 2px;
}

body[data-page="forum"] .comment-action.active {
  border-color: #99dcf0;
  background: #e6f7fd;
  color: #003b52;
  box-shadow: none;
}

/* 评论点赞按钮 */
body[data-page="forum"] .comment-like {
  min-height: 24px;
  border: 0;
  background: transparent !important;
  color: #7b8ca4 !important;
  box-shadow: none !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body[data-page="forum"] .comment-like:hover,
body[data-page="forum"] .comment-like.liked {
  background: #e6f7fd !important;
  color: #00aceb !important;
  box-shadow: none !important;
}

/* §8.4 帖子点赞按钮：与评论点赞同一视觉语言，位于 .post-time 行内。
   达 20/40/60/80/100 赞时给作者发里程碑积分，因此这里只呈现"我是否已赞"和有效赞数。
   注意 .post-time 是 display:flex + justify-content:space-between，
   所以这里**不能**用 margin-left:auto（会与 space-between 冲突造成间距异常）。 */
body[data-page="forum"] .post-like {
  min-height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent !important;
  color: #7b8ca4 !important;
  font-size: 12px;
  line-height: 1;
  box-shadow: none !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  cursor: pointer;
}

body[data-page="forum"] .post-like:hover,
body[data-page="forum"] .post-like.active {
  background: #e6f7fd !important;
  color: #00aceb !important;
  box-shadow: none !important;
}

body[data-page="forum"] .post-like-count {
  color: #7b8ca4;
  font-size: 12px;
}

/* §8.1 连续签到进度：与积分提示同一行，弱化处理不抢视觉 */
body[data-page="forum"] .forum-points-streak {
  margin-left: 8px;
  color: #7b8ca4;
  font-size: 12px;
}

/* 评论列表中性化：去掉淡蓝色底（评论直接坐在帖子卡片上） */
body[data-page="forum"] .comment {
  background: transparent !important;
}

/* 标题与正文的间距加大一点 */
body[data-page="forum"] .post h3 {
  margin-bottom: 7px !important;
}

/* 正文保留发布时的换行（多段落长文按行展示） */
.post-body {
  white-space: pre-line;
}

/* 评论输入框：前置书写笔线条图标，提示可发布评论 */
body[data-page="forum"] .comment-form input {
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 16px 16px;
}

/* 工具栏（表情+发布）：默认隐藏，聚焦输入框或打开表情面板时显示；表情紧邻发布按钮 */
body[data-page="forum"] .comment-form-toolbar {
  display: none !important;
}

body[data-page="forum"] .comment-form:focus-within .comment-form-toolbar,
body[data-page="forum"] .comment-form:has(.comment-emoji-panel:not([hidden])) .comment-form-toolbar {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center;
  gap: 8px;
}

/* 发布按钮收窄高度 */
body[data-page="forum"] .comment-btn {
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 16px !important;
}

/* 排序触发器（极简：白底、中性描边；主题蓝只留给发布等主操作） */
body[data-page="forum"] .forum-sort-trigger {
  min-height: 30px;
  background: #fff !important;
  color: #374151 !important;
  border: 1px solid rgba(15, 23, 42, 0.14) !important;
  box-shadow: none;
}

body[data-page="forum"] .forum-sort-trigger:hover {
  border-color: rgba(15, 23, 42, 0.24) !important;
  background: #f9fafb !important;
}

/* 排序菜单（极简风格：纯文字选项，选中项浅灰圆角+对勾） */
body[data-page="forum"] .forum-sort-menu {
  display: grid;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12) !important;
}

body[data-page="forum"] .forum-sort-option {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px !important;
  background: transparent !important;
  color: #374151 !important;
  box-shadow: none !important;
  font-size: 12px;
}

body[data-page="forum"] .forum-sort-option:hover {
  background: #f3f4f6 !important;
  color: #111827 !important;
}

body[data-page="forum"] .forum-sort-option.active {
  background: #f3f4f6 !important;
  color: #111827 !important;
  font-weight: 600;
}

body[data-page="forum"] .forum-sort-check {
  color: #374151 !important;
}

/* 展开评论等次级操作按钮：中性描边样式 */
body[data-page="forum"] .comment-action {
  background: #fff !important;
  color: #0a4a63 !important;
  border: 1px solid rgba(148, 163, 184, .38);
  box-shadow: none;
}

body[data-page="forum"] .comment-action:hover {
  border-color: #99dcf0;
  color: #0087b3;
}

/* 发帖弹窗内的标签选项 */
body[data-page="forum"] .forum-post-sheet .tag-option {
  height: 34px;
  border: 1px solid #cfeeff;
  background: rgba(255,255,255,.72);
  color: #003b52;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), 0 8px 18px rgba(43,82,120,.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-weight: 650;
}

body[data-page="forum"] .forum-post-sheet .tag-option:hover {
  border-color: #99dcf0;
  background: rgba(255,255,255,.90);
  color: #003b52;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 10px 20px rgba(43,82,120,.08);
}

body[data-page="forum"] .forum-post-sheet .tag-option.active {
  border-color: #99dcf0;
  background: #e6f7fd;
  color: #003b52;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78);
  font-weight: 700;
}

body[data-page="forum"] .forum-post-sheet .tag-option.disabled {
  opacity: .42;
}

/* 评论表单布局 */
body[data-page="forum"] .post-comment-compose .comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

body[data-page="forum"] .post-comment-compose .comment-form input {
  grid-column: 1 / -1;
}

body[data-page="forum"] .post-comment-compose .comment-form-toolbar {
  grid-column: 1 / -1;
}

body[data-page="forum"] .post-comment-compose .comment-btn {
  grid-column: auto;
  justify-self: auto;
  min-width: 88px;
}

/* 评论表情按钮（线条图标 + 中性底；主题蓝只留给发布等主操作） */
body[data-page="forum"] .comment-emoji-trigger {
  min-height: 0;
  background: #fff !important;
  color: #0a4a63 !important;
  border: 1px solid rgba(148, 163, 184, .38);
  box-shadow: none;
}

body[data-page="forum"] .comment-emoji-trigger svg {
  width: 18px;
  height: 18px;
}

body[data-page="forum"] .comment-emoji-trigger:hover,
body[data-page="forum"] .comment-emoji-trigger[aria-expanded="true"] {
  border-color: #99dcf0 !important;
  background: #f5fbff !important;
  color: #0087b3 !important;
}

body[data-page="forum"] .comment-emoji-panel button {
  min-height: 0;
  background: #fff;
  color: #0a4a63;
  box-shadow: none;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
}

/* 评论提交按钮 */
body[data-page="forum"] .comment-submit {
  background: linear-gradient(135deg, var(--forum-primary), var(--forum-primary-hover));
  color: #fff;
  border: 0;
  font-weight: 500;
}

body[data-page="forum"] .comment-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

body[data-page="forum"] .comment-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 发帖按钮样式 */
body[data-page="forum"] .forum-post-btn {
  background: linear-gradient(135deg, var(--forum-primary), var(--forum-primary-hover));
  color: #fff;
  border: 0;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

body[data-page="forum"] .forum-post-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* 移动端触摸区域优化（最小 44x44px） */
@media (max-width: 768px) {
  button,
  .clickable,
  .forum-topic-tab,
  .post-action,
  .comment-action {
    min-height: 44px;
    min-width: 44px;
  }

  /* 小按钮添加 padding 扩大点击区域 */
  .post-action svg,
  .comment-action svg {
    padding: 8px;
  }

  /* 移动端字体优化 */
  .post h3 {
    font-size: 18px;
    line-height: 1.5;
    font-weight: 600;
  }

  .post-body {
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-line;
  }

  .comment-body p {
    font-size: 14px;
    line-height: 1.7;
  }

  /* 其他文字也适当调整 */
  .post-meta,
  .time,
  .post-stats {
    font-size: 13px;
  }

  .tag {
    font-size: 12px;
    padding: 4px 10px;
  }
}

/* 图片灯箱 */
.forum-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.forum-image-lightbox.open {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}

.lightbox-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox-image-wrapper {
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

@media (max-width: 768px) {
  .lightbox-close {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }

  .lightbox-prev,
  .lightbox-next {
    width: 48px;
    height: 48px;
  }

  .lightbox-prev {
    left: 8px;
  }

  .lightbox-next {
    right: 8px;
  }

  .lightbox-counter {
    bottom: 16px;
  }
}

/* ===== 论坛内容治理：共享组件（FORUM_MEDIA_MODERATION_IMPLEMENTATION_PLAN §16） ===== */
/* 灯箱：高清原图加载状态与重试 */
.forum-image-lightbox .lightbox-image.is-loading { opacity: .55; }
.forum-image-lightbox .lightbox-image.is-error { opacity: .35; filter: grayscale(1); }
.lightbox-retry {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%);
  padding: 8px 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(17, 24, 39, .72); color: #fff; font-size: 13px; cursor: pointer; z-index: 3;
}
.lightbox-retry:hover { background: rgba(17, 24, 39, .9); }

/* 经平台审核调整标记（前台轻量提示，不展示差异） */
.platform-edited-badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; line-height: 18px; color: #8a6d1f; background: rgba(240, 200, 100, .18);
  border: 1px solid rgba(196, 156, 60, .35); white-space: nowrap;
}

/* 禁言/封禁提示横幅 */
.forum-sanction-banner {
  position: sticky; top: 0; z-index: 60;
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 10px 16px; font-size: 13px; color: #7f1d1d;
  background: rgba(254, 226, 226, .96); border-bottom: 1px solid rgba(220, 100, 100, .35);
}

/* 举报弹窗 */
.forum-report-dialog { position: fixed; inset: 0; z-index: 120; display: none; }
.forum-report-dialog.open { display: block; }
.forum-report-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.forum-report-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px)); background: #fff; border-radius: 16px;
  padding: 20px; box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
}
.forum-report-panel h2 { margin: 0 0 8px; font-size: 17px; }
.forum-report-hint { margin: 0 0 14px; font-size: 12.5px; color: #64748b; }
.forum-report-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 20px; cursor: pointer; color: #94a3b8; }
.forum-report-field { display: block; margin-bottom: 12px; font-size: 13px; color: #334155; }
.forum-report-field span { display: block; margin-bottom: 6px; font-weight: 600; }
.forum-report-field select, .forum-report-field textarea {
  width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit;
}
.forum-report-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.forum-report-cancel { padding: 8px 16px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; cursor: pointer; }
.forum-report-submit { padding: 8px 16px; border-radius: 8px; border: 0; background: #2563eb; color: #fff; cursor: pointer; }
.forum-report-submit:disabled { opacity: .6; }
