/* ============================================================
   chat.css —— 聊天室专用（导航 / 房间卡片 / 消息气泡）
   主站通用样式仍走 style.css，这里只加 chat 独有的东西
   ============================================================ */

.app {
  position: fixed; inset: 0; display: flex;
  background: linear-gradient(135deg, #eef1fb 0%, #e7ecfa 100%);
  color: #1f2333; font-size: 14px;
}
.app.hidden { display: none; }

/* ---------------- 左侧栏 ---------------- */
.side {
  width: 208px; flex: 0 0 auto; display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid #e6e9f5; padding: 14px 10px;
}
.side-me { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.side-me-text { min-width: 0; }
#me-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: #8a8fa3; font-size: 12px; }
.avatar.sm {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  background: #667eea center/cover no-repeat; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-i {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: none; background: none; border-radius: 9px; cursor: pointer;
  font-size: 14px; color: #4a4f66; font-family: inherit; text-align: left;
}
.nav-i:hover { background: #f4f6fd; }
.nav-i.active { background: #eef1ff; color: #4b5cd6; font-weight: 600; }
.nav-ic { font-size: 16px; width: 20px; text-align: center; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; color: #8a8fa3; padding: 12px; }
.side-foot-links { display: flex; gap: 12px; padding: 0 12px 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c8ccdd; flex: 0 0 auto; }
.dot.on { background: #2ecc71; }
.dot.off { background: #e74c3c; }
.dot.mid { background: #f1c40f; }
.link.tiny { font-size: 12px; }
.link.danger { color: #e74c3c; }

/* ---------------- 主区 ---------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid #e6e9f5; padding: 12px 16px; min-height: 46px;
}
.top.hidden { display: none; }
.top-name { font-weight: 700; font-size: 15px; }
.top-sub { font-size: 12px; color: #8a8fa3; margin-top: 2px; }
.icon-btn { border: none; background: none; font-size: 17px; cursor: pointer; padding: 6px 8px; border-radius: 8px; color: #4a4f66; }
.icon-btn:hover { background: #f2f4fc; }
.top-r { display: flex; gap: 4px; }

.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 下拉刷新提示条 */
.pull-tip { text-align: center; font-size: 12px; color: #8a8fa3; height: 0; overflow: hidden; transition: height .18s; }
.pull-tip.show { height: 34px; display: flex; align-items: center; justify-content: center; }

/* ---------------- 房间列表 ---------------- */
#v-home { padding: 14px 16px 24px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  border: 1px solid #dfe3f2; background: #fff; color: #5a5f76;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.tab.active { background: #667eea; border-color: #667eea; color: #fff; }
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input {
  flex: 1; padding: 10px 12px; border: 1.5px solid #dfe3f2; border-radius: 10px;
  font-size: 14px; outline: none; font-family: inherit; background: #fff;
}
.searchbar input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.12); }
.btn-sm { padding: 9px 14px; font-size: 13px; }

.room-list { display: flex; flex-direction: column; gap: 8px; }
.room {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 1px solid #e9ecf7; border-radius: 12px; padding: 12px 14px; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.room:hover { border-color: #c3cdf7; transform: translateY(-1px); }
.room-ic {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto;
  background: #eef1ff; color: #4b5cd6; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700;
}
.room-b { flex: 1; min-width: 0; }
.room-t { display: flex; align-items: center; gap: 7px; }
.room-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #f0f2fa; color: #787e96; flex: 0 0 auto; }
.badge.hall { background: #ffeef0; color: #e0566f; }
.badge.public { background: #eaf5ff; color: #2f7fbf; }
.room-m { font-size: 12px; color: #8a8fa3; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.tag { font-size: 11px; color: #667eea; background: #f1f4ff; padding: 1px 7px; border-radius: 999px; }
.list-end { text-align: center; font-size: 12px; padding: 16px 0 4px; }

/* ---------------- 消息区 ---------------- */
#v-room { display: flex; flex-direction: column; overflow: hidden; }
#v-room.hidden { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 9px; max-width: 100%; }
.msg-av {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  background: #9aa8f5 center/cover no-repeat; color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.msg-main { min-width: 0; max-width: min(74%, 560px); }
.msg-meta { font-size: 11px; color: #8a8fa3; margin: 0 0 3px 2px; display: flex; gap: 6px; }
.msg-body {
  background: #fff; border: 1px solid #eaeef8; border-radius: 3px 11px 11px 11px;
  padding: 8px 11px; line-height: 1.5; word-break: break-word; white-space: pre-wrap;
}
.msg.me { flex-direction: row-reverse; }
.msg.me .msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.msg.me .msg-meta { margin: 0 2px 3px 0; }
.msg.me .msg-body { background: #667eea; border-color: #667eea; color: #fff; border-radius: 11px 3px 11px 11px; }
.sys { text-align: center; font-size: 12px; color: #9aa0b4; padding: 2px 0; }
.day { text-align: center; margin: 6px 0; }
.day span { font-size: 11px; color: #7d839b; background: #e3e8f7; padding: 2px 10px; border-radius: 999px; }

.composer { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: #fff; border-top: 1px solid #e6e9f5; }
.composer input {
  flex: 1; padding: 10px 12px; border: 1.5px solid #dfe3f2; border-radius: 10px;
  font-size: 14px; outline: none; font-family: inherit;
}
.composer input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.12); }
.emoji-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 14px 10px; background: #fff; }
.emoji-row button { border: none; background: #f4f6fd; border-radius: 8px; font-size: 18px; padding: 4px 8px; cursor: pointer; }
.emoji-row button:hover { background: #e6ebfb; }

/* ---------------- 成员抽屉 ---------------- */
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 260px; background: #fff;
  border-left: 1px solid #e6e9f5; box-shadow: -6px 0 24px rgba(20,26,58,.07); z-index: 30;
  display: flex; flex-direction: column;
}
.drawer.hidden { display: none; }
.drawer-head { padding: 14px 16px; border-bottom: 1px solid #eef0f8; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.drawer-x { margin-left: auto; border: none; background: none; cursor: pointer; font-size: 15px; color: #8a8fa3; }
.drawer-body { overflow-y: auto; padding: 8px 0; }
.mem { display: flex; align-items: center; gap: 9px; padding: 8px 16px; }
.mem-role { margin-left: auto; font-size: 11px; color: #8a8fa3; }

/* ---------------- 占位 ---------------- */
.stub { text-align: center; color: #8a8fa3; padding: 60px 20px; font-size: 14px; }
.stub-box { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 50px 20px; }

/* ---------------- 窄屏：左栏收成顶部一行 ---------------- */
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .side {
    width: auto; flex: 0 0 auto; flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 10px; border-right: none; border-bottom: 1px solid #e6e9f5;
  }
  .side-me { padding: 0 6px 0 0; }
  .side-me-text { display: none; }
  .nav { flex-direction: row; flex: 1; overflow-x: auto; gap: 2px; }
  .nav-i { padding: 8px 9px; gap: 4px; font-size: 12px; }
  .side-foot { margin: 0; padding: 0 4px; }
  .side-foot span:not(.dot) { display: none; }
  .side-foot-links { display: none; }
  .msg-main { max-width: 82%; }
  .drawer { width: 100%; }
}
