/* messages.css —— 消息页：通知中心、私信列表、聊天气泡、语音 / 图片、@ 面板 */

/* ====================== 消息页 ====================== */

.msg-tabs {
  display: flex; border-bottom: 1px solid var(--border-light);
  background: var(--bg-card); position: sticky; top: 0; z-index: 10;
}
.msg-tab {
  flex: 1; text-align: center; padding: 12px 0; font-size: 14px;
  color: var(--text-tip); cursor: pointer; transition: color .15s;
  position: relative;
}
.msg-tab.active { color: var(--primary); font-weight: 700; }
.msg-tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 25%; right: 25%;
  height: 2px; background: var(--primary); border-radius: 2px;
}
.msg-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--alert); color: #fff; font-size: 10px; font-weight: 700;
  padding: 0 4px; margin-left: 4px; vertical-align: middle;
}

/* 通知列表 */
.notify-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.notify-item {
  background: var(--bg-card); border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 12px; box-shadow: var(--shadow);
  position: relative; cursor: pointer; transition: background .12s;
}
.notify-item:active { background: #f5f7fa; }
.notify-item.unread::before {
  content: ''; position: absolute; top: 14px; right: 14px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--alert);
}
.notify-icon {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.notify-icon.system { background: #e3f2fd; }
.notify-icon.like { background: #fce4ec; }
.notify-icon.comment { background: #e8f5e9; }
.notify-icon.follow { background: #fff3e0; }
.notify-icon.favorite { background: #fff8e1; }
.notify-body { flex: 1; min-width: 0; }
.notify-text { font-size: 13px; color: var(--text-title); line-height: 1.5; margin-bottom: 4px; }
.notify-sub { font-size: 12px; color: var(--text-tip); }
.notify-time { font-size: 11px; color: var(--text-tip); margin-top: 4px; display: block; }
.notify-post-preview {
  font-size: 12px; color: var(--text-body); background: var(--bg-page);
  border-radius: 6px; padding: 6px 10px; margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 通知中心（一级）：分类入口行 */
.notify-hub { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.hub-row {
  background: var(--bg-card); border-radius: 12px; padding: 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; cursor: pointer; transition: background .12s;
}
.hub-row:active { background: #f5f7fa; }
.hub-icon { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; position: relative; }
.hub-icon.comment { background: #e8f5e9; } .hub-icon.follow { background: #fff3e0; }
.hub-icon.like { background: #fce4ec; } .hub-icon.system { background: #e3f2fd; }
.hub-main { flex: 1; min-width: 0; }
.hub-title { font-size: 15px; font-weight: 700; color: var(--text-title); }
.hub-preview { font-size: 12px; color: var(--text-tip); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.hub-time { font-size: 11px; color: var(--text-tip); }
.hub-badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--alert); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.hub-arrow { color: var(--text-tip); font-size: 16px; }
.notify-readall { font-size: 13px; color: #fff; cursor: pointer; padding: 4px 6px; white-space: nowrap; }
#page-notify-cat .topbar-right { width: auto; min-width: 72px; text-align: right; }
#page-notify-cat .topbar-left { min-width: 72px; }
.notify-readall:active { opacity: .6; }

/* 通知分类标签（旧版，已不再使用） */
.notify-cats {
  display: flex; gap: 8px; padding: 10px 12px 0; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.notify-cats::-webkit-scrollbar { display: none; }
.notify-cat {
  flex-shrink: 0; position: relative; font-size: 13px; padding: 6px 14px;
  border-radius: 16px; background: var(--bg-card); color: var(--text-body);
  box-shadow: var(--shadow); cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background .15s, color .15s;
}
.notify-cat.active { background: var(--primary); color: #fff; font-weight: 700; }
.notify-cat-dot {
  position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px;
  border-radius: 8px; background: var(--alert); color: #fff; font-size: 10px;
  font-weight: 700; display: none; align-items: center; justify-content: center;
  padding: 0 4px; border: 1.5px solid var(--bg-page);
}
.notify-cat-dot.show { display: flex; }

/* 群聊消息免打扰 */
.chat-mute-btn {
  width: 36px; height: 36px; display: none; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; border-radius: 50%; opacity: .9;
}
.chat-mute-btn.show { display: flex; }
.chat-mute-btn.on { opacity: 1; background: rgba(255,255,255,0.28); }
.chat-mute-icon { font-size: 12px; margin-right: 4px; opacity: .65; }
.chat-avatar-badge.muted {
  min-width: 10px; width: 10px; height: 10px; padding: 0; font-size: 0;
  background: #b0b7c0; top: 0; right: 0;
}

/* 私信列表 */
.chat-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 0; }
.chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
  cursor: pointer; transition: background .1s;
}
.chat-item:last-child { border-bottom: none; }
.chat-avatar {
  width: 44px; height: 44px; border-radius: 50%; background: #e1f5fe;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--accent); flex-shrink: 0;
  position: relative;
}
.chat-avatar-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--alert); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
  border: 1.5px solid var(--bg-card);
}
.chat-info { flex: 1; min-width: 0; }
.chat-name { font-size: 14px; font-weight: 700; color: var(--text-title); margin-bottom: 3px; }
.chat-preview { font-size: 13px; color: var(--text-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-meta { text-align: right; flex-shrink: 0; }
.chat-time { font-size: 11px; color: var(--text-tip); display: block; margin-bottom: 4px; }
.chat-avatar.group { background: #fff3e0; }
.chat-avatar.group::after {
  content: '👥'; position: absolute; bottom: -2px; right: -2px; font-size: 11px;
  background: var(--bg-card); border-radius: 50%; line-height: 1; padding: 2px;
}
.chat-group-tag {
  display: inline-block; font-size: 10px; font-weight: 700; color: #e08a00;
  background: #fff3e0; border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px;
}

/* 私信对话页 */
#page-chat .page-content { top: 50px; bottom: 60px; padding: 12px; }
.chat-bubble-wrap { display: flex; margin-bottom: 14px; gap: 8px; }
.chat-bubble-wrap.mine { flex-direction: row-reverse; }
.bubble-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #e1f5fe;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.bubble-avatar.mine { background: var(--primary); color: var(--ink-on-primary); }
.chat-bubble-col { display: flex; flex-direction: column; align-items: flex-start; max-width: 68%; position: relative; }
.chat-recall-tip { text-align: center; font-size: 12px; color: var(--text-tip); margin: 6px 12px 14px; line-height: 1.6; white-space: normal; word-break: break-all; display: block; overflow: visible; }
.chat-recall-tip a {
  display: inline-block; color: var(--accent); cursor: pointer; margin-left: 8px;
  padding: 6px 10px; min-height: 32px; line-height: 20px; /* 手机上保证至少 32px 高的点击区域 */
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.chat-bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
/* 气泡点击后的底部操作菜单（不依赖 hover，不会被滚动容器裁掉） */
.msg-action-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.12); z-index: 400; }
.msg-pop { position: absolute; z-index: 401; background: rgba(58,60,66,0.97); border-radius: 12px; padding: 10px 6px 8px; display: flex; gap: 2px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35); animation: msgPopIn .12s ease-out; }
.msg-pop-item { width: 62px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; font-size: 12px; touch-action: manipulation; border-radius: 8px; padding: 2px 0; }
.msg-pop-item svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.msg-pop-item:active { background: rgba(255,255,255,0.14); }
.msg-pop-item.disabled { opacity: .4; }
.msg-pop-arrow { position: absolute; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; }
.msg-pop-arrow.down { bottom: -7px; border-top: 7px solid rgba(58,60,66,0.97); }
.msg-pop-arrow.up { top: -7px; border-bottom: 7px solid rgba(58,60,66,0.97); }
@keyframes msgPopIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.chat-bubble.lp-active { filter: brightness(.82); }
.chat-load-older { text-align: center; font-size: 12px; color: var(--primary); padding: 8px 0 12px; cursor: pointer; }
.chat-quote { margin-top: 4px; max-width: 100%; padding: 5px 9px; background: var(--bg-page); border-radius: 8px; font-size: 12px; color: var(--text-tip);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.chat-quote.gone { font-style: italic; cursor: default; }
.chat-bubble-wrap.flash .chat-bubble { animation: bubbleFlash 1.2s ease; }
@keyframes bubbleFlash { 0%,60% { filter: brightness(.7); } 100% { filter: none; } }
.chat-quote-bar { display: none; align-items: center; gap: 8px; padding: 6px 12px 0; font-size: 12px; color: var(--text-tip); }
.chat-quote-bar .cq-text { flex: 1; min-width: 0; padding: 5px 9px; background: var(--bg-page); border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-quote-bar .cq-x { font-size: 16px; padding: 4px 6px; cursor: pointer; }
.msgfav-tabs { display: flex; gap: 8px; padding: 10px 12px 2px; }
.msgfav-tab { padding: 5px 14px; border-radius: 14px; font-size: 13px; background: var(--bg-page); color: var(--text-tip); cursor: pointer; }
.msgfav-tab.active { background: var(--primary); color: #fff; }
.msgfav-item { margin: 10px 12px 0; padding: 10px 12px; background: var(--bg-card); border-radius: 12px; position: relative; }
.msgfav-meta { font-size: 11px; color: var(--text-tip); margin-bottom: 6px; padding-right: 24px; }
.msgfav-text { font-size: 14px; color: var(--text-title); white-space: pre-wrap; word-break: break-word; }
.msgfav-img { max-width: 160px; max-height: 160px; border-radius: 8px; display: block; cursor: pointer; }
.msgfav-del { position: absolute; top: 8px; right: 10px; font-size: 14px; color: var(--text-tip); padding: 2px 4px; cursor: pointer; }
.topbar-avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.chat-bubble-wrap.mine .chat-bubble-col { align-items: flex-end; }
.chat-sender-name { font-size: 12px; color: var(--text-tip); margin: 0 2px 4px; }
.chat-bubble {
  max-width: 100%; padding: 10px 13px; border-radius: 12px;
  font-size: 14px; line-height: 1.55; color: var(--text-title);
  background: var(--bg-card); box-shadow: var(--shadow);
}
.chat-bubble.mine { background: var(--primary); color: var(--ink-on-primary); border-radius: 12px 4px 12px 12px; }
.chat-bubble-time {
  font-size: 11px; color: var(--text-tip); text-align: center; margin: 6px 0 14px;
}
.chat-input-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 60px;
  background: var(--bg-card); border-top: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
}
.chat-input {
  flex: 1; height: 38px; background: var(--bg-page); border-radius: 20px;
  padding: 0 14px; font-size: 14px; color: var(--text-title); border: none;
}
.chat-send-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; transition: opacity .15s; flex-shrink: 0;
}
.chat-send-btn:active { opacity: .7; }
/* 输入栏：语音/键盘切换、按住说话、选图 */
.chat-tool-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer; background: var(--bg-page);
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.chat-tool-btn:active { opacity: .6; }
.chat-hold-btn {
  flex: 1; height: 38px; border-radius: 20px; background: var(--bg-page); color: var(--text-title);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: pointer;
}
.chat-hold-btn.recording { background: var(--primary); color: var(--ink-on-primary); }
.voice-rec-overlay {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 450;
  min-width: 160px; padding: 18px 22px; border-radius: 14px; text-align: center;
  background: rgba(0,0,0,0.72); color: #fff; pointer-events: none;
}
.voice-rec-overlay.cancel { background: rgba(229,57,53,0.88); }
.voice-rec-time { font-size: 22px; font-weight: 700; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.voice-rec-tip { font-size: 12px; opacity: .9; }
/* 图片 / 语音气泡 */
.chat-bubble.media { padding: 3px; }
.chat-img { display: block; max-width: 180px; max-height: 240px; border-radius: 9px; background: var(--bg-page); -webkit-touch-callout: none; }
.chat-bubble.voice { display: flex; align-items: center; gap: 8px; min-width: 80px; }
.chat-bubble-wrap.mine .chat-bubble.voice { flex-direction: row-reverse; }
.chat-bubble.voice.playing .voice-icon { animation: voicePulse .8s ease-in-out infinite; }
@keyframes voicePulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* 帖子详情页：回复某条具体评论时，输入框正上方显示的提示条 */
.reply-target-bar {
  position: absolute; left: 0; right: 0; bottom: 60px; z-index: 30;
  height: 32px; padding: 0 14px;
  background: #eef6fc; border-top: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--accent);
}
.reply-target-cancel { color: var(--text-tip); cursor: pointer; }
.reply-target-cancel:active { opacity: .6; }

.comment-reply-to { color: var(--accent); font-weight: 600; }
.mention-panel {
  position: absolute; left: 12px; right: 12px; bottom: 60px;
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 190px; overflow-y: auto; z-index: 20;
}
.mention-panel-title {
  font-size: 11px; color: var(--text-tip); padding: 8px 12px 4px;
}
.mention-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; }
.mention-item:active, .mention-item.active { background: var(--bg-page); }
.mention-item-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #e1f5fe;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.mention-item-name { font-size: 13px; color: var(--text-title); }

/* 空态提示增强 */
.empty-box {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 0; color: var(--text-tip);
}
.empty-icon { font-size: 38px; margin-bottom: 10px; }
.empty-label { font-size: 14px; margin-bottom: 6px; }
.empty-sub { font-size: 12px; color: var(--text-tip); }
