/* theme.css — CSS 变量 & 暗色/亮色主题 */
:root {
  --c-bg:        #1e1f25;
  --c-bg2:       #252630;
  --c-bg3:       #2d2e3a;
  --c-bg4:       #363748;
  --c-border:    #3a3b4a;
  --c-text:      #e2e4ef;
  --c-text2:     #9395a8;
  --c-text3:     #5e6077;
  --c-primary:   #3b82f6;
  --c-primary-h: #2563eb;
  --c-danger:    #ef4444;
  --c-green:     #22c55e;
  --c-yellow:    #f59e0b;
  --c-bubble-me: #1d4ed8;
  --c-bubble-other: #2d2e3a;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 2px 12px rgba(0,0,0,.35);
  --sidebar-w:   68px;
  --rooms-w:     280px;
  --trans:       .18s ease;
}
[data-theme="light"] {
  --c-bg:        #f0f2f7;
  --c-bg2:       #ffffff;
  --c-bg3:       #e8eaf0;
  --c-bg4:       #dde0ea;
  --c-border:    #d0d3e0;
  --c-text:      #1a1b23;
  --c-text2:     #5c5e72;
  --c-text3:     #9395a8;
  --c-bubble-me: #3b82f6;
  --c-bubble-other: #e8eaf0;
  --shadow:      0 2px 8px rgba(0,0,0,.1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--c-bg); color: var(--c-text);
  font-size: 14px; line-height: 1.5;
}
a { color: var(--c-primary); text-decoration: none; }
button, input, textarea, select {
  font: inherit; outline: none; border: none;
}
button { cursor: pointer; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; min-width: 0; }
.col { flex-direction: column; }
.center { align-items: center; }
.gap4 { gap: 4px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; }
.bold { font-weight: 600; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--c-text2); }

/* 通用按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 18px; border-radius: var(--radius-sm);
  background: var(--c-bg4); color: var(--c-text);
  transition: background var(--trans); user-select: none;
}
.btn:hover { background: var(--c-border); }
.btn.primary { background: var(--c-primary); color: #fff; }
.btn.primary:hover { background: var(--c-primary-h); }
.btn.danger { background: var(--c-danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* 输入框 */
.input {
  background: var(--c-bg4); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: 9px 12px; width: 100%;
  transition: border-color var(--trans);
}
.input:focus { border-color: var(--c-primary); }
.input::placeholder { color: var(--c-text3); }

/* 圆形头像 */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
  overflow: hidden; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }

/* 角标 */
.badge {
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--c-danger); color: #fff; border-radius: 9px;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* 弹窗遮罩 */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.overlay.hidden { display: none; }
.dialog {
  background: var(--c-bg2); border-radius: var(--radius);
  padding: 24px; width: 360px; max-width: 92vw;
  box-shadow: var(--shadow); animation: fadeUp .18s ease;
}
.dialog h3 { margin-bottom: 16px; font-size: 16px; }
.dialog-actions {
  margin-top: 20px; display: flex; gap: 8px; justify-content: flex-end;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 右键 / 长按菜单 */
.ctx-menu {
  position: fixed; background: var(--c-bg2); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  z-index: 300; min-width: 120px; overflow: hidden;
}
.ctx-menu.hidden { display: none; }
.ctx-item {
  padding: 10px 16px; cursor: pointer; white-space: nowrap;
  transition: background var(--trans);
}
.ctx-item:hover { background: var(--c-bg4); }
.ctx-item.danger { color: var(--c-danger); }

/* Toast 提示 */
#toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 8px 20px;
  border-radius: 999px; font-size: 13px; z-index: 999;
  opacity: 0; transition: opacity .25s;
  pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; }
