* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
}

body {
  margin: 0;
  background: #efeae2;
}

.app {
  display: flex;
  height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 30%;
  background: #fff;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
}

.sidebar header {
  background: #075e54;
  color: white;
  padding: 12px;
  font-weight: bold;
}

#chatList {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  padding: 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.chat-item small {
  color: #666;
}

.chat-item:hover {
  background: #f5f5f5;
}

/* CHAT */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat header {
  background: #075e54;
  color: white;
  padding: 12px;
  font-weight: bold;
}

.messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

.msg {
  max-width: 75%;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}

.in {
  background: #fff;
  align-self: flex-start;
}

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

.input-bar {
  display: flex;
  padding: 8px;
  background: #f0f0f0;
}

.input-bar input {
  flex: 1;
  padding: 8px;
  margin-right: 6px;
}

.input-bar button {
  background: #25d366;
  border: none;
  color: white;
  font-weight: bold;
  padding: 8px 12px;
}

/* MOBILE */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
  }

  .chat {
    display: none;
  }

  .chat.active {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #efeae2;
    z-index: 20;
  }
}

.back-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  margin-right: 10px;
  cursor: pointer;
}

/* Mostrar botón atrás SOLO en móvil */
@media (max-width: 768px) {
  .back-btn {
    display: inline-block;
  }

  .chat header {
    display: flex;
    align-items: center;
  }
}

