/* ============================================================
   components.css — chatbot flotante (fondo OSCURO)
   ============================================================ */

.chatbot {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1500;
}

/* Botón circular azul brillante con pulso sutil */
.chatbot__toggle {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--blue-bright);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(74, 127, 224, 0.5);
  transition: transform 0.28s var(--ease), background 0.28s var(--ease);
}
.chatbot__toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74, 127, 224, 0.55);
  animation: chatPulse 2.6s ease-out infinite;
}
@keyframes chatPulse {
  0%   { box-shadow: 0 0 0 0 rgba(74, 127, 224, 0.5); }
  70%  { box-shadow: 0 0 0 16px rgba(74, 127, 224, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 127, 224, 0); }
}
.chatbot__toggle:hover {
  transform: scale(1.06);
  background: var(--blue-glow);
}
.chatbot.is-open .chatbot__toggle::before { animation: none; }
.chatbot__icon-open,
.chatbot__icon-close {
  position: absolute;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.chatbot__icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.chatbot.is-open .chatbot__icon-open { opacity: 0; transform: rotate(90deg) scale(0.6); }
.chatbot.is-open .chatbot__icon-close { opacity: 1; transform: rotate(0) scale(1); }

/* Ventana */
.chatbot__window {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 360px;
  max-width: calc(100vw - 44px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.chatbot.is-open .chatbot__window {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header azul */
.chatbot__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--blue), var(--blue-bright));
  color: #fff;
  flex-shrink: 0;
}
.chatbot__header-info { display: flex; align-items: center; gap: 10px; }
.chatbot__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  padding: 1px;
}
.chatbot__title {
  display: block;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.2;
}
.chatbot__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.9);
}
.chatbot__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ee787;
  box-shadow: 0 0 8px rgba(110, 231, 135, 0.8);
  display: inline-block;
}
.chatbot__close {
  color: #fff;
  opacity: 0.85;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}
.chatbot__close:hover { opacity: 1; background: rgba(255, 255, 255, 0.18); }

/* Cuerpo */
.chatbot__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
  scroll-behavior: smooth;
}
.chatbot__body::-webkit-scrollbar { width: 6px; }
.chatbot__body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

/* Mensajes */
.msg {
  max-width: 82%;
  padding: 11px 15px;
  font-size: 0.92rem;
  line-height: 1.5;
  border-radius: 14px;
  animation: msgIn 0.35s var(--ease) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg--bot {
  align-self: flex-start;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.msg--user {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Opciones / quick replies */
.chat-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
  width: 100%;
  animation: msgIn 0.35s var(--ease) both;
}
.chat-option {
  text-align: left;
  padding: 11px 15px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease),
              transform 0.2s var(--ease), color 0.2s var(--ease);
}
.chat-option:hover {
  border-color: var(--blue-bright);
  background: rgba(74, 127, 224, 0.12);
  color: var(--blue-glow);
  transform: translateX(3px);
}
.chat-option--primary {
  background: var(--blue-bright);
  color: #fff;
  border-color: var(--blue-bright);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chat-option--primary:hover {
  background: var(--blue-glow);
  color: #fff;
}
.chat-option--ghost {
  background: transparent;
  color: var(--muted);
  border-style: dashed;
}
.chat-option--ghost:hover {
  color: var(--blue-bright);
  background: transparent;
}

/* Campo de nombre */
.chat-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  align-self: flex-start;
  animation: msgIn 0.35s var(--ease) both;
}
.chat-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease);
}
.chat-input::placeholder { color: var(--muted); }
.chat-input:focus { outline: none; border-color: var(--blue-bright); }
.chat-send {
  flex-shrink: 0;
  width: 44px;
  border-radius: var(--radius);
  background: var(--blue-bright);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease);
}
.chat-send:hover { background: var(--blue-glow); }

/* Typing */
.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 13px 16px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .chatbot { right: 16px; bottom: 16px; }
  .chatbot__window {
    width: calc(100vw - 32px);
    height: 68vh;
    bottom: 74px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg, .chat-options, .chat-input-row { animation: none; }
  .chat-typing span { animation: none; }
  .chatbot__toggle::before { animation: none; }
}
