/* ========== 私语聊天室 样式（微信风，清爽绿） ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --bg: #f5f5f5;
  --panel: #ffffff;
  --border: #e6e6e6;
  --text: #1a1a1a;
  --text-2: #888888;
  --bubble-other: #ffffff;
  --chat-bg: #f0f0f0;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.hidden { display: none !important; }

/* ========== 登录视图 ========== */
.auth-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e8f8ef 0%, #f5f5f5 55%, #eaf3ff 100%);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  padding: 36px 32px 28px;
  text-align: center;
}

.auth-logo { margin-bottom: 8px; }
.auth-title { font-size: 26px; letter-spacing: 6px; color: var(--text); }
.auth-sub { font-size: 13px; color: var(--text-2); margin: 6px 0 22px; }

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-2);
  transition: all 0.15s;
}
.auth-tabs button.active {
  background: var(--panel);
  color: var(--green);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.auth-card input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.auth-card input:focus { border-color: var(--green); }

#auth-submit {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 12px 0;
  font-size: 16px;
  letter-spacing: 4px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
#auth-submit:hover { background: var(--green-dark); }
#auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-error {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  color: #e6432d;
}
.auth-footer { margin-top: 22px; font-size: 12px; color: #aaa; }

/* ========== 聊天主视图 ========== */
.chat-view {
  height: 100%;
  display: flex;
}

/* 左侧栏 */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.me-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
  user-select: none;
}

.me-info { flex: 1; min-width: 0; }
.me-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me-status { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ccc; display: inline-block;
}
.dot.on { background: var(--green); }

.logout-btn {
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.logout-btn:hover { background: var(--bg); color: #e6432d; }

.conv-list { flex: 1; overflow-y: auto; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.conv-item:hover { background: #f7f7f7; }
.conv-item.active { background: #e9e9e9; }

.conv-item .avatar { width: 40px; height: 40px; font-size: 16px; position: relative; }
.conv-item .online-dot {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #ccc;
  border: 2px solid #fff;
}
.conv-item .online-dot.on { background: var(--green); }

.conv-meta { flex: 1; min-width: 0; }
.conv-name {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-preview {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #e6432d;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

/* 右侧主区 */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  min-width: 0;
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--chat-bg);
}
.chat-title { font-size: 16px; font-weight: 600; }
.chat-subtitle { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}

.load-more {
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px 0 12px;
}
.load-more:hover { color: var(--green); }

.time-divider {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin: 12px 0;
}

.msg-row {
  display: flex;
  margin-bottom: 14px;
  gap: 10px;
  align-items: flex-start;
}
.msg-row.mine { flex-direction: row-reverse; }

.msg-row .avatar { width: 38px; height: 38px; font-size: 15px; border-radius: 6px; }

.msg-body { max-width: 62%; min-width: 0; }
.msg-sender { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.msg-row.mine .msg-sender { text-align: right; }

.bubble {
  display: inline-block;
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  background: var(--bubble-other);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: relative;
}
.msg-row.mine .bubble { background: #95ec69; color: #1a1a1a; }

.msg-time { font-size: 11px; color: #aaa; margin-top: 4px; }
.msg-row.mine .msg-time { text-align: right; }

/* 输入区 */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #f7f7f7;
}
#msg-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
  max-height: 120px;
  outline: none;
  background: #fff;
}
#msg-input:focus { border-color: var(--green); }

#send-btn {
  border: none;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
#send-btn:hover { background: var(--green-dark); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #bbb; }
::-webkit-scrollbar-track { background: transparent; }

/* 移动端适配 */
@media (max-width: 720px) {
  .sidebar { width: 100%; min-width: 0; }
  .chat-view .main { display: none; }
  .chat-view.in-chat .sidebar { display: none; }
  .chat-view.in-chat .main { display: flex; }
  .chat-header { cursor: pointer; }
  .chat-title::before { content: "‹ "; color: var(--text-2); }
}
