/* 知识库 — 对齐 ipa.store/forum（毛玻璃变量见 glass.css） */

.page-main--kb-forum {
  max-width: 1280px;
  /* 导航高度 + 20px，封面不与顶栏重叠 */
  padding: calc(var(--nav-h, 64px) + 20px) 20px 56px;
  background: transparent;
}

/* —— 顶栏封面：同分类毛玻璃卡，无图标、内容居中 —— */
.kb-forum-cover.kb-forum-cat-card {
  margin: 0 0 20px;
  width: 100%;
  cursor: default;
  justify-content: center;
  text-align: center;
}

.kb-forum-cover.kb-forum-cat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 56px rgba(6, 10, 38, 0.18);
}

.kb-forum-cover .kb-cat-info {
  flex: none;
  width: 100%;
  text-align: center;
}

.kb-forum-cover .kb-cat-info h2 {
  font-size: 1.25rem;
  white-space: normal;
}

.kb-forum-cover .kb-cat-stat {
  display: inline-block;
  margin: 0 10px;
}

.kb-forum-cover .kb-cat-info h2 em {
  font-style: normal;
  font-weight: 500;
  color: #8b5cf6;
}

.kb-forum-cover-hint {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: #92400e;
}

/* —— 主栏 + 侧栏 —— */
.kb-forum-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.kb-forum-main {
  flex: 1 1 680px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.kb-forum-aside {
  flex: 0 0 300px;
  width: 300px;
  position: sticky;
  top: calc(var(--nav-h, 64px) + 12px);
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: calc(100vh - var(--nav-h, 64px) - 24px);
  overflow-y: auto;
  /* 侧栏容器不加底色，毛玻璃只落在各 .kb-widget 上 */
  background: transparent;
  border: none;
  box-shadow: none;
}

.kb-forum-aside > .kb-widget {
  margin-bottom: 16px;
}

.kb-forum-aside > .kb-widget:last-child {
  margin-bottom: 0;
}

/* 面板：仅布局，毛玻璃由 glass.css 提供 */
.kb-forum-panel {
  padding: 20px;
  /* 不重复写 background，避免盖住 blur */
}

/* —— 统计条 —— */
.kb-forum-count {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.kb-forum-count-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.kb-forum-count-wrapper {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.kb-forum-count-info {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  white-space: nowrap;
  font-size: 12px;
  color: #646464;
}

.kb-forum-count-info strong {
  color: #1167ff;
  font-weight: 700;
}

.kb-publish-btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 700;
  color: #1167ff;
  border: 2px solid #fff;
  border-radius: 8px;
  background: linear-gradient(0deg, #fff 0%, #f3f5f8 100%);
  box-shadow: 8px 8px 20px rgba(55, 99, 170, 0.12);
  text-decoration: none;
  flex-shrink: 0;
}

.kb-publish-btn:hover {
  color: #0052cc;
  text-decoration: none;
  transform: translateY(-1px);
}

/* —— 分类双列网格（核心：每张独立悬浮卡） —— */
.kb-forum-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.kb-forum-cat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  text-decoration: none;
  color: #646464;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.kb-forum-cat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 56px rgba(6, 10, 38, 0.18);
  text-decoration: none;
}

.kb-cat-icon {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff 0%, #e8f0ff 100%);
  border: 2px solid #fff;
  box-shadow: 8px 8px 20px rgba(55, 99, 170, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  flex-shrink: 0;
}

.kb-cat-info {
  flex: 1;
  min-width: 0;
}

.kb-cat-info h2 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-cat-stat {
  display: inline-block;
  margin-right: 12px;
  font-size: 14px;
  color: #666;
}

/* —— 帖子列表 —— */
.kb-forum-post-list {
  padding: 20px;
}

.kb-type-tab {
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.kb-type-tab-item {
  font-size: 14px;
  color: #8590a6;
  margin-right: 20px;
}

.kb-type-tab-item.is-current {
  color: #1167ff;
  font-weight: 600;
}

.kb-post-list-inner {
  margin-top: 16px;
}

.kb-post-item {
  display: flex;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e9e8e8;
}

.kb-post-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.kb-author-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #f3f4f6;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.kb-post-info-wrapper {
  flex: 1;
  min-width: 0;
  padding-left: 16px;
}

.kb-post-name {
  display: block;
  color: #505050;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.kb-post-name:hover {
  color: #1167ff;
  text-decoration: none;
}

.kb-post-other {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #8590a6;
}

.kb-post-user-cat-date {
  display: flex;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  min-width: 0;
}

.kb-post-user-cat-date span:not(:first-child) {
  margin-left: 0;
}

.kb-post-cat {
  color: #8590a6;
}

.kb-post-count-info {
  flex-shrink: 0;
  margin-left: 14px;
  font-size: 13px;
  color: #8590a6;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* —— 分类信息条（对齐 ipa.store .forum-common-info） —— */
.kb-forum-common-info {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 20px;
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
}

.kb-forum-common-box {
  flex: 1;
  min-width: 0;
}

.kb-forum-common-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.kb-forum-common-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.kb-forum-common-data {
  flex: 1;
  min-width: 0;
  padding-left: 20px;
  max-width: calc(100% - 80px);
}

.kb-forum-common-data h2 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-forum-common-data p {
  margin: 0;
}

.kb-forum-common-data p span {
  margin-right: 10px;
  display: inline-block;
  font-size: 14px;
  color: #666;
}

/* 快速发帖 / 发布文章（对齐 ipa .publish-post-btn） */
.kb-publish-post-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  line-height: 33px;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 700;
  color: #1167ff;
  border: 2px solid #fff;
  border-radius: 8px;
  background: linear-gradient(0deg, #fff 0%, #f3f5f8 100%);
  box-shadow: 8px 8px 20px rgba(55, 99, 170, 0.1);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, box-shadow 0.15s ease;
}

.kb-publish-post-btn:hover {
  color: #0052cc;
  text-decoration: none;
  box-shadow: 8px 8px 24px rgba(17, 103, 255, 0.15);
}

/* 返回上一页（对齐 ipa.store .return-before-btn：圆钮 + 箭头图标） */
.return-before-btn {
  box-sizing: border-box;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(0deg, #ffffff 0%, #f3f5f8 100%);
  border: 2px solid #fff;
  box-shadow: 8px 8px 20px rgba(55, 99, 170, 0.1);
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.15s ease;
}

.return-before-btn::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  border-left: 2px solid #505050;
  border-bottom: 2px solid #505050;
  transform: translateX(2px) rotate(45deg);
  transition: border-color 0.15s ease;
}

.return-before-btn:hover {
  box-shadow: 8px 8px 24px rgba(17, 103, 255, 0.18);
  text-decoration: none;
}

.return-before-btn:hover::before {
  border-color: #1167ff;
}

.kb-board-icon {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff 0%, #e8f0ff 100%);
  border: 2px solid #fff;
  box-shadow: 8px 8px 20px rgba(55, 99, 170, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  flex-shrink: 0;
}

/* —— 分类文章列表面板 —— */
.kb-board-panel {
  padding: 0;
  overflow: hidden;
}

.kb-board-panel .kb-type-tab {
  padding: 16px 20px 0;
  margin-bottom: 0;
}

.kb-board-panel .kb-post-list-inner {
  padding: 8px 20px 20px;
}

.kb-type-tab-item.is-muted {
  color: #c0c4cc;
  font-weight: 400;
  font-size: 13px;
}

/* —— 文章详情 —— */
.kb-single-head {
  padding: 20px;
  color: #505050;
}

.kb-single-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.kb-single-head-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.kb-single-head-row .return-before-btn {
  margin-left: auto;
  flex-shrink: 0;
}

.kb-single-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #f3f4f6;
  margin-right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.kb-single-title-wrap h1 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #333;
}

.kb-single-meta {
  margin: 0;
  font-size: 13px;
  color: #8590a6;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.kb-single-meta a {
  color: #1167ff;
  text-decoration: none;
}

.kb-single-body {
  padding: 20px;
  font-size: 16px;
  line-height: 1.85;
  color: #374151;
}

.kb-single-body h2 {
  position: relative;
  padding-left: 18px;
  margin: 1.4em 0 0.6em;
  font-size: 18px;
  color: #333;
}

.kb-single-body h2::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: #1167ff;
  border-radius: 2px;
}

.kb-back-links {
  display: flex;
  gap: 16px;
  font-size: 14px;
}

.kb-forum-empty-text {
  text-align: center;
  padding: 32px;
  color: #8590a6;
}

/* —— 侧栏 —— */
.kb-widget {
  overflow: hidden;
  /* 毛玻璃由 glass.css .kb-widget */
}

.kb-widget-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 13px;
  font-weight: 600;
  color: #505050;
}

.kb-win-dots {
  display: inline-flex;
  gap: 5px;
}

.kb-win-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}

.kb-win-dots i:nth-child(1) {
  background: #ff5f57;
}

.kb-win-dots i:nth-child(2) {
  background: #febc2e;
}

.kb-win-dots i:nth-child(3) {
  background: #28c840;
}

.kb-widget-body {
  padding: 14px;
}

.kb-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 14px;
  box-sizing: border-box;
}

.kb-search-form {
  margin: 0;
}

.kb-tag-cloud {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 1200px) {
  .kb-tag-cloud {
    grid-template-columns: repeat(3, 1fr);
  }
}

.kb-tag {
  display: block;
  text-align: center;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 6px;
  background: rgba(0, 132, 255, 0.08);
  color: #1167ff;
  border: 1px solid rgba(255, 255, 255, 0.8);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-tag.is-active {
  background: #1167ff;
  color: #fff;
}

.kb-hot-list {
  margin: 0;
  padding: 14px;
  list-style: none;
}

.kb-hot-list li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 13px;
}

.kb-hot-list a {
  display: block;
  color: #505050;
  text-decoration: none;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-hot-list a:hover {
  color: #1167ff;
}

.kb-hot-list time {
  font-size: 12px;
  color: #8590a6;
}

.kb-search-results {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
}

.kb-search-results a {
  display: block;
  padding: 8px 2px 2px;
  font-size: 13px;
  color: #505050;
  text-decoration: none;
}

.kb-search-results a:hover {
  color: #1167ff;
}

.kb-search-snippet {
  display: block;
  padding: 0 2px 8px;
  font-size: 11px;
  line-height: 1.4;
  color: #8590a6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-search-empty,
.kb-search-more {
  padding: 8px 2px;
  font-size: 12px;
  color: #8590a6;
}

/* 侧栏：论坛回帖排行（ipa-store 风格） */
.kb-forum-rank {
  padding: 14px !important;
}

.kb-forum-rank-empty {
  margin: 0;
  font-size: 13px;
  color: #8590a6;
  text-align: center;
}

.kb-rank-item {
  display: flex;
  align-items: center;
  overflow: hidden;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.kb-rank-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.kb-rank-index {
  flex-shrink: 0;
  width: 18px;
  margin-right: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #bdbdbd;
  text-align: center;
}

.kb-rank-item:nth-child(1) .kb-rank-index {
  color: #e80404;
}

.kb-rank-item:nth-child(2) .kb-rank-index {
  color: #f46300;
}

.kb-rank-item:nth-child(3) .kb-rank-index {
  color: #fdb500;
}

.kb-rank-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 28px;
  text-align: center;
  box-shadow: 0 0.2rem 0.8rem rgba(51, 51, 51, 0.15);
}

.kb-rank-right {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kb-rank-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  color: #333;
}

.kb-rank-count {
  flex-shrink: 0;
  font-size: 12px;
  color: #006eff;
  white-space: nowrap;
}

.kb-mobile-toggle {
  display: none;
  width: 100%;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 900px) {
  .kb-forum-cat-grid {
    grid-template-columns: 1fr;
  }

  .kb-forum-aside {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    display: none;
  }

  .kb-forum-aside.is-open {
    display: flex;
  }

  .kb-mobile-toggle {
    display: block;
  }

}

/* 论坛：帖子列表作者/回复数 */
.kb-post-author {
  color: #1167ff;
  font-weight: 600;
}

.kb-post-replies {
  color: #8590a6;
}

/* 论坛：悬浮 Toast 提示（发帖/回帖成功，页面正中） */
.forum-flash-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.08);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: forum-flash-in 0.35s ease;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.forum-flash-toast--ok {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.forum-flash-toast-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.forum-flash-toast.is-dismissed {
  opacity: 0;
  transform: translate(-50%, calc(-50% - 10px));
  pointer-events: none;
}

@keyframes forum-flash-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 18px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 640px) {
  .forum-flash-toast {
    max-width: calc(100vw - 32px);
  }
}

/* 兼容旧类名 */
.kb-flash-ok {
  margin-bottom: 12px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.kb-flash-ok.is-dismissed {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

/* 论坛：回复区 */
.forum-replies-box {
  margin-top: 16px;
}

.forum-replies-title {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.forum-reply-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.forum-reply-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.forum-reply-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1167ff, #6b9fff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.forum-reply-body {
  flex: 1;
  min-width: 0;
}

.forum-reply-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 13px;
}

.forum-reply-head time {
  color: #8590a6;
}

.forum-reply-content {
  font-size: 14px;
  line-height: 1.65;
  color: #333;
  word-break: break-word;
}

.forum-reply-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.forum-reply-form label {
  font-weight: 600;
  font-size: 14px;
}

.forum-reply-form textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  font: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.forum-login-hint {
  margin: 12px 0 0;
  font-size: 14px;
  color: #6b7280;
}

/* 发帖页 */
.forum-post-form-wrap {
  max-width: 860px;
  margin: 0 auto 32px;
}

.forum-post-form-wrap .forum-post-form.auth-form {
  max-width: none;
  width: 100%;
  margin: 0;
}

.forum-post-form select,
.forum-post-form input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  font: inherit;
  box-sizing: border-box;
}

.forum-post-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.forum-post-form textarea {
  width: 100%;
  min-height: 280px;
  box-sizing: border-box;
}

.forum-post-form .tox-tinymce {
  width: 100% !important;
  border-radius: 10px !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  margin-bottom: 1rem;
}

.forum-post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.kb-forum-empty-text {
  padding: 16px;
  color: #6b7280;
  font-size: 14px;
}

.kb-forum-empty-text a {
  color: #1167ff;
}

/* 帖子/回复正文内图片 */
.forum-thread-body img,
.forum-reply-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
}

.forum-badge {
  display: inline-block;
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
  font-weight: 600;
}
.forum-badge--pin { background: #fef3c7; color: #b45309; }
.forum-badge--highlight { background: #fce7f3; color: #be185d; }
.forum-badge--lock { background: #e5e7eb; color: #374151; }
