/* ============================================================
   CHATBOT STYLES — LOT Internacional
   Extraído de site.css
   Importar DESPUÉS de site.css en el HTML:
     <link rel="stylesheet" href="chatbot.css">
   ============================================================ */

/* ----------------------------------------------------------
   1. CONTENEDOR PRINCIPAL (posicionamiento fijo)
   ---------------------------------------------------------- */

   :root {
  --bg: #050505;
  --bg-soft: #0e0e0f;
  --surface: rgba(14, 14, 15, 0.94);
  --surface-strong: rgba(9, 9, 10, 0.98);
  --surface-2: #17181a;
  --surface-3: #222326;
  --text: #fbfbfc;
  --muted: #b3b3b8;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(25, 141, 255, 0.5);
  --accent: #148cff;
  --accent-strong: #0d6efd;
  --accent-2: #f2f8ff;
  --accent-warm: #6ed6ff;
}
.chatbot-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

/* ----------------------------------------------------------
   2. BOTÓN LAUNCHER — versión clásica (ícono panda/SVG)
   ---------------------------------------------------------- */
.chatbot-toggle {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(135deg, #ffffff, #bdefff);
  color: #02111f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 48px rgba(0,0,0,0.4), 0 0 26px rgba(39,194,255,0.28);
  transition: transform .25s ease, box-shadow .25s ease;
  position: relative;
}

.chatbot-toggle:hover {
  transform: scale(1.08);
}

.chatbot-toggle svg {
  width: 34px;
  height: 34px;
}

.chatbot-toggle .close-icon {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(.8);
  transition: all .25s ease;
}

.chatbot-toggle .panda-icon {
  transition: all .25s ease;
}

.chatbot-toggle.active .panda-icon {
  opacity: 0;
  transform: rotate(90deg) scale(.75);
}

.chatbot-toggle.active .close-icon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* ----------------------------------------------------------
   3. BOTÓN LAUNCHER — versión video (RAC LOT)
   ---------------------------------------------------------- */
.chatbot-video-toggle {
  position: relative;
  isolation: isolate;
  width: 82px;
  height: 82px;
  padding: 0;
  border-radius: 26px;
  overflow: visible;
  background: #050505;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
}

/* Aura difusa detrás del botón */
.chatbot-video-toggle::before,
.chatbot-video-toggle::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 28px;
  pointer-events: none;
}

.chatbot-video-toggle::before {
  z-index: 0;
  background: radial-gradient(circle at 20% 20%, rgba(118,188,255,0.34), transparent 42%),
              radial-gradient(circle at 80% 80%, rgba(178,121,255,0.2), transparent 46%);
  filter: blur(10px);
  opacity: 0.6;
  animation: chatbotLauncherAura 3.6s ease-in-out infinite;
}

/* Borde gradiente giratorio */
.chatbot-video-toggle::after {
  z-index: 1;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.28),
    rgba(118,188,255,0.24) 32%,
    rgba(255,255,255,0.08) 58%,
    rgba(178,121,255,0.26)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1px;
  opacity: 0.9;
  animation: chatbotLauncherBorder 4.8s linear infinite;
}

/* Shell que contiene el video */
.chatbot-video-shell {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  border-radius: inherit;
  overflow: hidden;
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  transition: opacity .22s ease, transform .22s ease;
}

.chatbot-launcher-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.02) contrast(1.04);
  transition: opacity .18s ease;
}

/* Video congelado (último frame) */
.chatbot-video-shell.is-frozen .chatbot-launcher-video {
  opacity: 1;
}

/* Icono de cierre sobre el video cuando está activo */
.chatbot-toggle.active .chatbot-video-shell {
  opacity: 0;
  transform: scale(.82);
  pointer-events: none;
}

.chatbot-toggle.active .chatbot-pulse {
  opacity: 0;
}

.chatbot-toggle .close-icon {
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(0,0,0,0.7);
  color: #fff;
}

/* ----------------------------------------------------------
   4. PULSO ANIMADO alrededor del launcher
   ---------------------------------------------------------- */
.chatbot-pulse {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 1px solid rgba(39, 194, 255, 0.35);
  animation: chatbotPulse 2.2s infinite;
  z-index: 1;
}

@keyframes chatbotPulse {
  0%   { transform: scale(1);    opacity: .8; }
  70%  { transform: scale(1.18); opacity: 0;  }
  100% { transform: scale(1.18); opacity: 0;  }
}

/* ----------------------------------------------------------
   5. VENTANA DEL CHAT
   ---------------------------------------------------------- */
.chatbot-window {
  position: absolute;
  right: 0;
  bottom: 86px;
  width: min(560px, calc(100vw - 40px));
  min-width: min(460px, calc(100vw - 40px));
  min-height: 560px;
  max-width: calc(100vw - 40px);
  max-height: min(76vh, 760px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(7,14,26,0.98), rgba(5,11,21,0.98));
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

body[data-theme="light"] .chatbot-window {
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(241,248,255,0.99));
}

.chatbot-window.active {
  display: flex;
  animation: chatOpen .28s ease;
}

@keyframes chatOpen {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ----------------------------------------------------------
   6. HEADER DEL CHAT (avatar + info + herramientas)
   ---------------------------------------------------------- */
.chatbot-header {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1rem .9rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(39,194,255,0.15), rgba(255,255,255,0.04));
}

.chatbot-info {
  min-width: 0;
  flex: 1 1 auto;
}

.chatbot-info h4 {
  margin: 0 0 .2rem;
  font-size: .96rem;
}

.chatbot-info span {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .78rem;
}

.chatbot-tools {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

/* ----------------------------------------------------------
   7. BOTONES DE HERRAMIENTAS (import / export / warning)
   ---------------------------------------------------------- */
.chatbot-import,
.chatbot-export {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: .45rem .72rem;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.chatbot-import:hover,
.chatbot-export:hover {
  background: rgba(39,194,255,0.14);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Variante compacta usada en RAC LOT */
.chatbot-export {
  padding: 8px 12px;
  font-size: 12px;
}

.chatbot-export:hover {
  background: rgba(255,255,255,0.09);
}

/* Ícono de advertencia con tooltip */
.chatbot-warning {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: #ffce6a;
  cursor: help;
}

.chatbot-warning-mark {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.chatbot-warning-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: 220px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(5,5,5,0.96);
  border: 1px solid rgba(255,255,255,0.08);
  color: #d5d5d5;
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.chatbot-warning:hover .chatbot-warning-tooltip,
.chatbot-warning:focus-within .chatbot-warning-tooltip,
.chatbot-warning:focus .chatbot-warning-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* ----------------------------------------------------------
   8. AVATAR (header y mensajes)
   ---------------------------------------------------------- */
.chatbot-avatar,
.msg-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff, #ccefff);
  color: #02111f;
  flex: 0 0 auto;
}

.bot-avatar-mini {
  width: 32px;
  height: 32px;
}

.chatbot-avatar svg,
.bot-avatar-mini svg,
.chatbot-toggle .panda-icon,
.chatbot-toggle .close-icon {
  display: block;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(39,194,255,0.66);
}

/* ----------------------------------------------------------
   9. ÁREA DE MENSAJES
   ---------------------------------------------------------- */
.chatbot-messages {
  flex: 1 1 auto;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .95rem;
}

.chat-msg {
  display: flex;
  gap: .7rem;
  align-items: flex-end;
}

.chat-msg.user {
  justify-content: flex-end;
}

.chat-msg.user .msg-avatar {
  order: 2;
  background: linear-gradient(135deg, var(--accent), #9de8ff);
}

.msg-bubble {
  max-width: 270px;
  padding: .82rem .95rem;
  border-radius: 16px 16px 16px 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
  font-size: .92rem;
}

.chat-msg.user .msg-bubble {
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(135deg, rgba(39,194,255,0.2), rgba(255,255,255,0.08));
}

.chat-msg-time {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

/* ----------------------------------------------------------
   10. SUGERENCIAS RÁPIDAS
   ---------------------------------------------------------- */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .6rem;
}

.chat-suggestion {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .52rem .76rem;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: .74rem;
  font-weight: 600;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.chat-suggestion:hover {
  background: rgba(39,194,255,0.14);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ----------------------------------------------------------
   11. ÁREA DE ESCRITURA (input + botón enviar)
   ---------------------------------------------------------- */
.chatbot-input-area {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.chatbot-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: .95rem 1rem;
  outline: none;
}

.chatbot-input::placeholder {
  color: var(--muted);
}

.chatbot-send {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #02111f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 26px rgba(0,168,255,0.24);
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ----------------------------------------------------------
   12. OVERRIDES PARA PÁGINAS ESPECÍFICAS
       (inner-enhanced-page y home-universe-page)
   ---------------------------------------------------------- */

/* text-shadow del título en header del chat (extraído de bloque global de site.css) */
.chatbot-info h4 {
  text-shadow: 0 0 18px rgba(39, 194, 255, 0.08);
}

/* border-color del panel del chat (extraído de bloque global de site.css) */
.chatbot-window {
  border-color: var(--line) !important;
}
body.inner-enhanced-page .chatbot-window,
body.inner-enhanced-page .chatbot-toggle,
body.home-universe-page .chatbot-window,
body.home-universe-page .chatbot-toggle {
  background: rgba(9,9,9,0.96);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 40px rgba(0,0,0,0.28);
}

body.inner-enhanced-page .chatbot-input,
body.home-universe-page .chatbot-input {
  background: #0b0b0b;
  color: #fff;
  border-color: rgba(255,255,255,0.08);
}

body.inner-enhanced-page .chatbot-export,
body.home-universe-page .chatbot-export,
body.inner-enhanced-page .chatbot-warning,
body.home-universe-page .chatbot-warning {
  background: rgba(255,255,255,0.03);
}

/* ----------------------------------------------------------
   13. KEYFRAMES DE ANIMACIÓN DEL LAUNCHER VIDEO
   ---------------------------------------------------------- */
@keyframes chatbotLauncherAura {
  0%, 100% { opacity: 0.5;  transform: scale(0.96); }
  50%       { opacity: 0.88; transform: scale(1.04); }
}

@keyframes chatbotLauncherBorder {
  0%   { transform: rotate(0deg);   opacity: 0.72; }
  50%  {                             opacity: 1;    }
  100% { transform: rotate(360deg); opacity: 0.72; }
}

/* ----------------------------------------------------------
   14. RESPONSIVE
   ---------------------------------------------------------- */

/* Tablet / móvil grande (≤ 820px) */
@media (max-width: 820px) {
  .chatbot-container {
    right: 14px;
    bottom: 14px;
  }

  .chatbot-window {
    width: min(100vw - 28px, 500px);
    min-width: 0;
    max-width: calc(100vw - 28px);
    bottom: 78px;
    min-height: 460px;
    max-height: calc(100vh - 110px);
  }

  .chatbot-video-toggle {
    width: 72px;
    height: 72px;
    border-radius: 22px;
  }

  .chatbot-tools {
    gap: 8px;
  }

  .chatbot-export {
    padding: 7px 10px;
    font-size: 11px;
  }
}

/* Móvil medio (≤ 600px) */
@media (max-width: 600px) {
  .chatbot-container {
    right: 12px;
    left: 12px;
    bottom: 12px;
    display: flex;
    justify-content: flex-end;
  }

  .chatbot-window {
    right: 0;
    width: min(100%, 420px);
    bottom: 82px;
    min-height: min(560px, calc(100vh - 124px));
    max-height: calc(100vh - 124px);
  }

  .chatbot-header {
    align-items: flex-start;
  }

  .chatbot-tools {
    width: 100%;
    justify-content: flex-start;
    padding-left: 52px;
  }
}

/* Móvil pequeño (≤ 420px) */
@media (max-width: 420px) {
  .chatbot-window {
    width: 100%;
    bottom: 78px;
    min-height: min(520px, calc(100vh - 108px));
    max-height: calc(100vh - 108px);
    border-radius: 20px;
  }

  .chatbot-header,
  .chatbot-messages,
  .chatbot-input-area {
    padding-left: .85rem;
    padding-right: .85rem;
  }

  .chatbot-tools {
    padding-left: 0;
  }

  .chatbot-import,
  .chatbot-export {
    font-size: .68rem;
    padding: .42rem .62rem;
  }

  .msg-bubble {
    max-width: min(100%, 220px);
  }
}