#chat-wrapper {
  position: fixed;
  bottom: 80px;
  /* Ajusta este valor para subir el botón */
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 1000;
  /* Asegura que el chat esté sobre la página */
  pointer-events: none;
  /* Permite que los clics pasen a través cuando está cerrado */
}

#chat-container {
  width: 400px;
  height: 80vh;
  max-height: 100vh;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 10px rgba(75, 150, 232, 0.1);
  overflow: hidden;
  padding: 10px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: bottom right;
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

#chat-container.expanded {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
  /* Reactiva las interacciones cuando está abierto */
}

#chat-box {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: #f8fbff;
  margin-bottom: 15px;
  box-shadow: inset 0 4px 6px rgba(75, 150, 232, 0.05);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message,
.chatbot-message {
  display: flex;
  align-items: center;
  max-width: 70%;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 2px 4px rgba(75, 150, 232, 0.1);
  animation: fadeIn 0.3s ease-out;
}

.error-message {
  border-radius: 20px;
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  display: flex; /* Activar flexbox */
  justify-content: center; /* Centrar horizontalmente */
  align-items: center; /* Centrar verticalmente */
  text-align: center; /* Centrar el texto dentro del contenido */
  padding: 10px; /* Asegurar que tenga algo de espacio interno */
}

.chatbot-icon {
  width: 30px;
  /* Ajusta el tamaño según tus necesidades */
  height: 30px;
  /* Ajusta el tamaño según tus necesidades */
  margin-right: 10px;
  /* Espacio entre el icono y el texto */
}


.user-message {
  align-self: flex-end;
  background: linear-gradient(145deg, #4B96E8, #00C4CE);
  color: white;
  border-bottom-right-radius: 0;
}

.chatbot-message {
  align-self: flex-start;
  background-color: #f0f7ff;
  color: #000;
  border-bottom-left-radius: 0;
}

#input-container {
  display: flex;
  gap: 10px;
}

#user-input {
  width: calc(100% - 90px);
  padding: 12px;
  border: 1px solid #e0e0e0;
  background-color: #fff;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(75, 150, 232, 0.05);
}

#user-input:focus {
  border-color: #4B96E8;
}

#send-button {
  width: 80px;
  border: none;
  background: linear-gradient(145deg, #4B96E8, #00C4CE);
  color: white;
  padding: 12px;
  cursor: pointer;
  border-radius: 20px;
  font-size: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(75, 150, 232, 0.2);
}


#send-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(75, 150, 232, 0.3);
}

#chat-toggle {
  background-color: #ffffff;
  color: white;
  border: none;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  position: fixed;
  bottom: 70px;
  right: 12px;
  /* Mantén el botón a la derecha */
  z-index: 1001;
  pointer-events: auto;
  /* Siempre permite interacciones */
}

#chat-toggle:hover {
  background-color: #c9c9c9;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
  /* Sombra más pronunciada al pasar el cursor */
  transform: scale(1.1);

}

.icon-small {
  width: 50px;
  /* Ajusta el tamaño según tus necesidades */
  height: 50px;
  /* Ajusta el tamaño según tus necesidades */
}

#chat-toggle.hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: linear-gradient(145deg, #4B96E8, #00C4CE);
  color: white;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 4px 6px rgba(75, 150, 232, 0.2);
}

.header .title {
  font-size: 16px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  /* Sombra de texto para efecto 3D */
  text-align: center;
  /* Centrar el texto */
  width: 100%;
  /* Asegurar que el texto ocupe todo el ancho del contenedor */
  padding: 10px 15px;
}

.header button {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.header button:hover {
  color: #f1f1f1;
}

@media (max-height: 600px) {
  #chat-container {
    height: 70vh;
    /* Reduce el tamaño si la pantalla es muy baja */
    max-height: 70vh; /* Asegura que no supere el 70% de la altura */

  }

  #chat-toggle {
    bottom: 10px;
    /* Asegura que el botón esté visible en pantallas pequeñas */
  }
}

/* Estilos específicos para pantallas pequeñas (móviles) */
@media (max-width: 768px) {
  #chat-wrapper {
    bottom: 80px;
    right: 10px;
  }

  #chat-container {
    width: 100%;
    height: 80%;
    max-height: 80vh; /* Limitar altura en pantallas móviles */
    right: 0;
    bottom: 0;
    border-radius: 15px 15px 0 0;
    transform-origin: bottom center;
    transform: translateY(100%);
  }

  #chat-box {
    padding: 10px;
    margin-bottom: 10px;
    overflow-y: auto; /* Asegura scroll en pantallas pequeñas */
  }

  .user-message,
  .chatbot-message {
    font-size: 12px;
    max-width: 80%;
    padding: 8px 12px;
  }

  #input-container {
    gap: 5px;
  }

  #user-input {
    width: calc(100% - 70px);
    padding: 10px;
  }

  #send-button {
    width: 60px;
    padding: 10px;
  }

  #chat-toggle {
    width: 50px;
    height: 50px;
    right: 12px;
    /* Ajusta este valor para mover el botón a la derecha en pantallas pequeñas */
  }

  .icon-small {
    width: 50px;
    height: 50px;
  }

  #chat-container.expanded {
    transform: translateY(0);
  }
}

/* Estilos para el modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000; /* Asegura que el modal esté por encima del chatbot */
  right: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  padding-top: 60px;
}

.modal-content {
  background-color: #fff;
  margin: 5% 0 5% auto; /* Cambiado para alinear a la derecha */
  padding: 20px;
  border: 1px solid #ccc;
  width: 80%;
  max-width: 500px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* Estilos para el chat dentro del modal */
.chat-history-body {
  max-height: 60vh;
  overflow-y: auto;
}

.chat-message {
  margin-bottom: 15px;
}

.chat-message-right {
  text-align: right;
}

.chat-message-wrapper {
  display: flex;
  flex-direction: column;
}

.chat-message-text {
  background-color: #e4e6eb;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 5px;
}

.chat-message-right .chat-message-text {
  background: linear-gradient(145deg, #4B96E8, #00C4CE);
  color: white;
}

.header-banner {
  width: 100%;
  display: flex;
  align-items: center;
  background-color: #25D366; /* Color de fondo de WhatsApp */
  padding: 10px 15px;
  border-radius: 8px;
  /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
}

.header-banner a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.header-banner .fa-whatsapp {
  margin-right: 8px;
  font-size: 24px;
}