* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
}

/* ---- Login ---- */
.login-body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4b6cb7, #182848);
}
.login-box {
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  width: 320px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.login-box h1 { margin: 0 0 8px; font-size: 22px; }
.login-box p { color: #666; margin-bottom: 20px; font-size: 14px; }
.login-box input {
  width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px;
  margin-bottom: 12px; font-size: 15px;
}
.login-box button {
  width: 100%; padding: 12px; background: #4b6cb7; color: #fff;
  border: none; border-radius: 8px; font-size: 15px; cursor: pointer;
}
.login-box .error { color: #d33; font-size: 13px; }

/* ---- App layout ---- */
.app { display: flex; height: 100vh; }

.sidebar {
  width: 260px; background: #1e2130; color: #fff; display: flex; flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 16px; font-weight: 600; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #333a52;
}
.logout-link { color: #aaa; text-decoration: none; font-size: 18px; }
.room-list { flex: 1; overflow-y: auto; padding: 8px; }
.room-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.room-item:hover { background: #2a2f45; }
.room-item.active { background: #4b6cb7; }
.room-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; flex-shrink: 0; }
.room-item:hover .room-actions { opacity: 1; }
.room-action-btn {
  background: transparent; border: none; cursor: pointer; font-size: 13px; padding: 2px 4px;
  border-radius: 4px; line-height: 1;
}
.room-action-btn:hover { background: rgba(255,255,255,.15); }

@media (max-width: 700px) {
  .room-actions { opacity: 1; } /* trên di động không có hover nên luôn hiện */
}
.new-room-btn {
  margin: 12px; padding: 10px; background: transparent; border: 1px dashed #555;
  color: #ccc; border-radius: 8px; cursor: pointer;
}

.chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header { padding: 16px 20px; background: #fff; border-bottom: 1px solid #e5e5e5; }
.chat-header h2 { margin: 0 0 4px; font-size: 18px; }
.chat-header .hint { font-size: 12px; color: #888; }

.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 75%; padding: 10px 14px; border-radius: 12px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg-user { align-self: flex-end; background: #4b6cb7; color: #fff; border-bottom-right-radius: 2px; }
.msg-gpt { align-self: flex-start; background: #e6f4ea; border-bottom-left-radius: 2px; }
.msg-claude { align-self: flex-start; background: #fdf1e6; border-bottom-left-radius: 2px; }
.msg-gemini { align-self: flex-start; background: #e8eefc; border-bottom-left-radius: 2px; }
.msg-label { font-size: 11px; font-weight: 700; opacity: .6; margin-bottom: 4px; text-transform: uppercase; }
.msg-pending { align-self: flex-start; font-size: 13px; color: #999; font-style: italic; }

.message-form { display: flex; gap: 10px; padding: 16px 20px; background: #fff; border-top: 1px solid #e5e5e5; }
.message-form textarea {
  flex: 1; resize: none; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; font-family: inherit;
}
.message-form button {
  padding: 0 20px; background: #4b6cb7; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 14px;
}

@media (max-width: 700px) {
  .sidebar { position: fixed; z-index: 10; height: 100%; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: translateX(0); }
  .msg { max-width: 90%; }
}
