/* ================= RESET ================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body,
button,
input {
  font-family: Arial, sans-serif;
}

/* ================= BODY ================= */

body {
  background: #111827;
  color: #e5e7eb;
  height: 100vh;
  overflow: hidden;
}

/* ================= LAYOUT ================= */

.app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ================= SIDEBAR ================= */

.sidebar {
  width: 260px;
  min-width: 260px;
  background: #0b1220;
  padding: 20px;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
}

.sidebar h2 {
  margin-bottom: 20px;
  font-weight: 600;
  color: #f9fafb;
}

/* ================= BOTÓN NUEVO CHAT ================= */

.new-chat {
  width: 100%;
  padding: 10px;
  background: #1f2a44;
  border: none;
  border-radius: 8px;
  color: #e5e7eb;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.new-chat:hover {
  background: #2a3a5f;
  transform: translateY(-1px);
}

/* ================= LISTA CHATS ================= */

.chat-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

/* ITEM CHAT */

.chat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  background: #1f2a44;
  font-size: 14px;
  transition: background 0.2s ease;
}

.chat-item:hover {
  background: #2a3a5f;
}

.chat-item.active {
  background: #2b6bff;
}

/* TÍTULO CHAT */

.chat-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================= MAIN CHAT ================= */

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f1a2f;
  overflow: hidden;
}

/* ================= MENSAJES ================= */

.messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* ================= BURBUJAS ================= */

.message {
  max-width: 65%;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: fadeIn 0.15s ease-in-out;
}

/* ANIMACIÓN */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* MENSAJE BOT */

.bot {
  background: #23324a;
  color: #e5e7eb;
}

/* MENSAJE USER */

.user {
  background: #2b6bff;
  color: #ffffff;
  margin-left: auto;
}

/* ================= INPUT ================= */

.input-area {
  display: flex;
  padding: 16px;
  border-top: 1px solid #1e293b;
  background: #0b1220;
}

/* INPUT TEXTO */

.input-area input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  outline: none;
  margin-right: 10px;
  background: #1f2a44;
  color: #e5e7eb;
}

.input-area input::placeholder {
  color: #94a3b8;
}

.input-area input:focus {
  box-shadow: 0 0 0 2px #2b6bff;
}

/* BOTÓN ENVIAR */

.input-area button {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: #2b6bff;
  color: white;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.1s ease;
}

.input-area button:hover {
  background: #3b7cff;
  transform: translateY(-1px);
}

/* ================= SCROLL ================= */

.messages::-webkit-scrollbar,
.chat-list::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 900px) {

  .sidebar {
    width: 220px;
    min-width: 220px;
  }

}

@media (max-width: 700px) {

  .sidebar {
    display: none;
  }

}