body {
  font-family: Arial, sans-serif;
  padding: 20px;
  max-width: 600px;
  margin: auto;
  background: #f9f9f9;
}

h2 {
  text-align: center;
  margin-bottom: 20px;
}

#username-container,
#chat-container {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#username-container input {
  width: 70%;
  padding: 10px;
  font-size: 1rem;
  margin-right: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

#username-container button {
  padding: 10px 15px;
  font-size: 1rem;
  border: none;
  background: #007bff;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  min-width: 80px;
}

#username-container button:hover {
  background: #0056b3;
}

#chat-container {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  flex-wrap: wrap;
}

#users {
  flex: 1 1 30%;
  border-right: 1px solid #ddd;
  padding-right: 10px;
  min-width: 150px;
}

#user-list {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 10px;
}

.user {
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 4px;
  margin-bottom: 6px;
  background: #eee;
  transition: background-color 0.2s ease;
}

.user:hover {
  background: #ddd;
}

.unread {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: red;
  border-radius: 50%;
  margin-left: 8px;
}

#chat {
  flex: 1 1 65%;
  display: flex;
  flex-direction: column;
  min-width: 250px;
}

#messages {
  flex-grow: 1;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px;
  background: #fafafa;
  overflow-y: auto;
  margin-bottom: 10px;
  min-height: 300px;
}

.message {
  margin-bottom: 10px;
}

.typing {
  font-style: italic;
  color: #888;
  height: 18px;
  margin-bottom: 10px;
}

#message-input {
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
}

button {
  padding: 8px 12px;
  font-size: 0.9rem;
  border: none;
  background: #007bff;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  min-width: 75px;
  transition: background-color 0.3s ease;
}

button:hover {
  background: #0056b3;
}

/* Image input and send button */
#image-input {
  margin-top: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px;
  width: calc(100% - 90px);
  box-sizing: border-box;
  vertical-align: middle;
  display: inline-block;
}

#chat > button:last-of-type {
  margin-top: 10px;
  width: 80px;
  padding: 8px 10px;
  display: inline-block;
  vertical-align: middle;
}

/* Responsive for smaller screens */
@media (max-width: 600px) {
  #chat-container {
    flex-direction: column;
  }

  #users, #chat {
    flex: 1 1 100%;
    min-width: 100%;
    border-right: none;
    padding-right: 0;
  }

  #image-input, #chat > button:last-of-type {
    width: 100%;
    margin-top: 8px;
  }

  #message-input {
    margin-bottom: 8px;
  }
}
