/* chatbot.css - Versión optimizada y consistente */

:root {
  --aqua-dark: #4b7f92;
  --aqua-light: #9fc5c2;
  --text-dark: #333;
  --font-main: 'Inter', sans-serif;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 25px rgba(0,0,0,0.2);
  --border-radius: 12px;
}

/* Elemento flotante del chatbot */
button#astrasoft-chatbot-bubble.chatbot-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--aqua-dark);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1000;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
}

button#astrasoft-chatbot-bubble.chatbot-trigger:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Ventana principal del chatbot */
#astrasoft-chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 350px;
  max-width: 90vw;
  height: 500px;
  max-height: 70vh;
  background: white;
  border: 1px solid #e1e1e1;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 999;
  font-family: var(--font-main);
  overflow: hidden;
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.3s ease;
}

#astrasoft-chatbot-window.visible {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

/* Encabezado del chatbot */
#astrasoft-chatbot-header {
  background: var(--aqua-dark);
  color: white;
  padding: 15px 20px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

/* Botón de cerrar */
#astrasoft-chatbot-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

#astrasoft-chatbot-close:hover {
  background: rgba(255,255,255,0.2);
  transform: rotate(90deg);
}

/* Área de mensajes */
#astrasoft-chatbot-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #f8fafb;
}

/* Contenedor de entrada */
#astrasoft-chatbot-input-container {
  display: flex;
  padding: 12px 15px;
  border-top: 1px solid #eee;
  background: white;
  align-items: center;
}

#astrasoft-chatbot-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: all 0.3s ease;
  font-family: var(--font-main);
  margin: 0;
  min-height: 20px;
  resize: none;
}

#astrasoft-chatbot-input:focus {
  border-color: var(--aqua-dark);
  box-shadow: 0 0 0 2px rgba(75, 127, 146, 0.2);
}

/* Botón de enviar */
#astrasoft-chatbot-send {
  background: var(--aqua-dark);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  margin-left: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
}

#astrasoft-chatbot-send:hover {
  background: #3b6a7a;
  transform: translateY(-1px);
}

#astrasoft-chatbot-send:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Estilos de mensajes */
.user-message {
  align-self: flex-end;
  background: var(--aqua-light);
  color: var(--text-dark);
  padding: 12px 16px;
  border-radius: 18px 18px 0 18px;
  max-width: 85%;
  animation: messageIn 0.25s ease-out;
  line-height: 1.5;
  word-break: break-word;
  margin: 0;
  box-shadow: var(--shadow-sm);
}

.bot-message {
  align-self: flex-start;
  background: #f9f9f9; /* Color de fondo más suave */
  color: var(--text-dark);
  padding: 14px 18px;
  border-radius: 16px;
  max-width: 90%;
  border: 1px solid #ddd;
  box-shadow: var(--shadow-sm);
  animation: messageIn 0.25s ease-out;
  line-height: 1.6;
  word-break: break-word;
  margin: 6px 0;
  font-size: 15px;
  white-space: pre-wrap; /* Para conservar saltos de línea */
}

.bot-message strong {
  font-weight: 600;
  color: var(--aqua-dark); /* Negrita con color de marca */
}

.bot-message ul {
  padding-left: 20px;
  margin: 8px 0;
}

.bot-message li {
  margin-bottom: 4px;
}
/* Indicador de "escribiendo" */
.typing-indicator {
  display: inline-flex;
  gap: 6px;
  padding: 12px 16px;
  background: white;
  border-radius: 18px;
  border: 1px solid #eee;
  box-shadow: var(--shadow-sm);
  align-self: flex-start;
  margin: 0;
}

.typing-indicator span {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--aqua-dark);
  border-radius: 50%;
  animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Scrollbar personalizada */
#astrasoft-chatbot-messages::-webkit-scrollbar {
  width: 8px;
}

#astrasoft-chatbot-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

#astrasoft-chatbot-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

#astrasoft-chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Animaciones */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingPulse {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Texto oculto para accesibilidad */
.astra-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Responsive para móviles */
@media (max-width: 768px) {
  #astrasoft-chatbot-window {
    width: 92vw;
    right: 4vw;
    bottom: 90px;
    height: 65vh;
  }
  
  button#astrasoft-chatbot-bubble.chatbot-trigger {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
  }
  
  #astrasoft-chatbot-input {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  #astrasoft-chatbot-send {
    padding: 10px 14px;
  }
}