/* ============================================
   微信朋友圈主题 - 完整样式表
   WeChat Moments Theme
   ============================================ */

/* === 1. CSS变量定义 === */
/* 亮色模式颜色 */
:root {
  --wc-green: #07C160;          /* 微信绿 */
  --wc-blue: #576B95;           /* 链接蓝 */
  --bg-primary: #EDEDED;        /* 主背景灰 */
  --bg-secondary: #FFFFFF;      /* 卡片白 */
  --bg-tertiary: #F7F7F7;       /* 次级灰 */
  --bg-hover: #F0F0F0;          /* 悬停灰 */
  --text-primary: #191919;      /* 主文字黑 */
  --text-secondary: #666666;    /* 次级文字灰 */
  --text-tertiary: #999999;     /* 时间/占位文字 */
  --text-link: #576B95;         /* 链接色 */
  --border-color: #E5E5E5;      /* 分割线色 */
  --shadow-medium: rgba(0, 0, 0, 0.1);  /* 中等阴影 */
  --overlay-bg: rgba(0, 0, 0, 0.7);     /* 遮罩层背景 */
  --nav-bg: #EDEDED;            /* 导航背景 */
  --card-bg: #FFFFFF;           /* 卡片背景 */
  --music-bg: #F7F7F7;          /* 音乐卡片背景 */
  --link-card-bg: #F7F7F7;      /* 链接卡片背景 */
}

/* 暗色模式颜色 */
[data-theme="dark"] {
  --bg-primary: #6b6b6b;
  --bg-secondary: #7b7b7b;
  --bg-tertiary: #8b8b8b;
  --bg-hover: #8b8b8b;
  --text-primary: #E0E0E0;
  --text-secondary: #b0b0b0;
  --text-tertiary: #909090;
  --text-link: #7B9FD4;
  --border-color: #8b8b8b;
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --overlay-bg: rgba(0, 0, 0, 0.85);
  --nav-bg: #7b7b7b;
  --card-bg: #7b7b7b;
  --music-bg: #8b8b8b;
  --link-card-bg: #8b8b8b;
}

/* === 2. 重置与基础样式 === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-link); text-decoration: none; }
a:hover { opacity: 0.8; }
img { max-width: 100%; height: auto; display: block; }
button { border: none; background: none; cursor: pointer; color: inherit; font-family: inherit; }

/* === 3. 主体容器 === */
/* 最大宽度600px居中 */
.wechat-moments { max-width: 600px; margin: 0 auto; min-height: 100vh; background-color: var(--bg-primary); }

/* === 4. 导航栏（隐藏） === */
.moments-header { display: none; }

/* === 5. 暗色模式切换按钮 === */
/* 右下角浮动按钮，滚动后显示 */
.theme-toggle-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
  pointer-events: none;
}
.theme-toggle-float.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.theme-toggle-float:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
/* 亮色模式显示月亮图标，暗色模式显示太阳图标 */
.theme-toggle-float .icon-sun { display: none; }
.theme-toggle-float .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle-float .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle-float .icon-moon { display: none; }

/* === 6. 封面区域 === */
.profile-header { background-color: var(--bg-secondary); }
/* 封面图片，宽600px高325px，居中显示 */
.profile-cover { position: relative; width: 600px; height: 325px; max-width: 100%; overflow: hidden; margin: 0 auto; }
.profile-cover img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s ease; }
/* 亮色/暗色封面切换 */
.cover-light { opacity: 1; }
.cover-dark { opacity: 0; pointer-events: none; position: absolute; top: 0; left: 0; }
[data-theme="dark"] .cover-light { opacity: 0; pointer-events: none; }
[data-theme="dark"] .cover-dark { opacity: 1; }
/* 封面占位符（无封面时显示渐变背景） */
.cover-placeholder { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }

/* === 7. 个人信息区域 === */
/* 头像和昵称，上移覆盖封面底部 */
.profile-info { position: relative; margin-top: -50px; padding: 0 16px 10px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; z-index: 10; }
/* 封面昵称，白色带阴影 */
.profile-nickname { font-size: 18px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.5); line-height: 1.3; }
.profile-nickname a { color: #fff; }
/* 个性签名 */
.profile-signature { padding: 0 16px 8px; font-size: 14px; color: #b2b2b2; line-height: 1.4; text-align: right; }
.profile-avatar-wrap { flex-shrink: 0; }
/* 封面头像 60x60 */
.profile-avatar { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
/* 头像占位符 */
.avatar-placeholder { display: flex; align-items: center; justify-content: center; background-color: var(--bg-tertiary); color: var(--text-tertiary); }
.avatar-placeholder.small { width: 40px; height: 40px; border-radius: 6px; }

/* === 8. 文章列表区域 === */
.moments-feed { padding-bottom: 40px; margin-top: -10px; }

/* === 9. 文章卡片 === */
.moment-card {
  background-color: var(--card-bg);
  padding: 12px 16px;
}
/* 非最后一个卡片底部加分割线（主页） */
.moment-card:not(:last-child) .moment-content {
  border-bottom: 0.5px solid var(--border-color);
  padding-bottom: 12px;
}
/* 内页只有一个卡片，去掉分割线避免和导航线重复 */
.single-post .moment-card .moment-content {
  border-bottom: none;
  padding-bottom: 0;
}
/* 卡片内部布局：头像+内容 */
.moment-inner { display: flex; gap: 10px; }
.moment-avatar { flex-shrink: 0; }
.moment-avatar a { display: block; }
/* 文章头像 36x36 */
.moment-avatar img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.moment-content { flex: 1; min-width: 0; }
/* 昵称 */
.moment-nickname { margin-bottom: 4px; }
.moment-nickname span { font-size: 16px; font-weight: 600; color: var(--wc-blue); }
/* 正文文字 */
.moment-text { font-size: 16px; line-height: 1.5; color: var(--text-primary); margin-bottom: 8px; word-break: break-word; }

/* === 10. 图片九宫格 === */
.moment-images { display: grid; gap: 4px; margin-bottom: 8px; }
/* 1张图片：单列，最大宽度270px */
.image-count-1 { grid-template-columns: 1fr; max-width: 270px; }
.image-count-1 .image-item::before { display: none; }
.image-count-1 .image-item a { position: relative; }
.image-count-1 .image-item img { position: relative; width: 100%; height: auto; aspect-ratio: auto; max-height: 400px; object-fit: cover; }
/* 2张图片：两列 */
.image-count-2 { grid-template-columns: repeat(2, 1fr); max-width: 270px; }
/* 3-9张图片：三列 */
.image-count-3, .image-count-5, .image-count-6, .image-count-7, .image-count-8, .image-count-9 { grid-template-columns: repeat(3, 1fr); max-width: 449px; }
/* 单个图片项 */
.image-item { position: relative; overflow: hidden; cursor: pointer; background-color: var(--bg-tertiary); }
.image-item::before { content: ''; display: block; padding-bottom: 100%; }  /* 正方形比例 */
.image-item a { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; }
.image-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.image-item:hover img { transform: scale(1.03); }  /* 悬停放大效果 */

/* === 11. 链接卡片 === */
.moment-link-card { display: block; margin-bottom: 8px; border-radius: 4px; overflow: hidden; }
.link-card-body { display: flex; background-color: var(--link-card-bg); padding: 10px; border-radius: 4px; }
.link-card-info { flex: 1; padding-right: 10px; }
.link-card-title { font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.link-card-domain { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.link-card-thumb { flex-shrink: 0; width: 60px; height: 60px; }
.link-card-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* === 12. 音乐播放器 === */
.moment-music { margin-bottom: 8px; border-radius: 6px; overflow: hidden; max-width: 333px; height: 84px; display: flex; position: relative; }
/* 左侧封面 */
.music-cover-left { flex-shrink: 0; width: 84px; height: 84px; overflow: hidden; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.music-cover-left img { width: 100%; height: 100%; object-fit: cover; }
/* 右侧渐变背景+歌曲信息 */
.music-gradient-right { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: linear-gradient(to right, #667eea 0%, rgba(102,126,234,0) 100%); position: relative; z-index: 1; }
.music-info { flex: 1; min-width: 0; }
.music-title { font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.music-artist { font-size: 12px; color: rgba(255,255,255,0.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
/* 播放/暂停按钮 */
.music-play-btn { flex-shrink: 0; width: 24px; height: 24px; background: none; color: #000; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; padding: 0; }
.music-play-btn:hover { transform: scale(1.1); }
.music-play-btn .icon-pause { display: none; }
.music-play-btn.playing .icon-play { display: none; }
.music-play-btn.playing .icon-pause { display: block; }
.music-audio { display: none; }
/* 暗色模式音乐播放器 */
[data-theme="dark"] .music-gradient-right { background: linear-gradient(to right, #4a5568 0%, rgba(74,85,104,0) 100%); }
[data-theme="dark"] .music-play-btn { color: #fff; }
[data-theme="dark"] .music-play-btn:hover { color: rgba(255,255,255,0.8); }

/* === 13. 视频 === */
.moment-video { margin-bottom: 8px; border-radius: 4px; overflow: hidden; }
.moment-video video { width: 100%; max-height: 300px; border-radius: 4px; background-color: #000; }

/* === 14. 底部信息栏（位置、时间、操作按钮） === */
.moment-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; margin-bottom: 10px; position: relative; }
.moment-meta-left { display: flex; align-items: center; gap: 8px; }
/* 操作按钮区域，绝对定位在右上角 */
.moment-actions { display: flex; align-items: center; position: absolute; right: 0; top: 0; }
.action-menu-wrapper { position: relative; }
/* 两个点按钮（30x20灰色方形） */
.action-expand { display: flex; align-items: center; justify-content: center; width: 30px; height: 20px; color: #576b95; background-color: var(--bg-tertiary); border-radius: 4px; transition: background-color 0.2s; }
.action-expand:hover { background-color: var(--bg-hover); }
/* 弹出菜单（赞/评论），在按钮左边垂直居中 */
.action-menu-popup { display: none; position: absolute; right: 100%; top: 50%; transform: translateY(-50%); margin-right: 8px; background-color: #4a4a4a; border-radius: 6px; overflow: hidden; z-index: 100; box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
.action-menu-popup.show { display: flex; }  /* 显示时横向排列 */
.action-menu-item { display: flex; align-items: center; gap: 6px; padding: 10px 16px; font-size: 14px; color: #fff; border-right: 1px solid rgba(255,255,255,0.1); transition: background-color 0.2s; white-space: nowrap; }
.action-menu-item:last-child { border-right: none; }
.action-menu-item:hover { background-color: rgba(255,255,255,0.1); }
.action-menu-item svg { color: #fff; }
/* 位置和时间 */
.moment-location { display: flex; align-items: center; gap: 3px; font-size: 14px; color: var(--wc-blue); }
.moment-time { font-size: 14px; color: var(--text-tertiary); }

/* === 15. 标签 === */
.moment-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.moment-tags .post-tag { font-size: 13px; color: var(--text-link); }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.post-tag { font-size: 13px; color: var(--text-link); background-color: var(--bg-tertiary); padding: 4px 10px; border-radius: 12px; }

/* === 16. 文章内页导航（上一篇/下一篇） === */
.post-nav-wrapper { background-color: var(--card-bg); padding: 0 16px; }
.post-nav { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 0.5px solid var(--border-color); }
.post-nav-link { font-size: 14px; color: var(--wc-blue); }

/* === 17. 分页 === */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 20px 16px; background-color: var(--bg-secondary); }
.pagination-prev, .pagination-next { font-size: 14px; color: var(--wc-blue); padding: 6px 16px; border-radius: 16px; background-color: var(--bg-tertiary); }
.pagination-info { font-size: 13px; color: var(--text-tertiary); }

/* === 18. 空状态 === */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; }
.empty-state p { font-size: 14px; color: var(--text-tertiary); }

/* === 19. 图片灯箱 === */
.lightbox-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--overlay-bg); z-index: 1000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; }
.lightbox-overlay.active { display: flex; opacity: 1; }
.lightbox-container { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
/* 关闭按钮 */
.lightbox-close { position: absolute; top: 12px; right: 12px; z-index: 1001; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background-color: rgba(0,0,0,0.3); }
/* 上一张/下一张按钮 */
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1001; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background-color: rgba(0,0,0,0.3); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-content { max-width: 90vw; max-height: 85vh; display: flex; align-items: center; justify-content: center; }
.lightbox-image { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 2px; }
/* 图片计数器 */
.lightbox-counter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); font-size: 14px; color: rgba(255,255,255,0.8); background-color: rgba(0,0,0,0.3); padding: 4px 12px; border-radius: 12px; }

/* === 20. 底部版权 === */
.moments-footer { padding: 20px 16px; text-align: center; border-top: 0.5px solid var(--border-color); }
.footer-content p { font-size: 12px; color: var(--text-tertiary); }

/* === 21. 响应式 === */
/* 小屏幕（手机） */
@media (max-width: 480px) {
  .profile-avatar { width: 50px; height: 50px; }
  .profile-nickname { font-size: 15px; }
  .profile-info { margin-top: -35px; padding: 0 12px 12px; gap: 8px; }
  .image-count-1 { max-width: 200px; }
  .image-count-2 { max-width: 200px; }
  .image-count-3, .image-count-5, .image-count-6, .image-count-7, .image-count-8, .image-count-9 { max-width: 100%; }
  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
}

/* === 22. 动画 === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.moment-card { animation: fadeIn 0.3s ease forwards; }

/* === 23. 加载动画 === */
.loading-indicator { display: flex; align-items: center; justify-content: center; padding: 20px; }
.loading-indicator.hidden { display: none; }
.load-more-indicator { display: none; align-items: center; justify-content: center; padding: 20px; }
.load-more-indicator.visible { display: flex; }
/* "正在加载..."一明一暗闪烁 */
.loading-text { font-size: 14px; color: var(--text-tertiary); animation: textPulse 1.5s ease-in-out infinite; }
@keyframes textPulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* === 24. 滚动条 === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* === 25. 文字选中颜色 === */
::selection { background-color: var(--wc-green); color: #fff; }
