* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
}

/* === HEADER === */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #4a76a8;
  color: white;
  padding: 10px 20px;
  flex-wrap: wrap;
}

.chat-header h1 {
  font-size: 1.5rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.user-profile img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
}

/* === TOP NAV LINKS === */
.top-nav ul {
  display: flex;
  gap: 15px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.top-nav a {
  text-decoration: none;
  color: white;
  font-weight: bold;
}

.top-nav a.active {
  text-decoration: underline;
}

/* === LOGOUT BUTTON === */
#logoutBtn {
  background: #ffffff;
  color: #4a76a8;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}

#logoutBtn:hover {
  background: #e3e3e3;
}

/* === LAYOUT CONTAINER === */
.chat-container {
  display: flex;
  height: calc(100vh - 60px);
  background: white;
}

/* === USERS LIST SIDEBAR === */
.users-list {
  width: 250px;
  background: #f2f2f2;
  border-right: 1px solid #ccc;
  padding: 20px;
  overflow-y: auto;
}

.users-list h2 {
  margin-bottom: 15px;
}

.users-list ul {
  list-style: none;
}

.users-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

.users-list li:hover {
  background-color: #ddd;
}

.users-list img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

/* === CHAT BOX AREA === */
.chat-box {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Selected Chat Header */
.chat-header-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background-color: #e9e9e9;
  border-bottom: 1px solid #ccc;
}

.chat-header-bar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-header-bar h3 {
  font-weight: 500;
}

/* === MESSAGES DISPLAY === */
.messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background-color: #fafafa;
  display: flex;
  flex-direction: column;
}

.message {
  margin-bottom: 10px;
  max-width: 60%;
  padding: 10px;
  border-radius: 10px;
  background-color: #e0e0e0;
}

.message.sent {
  background-color: #d1ecf1;
  align-self: flex-end;
  text-align: right;
}

/* === INPUT FORM === */
#messageForm {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ccc;
  background-color: #fff;
}

#messageInput {
  flex: 1;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

#messageForm button {
  margin-left: 10px;
  padding: 10px 20px;
  background-color: #4a76a8;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
}

#messageForm button:hover {
  background-color: #3b5f85;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .chat-container {
    flex-direction: column;
  }

  .users-list {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ccc;
  }

  .chat-box {
    height: calc(100vh - 250px);
  }
}
