/* 基础布局 */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #f8f8f8;
}

/* 主布局 */
.layout {
  display: flex;
  height: 90vh;
  margin: 0 auto;
  max-width: 1200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 0 16px 2px #eaeaea;
  min-width: 900px;
}

.room-list {
  width: 160px;
  border-right: 1px solid #eee;
  background: #f9f9f9;
  padding: 0;
  min-width: 120px;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fafbfc;
}

/* 用户列表右侧 */
.user-list {
  width: 180px;
  border-left: 1px solid #eee;
  background: #fcfcfc;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
}

.user-list-title {
  font-weight: bold;
  margin: 16px 0 12px 0;
  text-align: center;
  color: #888;
  font-size: 16px;
  letter-spacing: 2px;
}

#user-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
  min-height: 120px;
}

#user-list li {
  padding: 9px 10px;
  margin-bottom: 4px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  font-size: 15px;
  color: #333;
  border: 1px solid transparent;
}
#user-list li:hover,
#user-list li.active {
  background: #fffbe7;
  color: #e67e22;
  border: 1px solid #ffe082;
  font-weight: bold;
}

/* 聊天顶部提示区 */
.chat-mode-tip {
  margin: 10px 0 0 0;
  font-size: 1em;
  color: #666;
}

.chat-mode-tip b { color: #d35400; }
.chat-mode-tip a {
  font-size: 0.96em;
  color: #888;
  margin-left: 8px;
  text-decoration: underline;
  cursor: pointer;
}

/* 聊天消息区 */
.chat-area {
  flex: 1;
  overflow-y: auto;
  background: #f9f9f9;
  padding: 18px 20px 12px 20px;
  box-sizing: border-box;
}

.msg-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 15px;
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px #eee;
  max-width: 540px;
  min-width: 120px;
}

.msg-me {
  background: #eaf7fb;
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  background: #ffe082;
  color: #e67e22;
  font-size: 22px;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 12px;
  margin-left: 0;
  box-shadow: 0 1px 3px #eee;
}
.msg-me .msg-avatar {
  margin-left: 12px;
  margin-right: 0;
  background: #b2ebf2;
  color: #0097a7;
}

.msg-nick {
  font-size: 14px;
  color: #888;
  margin-bottom: 3px;
}
.msg-me .msg-nick {
  color: #0097a7;
}

.msg-content {
  font-size: 16px;
  color: #3d3d3d;
  word-break: break-all;
  margin-bottom: 2px;
}

.msg-time {
  font-size: 12px;
  color: #bdbdbd;
  margin-top: 2px;
}

/* 私聊消息高亮 */
.msg-private {
  background: #fff8e1;
  border-left: 4px solid #ffd54f;
}
.msg-private-tag {
  color: #d35400;
  font-size: 0.96em;
  margin-left: 6px;
  padding: 1px 6px;
  background: #fff3cd;
  border-radius: 8px;
}

/* 聊天输入区 */
.chat-main footer {
  display: flex;
  align-items: center;
  padding: 16px 18px;
  background: #fff;
  border-top: 1px solid #eee;
  border-bottom-left-radius: 12px;
}

#msg-input {
  flex: 1;
  height: 38px;
  font-size: 15px;
  border: 1px solid #eee;
  border-radius: 7px;
  padding: 0 12px;
  outline: none;
  margin-right: 10px;
  background: #f8f8f8;
  transition: border 0.2s;
}

#msg-input:focus {
  border: 1.5px solid #d35400;
  background: #fffbe7;
}

#send-btn {
  padding: 0 20px;
  height: 38px;
  background: #e67e22;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.17s;
}
#send-btn:hover {
  background: #d35400;
}

@media (max-width: 1100px) {
  .layout { max-width: 100vw; }
  .user-list { display: none; }
}

/* 登录页专用样式 */
.login-bg {
  background: linear-gradient(120deg, #fbc2eb 0%, #a6c1ee 100%);
  min-height: 100vh;
}
.login-box {
  background: #fff;
  border-radius: 10px;
  margin: 80px auto 0 auto;
  padding: 40px 30px 30px 30px;
  max-width: 340px;
  box-shadow: 0 0 20px 5px #eee;
  text-align: center;
}
.login-box h2 {
  color: #e67e22;
  margin-bottom: 28px;
}
.login-box input, .login-box select {
  width: 90%;
  padding: 10px 8px;
  margin-bottom: 14px;
  border: 1px solid #eee;
  border-radius: 7px;
  font-size: 15px;
  background: #fafbfc;
}
.login-box button {
  width: 100%;
  padding: 10px 0;
  background: #e67e22;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}
.login-box button:hover {
  background: #d35400;
}

/* ====== 聊天室整体背景 ====== */
body {
  background: linear-gradient(120deg, #fbc2eb 0%, #a6c1ee 100%);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* ====== 聊天主卡片 ====== */
.layout {
  margin-top: 40px;
  box-shadow: 0 4px 32px 0 #e3e3e3;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  animation: fadein 0.7s;
  display: flex;
  height: 90vh;
  max-width: 1200px;
  min-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(40px);}
  to   { opacity: 1; transform: translateY(0);}
}

/* ====== header 美化 ====== */
.chat-main header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 10px 24px;
  background: linear-gradient(90deg, #fbc2eb 0%, #a6c1ee 100%);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 8px #f6eaff;
}

/* title 超链接 */
.room-title-link {
  font-size: 1.3em;
  font-weight: bold;
  color: #e67e22;
  text-decoration: none;
  background: #fffbe7;
  padding: 6px 18px;
  border-radius: 13px;
  box-shadow: 0 1px 3px #eee;
  transition: background 0.15s, color 0.15s;
}
.room-title-link:hover {
  background: #ffe0b2;
  color: #d35400;
  text-decoration: underline;
}

.chat-main header .user {
  font-size: 1em;
  color: #888;
  background: #f4f4f4;
  padding: 6px 16px;
  border-radius: 10px;
  margin-left: 8px;
}
.chat-main header .user b {
  color: #e67e22;
}

/* 房间切换链接 */
.allrooms-link {
  font-size: 0.95em;
  color: #0097a7;
  margin-left: 18px;
  text-decoration: underline;
  background: #e0f7fa;
  border-radius: 7px;
  padding: 4px 10px;
  transition: background 0.17s, color 0.17s;
}
.allrooms-link:hover {
  color: #00796b;
  background: #b2ebf2;
}

