/* ══════════════════════════════════════════════════════
   空间动态模块样式
   File: public/css/dynamics.css
══════════════════════════════════════════════════════ */

/* ── 全屏子页基础 ── */
.dyn-page {
  position: fixed;
  inset: 0;
  z-index: 860;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.34, 1.1, 0.64, 1);
}
.dyn-page:not(.hidden) { transform: translateX(0); }
.dyn-page.hidden { transform: translateX(100%); pointer-events: none; }

/* ── 顶栏 ── */
.dyn-topbar {
  height: var(--top-nav-h, 52px);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
  backdrop-filter: blur(16px);
  z-index: 1;
}
.dyn-topbar-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.dyn-back-btn {
  width: 36px; height: 36px;
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s ease;
}
.dyn-back-btn:hover { background: var(--bg-active); color: var(--accent); }
.dyn-publish-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.18s ease;
}
.dyn-publish-btn:hover { filter: brightness(1.1); }
.dyn-publish-btn:disabled { opacity: 0.55; pointer-events: none; }
.dyn-icon-btn {
  width: 36px; height: 36px;
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s ease;
}
.dyn-icon-btn:hover { background: var(--bg-active); color: var(--accent); }

/* ── 滚动区 ── */
.dyn-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── 我的快速入口条 ── */
.dyn-my-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
 /* border-bottom: 6px solid var(--bg-base);*/
  cursor: pointer;
}
.dyn-my-strip-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-active);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.9rem;
  border: 2px solid var(--accent);
}
.dyn-my-strip-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dyn-write-placeholder {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.18s ease;
}
.dyn-write-placeholder:hover { border-color: var(--accent); }

/* ── 动态卡片 ── */
.post-card {
  background: var(--bg-surface);
  border-bottom: 6px solid var(--bg-base);
  padding: 14px 16px 10px;
}
.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.post-author-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-active);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.9rem;
}
.post-author-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.post-author-info { flex: 1; min-width: 0; }
.post-author-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: inline;
}
.post-author-name:hover { color: var(--accent); }
.post-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.post-privacy-badge {
  font-size: 0.6rem;
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 5px;
  vertical-align: middle;
}
.post-more-btn {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.post-more-btn:hover { background: var(--bg-active); color: var(--text-secondary); }
.post-content {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 10px;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ── 媒体网格 ── */
.post-media { margin-bottom: 10px; }
.post-media-grid {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  overflow: hidden;
}
.post-media-grid.count-1 { grid-template-columns: 1fr; }
.post-media-grid.count-2 { grid-template-columns: 1fr 1fr; }
.post-media-grid.count-3 { grid-template-columns: 1fr 1fr 1fr; }
.post-media-item {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-active);
  overflow: hidden;
  cursor: pointer;
}
.post-media-grid.count-1 .post-media-item { aspect-ratio: 4/3; max-height: 260px; }
.post-media-item img, .post-media-item video {
  width: 100%; height: 100%; object-fit: cover;
}
.post-media-item:hover { opacity: 0.92; }

/* ── 操作栏 ── */
.post-actions {
  display: flex;
 /* border-top: 1px solid var(--border-dim);*/
  margin-top: 8px;
  padding-top: 6px;
}
.post-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  justify-content: center;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 7px 4px;
  border-radius: 8px;
  transition: all 0.18s ease;
}
.post-action-btn:hover { background: var(--bg-active); color: var(--text-secondary); }
.post-action-btn.liked { color: #ef4444; }
.post-action-btn i { font-size: 1rem; }

/* ── 空间主页 Header ── */
.space-header {
  position: relative;
  padding: 20px 16px 16px;
  background: linear-gradient(160deg, rgba(0,212,160,0.08) 0%, var(--bg-surface) 70%);
  border-bottom: 1px solid var(--border-dim);
}
.space-profile {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.space-avatar {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-active);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.space-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.space-info { flex: 1; padding-top: 4px; }
.space-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.space-bio {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}
.space-stats {
  display: flex;
  background: var(--bg-base);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  overflow: hidden;
}
.space-stat-item {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  cursor: pointer;
  border-right: 1px solid var(--border-dim);
  transition: background 0.15s ease;
}
.space-stat-item:last-child { border-right: none; }
.space-stat-item:hover { background: var(--bg-panel); }
.space-stat-num {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}
.space-stat-label { font-size: 0.62rem; color: var(--text-muted); display: block; }

/* ── 写动态页 ── */
.write-post-area {
  width: 100%;
  min-height: 130px;
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-primary);
  font-family: inherit;
  padding: 16px;
}
.write-post-area::placeholder { color: var(--text-muted); }
.media-upload-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 16px 14px;
}
.media-upload-slot {
  width: 82px; height: 82px;
  border-radius: 10px;
  border: 1.5px dashed var(--border-mid);
  background: var(--bg-panel);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}
.media-upload-slot:hover { border-color: var(--accent); background: var(--accent-dim); }
.media-upload-slot img, .media-upload-slot video {
  width: 100%; height: 100%; object-fit: cover;
}
.slot-icon { font-size: 1.5rem; color: var(--text-muted); }
.slot-label { font-size: 0.62rem; color: var(--text-muted); margin-top: 4px; }
.remove-media-btn {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.65);
  border-radius: 50%; border: none;
  color: #fff; font-size: 0.62rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.write-divider { height: 1px; background: var(--border-dim); margin: 0 16px; }
.privacy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-dim);
  transition: background 0.15s ease;
}
.privacy-row:hover { background: var(--bg-panel); }
.privacy-row-left {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.88rem; color: var(--text-secondary);
}
.privacy-value {
  font-size: 0.82rem; color: var(--accent);
  display: flex; align-items: center; gap: 4px;
}

/* ── 隐私选择弹出 ── */
.privacy-popup-overlay {
  position: fixed; inset: 0; z-index: 920;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.privacy-popup-overlay.hidden { display: none; }
.privacy-popup-sheet {
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  width: 100%; max-width: 480px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.privacy-popup-title {
  text-align: center;
  padding: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-dim);
}
.privacy-option {
  padding: 14px 20px;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border-dim);
}
.privacy-option:last-child { border-bottom: none; }
.privacy-option:hover { background: var(--bg-panel); }
.privacy-option.active { color: var(--accent); }
.privacy-option .opt-check { margin-left: auto; color: var(--accent); }

/* ── 评论底部浮层 ── */
.comments-overlay {
  position: fixed; inset: 0; z-index: 870;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.comments-overlay.hidden { display: none; }
.comments-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 871;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  max-height: 72vh;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.1, 0.64, 1);
}
.comments-sheet:not(.hidden) { transform: translateY(0); }
.comments-sheet.hidden { transform: translateY(100%); pointer-events: none; }
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-mid);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.comments-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 10px;
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}
.comments-sheet-title {
  font-family: var(--font-display);
  font-size: 0.9rem; font-weight: 700;
  color: var(--text-primary);
}
.comments-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.comment-item {
  display: flex; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-dim);
}
.comment-item:last-child { border-bottom: none; }
.comment-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0; overflow: hidden;
  background: var(--bg-active);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  color: var(--accent); cursor: pointer;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.comment-body { flex: 1; min-width: 0; }
.comment-author {
  font-size: 0.8rem; font-weight: 600;
  color: var(--accent); cursor: pointer;
}
.comment-text {
  font-size: 0.85rem; color: var(--text-secondary);
  line-height: 1.5; margin-top: 2px; word-break: break-word;
}
.comment-time { font-size: 0.65rem; color: var(--text-muted); margin-top: 3px; }
.comment-delete-btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 0.7rem;
  cursor: pointer; padding: 2px 4px; border-radius: 4px;
  opacity: 0; transition: opacity 0.15s;
}
.comment-item:hover .comment-delete-btn { opacity: 1; }
.comment-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-dim);
  background: var(--bg-panel);
  flex-shrink: 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.comment-input-field {
  flex: 1;
  background: var(--bg-active);
  border: 1px solid var(--border-dim);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.88rem; color: var(--text-primary);
  outline: none; font-family: inherit;
}
.comment-input-field:focus { border-color: var(--accent); }
.comment-send-btn {
  background: var(--accent); color: #fff;
  border: none; border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.9rem; flex-shrink: 0;
}
.comment-send-btn:hover { filter: brightness(1.1); }
.comment-send-btn:disabled { opacity: 0.5; }

/* ── 访客 / 统计列表 ── */
.visitor-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-dim);
  cursor: pointer; transition: background 0.15s ease;
}
.visitor-item:hover { background: var(--bg-panel); }
.visitor-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  background: var(--bg-active);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700; color: var(--accent);
}
.visitor-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.visitor-name { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.visitor-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* ── Stats tab (点赞/评论记录) ── */
.stats-tab-bar {
  display: flex; border-bottom: 1px solid var(--border-dim);
  background: var(--bg-panel); flex-shrink: 0;
}
.stats-tab {
  flex: 1; padding: 13px 8px;
  text-align: center; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.18s ease;
}
.stats-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.stats-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-dim);
}
.stats-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  background: var(--bg-active);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--accent);
}
.stats-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.stats-action-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }
.stats-post-preview {
  font-size: 0.72rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.stats-time { font-size: 0.65rem; color: var(--text-muted); margin-top: 3px; }

/* ── 侧边栏预览 ── */
.dyn-preview-wrap {
  display: flex; align-items: center; gap: 5px;
}
.dyn-preview-mini-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  overflow: hidden; background: var(--bg-active);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.dyn-preview-mini-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dyn-preview-mini-name {
  font-size: 0.7rem; color: var(--text-muted);
  max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── 加载/空状态 ── */
.dyn-loading, .dyn-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 60px 20px;
  color: var(--text-muted); font-size: 0.88rem;
}
.dyn-loading i, .dyn-empty i { font-size: 2rem; opacity: 0.4; }

[data-theme="light"] .post-card { background: #fff; }
[data-theme="light"] .comments-sheet { background: #f5f5f7; }
[data-theme="light"] .privacy-popup-sheet { background: #f5f5f7; }



.upload-progress-bar {
  position: absolute; bottom: 4px; left: 4px; right: 4px; height: 6px;
  background: rgba(0,0,0,0.6); border-radius: 3px; overflow: hidden;
}
.upload-progress-bar .bar { height: 100%; background: var(--accent); transition: width .2s; }
.upload-progress-bar .percent { position: absolute; top: -18px; right: 0; font-size: 0.65rem; color: #fff; }


/* ── 我的获赞 / 我的评论 快捷入口 ── */


.quick-link-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-right: 1px solid var(--border-dim);
  transition: background 0.15s ease;
  position: relative;
}
.quick-link-item:last-child { border-right: none; }
.quick-link-item:hover { background: var(--bg-panel); color: var(--accent); }
.quick-link-item:active { background: var(--bg-active); }

.quick-link-item i {
  font-size: 0.95rem;
}
.quick-link-item:first-child i { color: #ef4444; }
.quick-link-item:last-child i  { color: var(--accent); }

.quick-link-item .badge {
  min-width: 18px;
  height: 18px;
  background: #ef4444;
  color: #fff;
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.quick-link-item .badge:empty,
.quick-link-item .badge[textContent="0"] { display: none; }



/* ── 动作区整体容器 ── */
.dyn-action-zone {
  background: var(--bg-surface);
  border-bottom: 6px solid var(--bg-base);
}

/* ── 三快捷按钮行 ── */
.dyn-shortcut-row {
  display: flex;
  /*border-top: 1px solid var(--border-dim);*/
}

.dyn-shortcut-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  /*border-right: 1px solid var(--border-dim);*/
  transition: background 0.15s ease;
  position: relative;
}
.dyn-shortcut-btn:last-child { border-right: none; }
.dyn-shortcut-btn:hover { background: var(--bg-panel); color: var(--accent); }
.dyn-shortcut-btn:active { background: var(--bg-active); }
.dyn-shortcut-btn i { font-size: 1.1rem; }

/* 角标 */
.shortcut-badge {
  position: absolute;
  top: 6px; right: calc(50% - 18px);
  min-width: 16px; height: 16px;
  background: #ef4444;
  color: #fff;
  border-radius: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.shortcut-badge.hidden { display: none; }

/* ── 图片/视频尺寸控制 ── */
.post-media-grid.count-1 .post-media-item {
  aspect-ratio: unset;
  max-height: 200px;         /* 单张最大高度 */
  border-radius: 8px;
  overflow: hidden;
}
.post-media-grid.count-1 .post-media-item img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}
.post-media-grid.count-2 .post-media-item,
.post-media-grid.count-3 .post-media-item {
  aspect-ratio: 1;
  max-height: 130px;
}

/* ── 内置视频播放器 ── */
.post-video-wrap {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  max-height: 220px;
}
.post-video-wrap video {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}
.post-video-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  cursor: pointer;
  transition: opacity 0.2s;
}
.post-video-cover i {
  font-size: 2.8rem;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.5));
}
.post-video-wrap.playing .post-video-cover { opacity: 0; pointer-events: none; }

/* ── 点赞人员名字列表（QQ 空间样式） ── */
.post-likers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  padding: 6px 0 4px;
  border-top: 1px solid var(--border-dim);
  font-size: 0.78rem;
  line-height: 1.6;
}
.post-likers-icon {
  color: #ef4444;
  margin-right: 5px;
  flex-shrink: 0;
  font-size: 0.82rem;
}
.liker-name {
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}
.liker-name:hover { text-decoration: underline; }
.liker-sep { color: var(--text-muted); margin: 0 2px; }
.liker-more { color: var(--text-muted); }

/* 删除旧的 dyn-quick-links（如有） */
.dyn-quick-links { display: none !important; }

@media (max-width: 640px) {
  .post-card { padding: 12px 13px 8px; }
  .media-upload-slot { width: 74px; height: 74px; }
  .space-stats { margin-top: 10px; }
}