/* ============================================
   White Cloud 主题 v3（QQ 风格 + 左侧导航条）
   改完保存 → 双击「上传样式.bat」→ 浏览器 Ctrl+F5
   ============================================ */

/* ---------- 全局配色（Tinode 的 CSS 变量） ---------- */
:root {
  --clr-primary-accent: #2e86c1;
  --clr-header-stripe-bg: #2e86c1;
  --clr-body-background: #eef3f8;
  --clr-bubble-left-bg: #ffffff;
  --clr-bubble-right-bg: #d6ecff;
  --clr-bubble-left-bg-flash: #eef7ff;
  --clr-bubble-right-bg-flash: #c7e4ff;
  --clr-bubble-text: #1f2937;
  --clr-bubble-timestamp-text: #8a94a6;
  --clr-bubble-meta-text: #8a94a6;
}

/* ---------- 字体 ---------- */
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif !important;
}

/* ---------- 左侧会话列表 ---------- */
#side-caption-panel {
  background-color: #2e86c1 !important;
}
.contact-box {
  border-radius: 8px !important;
}
.contact-box:hover {
  background-color: #e8f1fa !important;
}

/* ---------- 聊天区 ---------- */
#messages-panel,
ul.chat-box {
  background-image: none !important;
  background-color: #f5f7fa !important;
}
li.first-left .bubble,
li.first-right .bubble {
  border-radius: 12px 12px 10px 10px !important;
}
.bubble .timestamp {
  color: #8a94a6 !important;
  font-size: 0.75rem !important;
}
.bubble .message-content,
.bubble .message-content * {
  color: #1f2937 !important;
}

/* ---------- 输入区 ---------- */
textarea {
  border-radius: 8px !important;
}

/* ============================================
   左侧导航条
   ============================================ */
#wc-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 60px;
  z-index: 9999;
  background: #1f2d3d;
  color: #cfd8e3;
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  box-sizing: border-box;
  transition: width 0.18s ease;
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
#wc-rail:hover {
  width: 190px;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.25);
}
#wc-rail .wc-logo {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  margin-bottom: 12px;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
#wc-rail .wc-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: 0 0 32px;
}
#wc-rail .wc-item {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  border-left: 3px solid transparent;
}
#wc-rail .wc-item:hover {
  background: #2b3d52;
  color: #fff;
  border-left-color: #4aa3e0;
}
#wc-rail .wc-item svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
#wc-rail .wc-label {
  opacity: 0;
  transition: opacity 0.12s;
}
#wc-rail:hover .wc-label {
  opacity: 1;
}
#wc-rail .wc-spacer {
  flex: 1;
}

/* 给页面让出 60px */
#app-container {
  margin-left: 60px !important;
  width: calc(100% - 60px) !important;
}

/* 小提示 */
#wc-toast {
  position: fixed;
  left: 80px;
  bottom: 24px;
  background: rgba(30, 41, 59, 0.92);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#wc-toast.show {
  opacity: 1;
}

/* ============ 收藏 / 面板 / 搜索 ============ */
.wc-star {
  position: absolute;
  right: 6px;
  top: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  color: #b0b8c4;
  opacity: 0;
  transition: opacity .15s;
}
li:hover .wc-star { opacity: 1; }
.wc-star.active { color: #f5a623; opacity: 1; }
li { position: relative; }

.wc-panel {
  position: fixed;
  left: 60px;
  top: 0;
  bottom: 0;
  width: 340px;
  background: #fff;
  border-right: 1px solid #e3e9f0;
  box-shadow: 4px 0 16px rgba(0,0,0,.08);
  transform: translateX(-110%);
  transition: transform .2s ease;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  font-family: "Microsoft YaHei", sans-serif;
}
.wc-panel.open { transform: translateX(0); }
.wc-panel-head {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-weight: 600;
  border-bottom: 1px solid #eef2f6;
  color: #1f2d3d;
}
.wc-close { border: none; background: transparent; font-size: 22px; cursor: pointer; color: #8a94a6; }
.wc-panel-body { padding: 12px 16px; overflow-y: auto; }

.wc-fav-item { padding: 10px 0; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.wc-fav-text { font-size: 13px; color: #1f2937; line-height: 1.5; }
.wc-fav-meta { font-size: 12px; color: #8a94a6; margin-top: 4px; display: flex; justify-content: space-between; }
.wc-fav-del { color: #e05555; }
.wc-empty { color: #8a94a6; font-size: 13px; padding: 20px 0; text-align: center; }

#wc-search {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  display: none;
  z-index: 10001;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
#wc-search.open { display: flex; }
.wc-search-box {
  width: 560px;
  max-width: 90vw;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
#wc-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
#wc-search-results { max-height: 50vh; overflow-y: auto; margin-top: 10px; }
.wc-hit { padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.wc-hit:hover { background: #f2f7fb; }
.wc-hit-text { font-size: 13px; color: #1f2937; }
.wc-hit-meta { font-size: 12px; color: #8a94a6; margin-top: 2px; }
.wc-hit mark { background: #ffe9a8; }

.wc-stat {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  color: #46566b;
}
.wc-stat b { color: #1f2d3d; }
.wc-note { font-size: 12px; color: #8a94a6; margin: 12px 0; line-height: 1.5; }
.wc-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border: 1px solid #dbe4ee;
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #1f2d3d;
}
.wc-btn:hover { background: #eef4fa; }
.wc-btn.danger { color: #d9534f; }

li.wc-flash { animation: wcFlash 1.4s ease; }
@keyframes wcFlash {
  0% { background: rgba(255, 214, 102, .5); }
  100% { background: transparent; }
}

/* ---------- 面板内按钮/文字修正（覆盖 Tinode 按钮样式） ---------- */
.wc-panel .wc-btn {
  background: #f8fafc !important;
  color: #1f2d3d !important;
  border: 1px solid #dbe4ee !important;
  height: auto !important;
  min-height: 36px;
  line-height: 1.5 !important;
  padding: 9px 12px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  text-align: center;
  white-space: normal !important;
}
.wc-panel .wc-btn:hover { background: #eef4fa !important; }
.wc-panel .wc-btn.danger {
  background: #fff !important;
  color: #d9534f !important;
  border-color: #f0c9c6 !important;
}
.wc-panel .wc-btn.danger:hover { background: #fdf3f2 !important; }
.wc-panel-body { padding: 14px 16px !important; }
.wc-stat { align-items: center; line-height: 1.4; }
.wc-note { line-height: 1.6; }
/* 菜单里的收藏项 */
ul.menu > li.wc-menu-fav { color: #1f2d3d; }

/* ---------- QQ 风气泡（v6） ---------- */
ul.chat-box li .bubble {
  background: #ffffff !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  padding: 8px 12px !important;
}
ul.chat-box li.right .bubble {
  background: #cfe9ff !important;
}
.chat-box .author {
  font-size: 12px !important;
  color: #7b8795 !important;
  margin-bottom: 3px;
  padding-left: 2px;
}
.chat-box .timestamp {
  font-size: 11px !important;
  color: #9aa6b4 !important;
}
ul.chat-box li {
  padding-top: 6px;
  padding-bottom: 6px;
}

/* ---------- QQ 风布局（v7）：头像顶对齐，昵称在气泡上方 ---------- */
ul.chat-box li {
  position: relative !important;
  align-items: flex-start !important;
}
ul.chat-box li.single,
ul.chat-box li.first {
  padding-top: 20px !important;
}
ul.chat-box li .author {
  position: absolute !important;
  top: 1px !important;
  left: 56px !important;
  margin: 0 !important;
  font-size: 12px !important;
  color: #7b8795 !important;
  line-height: 16px !important;
  max-width: 60% !important;
}
ul.chat-box li.right .author {
  left: auto !important;
  right: 56px !important;
  text-align: right !important;
}
.chat-box .avatar-box {
  width: 40px !important;
  height: 40px !important;
  flex: 0 0 40px !important;
  margin-top: 18px !important;
}
.chat-box .avatar-box .lettertile,
.chat-box .avatar-box img {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
}
ul.chat-box li.left .bubble { margin-left: 8px !important; }
ul.chat-box li.right .bubble { margin-right: 8px !important; }

/* ---------- v8：头像对齐气泡顶，昵称+时间在气泡上方 ---------- */
ul.chat-box li.single,
ul.chat-box li.first {
  padding-top: 24px !important;
}
.chat-box .avatar-box {
  margin-top: 24px !important;
  width: 40px !important;
  height: 40px !important;
  flex: 0 0 40px !important;
}
ul.chat-box li .author {
  top: 2px !important;
  left: 52px !important;
  font-size: 12px !important;
  color: #7b8795 !important;
}
ul.chat-box li.right .author {
  left: auto !important;
  right: 52px !important;
  text-align: right !important;
}
/* 时间挪到气泡上方（气泡外） */
.bubble .timestamp {
  position: absolute !important;
  top: -17px !important;
  right: 6px !important;
  float: none !important;
  font-size: 11px !important;
  color: #9aa6b4 !important;
  background: transparent !important;
}
ul.chat-box li.left .bubble .timestamp {
  right: 6px !important;
}
ul.chat-box li.right .bubble .timestamp {
  right: 6px !important;
}

/* ---------- v9：自己头像 + 菜单触发器收进气泡 ---------- */
.wc-own-avatar {
  order: 3;
  margin-left: 8px !important;
  margin-right: 0 !important;
}
.wc-own-tile {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: #2e86c1 !important;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 15px !important;
}
ul.chat-box li.right {
  align-items: flex-start !important;
}
.bubble .menuTrigger,
li .menuTrigger {
  top: 3px !important;
  right: 4px !important;
  opacity: 0 !important;
  font-size: 12px !important;
}
li:hover .menuTrigger {
  opacity: 0.65 !important;
}

/* ---------- v10：去掉气泡小尾巴 ---------- */
ul.chat-box .bubble::before,
ul.chat-box .bubble::after,
ul.chat-box .bubble.tip::before,
ul.chat-box .bubble.tip::after {
  display: none !important;
  content: none !important;
}

/* ---------- v11：QQ 式聊天布局 ---------- */
/* 自己的头像用图片填满 */
.wc-own-tile img {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  display: block !important;
}
.wc-own-tile { padding: 0 !important; overflow: hidden !important; background: transparent !important; }

/* 连发合并：只在该组第一条显示头像和昵称 */
ul.chat-box li.middle .avatar-box,
ul.chat-box li.last .avatar-box {
  visibility: hidden !important;
}
ul.chat-box li.middle .author,
ul.chat-box li.last .author {
  display: none !important;
}
ul.chat-box li.middle .timestamp,
ul.chat-box li.first .timestamp {
  display: none !important;
}
/* 合并后消息间距收紧 */
ul.chat-box li.middle,
ul.chat-box li.last {
  padding-top: 4px !important;
}

/* ---------- v12：头像在昵称旁，气泡在下面 ---------- */
/* 取消 v11 的连发合并 */
ul.chat-box li.middle .avatar-box,
ul.chat-box li.last .avatar-box {
  visibility: visible !important;
}
ul.chat-box li.middle .author,
ul.chat-box li.last .author {
  display: block !important;
}
ul.chat-box li.middle .timestamp,
ul.chat-box li.first .timestamp {
  display: inline !important;
}
ul.chat-box li.single,
ul.chat-box li.first,
ul.chat-box li.middle,
ul.chat-box li.last {
  padding-top: 0 !important;
  margin-top: 10px !important;
  margin-bottom: 2px !important;
}
/* 头像贴顶 */
.chat-box .avatar-box {
  margin-top: 2px !important;
}
/* 昵称在头像右侧、气泡上方 */
ul.chat-box li .author {
  position: absolute !important;
  top: 4px !important;
  left: 52px !important;
  margin: 0 !important;
}
ul.chat-box li.right .author {
  left: auto !important;
  right: 52px !important;
  text-align: right !important;
}
/* 气泡下移，给昵称让位；并缩进到昵称位置 */
ul.chat-box li .bubble {
  margin-top: 22px !important;
}
ul.chat-box li.left .bubble {
  margin-left: 8px !important;
}
ul.chat-box li.right .bubble {
  margin-right: 8px !important;
}
/* 时间放在昵称同一行右侧 */
.bubble .timestamp {
  top: -22px !important;
  right: 4px !important;
}

/* ---------- v13：气泡贴近头像 + 时间分隔，隐藏行内时间 ---------- */
ul.chat-box li.left .bubble { margin-left: 4px !important; }
ul.chat-box li.right .bubble { margin-right: 4px !important; }
.wc-own-avatar { margin-left: 4px !important; }

.bubble .timestamp { display: none !important; }

.wc-timesep {
  text-align: center;
  color: #9aa6b4;
  font-size: 12px;
  margin: 14px 0 8px;
  user-select: none;
}

/* ---------- v14：自己的昵称 ---------- */
ul.chat-box li.right .wc-own-author {
  position: absolute !important;
  top: 4px !important;
  right: 52px !important;
  left: auto !important;
  text-align: right !important;
  font-size: 12px !important;
  color: #7b8795 !important;
}

/* ---------- v15：彻底隐藏消息自带时间，只留分隔条 ---------- */
.chat-box .timestamp,
ul.chat-box .timestamp,
li .timestamp {
  display: none !important;
}

/* ---------- v16：隐藏 menuTrigger 里的时间文字，只留箭头 ---------- */
li .menuTrigger {
  font-size: 0 !important;
}
li .menuTrigger .material-icons {
  font-size: 14px !important;
}

/* ---------- v17：只隐藏 menuTrigger 的文字 span，保留箭头 a ---------- */
li .menuTrigger > span {
  display: none !important;
}
li .menuTrigger {
  width: auto !important;
  min-width: 0 !important;
}

/* 查看原图按钮 */
#messages-panel a.wc-orig-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 12px;
  border: 1px solid #2e86c1;
  border-radius: 14px;
  color: #2e86c1 !important;
  font-size: 12px;
  text-decoration: none !important;
  background: rgba(46,134,193,.08);
}
#messages-panel a.wc-orig-btn:hover { background: rgba(46,134,193,.18); }
/* 原图按钮定位到气泡右下角 */
#messages-panel li .bubble { position: relative; }
#messages-panel a.wc-orig-btn {
  position: absolute;
  right: 10px;
  bottom: 26px;
  display: inline-block;
  white-space: nowrap;
  padding: 3px 10px;
  border: 1px solid #2e86c1;
  border-radius: 12px;
  color: #2e86c1 !important;
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none !important;
  background: rgba(255,255,255,.85);
}
#messages-panel a.wc-orig-btn:hover { background: rgba(46,134,193,.15); }