.chat-container {
  display: flex;                        /* Layout: sidebar + chat feed side by side */
  background: #f9fafb;                  /* Light background */
  border-radius: 12px;                  /* Rounded corners for the chat window */
  overflow: hidden;                     /* Hide overflow for rounded corners */
  box-shadow: 0 2px 8px rgba(0,0,0,0.04); /* Subtle shadow */
  min-height: 420px;                    /* Minimum height for chat area */
}

/* --- Sidebar (User List) --- */
.chat-sidebar {
  width: 220px;                         /* Sidebar width */
  background: #fff;                     /* White background */
  border-right: 1px solid #e5e7eb;      /* Divider line */
  padding: 1.5rem 1rem;                 /* Inner spacing */
  border-top-left-radius: 12px;         /* Rounded top-left */
  border-bottom-left-radius: 12px;      /* Rounded bottom-left */
}

.chat-sidebar h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: #4a90e2;                       /* Primary color for section title */
  font-weight: 600;
}

.chat-users {
  list-style: none;                     /* Remove default list styling */
  padding: 0;
  margin: 0;
}

.chat-users li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

/* Highlight active or hovered user */
.chat-users li.active,
.chat-users li:hover {
  background: #f0f4fa;
}

.chat-users img {
  width: 36px;
  height: 36px;
  border-radius: 50%;                   /* Circular user avatars */
  object-fit: cover;
}

/* --- Chat Feed Area (Messages) --- */
.chat-feed {
  flex: 1;                              /* Take up remaining space */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #f9fafb;
  padding: 1.5rem 1.2rem 1rem 1.2rem;
  border-top-right-radius: 12px;        /* Rounded top-right */
  border-bottom-right-radius: 12px;     /* Rounded bottom-right */
}

/* --- Messages List --- */
.chat-messages {
  flex: 1;
  overflow-y: auto;                     /* Scroll if too many messages */
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;                          /* Space between messages */
}

/* --- Individual Message Bubble --- */
.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
}

/* Message alignment for sender/receiver */
.chat-message.you {
  flex-direction: row;                  /* Received messages: left */
}

.chat-message.me {
  flex-direction: row-reverse;          /* Sent messages: right */
}

.chat-message img {
  width: 32px;
  height: 32px;
  border-radius: 50%;                   /* Circular avatar */
  object-fit: cover;
}

.chat-message .chat-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #4a90e2;                       /* Username color */
}

.chat-message p {
  background: #e5e7eb;                  /* Message bubble background */
  color: #222;
  padding: 0.7rem 1.1rem;
  border-radius: 16px;                   /* Rounded message bubbles */
  margin: 0.2rem 0 0.2rem 0;
  max-width: 320px;
  font-size: 1rem;
}

/* Sent message bubble color */
.chat-message.me p {
  background: #4a90e2;
  color: #fff;
}

.chat-time {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.1rem;
  display: block;
}

/* --- Chat Input Area --- */
.chat-input {
  display: flex;
  gap: 0.7rem;
  background: #fff;
  border-radius: 8px;                   /* Rounded input area */
  padding: 0.5rem 0.8rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.chat-input input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  background: transparent;
  padding: 0.6rem 0;
}

.chat-input button {
  background: #4a90e2;
  border: none;
  color: #fff;
  border-radius: 50%;                   /* Circular send button */
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-input button:hover {
  background: #357ab8;
}