/* ============================================================
   朋友圈样式 (social.css) —— 微信风格布局
   结构：头像 + 昵称(链接蓝) + 正文 + 时间/··· + 点赞行 + 灰条评论区
   主题变量在 .social-feed 上声明，暗色主题整体覆盖。
   ============================================================ */

.social-feed {
  --wx-link: #576b95;          /* 微信链接蓝（昵称/点赞名） */
  --wx-bar-bg: #f7f7f7;        /* 点赞/评论区灰底 */
  --wx-muted: #9b9b9b;         /* 时间灰 */
  --wx-popup-bg: #4c4c4c;      /* 赞/评论弹出菜单深底 */
  --wx-divider: #ededed;       /* 帖子分隔线 */
  max-height: 70vh;
  overflow-y: auto;
  /* 与帖子同底色，避免下方空白区露出灰底与白卡割裂 */
  background: var(--color-bg-primary);
  padding: 0;
}
[data-theme="wechat-dark"] .social-feed,
[data-theme="dark"] .social-feed {
  --wx-link: #8aa2cf;
  --wx-bar-bg: #2b2b2b;
  --wx-muted: #7a7a7a;
  --wx-popup-bg: #3a3a3a;
  --wx-divider: #2e2e2e;
}

/* 头部：仅保留右侧操作按钮（标题栏已移除），底色与帖子一致 */
.social-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--wx-divider);
}
.social-header-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

/* 发布框 */
.social-publish-box {
  background: var(--color-bg-primary);
  padding: 10px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--wx-divider);
  animation: fadeIn 0.2s ease;
}
.social-publish-box textarea {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  width: 100%;
  resize: vertical;
  font-family: inherit;
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  transition: border-color var(--transition-fast);
}
.social-publish-box textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}
.social-publish-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

/* 帖子列表：微信式平铺，帖子间细分割线（无卡片） */
.social-posts {
  display: flex;
  flex-direction: column;
  /* 与帖子（.social-post）同底色，整片区域不再出现灰白分层 */
  background: var(--color-bg-primary);
}

/* 单条帖子：头像在左，内容区在右；无卡片边框阴影，靠分割线分层 */
.social-post {
  display: flex;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--wx-divider);
}
.social-posts .social-post:last-child {
  border-bottom: none;
}
/* 覆盖 main.css 的悬停卡片动画（微信朋友圈无此效果） */
.social-posts .social-post {
  transition: none;
}
.social-posts .social-post:hover {
  box-shadow: none;
  transform: none;
}
.social-post-avatar {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-bg-tertiary, #e0e0e6);
}
.social-post-main {
  flex: 1;
  min-width: 0;
}
.social-post-author {
  color: var(--wx-link);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 3px;
  cursor: default;
}
.social-post-content {
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text-primary);
}

/* 图片：单图大图（保持比例），4 图 2×2，其余 3 列九宫格 */
.social-post-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 8px;
  max-width: 78%;
}
.social-post-images img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.social-post-images.count-1 {
  display: block;
  max-width: 65%;
}
.social-post-images.count-1 img {
  width: auto;
  max-width: 100%;
  aspect-ratio: auto;
  max-height: 320px;
}
.social-post-images.count-4 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 56%;
}

/* 元信息行：时间 + ··· 按钮 + 赞/评论弹出菜单 */
.social-post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  min-height: 26px;
}
.social-post-time {
  color: var(--wx-muted);
  font-size: 13px;
}
/* 「··」按钮：微信式浅灰圆角 + 两个小圆点（用 <i> 画点） */
.social-more-wrap {
  position: relative;
}
.social-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--wx-bar-bg);
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 20px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.social-more-btn i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--wx-link);
  opacity: 0.85;
}
.social-more-btn:hover {
  background: color-mix(in srgb, var(--wx-bar-bg) 78%, var(--wx-link) 10%);
}
/* 微信式弹出菜单：深灰半透明圆角横条，在「··」按钮**左侧**水平弹出并与按钮垂直居中。
   放在左侧而非上方：按钮贴在帖子右边缘，向上弹会被列表可视区/顶栏裁掉。 */
.social-action-popup {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  display: none;
  background: var(--wx-popup-bg);
  border-radius: 6px;
  overflow: hidden;
  z-index: 8;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  animation: socialPopupIn 0.15s ease;
}
.social-action-popup.open {
  display: flex;
}
.social-action-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  background: transparent;
  border: none;
  padding: 9px 18px;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast);
}
.social-action-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.social-action-item + .social-action-item {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}
.social-action-item.social-action-delete {
  color: #fa9d9d;
}

/* —— 微信式灰底容器：点赞行 + 白线分隔 + 评论区，同处一个圆角条 —— */
.social-comment-bar {
  background: var(--wx-bar-bg);
  border-radius: 4px;
  margin-top: 8px;
  font-size: 13.5px;
  overflow: hidden;
}
/* 点赞行：空心心形 + 蓝色名字列表 */
.social-post-likes {
  padding: 7px 9px;
  line-height: 1.6;
  color: var(--wx-link);
}
.social-like-icon {
  margin-right: 8px;
  color: var(--wx-muted);
  font-size: 14px;
}
.social-like-name {
  color: var(--wx-link);
  font-weight: 600;
  margin-right: 7px;
}
.social-like-name:last-child {
  margin-right: 0;
}
/* 点赞与评论之间的白色细分割线 */
.social-bar-divider {
  height: 1px;
  background: var(--color-bg-secondary);
  margin: 0 9px;
}
/* 评论区 */
.social-post-comments {
  padding: 5px 9px 6px;
  line-height: 1.55;
  color: var(--color-text-primary);
}
.social-comment-floor {
  padding: 2.5px 0;
}
.social-comment-row {
  cursor: pointer;
  word-break: break-word;
}
.social-comment-row:hover .social-cname,
.social-reply:hover .social-cname {
  text-decoration: underline;
}
.social-cname {
  color: var(--wx-link);
  font-weight: 600;
  margin-right: 2px;
  cursor: pointer;
}
.social-comment-row .social-cname:first-child {
  margin-left: 0;
}

/* 回复行：A 回复 B: 内容 */
.social-reply {
  padding: 2.5px 0;
  cursor: pointer;
  word-break: break-word;
  color: var(--color-text-primary);
}

/* 内联评论输入框 */
.social-inline-comment {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-top: 6px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.3rem 0.5rem;
  animation: fadeIn 0.2s ease;
}
.social-inline-comment .social-comment-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.4rem 0.2rem;
  outline: none;
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}
.social-inline-comment .social-inline-actions {
  display: flex;
  gap: var(--spacing-xs);
}
.social-inline-comment .social-inline-actions .btn {
  font-size: var(--font-size-xs);
  padding: 0.2rem 0.6rem;
}

/* 空状态 */
.empty-msg {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--spacing-2xl);
  margin: 0;
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
/* 弹出菜单专用：必须保留 translateY(-50%)，否则会被动画覆写导致垂直居中失效 */
@keyframes socialPopupIn {
  from { opacity: 0; transform: translate(4px, -50%); }
  to { opacity: 1; transform: translate(0, -50%); }
}

/* 响应式调整（可选） */
@media (max-width: 768px) {
  .social-post {
    padding: 14px 12px 6px;
  }
  .social-inline-comment {
    flex-wrap: wrap;
  }
  .social-inline-comment .social-comment-input {
    flex-basis: 100%;
  }
  .social-inline-comment .social-inline-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
