/* Estilos del Chatbot Ital Vet 24hs */
:root {
  --chat-primary: #6366f1;
  /* Púrpura (Kodee Style) */
  --chat-primary-dark: #4f46e5;
  --chat-bg: #ffffff;
  --chat-text: #1f2937;
  --chat-gray: #f3f4f6;
  --chat-white: #ffffff;
  --chat-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.25), 0 8px 10px -6px rgba(99, 102, 241, 0.1);
}

/* Botón Flotante (Píldora) */
.chatbot-toggler {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  height: 50px;
  min-width: 50px;
  padding: 0 20px;
  background: var(--chat-primary);
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  border: none;
  outline: none;
}

.chatbot-toggler:hover {
  transform: translateY(-2px);
  background: var(--chat-primary-dark);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.chatbot-toggler .text-node {
  color: var(--chat-white);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  display: block;
  /* Visible por defecto */
}

.chatbot-toggler .icon-close {
  color: var(--chat-white);
  font-size: 1.4rem;
  display: none;
  /* Oculto por defecto */
}

/* Ventana del Chat */
.chatbot-window {
  position: fixed;
  right: 2rem;
  bottom: 6rem;
  /* Un poco más arriba */
  width: 420px;
  /* Más grande */
  background: var(--chat-bg);
  border-radius: 20px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  max-height: 650px;
  /* Más alto */
  border: 1px solid rgba(0, 0, 0, 0.05);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body.show-chatbot .chatbot-window {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Animación del botón toggler */
body.show-chatbot .chatbot-toggler {
  transform: rotate(90deg);
  width: 50px;
  /* Se vuelve redondo al abrir */
  min-width: 50px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

body.show-chatbot .chatbot-toggler .text-node {
  display: none;
  /* Ocultar texto al abrir */
}

body.show-chatbot .chatbot-toggler .icon-close {
  display: block;
  /* Mostrar icono cerrar al abrir */
}

/* Header */
.chatbot-header {
  background: var(--chat-primary);
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  padding: 1.2rem 1.5rem;
  color: var(--chat-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
}

.chatbot-header .close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--chat-white);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.chatbot-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chatbox (Area de mensajes) */
.chatbox {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 10px 20px;
  background: #f9fafb;
}

.chatbox .chat {
  display: flex;
  list-style: none;
  margin-bottom: 15px;
}

.chatbox .chat.incoming {
  justify-content: flex-start;
}

.chatbox .chat.outgoing {
  justify-content: flex-end;
}

.chatbox .chat p {
  white-space: pre-wrap;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 80%;
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.chatbox .chat.outgoing p {
  background: var(--chat-primary);
  color: var(--chat-white);
  border-bottom-right-radius: 2px;
}

.chatbox .chat.incoming p {
  background: #ffffff;
  color: var(--chat-text);
  border-bottom-left-radius: 2px;
  border: 1px solid #e5e7eb;
}

/* Preguntas Sugeridas (Chips) */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 15px 20px;
  margin-top: -5px;
}

.suggestion-chip {
  background: #ffffff;
  border: 1px solid var(--chat-primary);
  color: var(--chat-primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.suggestion-chip:hover {
  background: var(--chat-primary);
  color: var(--chat-white);
  transform: translateY(-1px);
}

/* Disclaimer */
.chat-disclaimer {
  padding: 8px 20px;
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
  background: #f9fafb;
  border-top: 1px solid #f0f0f0;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Input Area */
.chat-input {
  display: flex;
  gap: 10px;
  padding: 15px;
  border-top: 1px solid #f0f0f0;
  background: #fff;
}

.chat-input textarea {
  height: 45px;
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  outline: none;
  padding: 12px 20px;
  resize: none;
  font-family: inherit;
  font-size: 0.95rem;
  background: #f9fafb;
  transition: border-color 0.2s;
}

.chat-input textarea:focus {
  border-color: var(--chat-primary);
  background: #fff;
}

.chat-input button {
  border: none;
  background: var(--chat-primary);
  color: #fff;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}

.chat-input button:hover {
  background: var(--chat-primary-dark);
  transform: scale(1.05);
}

/* Responsive */
@media (max-width: 450px) {
  .chatbot-window {
    width: 100%;
    height: 100%;
    right: 0;
    bottom: 0;
    border-radius: 0;
    max-height: 100vh;
  }
}