/* =============================================================
   AD2N AI ASSISTANT - ESTILOS Y ANIMACIONES ULTRA-PREMIUM
   ============================================================= */

/* Botón disparador en el Navbar */
.ad2n-chatbot-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0 !important;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ad2n-chatbot-trigger::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #00b4d8;
  box-shadow: 0 0 10px #00b4d8, 0 0 18px rgba(0, 180, 216, 0.9);
  animation: ad2nBotPulse 2s infinite ease-in-out;
}

@keyframes ad2nBotPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; box-shadow: 0 0 8px #00b4d8; }
  50% { transform: scale(1.4); opacity: 1; box-shadow: 0 0 18px #8ce7f8, 0 0 26px #00b4d8; }
}

.ad2n-chatbot-trigger:hover,
.ad2n-chatbot-trigger[aria-expanded="true"] {
  color: #00b4d8 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  transform: translateY(-1px);
}

.ad2n-chatbot-trigger:focus-visible {
  outline: 2px solid rgba(0, 180, 216, 0.8);
  outline-offset: 2px;
}

/* Avatares */
.ad2n-chatbot-avatar,
.ad2n-chat-message-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Ventana flotante del Chatbot */
.ad2n-chatbot-panel {
  position: fixed;
  top: 88px;
  right: max(24px, calc((100vw - 1280px) / 2 + 24px));
  z-index: 100000000;
  display: flex;
  flex-direction: column;
  width: min(410px, calc(100vw - 32px));
  height: min(660px, calc(100vh - 112px));
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(140, 231, 248, 0.22);
  border-radius: 26px;
  color: #eefcff;
  background: linear-gradient(165deg, rgba(11, 20, 43, 0.98), rgba(4, 7, 20, 0.99));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8), 0 0 50px rgba(0, 180, 216, 0.2), inset 0 1px rgba(255, 255, 255, 0.15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-24px) scale(0.92);
  transform-origin: top right;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
}

.ad2n-chatbot-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Encabezado del Panel */
.ad2n-chatbot-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 12% 0, rgba(0, 180, 216, 0.22), transparent 50%);
}

.ad2n-chatbot-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ad2n-chatbot-avatar {
  width: 58px;
  height: 38px;
  flex: 0 0 auto;
}

.ad2n-chatbot-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 180, 216, 0.5));
}

.ad2n-chatbot-identity strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
}

.ad2n-chatbot-identity span {
  display: block;
  margin-top: 2px;
  color: rgba(238, 252, 255, 0.6);
  font-size: 11px;
}

.ad2n-chatbot-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.25s ease;
}

.ad2n-chatbot-close:hover {
  color: #fff;
  border-color: rgba(213, 11, 82, 0.65);
  background: rgba(213, 11, 82, 0.22);
  transform: rotate(90deg);
}

/* Contexto / Subtítulo */
.ad2n-chatbot-context {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  color: rgba(238, 252, 255, 0.45);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Contenedor de Mensajes */
.ad2n-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 180, 216, 0.35) transparent;
  scroll-behavior: smooth;
}

.ad2n-chatbot-messages::-webkit-scrollbar {
  width: 5px;
}
.ad2n-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 180, 216, 0.35);
  border-radius: 10px;
}

/* Mensajes individuales */
.ad2n-chat-message {
  display: flex;
  gap: 10px;
  margin: 14px 0;
  animation: ad2nChatMessageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ad2n-chat-message--user {
  justify-content: flex-end;
  animation: ad2nUserMessageIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ad2n-chat-message-avatar {
  width: 32px;
  height: 24px;
  flex: 0 0 auto;
  align-self: flex-start;
  margin-top: 4px;
}

.ad2n-chat-message-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Burbujas de chat limpias */
.ad2n-chat-bubble {
  position: relative;
  max-width: 86%;
  padding: 12px 15px 9px;
  border: 1px solid rgba(140, 231, 248, 0.15);
  border-radius: 18px 18px 18px 4px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: border-color 0.25s ease;
}

.ad2n-chat-bubble:hover {
  border-color: rgba(140, 231, 248, 0.3);
}

.ad2n-chat-message--user .ad2n-chat-bubble {
  border-color: rgba(0, 180, 216, 0.35);
  border-radius: 18px 18px 4px 18px;
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.28), rgba(0, 119, 182, 0.25));
  box-shadow: 0 8px 24px rgba(0, 180, 216, 0.15);
}

.ad2n-chat-bubble p {
  margin: 0;
  color: rgba(238, 252, 255, 0.92);
  font-size: 13.5px;
  line-height: 1.58;
  word-break: break-word;
}

.ad2n-chat-time {
  display: block;
  margin-top: 6px;
  color: rgba(238, 252, 255, 0.4);
  font-size: 9px;
  text-align: right;
  font-feature-settings: 'tnum';
}

/* =============================================================
   EFECTO DE APARICIÓN DE LETRAS (TYPEWRITER & CURSOR)
   ============================================================= */
.ad2n-typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  vertical-align: -0.15em;
  margin-left: 2px;
  background: #00b4d8;
  box-shadow: 0 0 10px #00b4d8, 0 0 16px #8ce7f8;
  animation: ad2nCursorBlink 0.7s infinite ease-in-out;
  border-radius: 1px;
}

@keyframes ad2nCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Indicador de "Escribiendo..." con 3 puntos neón */
.ad2n-typing-indicator-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  animation: ad2nChatMessageIn 0.3s ease both;
}

.ad2n-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 11px 16px;
  border: 1px solid rgba(140, 231, 248, 0.15);
  border-radius: 18px 18px 18px 4px;
  background: rgba(255, 255, 255, 0.055);
}

.ad2n-typing-dot {
  width: 7px;
  height: 7px;
  background: #00b4d8;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 180, 216, 0.7);
  animation: ad2nTypingDot 1.4s infinite ease-in-out both;
}

.ad2n-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ad2n-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.ad2n-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes ad2nTypingDot {
  0%, 80%, 100% {
    transform: scale(0.65);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.25);
    opacity: 1;
    background: #8ce7f8;
    box-shadow: 0 0 12px #8ce7f8;
  }
}

/* =============================================================
   EXPLORA RÁPIDAMENTE - SECCIÓN Y BOTONES DINÁMICOS CON ENLACES
   ============================================================= */
.ad2n-chatbot-quick-actions {
  padding: 12px 18px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.14);
  transition: all 0.3s ease;
}

.ad2n-chatbot-quick-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: rgba(238, 252, 255, 0.48);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ad2n-chatbot-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ad2n-chatbot-quick-action {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  color: rgba(238, 252, 255, 0.82);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
}

.ad2n-chatbot-quick-action i {
  width: 16px;
  color: #00b4d8;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.ad2n-chatbot-quick-action:hover {
  border-color: rgba(0, 180, 216, 0.65);
  color: #fff !important;
  background: rgba(0, 180, 216, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 180, 216, 0.2);
}

.ad2n-chatbot-quick-action:hover i {
  transform: scale(1.15);
}

/* Estilo especial para botones que son enlaces directos a páginas */
.ad2n-chatbot-quick-action--link {
  border-color: rgba(0, 180, 216, 0.3);
  background: rgba(0, 180, 216, 0.08);
  color: #8ce7f8;
}

.ad2n-chatbot-quick-action--link:hover {
  border-color: #00b4d8;
  background: rgba(0, 180, 216, 0.25);
  color: #ffffff !important;
  box-shadow: 0 6px 18px rgba(0, 180, 216, 0.35);
}

.ad2n-chatbot-quick-action--link .nav-arrow-icon {
  margin-left: auto;
  font-size: 9px;
  opacity: 0.7;
}

/* Caja de entrada (Composer) */
.ad2n-chatbot-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 18px 0;
  padding: 6px 6px 6px 14px;
  border: 1px solid rgba(140, 231, 248, 0.22);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.25s ease;
}

.ad2n-chatbot-composer:focus-within {
  border-color: #00b4d8;
  box-shadow: 0 0 16px rgba(0, 180, 216, 0.35);
  background: rgba(0, 0, 0, 0.45);
}

.ad2n-chatbot-composer input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: #effcff;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
}

.ad2n-chatbot-composer input::placeholder {
  color: rgba(238, 252, 255, 0.38);
}

.ad2n-chatbot-composer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  color: #06101e;
  background: #00b4d8;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(0, 180, 216, 0.4);
}

.ad2n-chatbot-composer button:hover {
  background: #8ce7f8;
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 0 18px rgba(140, 231, 248, 0.6);
}

/* Nota inferior */
.ad2n-chatbot-note {
  margin: 9px 18px 14px;
  color: rgba(238, 252, 255, 0.35);
  font-size: 9.5px;
  text-align: center;
}

.ad2n-chatbot-note i {
  margin-right: 4px;
  color: rgba(0, 180, 216, 0.7);
}

/* Animaciones de Mensajes */
@keyframes ad2nChatMessageIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ad2nUserMessageIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Responsividad en Celulares */
@media (max-width: 991.98px) {
  .ad2n-chatbot-panel {
    top: 74px;
    right: 16px;
    height: min(650px, calc(100vh - 90px));
  }
}

@media (max-width: 575.98px) {
  .ad2n-chatbot-panel {
    top: 68px;
    right: 8px;
    left: 8px;
    width: auto;
    height: calc(100vh - 80px);
    min-height: 460px;
    border-radius: 22px;
    transform-origin: top center;
  }
}
