/* Contenedor flotante */
#chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-family: sans-serif;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Botón circular */

#chat-button {
  width: 60px;           /* Tamaño del botón */
  height: 60px;
  background: #408d36;
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center; /* Centra horizontal */
  align-items: center;     /* Centra vertical */
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: background 0.3s, transform 0.3s;
  transform-origin: center;
  transform: scale(1);
}

#chat-button svg {
  width: 30px;  /* Tamaño del SVG */
  height: 30px;
}

#chat-button:hover {
  background: #27661f;
  transform: scale(1.1);
}
#chat-button:active {
  transform: scale(0.95);
}

#chat-button.open {
  background: #1b4316 !important;
}

/* Caja de chat (oculta por defecto) */
/* Caja de chat (oculta por defecto) */
#chat-box {
  width: 400px;
  height: 500px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 10px;

  /* Animación */
  opacity: 0;
  transform:scale(0.4);
  transform-origin: bottom right;
  transition: all 0.35s ease;
  pointer-events: none;
}

/* Cuando se abre */
#chat-box.open {
  opacity: 1;
  transform: scale(1);
  transition: all 0.35s ease;
  transform-origin: bottom right;
  pointer-events: auto;
}

/* Header del chat */
#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* separa avatar/titulo y boton cerrar */
  padding: 12px;
  background: #408d36;
  color: white;
  font-weight: bold;
  font-size: 16px;
  border-bottom: 2px solid rgba(0,0,0,0.1);
}

#chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

#chat-title {
  flex: 1;
  margin-left: 10px;
}

#chat-close {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#chat-close:hover svg {
  stroke: #ccc; /* opcional: cambio de color al pasar raton */
}


/* Mensajes */
#chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Mensajes del usuario */
.message.user {
  align-self: flex-end;
  background: #408d36;
  color: white;
  padding: 6px 10px;
  border-radius: 12px 12px 0px 12px;
  max-width: 80%;
}

/* Mensajes del bot */
.message.bot {
  align-self: flex-start;
  background: #f1f1f1;
  color: black;
  padding: 6px 10px;
  border-radius: 12px 12px 12px 0;
  max-width: 80%;
}

/* Input */
#chat-input-area {
  display: flex;
  border-top: 1px solid #ddd;
}
#chat-input-area input {
  flex: 1;
  padding: 10px;
  border: none;
  outline: none;
  border-radius: 0;
}
#send-btn {
  width: 42px;
  height: 42px;
  margin: 6px;
  border-radius: 50%;
  background: #408d36;
  color: white;
  font-size: 18px;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease;
}
#send-btn svg {
  width: 20px;  /* Tamaño del SVG */
  height: 20px;
}

#send-btn:active {
  transform: scale(0.9);
}

.message.bot.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eee;
  padding: 8px 12px;
  border-radius: 10px;
  width: fit-content;
}

.message.bot.typing span {
  width: 6px;
  height: 6px;
  background: #555;
  border-radius: 50%;
  animation: typing 1s infinite ease-in-out;
}

.message.bot.typing span:nth-child(1) {
  animation-delay: 0s;
}
.message.bot.typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.message.bot.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0% { transform: translateY(0); opacity: .3; }
  50% { transform: translateY(-4px); opacity: 1; }
  100% { transform: translateY(0); opacity: .3; }
}

