/* 给力心理网页版 IM 公共样式（主色 #F8D94D） */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: #333;
  background: #f5f5f5;
}
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.btn-primary {
  background: #F8D94D;
  border: none;
  border-radius: 6px;
  color: #333;
  font-size: 14px;
  padding: 9px 24px;
  font-weight: 600;
}
.btn-primary:hover { background: #f5cf2e; }
.btn-primary:disabled { background: #eee; color: #aaa; cursor: not-allowed; }

/* ---------- 登录页 / 引导页 ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(180deg, #fdf6d8 0%, #f5f5f5 45%);
}
.login-card {
  width: 360px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 30px rgba(0,0,0,.08);
  padding: 36px 30px 24px;
  text-align: center;
}
.login-logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.login-logo-sub {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  background: #F8D94D;
  border-radius: 4px;
  padding: 2px 8px;
  vertical-align: 4px;
}
.login-slogan { font-size: 13px; color: #999; margin-bottom: 24px; }
.qr-box {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
  border: 1px solid #eee;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.qr-box img, .qr-box canvas { display: block; }
.qr-loading { color: #bbb; font-size: 13px; }
.qr-mask {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.94);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.qr-mask-text { font-size: 14px; color: #666; }
.login-status { margin-top: 18px; font-size: 15px; color: #333; min-height: 22px; }
.login-status.is-scanned { color: #18a058; }
.login-tip { margin-top: 8px; font-size: 12px; color: #999; }
.login-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #f2f2f2;
  font-size: 12px;
  color: #bbb;
}
.guide-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.guide-text { font-size: 14px; color: #666; line-height: 1.9; text-align: left; }
.guide-text b { color: #333; }
.guide-link { color: #b89b1f; text-decoration: none; font-size: 13px; }
.guide-link:hover { text-decoration: underline; }

/* ---------- 聊天页 ---------- */
.chat-body { overflow: hidden; }
.chat-layout { display: flex; height: 100vh; background: #fff; }

/* 左栏会话列表 */
.conv-panel {
  width: 320px;
  flex: 0 0 320px;
  border-right: 1px solid #ececec;
  display: flex;
  flex-direction: column;
  background: #fff;
  min-width: 0;
}
/* 当前登录账号信息（退出按钮在右侧） */
.my-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #f0f0f0;
}
.my-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #f2f2f2;
  overflow: hidden;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #999;
  box-shadow: 0 0 0 2px #fdf6d9;
}
.my-avatar img { width: 100%; height: 100%; object-fit: cover; }
.my-meta { min-width: 0; flex: 1; }
.my-name {
  font-size: 15px;
  font-weight: 600;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.my-sub { font-size: 12px; color: #aaa; margin-top: 3px; }
.logout-btn {
  flex: 0 0 auto;
  border: none;
  background: #f4f4f4;
  border-radius: 14px;
  font-size: 12px;
  color: #999;
  padding: 6px 14px;
}
.logout-btn:hover { background: #fdecec; color: #e05252; }

.conv-list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.conv-empty { padding: 48px 16px; text-align: center; color: #c0c0c0; font-size: 13px; }
.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-radius: 12px;
}
.conv-item:hover { background: #f7f7f7; }
.conv-item.is-active { background: #fdf6d9; }
.conv-avatar {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  flex: 0 0 46px;
  background: #F8D94D;
  color: #333;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.conv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.conv-info { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.conv-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-time { font-size: 11px; color: #c2c2c2; flex: 0 0 auto; }
.conv-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 5px; }
.conv-digest {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-badge {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #f24d4d;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
}

/* 细滚动条 */
.conv-list::-webkit-scrollbar, .msg-list::-webkit-scrollbar { width: 6px; }
.conv-list::-webkit-scrollbar-thumb, .msg-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.12);
  border-radius: 3px;
}
.conv-list::-webkit-scrollbar-thumb:hover, .msg-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,.22);
}

/* 右栏聊天窗口 */
.chat-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c8c8c8;
  font-size: 15px;
  letter-spacing: 1px;
  background: #f5f6f8;
}
.chat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-title {
  padding: 18px 24px;
  font-size: 17px;
  font-weight: 600;
  color: #222;
  border-bottom: 1px solid #ececec;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 26px;
  background: #f5f6f8;
}
.msg-loading, .msg-nomore {
  text-align: center;
  font-size: 12px;
  color: #c0c0c0;
  padding: 6px 0 12px;
}
.msg-row { display: flex; margin-bottom: 18px; gap: 12px; }
.msg-row.is-out { flex-direction: row-reverse; }
.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: 0 0 40px;
  background: #F8D94D;
  color: #333;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-content { max-width: 62%; min-width: 0; }
.msg-row.is-out .msg-content { display: flex; flex-direction: column; align-items: flex-end; }
.msg-sender { font-size: 11px; color: #bbb; margin-bottom: 4px; }
.msg-bubble {
  display: inline-block;
  background: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.msg-row.is-out .msg-bubble { background: #F8D94D; box-shadow: 0 2px 6px rgba(214,178,24,.25); }
.msg-bubble.is-placeholder { color: #999; font-size: 13px; }
.msg-image {
  max-width: 198px;
  max-height: 198px;
  border-radius: 10px;
  cursor: zoom-in;
  display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.msg-video { max-width: 280px; border-radius: 10px; display: block; background: #000; }
.msg-audio-btn {
  border: none;
  background: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  color: #333;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.msg-row.is-out .msg-audio-btn { background: #F8D94D; }
.msg-audio-btn:hover { filter: brightness(.97); }
.msg-status { font-size: 11px; color: #f24d4d; margin-top: 4px; }

/* 底部输入区 */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 20px 16px;
  border-top: 1px solid #ececec;
  background: #fff;
}
.btn-icon {
  border: none;
  background: #f4f4f4;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  color: #777;
  flex: 0 0 auto;
}
.btn-icon:hover { background: #fdf6d9; color: #333; }
.chat-input-bar textarea {
  flex: 1;
  resize: none;
  border: 1px solid transparent;
  background: #f4f4f4;
  border-radius: 19px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 120px;
  outline: none;
  min-width: 0;
}
.chat-input-bar textarea:focus { background: #fff; border-color: #F8D94D; }
.chat-input-bar .btn-primary { border-radius: 19px; padding: 10px 26px; }

/* 图片查看器 */
.img-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: zoom-out;
}
.img-viewer img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
}

@media (max-width: 860px) {
  .conv-panel { width: 260px; flex-basis: 260px; }
}
