/**
 * =============================================================================
 * 文件: forum.css (功能增强版)
 * 描述: 论坛页面专属样式表。
 * =============================================================================
 */

/* 1. 论坛主布局 */
.forum-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

/* 2. 左侧栏 */
.forum-sidebar .sidebar-block {
  background: var(--container-bg);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid var(--input-border);
}

.forum-sidebar h3 {
  margin: 0 0 12px 0;
  font-size: 1.1em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--input-border);
}

.board-list .board-item {
  display: block;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
}

.board-list .board-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.board-list .board-item.active {
  background-color: var(--btn-bg);
  color: var(--btn-text);
}

.point-ranking-list .ranking-item {
  display: flex;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9em;
  border-bottom: 1px solid var(--input-border);
}

.point-ranking-list .ranking-item:last-child {
  border-bottom: none;
}

.ranking-item .rank {
  font-weight: bold;
  width: 30px;
  text-align: center;
}

.ranking-item .username {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-item .points {
  font-weight: bold;
  color: var(--btn-bg);
}

/* 3. 右侧内容区 */
.forum-content .content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.content-header h1 {
  margin: 0;
  font-size: 1.5em;
}

.post-list .post-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--container-bg);
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--input-border);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-list .post-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.post-item .post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.post-item .post-details {
  flex-grow: 1;
  min-width: 0;
}

.post-item .post-title {
  font-size: 1.1em;
  font-weight: bold;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-item .post-meta {
  font-size: 0.8em;
  color: #666;
}

.post-item .post-stats {
  text-align: right;
  font-size: 0.9em;
  flex-shrink: 0;
}

/* 4. 置顶和锁帖样式 */
.post-item.pinned .post-title {
  color: #d93025;
  font-weight: 900;
}

.post-item.pinned .post-title::before {
  content: '🔥';
  margin-right: 8px;
}

.post-item.locked {
  opacity: 0.7;
}

/* 5. 模态框样式 */
.char-counter {
  text-align: right;
  font-size: 0.8em;
  color: #666;
  margin-top: 4px;
}

.dangerous-link {
  word-break: break-all;
  background: #f0f0f0;
  padding: 8px;
  border-radius: 4px;
  margin-top: 12px;
  font-size: 0.9em;
}

#detailModal .modal-body {
  line-height: 1.7;
}

#detailModal .detail-title {
  font-size: 1.8em;
  font-weight: bold;
}

#detailModal .detail-meta {
  font-size: 0.9em;
  color: #666;
  margin-top: 8px;
}

#detailModal .detail-content {
  margin: 24px 0;
}

#detailModal .detail-content a {
  color: var(--btn-bg);
  text-decoration: underline;
}

#detailModal .detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  border-top: 1px solid var(--input-border);
  padding-top: 16px;
}

#detailModal .comment-section {
  margin-top: 24px;
}

#detailModal .comment-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--input-border);
}

#detailModal .comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

#detailModal .comment-body {
  flex-grow: 1;
}

#detailModal .comment-meta {
  font-size: 0.8em;
  font-weight: bold;
  margin-bottom: 4px;
}

#detailModal .reply-box textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  resize: vertical;
  box-sizing: border-box;
}

#detailModal .reply-box button {
  margin-top: 8px;
  float: right;
}

/* 禁止所有交互 */
.reply-box.is-locked {
  pointer-events: none;
}

.reply-box.is-locked textarea,
.reply-box.is-locked button {
  background-color: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.6;
}

.locked-notice {
  text-align: center;
  padding: 16px;
  background-color: #f8f9fa;
  border-radius: 8px;
  font-weight: 500;
  margin-top: 16px;
}
/*
.progress-container {
  width: 100%;
  height: 8px;
  background-color: #e9ecef;
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
  display: none;
}　*/

.progress-bar {
  width: 0;
  height: 100%;
  background-color: var(--btn-bg);
  transition: width 0.3s ease;
}

.fab-new-post {
  position: fixed;
  bottom: 90px;
  right: 25px;
  width: 56px;
  height: 56px;
  background-color: var(--btn-bg);
  color: var(--btn-text);
  border-radius: 50%;
  border: none;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 1100;
  transition: all 0.2s ease-out;
}

.fab-new-post:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* 6. 响应式设计 */
@media (max-width: 800px) {
  .forum-grid {
    grid-template-columns: 1fr;
  }
  .forum-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .forum-sidebar .sidebar-block {
    margin-bottom: 0;
  }
}

@media (max-width: 480px) {
  .fab-new-post {
    bottom: 80px;
    right: 16px;
    width: 50px;
    height: 50px;
  }
}

@media (prefers-color-scheme: dark) {
  .reply-box.is-locked textarea,
  .reply-box.is-locked button {
    background-color: #2a2d3d;
  }
  .locked-notice {
    background-color: #2a2d3d;
  }
}

.detail-attachment {
  margin: 16px 0;
  text-align: center;
}

.detail-attachment img {
  max-width: 100%;
  height: auto;
  /* 【新增】限制最大高度，避免图片过大撑开弹窗 */
  max-height: 400px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  /* 【新增】鼠标指针变为手形，提示可点击 */
  cursor: pointer;
  transition: opacity 0.2s ease;
}

/* 【新增】鼠标悬停时降低图片透明度，提供视觉反馈 */
.detail-attachment img:hover {
  opacity: 0.8;
}

/* 【新增】图片灯箱 (Lightbox) 样式 */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.lightbox-close:hover {
  color: #ccc;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 32px;
  cursor: pointer;
  padding: 16px;
  user-select: none; /* 防止选中文本 */
  transition: background-color 0.2s;
  border-radius: 4px;
}

.lightbox-nav:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.lightbox-prev {
  left: 10px;
}

.lightbox-next {
  right: 10px;
}

/* 【新增】多图上传预览区域样式 */
.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--input-border);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-img-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-img-btn:hover {
  background-color: rgba(217, 48, 37, 0.9); /* #d93025 */
}

.preview-item .progress-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}

.preview-item .progress-overlay .progress-bar-inner {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 5px;
    background-color: var(--btn-bg);
    transition: width 0.3s ease;
}

/* =====================================================================
   新增: 评论区管理功能样式
   ===================================================================== */

.comment-body {
  position: relative; /* 为操作按钮的绝对定位提供容器 */
}

.comment-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 8px;
  opacity: 0; /* 默认隐藏 */
  transition: opacity 0.2s ease-in-out;
}

.comment-item:hover .comment-actions {
  opacity: 1; /* 鼠标悬停在评论上时显示按钮 */
}

.comment-action-btn {
  background-color: #f1f1f1;
  border: 1px solid #ddd;
  color: #555;
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 5px;
  cursor: pointer;
}

.comment-action-btn:hover {
  background-color: #e0e0e0;
}

.comment-action-btn.delete {
  background-color: #fff1f1;
  border-color: #ffc9c9;
  color: #d90429;
}

.comment-action-btn.delete:hover {
  background-color: #ffdbdb;
}


/* 评论内联编辑框样式 */
.comment-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-edit-textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.comment-edit-textarea:focus {
  outline: none;
  border-color: var(--btn-bg);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}