/* ===== BOX-SIZING GLOBAL ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== CONTENEDOR DEL CHAT ===== */
.chat_window {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: visible;
  /*background-color: #f8f8f8;*/
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

/* ===== TOP MENU ===== */
.top_menu {
  background-color: #fff;
  width: 100%;
  padding: 20px 0 15px;
  box-shadow: 0 1px 30px rgba(0,0,0,0.1);
  position: relative;
}
.top_menu .buttons {
  margin: 3px 0 0 20px;
  position: absolute;
}
.top_menu .buttons .button {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 10px;
}
.top_menu .buttons .button.close { background-color: #f5886e; }
.top_menu .buttons .button.minimize { background-color: #fdbf68; }
.top_menu .buttons .button.maximize { background-color: #a3d063; }
.top_menu .title {
  text-align: center;
  color: #bcbdc0;
  font-size: 20px;
}

/* ===== MESSAGES ===== */
.messages {
  list-style: none;
  padding: 20px 10px 0 10px;
  margin: 0;
  max-height: 347px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ===== MESSAGE ===== */
.messages .message {
  display: flex;
  align-items: flex-start;  /* Alinea la parte superior del texto con el avatar */
  margin-bottom: 20px;
  opacity: 0;
  transition: all 0.5s linear;
}

.messages .message.appeared { opacity: 1; }

/* ===== AVATAR ===== */
.messages .message .avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  flex-shrink: 0; /* evita que el avatar se reduzca */
  overflow: hidden;
  background: white;
}
.messages .message .avatar img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ===== POSICIÓN AVATAR SEGÚN LADO ===== */
.messages .message.left { flex-direction: row; }
.messages .message.right { flex-direction: row-reverse; }

/* Separación entre avatar y texto */
.messages .message.left .avatar { margin-right: 10px; }
.messages .message.right .avatar { margin-left: 10px; }

/* ===== BURBUJA DE MENSAJE ===== */
.messages .message .text_wrapper {
  display: inline-block;
  padding: 15px 20px;
  border-radius: 12px;
  max-width: 70%; /* Limita ancho del mensaje */
  word-wrap: break-word;
  position: relative;
}

/* Burbuja izquierda */
.messages .message.left .text_wrapper {
  /*background-color: #ffe6cb;*/
  background-color: #f8f8f8;
}

/* Burbuja derecha */
.messages .message.right .text_wrapper {
  background-color: #c7eafc;
}

/* ===== TEXTO ===== */
.messages .message .text {
  font-size: 18px;
  font-weight: 300;
  line-height: 1.4;
}

.messages .message.left .text { color: black; }
.messages .message.right .text { color: black; }

/*.messages .message.left .text { color: #c48843; }
.messages .message.right .text { color: #45829b; }*/

/* ===== BOTTOM WRAPPER ===== */
.bottom_wrapper {
  position: relative;
  width: 100%;
  background-color: #fff;
  padding: 20px;
  overflow: hidden;
}
.bottom_wrapper .message_input_wrapper {
  display: inline-block;
  height: 50px;
  border-radius: 25px;
  border: 1px solid #bcbdc0;
  width: calc(100% - 160px);
  padding: 0 20px;
  position: relative;
}
.bottom_wrapper .message_input_wrapper .message_input {
  border: none;
  height: 100%;
  width: 100%;
  outline: none;
  color: gray;
}
.bottom_wrapper .send_message {
  width: 140px;
  height: 50px;
  display: inline-block;
  border-radius: 50px;
  background-color: #a3d063;
  border: 2px solid #a3d063;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s linear;
  text-align: center;
  float: right;
}
.bottom_wrapper .send_message:hover {
  color: #a3d063;
  background-color: #fff;
}
.bottom_wrapper .send_message .text {
  font-size: 18px;
  font-weight: 300;
  line-height: 48px;
  display: inline-block;
}

/* ===== MESSAGE TEMPLATE ===== */
.message_template { display: none; }
