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

/* LOGIN */
.login-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
}

.login-container h2 {
  text-align: center;
}

input {
  padding: 12px;
  margin: 5px 0;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
}

button {
  padding: 12px;
  margin-top: 5px;
  border: none;
  border-radius: 8px;
  background: #4CAF50;
  color: white;
  font-size: 16px;
}

button.secondary {
  background: #ccc;
  color: black;
}

/* CHAT */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* 🔥 NOVA TOP BAR */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #4CAF50;
  color: white;
  padding: 10px;
  font-weight: bold;
}

/* botão menu */
#menuBtn {
  margin-right: 10px;
  font-size: 18px;
  background: transparent;
  border: none;
  color: white;
}

/* título central */
#chatTitulo {
  flex: 1;
  text-align: center;
}

/* user menu direita */
.user-menu {
  position: relative;
  text-align: center;
  cursor: pointer;
}

/* avatar */
.avatar {
  width: 30px;
  height: 30px;
  background: #2196F3;
  border-radius: 50%;
  margin: auto;
}

/* nome usuário */
#userNome {
  font-size: 12px;
}

/* dropdown */
.dropdown {
  position: absolute;
  top: 45px;
  right: 0;
  background: white;
  color: black;
  border-radius: 8px;
  display: none;
  min-width: 100px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.dropdown div {
  padding: 10px;
}

.dropdown div:hover {
  background: #eee;
}

.dropdown.active {
  display: block;
}

/* layout principal */
.main {
  display: flex;
  flex: 1;
  min-height: 0; 
}

.sidebar {
  width: 30%;
  background: #fff;
  border-right: 1px solid #ddd;
  overflow-y: auto;
}

.sidebar h4 {
  padding: 10px;
  margin: 0;
}

/* Alterado recente */
.sidebar li {
  padding: 10px;
  list-style: none;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.sidebar li:hover {
  background: #f5f5f5;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#chat {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #e5ddd5;
  min-height: 0;
}

.msg {
  max-width: 70%;
  padding: 10px;
  margin: 5px 0;
  border-radius: 10px;
}

.me {
  background: #dcf8c6;
  align-self: flex-end;
}

.other {
  background: white;
  align-self: flex-start;
}

.input-area {
  display: flex;
  gap: 10px;
}

.input-area input {
  flex: 1;
  width: auto;
}

.input-area button {
  width: auto !important;
  flex-shrink: 0;
}

/* 💻 desktop */
@media (min-width: 768px) {
  .login-container {
    max-width: 400px;
    margin: auto;
  }

  input {
    width: 100%;
  }

  button {
    width: 100%;
  }
}

/* 📱 MOBILE SIDEBAR */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 70%;
    height: 100%;
    z-index: 1000;
    transition: 0.3s;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
  }

  .sidebar.active {
    left: 0;
  }
}

/* overlay */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  display: none;
  z-index: 999;
}

#overlay.active {
  display: block;
}