/* Reset básico y box-sizing */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Aseguramos que html y body ocupen el 100% de la altura */
html, body {
  height: 100%;
}

/* Estilos para el body: centrado vertical y horizontal */
body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f5f5f5;
  font-family: Arial, sans-serif;
  padding: 20px; /* margen interno para dispositivos pequeños */
}

/* Contenedor del chat */
#chatContainer {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  background: #fff;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  /* Se establece una altura dinámica: 100vh menos 100px para evitar problemas en móviles */
  height: calc(100vh - 100px);
  margin: 0 auto;
}

/* Área de mensajes */
#messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

/* Mensajes individuales */
.chat-message {
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 6px;
  max-width: 80%;
  word-wrap: break-word;
}

.sent {
  background: #d1e7dd;
  align-self: flex-end;
}

.received {
  background: #f8d7da;
  align-self: flex-start;
}

/* Contenedor de entrada y botones */
#inputContainer {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ccc;
  background: #eee;
}

#msgInput {
  flex: 1;
  padding: 8px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-right: 5px;
}

/* Botones */
#sendBtn, #backBtn {
  padding: 8px 12px;
  font-size: 1em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 5px;
}

#sendBtn {
  background-color: #007bff;
  color: #fff;
}

#backBtn {
  background-color: #6c757d;
  color: #fff;
}

/* Ajustes responsivos para pantallas pequeñas */
@media (max-width: 600px) {
  #sendBtn, #backBtn {
    font-size: 0.9em;
    padding: 6px 10px;
  }
  /* Si es necesario reducir aún más la altura del chat en móviles */
  #chatContainer {
    height: calc(100vh - 100px);
  }
}

/* ANIMACIONES NUEVAS */

/* Keyframes para la animación del contenedor del chat */
/* Keyframes para el mensaje de bienvenida */
@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  20% {
    opacity: 1;
    transform: translateY(0);
  }
  80% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Clase para el mensaje de bienvenida */
.welcome-message {
  animation: fadeInOut 8s ease-in-out forwards;
  background: #007bff;
  color: #fff;
  padding: 10px;
  border-radius: 6px;
  text-align: center;
  margin-bottom: 10px;
  font-weight: bold;
}
