/* ================================================================
 * comment.css —— 评论区样式
 * 布局（按设计图）：
 *   顶部发表区：左（用户名+头像竖排）｜ 中（评论输入框）｜ 右（发送按钮）
 *   下方评论区：评论数量标题 + 评论列表
 *   每条评论：左（用户名+头像竖排窄栏）｜ 右（内容气泡框）
 * 列表区固定高度，超出滚动，最新评论在顶部。
 * ================================================================ */

.comment-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==================== 顶部发表区 ====================
 * 第一行：用户栏（左） + 输入框（占满右侧）
 * 第二行：发送按钮独占一行 */
.comment-publish {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  padding: 14px;
  background: var(--card-bg, var(--surface));
  border: 1px solid var(--border);
  border-radius: 14px;
}

/* 左侧用户栏（竖排：用户名在上、头像在下） */
.comment-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 64px;
  flex-shrink: 0;
}

.comment-user-name {
  max-width: 64px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comment-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

/* 中间输入框（占满用户栏右侧） */
.comment-input {
  flex: 1;
  min-width: 0;
  /* 允许在窄容器里收缩，避免撑破外框 */
  min-height: 84px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  resize: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.comment-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.16);
}

.comment-input::placeholder {
  color: var(--text-3);
}

/* 发送按钮：独占下一行，通栏 */
.comment-send {
  flex: 1 1 100%;
  height: 40px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.comment-send:hover {
  background: var(--blue-light);
}

.comment-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==================== 未登录引导条 ==================== */
.comment-login-tip {
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 84px;
  color: var(--text-3);
  font-size: 14px;
}

.comment-login-tip svg {
  width: 18px;
  height: 18px;
}

.comment-login-btn {
  height: 34px;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.comment-login-btn:hover {
  background: var(--blue-light);
}

/* ==================== 下方评论区 ==================== */
.comment-section {
  padding: 14px;
  background: var(--card-bg, var(--surface));
  border: 1px solid var(--border);
  border-radius: 14px;
}

/* 数量标题 */
.comment-count-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.comment-count-title svg {
  width: 16px;
  height: 16px;
  color: var(--blue-light);
}

.comment-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
}

/* ---------- 评论列表（固定高度 + 滚动，最新在顶部） ---------- */
.comment-list {
  height: 300px;
  /* 固定高度，超出滚动 */
  overflow-y: auto;
  margin: 0;
  padding: 0 6px 0 0;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.comment-list::-webkit-scrollbar {
  width: 5px;
}

.comment-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

/* 每条评论：左用户栏 + 右内容气泡 */
.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}

.comment-item+.comment-item {
  border-top: 1px solid var(--border);
}

/* 内容气泡框 */
.comment-bubble {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.comment-content {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
  word-break: break-word;
}

/* 气泡底部：时间 + 删除 */
.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.comment-time {
  font-size: 12px;
  color: var(--text-3);
}

/* 删除按钮（登录可见，hover 评论时显示） */
.comment-del {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.comment-item:hover .comment-del {
  opacity: 1;
}

.comment-del:hover {
  background: rgba(255, 92, 92, 0.15);
  color: #ff7b7b;
}

.comment-del svg {
  width: 13px;
  height: 13px;
}

/* 评论点赞按钮 */
.comment-like {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.comment-like svg {
  width: 13px;
  height: 13px;
}

.comment-like:hover {
  color: #ff7b9c;
  background: rgba(255, 123, 156, 0.12);
}

.comment-like.is-liked {
  color: #ff6b8f;
}

/* 楼中楼回复列表 */
.comment-replies {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-reply-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.comment-reply-item .comment-user-avatar {
  width: 26px;
  height: 26px;
}

.comment-reply-item .comment-user-name {
  font-size: 12px;
}

.comment-reply-item .comment-content {
  font-size: 13px;
}

.comment-reply-item .comment-meta {
  margin-top: 5px;
}

/* 空态 / 加载态 */
.comment-empty,
.comment-loading {
  padding: 32px 0;
  font-size: 13.5px;
  text-align: center;
  color: var(--text-3);
  list-style: none;
}

/* ==================== 项目详情侧栏内（发表区与默认一致：用户栏｜输入框｜发送） ==================== */
.pdetail-side .comment-input {
  min-height: 72px;
}

.pdetail-side .comment-list {
  height: 260px;
  /* 侧栏稍矮 */
}

/* ==================== 文章点赞栏 ==================== */
.adetail-likebar {
  display: flex;
  justify-content: center;
  margin: 34px 0 8px;
}

.post-like {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 26px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.post-like svg {
  width: 18px;
  height: 18px;
}

.post-like small {
  font-size: 12px;
  opacity: 0.7;
}

.post-like:hover {
  color: #ff6b8f;
  border-color: rgba(255, 107, 143, 0.45);
  transform: translateY(-1px);
}

.post-like.is-liked {
  color: #ff6b8f;
  border-color: rgba(255, 107, 143, 0.55);
  background: rgba(255, 107, 143, 0.08);
}