/* Variables de colores para el chatbot */
:root {
  --chat-primary: #2A585E; /* Verde Teal */
  --chat-bg: #ffffff;
  --chat-text: #1f2937;
  --chat-gray: #f3f4f6;
}

/* Botón flotante */
.chatbot-toggle {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  background-color: #F4BC33; /* Color oro de la marca */
  color: #2A585E; /* Verde Teal */
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  background-color: #E2A820; /* Oro un poco más oscuro al pasar el cursor */
}

.chatbot-toggle svg {
  width: 32px;
  height: 32px;
  stroke: #2A585E; /* Icono verde teal para contraste */
}

/* Ventana del Chat */
.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 350px;
  height: 550px;
  max-height: 80vh;
  background: var(--chat-bg);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-family: 'Raleway', sans-serif;
  transform-origin: bottom right;
}

.chatbot-window.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8) translateY(20px);
}

/* Cabecera */
.chatbot-header {
  background: var(--chat-primary);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbot-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: white; /* Texto blanco */
}

.chatbot-social-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-social-links a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}

.chatbot-social-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.15);
}

.chatbot-header button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 20px;
  opacity: 0.8;
  transition: opacity 0.2s;
  padding: 0;
  line-height: 1;
  margin-left: 4px;
}

.chatbot-header button:hover {
  opacity: 1;
}

/* Área de mensajes */
.chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #fafafa;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.bot-message {
  background: var(--chat-gray);
  color: var(--chat-text);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.user-message {
  background: var(--chat-primary);
  color: white; /* Texto blanco */
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.loading-message {
  font-style: italic;
  color: #6b7280;
  font-size: 12px;
}

/* Input y Botón */
.chatbot-input {
  display: flex;
  padding: 16px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

.chatbot-input input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s;
}

.chatbot-input input:focus {
  border-color: var(--chat-primary);
}

.chatbot-input button {
  background: var(--chat-primary);
  color: white; /* Texto blanco */
  border: none;
  padding: 0 16px;
  margin-left: 8px;
  border-radius: 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.2s;
}

.chatbot-input button:hover {
  background-color: #8a4611; /* Oscurecimiento del color base */
}

/* Ajustes para móviles */
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 40px);
    right: 20px;
    bottom: 90px;
    height: 60vh;
  }
}

/* Envolturas de mensaje con avatar */
.message-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 85%;
}

.bot-message-container {
  align-self: flex-start;
}

.user-message-container {
  align-self: flex-end;
  flex-direction: row-reverse;
}

/* Forzar ancho completo de mensaje dentro de contenedor */
.message-container .message {
  max-width: 100%;
  margin: 0;
}

/* Avatares */
.bot-avatar-img-container {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  border: 1px solid rgba(42, 88, 94, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

.bot-avatar-img-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--chat-primary);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-avatar i {
  color: white;
  font-size: 11px;
}

