/* ============================================================
   NEXUS v2 — bolinha orbital + chat
   ------------------------------------------------------------
   • O botão agora é uma esfera brilhante que flutua em círculos
     (360° no plano + sobe/desce) chamando atenção sem abrir nada.
   • O painel SÓ abre no clique e fecha de verdade:
     .nexus-panel[hidden] { display:none } — era isso que fazia
     o chat "não fechar" na versão antiga.
   ============================================================ */

.nexus-root {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

/* ---------- A ESFERA ---------- */
.nexus-fab {
  position: relative;
  width: 62px;
  height: 62px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #03151a;
  font-size: 1.35rem;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), transparent 34%),
    radial-gradient(circle at 60% 65%, var(--green, #22D3EE) 0%, #0891b2 55%, #083344 100%);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.55),
    0 0 26px rgba(34, 211, 238, 0.45),
    inset 0 -6px 14px rgba(0, 0, 0, 0.35);
  animation:
    nexusOrbit 7s ease-in-out infinite,
    nexusGlow 2.8s ease-in-out infinite;
  transition: transform 0.25s ease;
}

.nexus-fab:hover {
  animation-play-state: paused, running;
  transform: scale(1.12);
}

.nexus-fab:active {
  transform: scale(0.96);
}

/* anel de pulso ao redor da esfera */
.nexus-fab::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.5);
  animation: nexusPing 2.8s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}

/* segundo anel, defasado */
.nexus-fab::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.35);
  animation: nexusPing 2.8s cubic-bezier(0, 0, 0.2, 1) infinite;
  animation-delay: 1.4s;
  pointer-events: none;
}

.nexus-fab-icon {
  display: grid;
  place-items: center;
  animation: nexusSpin 9s linear infinite;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.nexus-fab-label {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: rgba(7, 13, 24, 0.92);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--text, #f5f7f8);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.nexus-fab:hover .nexus-fab-label {
  opacity: 1;
}

/* movimento orbital: círculo horizontal 360° + flutuação vertical */
@keyframes nexusOrbit {
  0%   { transform: translate(0px, 0px); }
  12%  { transform: translate(-7px, -6px); }
  25%  { transform: translate(-10px, 0px); }
  37%  { transform: translate(-7px, 6px); }
  50%  { transform: translate(0px, 9px); }
  62%  { transform: translate(7px, 6px); }
  75%  { transform: translate(10px, 0px); }
  87%  { transform: translate(7px, -6px); }
  100% { transform: translate(0px, 0px); }
}

@keyframes nexusGlow {
  0%, 100% {
    box-shadow:
      0 12px 30px rgba(0, 0, 0, 0.55),
      0 0 20px rgba(34, 211, 238, 0.35),
      inset 0 -6px 14px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 12px 30px rgba(0, 0, 0, 0.55),
      0 0 40px rgba(34, 211, 238, 0.65),
      inset 0 -6px 14px rgba(0, 0, 0, 0.35);
  }
}

@keyframes nexusPing {
  0%   { transform: scale(1); opacity: 0.8; }
  80%, 100% { transform: scale(1.55); opacity: 0; }
}

@keyframes nexusSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* quando o chat está aberto, a esfera fica quieta */
.nexus-root.is-open .nexus-fab {
  animation: nexusGlow 2.8s ease-in-out infinite;
}

.nexus-root.is-open .nexus-fab::before,
.nexus-root.is-open .nexus-fab::after {
  animation: none;
  opacity: 0;
}

/* ---------- PAINEL DO CHAT ---------- */
.nexus-panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 40px));
  height: min(540px, calc(100vh - 130px));
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #0b1120 0%, #070d18 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 30px rgba(34, 211, 238, 0.08);
  transform-origin: bottom right;
  animation: nexusPop 0.28s cubic-bezier(0.22, 1.1, 0.36, 1) both;
}

/* A CORREÇÃO: painel escondido fica escondido de verdade */
.nexus-panel[hidden] {
  display: none !important;
}

@keyframes nexusPop {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.nexus-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(34, 211, 238, 0.05);
}

.nexus-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green, #22D3EE);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.8);
  animation: nexusGlowDot 2s ease-in-out infinite;
}

@keyframes nexusGlowDot {
  0%, 100% { box-shadow: 0 0 6px rgba(34, 211, 238, 0.5); }
  50% { box-shadow: 0 0 14px rgba(34, 211, 238, 0.95); }
}

.nexus-header-text {
  display: grid;
  line-height: 1.25;
}

.nexus-header-text strong {
  font-size: 0.95rem;
  color: var(--text, #f5f7f8);
}

.nexus-header-text small {
  color: var(--muted, #aeb5bb);
  font-size: 0.74rem;
}

.nexus-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: transparent;
  color: var(--muted, #aeb5bb);
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.nexus-close:hover {
  color: var(--text, #f5f7f8);
  border-color: rgba(255, 255, 255, 0.35);
  transform: rotate(90deg);
}

.nexus-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.nexus-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  animation: nexusMsgIn 0.25s ease both;
}

@keyframes nexusMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nexus-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text, #f5f7f8);
  border-bottom-left-radius: 5px;
}

.nexus-msg.user {
  align-self: flex-end;
  background: rgba(34, 211, 238, 0.14);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--text, #f5f7f8);
  border-bottom-right-radius: 5px;
}

.nexus-typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 20px;
}

.nexus-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green, #22D3EE);
  opacity: 0.4;
  animation: nexusTyping 1.1s ease-in-out infinite;
}

.nexus-typing span:nth-child(2) { animation-delay: 0.16s; }
.nexus-typing span:nth-child(3) { animation-delay: 0.32s; }

@keyframes nexusTyping {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.nexus-chips {
  display: flex;
  gap: 8px;
  padding: 0 14px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nexus-chips::-webkit-scrollbar {
  display: none;
}

.nexus-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted, #aeb5bb);
  font-size: 0.76rem;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.nexus-chip:hover {
  border-color: rgba(34, 211, 238, 0.5);
  color: var(--text, #f5f7f8);
  background: rgba(34, 211, 238, 0.08);
}

.nexus-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nexus-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 0.88rem;
  color: var(--text, #f5f7f8);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nexus-form input:focus {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.nexus-send {
  width: 42px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--green, #22D3EE), #0891b2);
  color: #03151a;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nexus-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(34, 211, 238, 0.3);
}

@media (max-width: 560px) {
  .nexus-root {
    right: 16px;
    bottom: 16px;
  }

  .nexus-panel {
    width: calc(100vw - 32px);
    height: min(520px, calc(100vh - 110px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .nexus-fab,
  .nexus-fab::before,
  .nexus-fab::after,
  .nexus-fab-icon {
    animation: none;
  }
}

/* ---------- TELA DE BLOQUEIO (plano grátis / não logado) ---------- */
.nexus-gate {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 28px 24px;
}

.nexus-gate-orb {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  color: #03151a;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), transparent 34%),
    radial-gradient(circle at 60% 65%, #22D3EE 0%, #0891b2 55%, #083344 100%);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.4);
  animation: nexusGlow 2.8s ease-in-out infinite;
}

.nexus-gate h3 {
  margin: 4px 0 0;
  font-size: 1.05rem;
  color: var(--text, #EAF2FF);
}

.nexus-gate p {
  margin: 0;
  color: var(--muted, #8b96ad);
  font-size: 0.86rem;
  line-height: 1.55;
  max-width: 280px;
}

.nexus-gate .nexus-gate-pro {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #F5B614;
  border: 1px solid rgba(245, 182, 20, 0.45);
  background: rgba(245, 182, 20, 0.08);
}

.nexus-gate-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 11px 22px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.88rem;
  text-decoration: none;
  color: #1a1205;
  background: linear-gradient(135deg, #F5B614, #d99a06);
  box-shadow: 0 8px 22px rgba(245, 182, 20, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nexus-gate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(245, 182, 20, 0.4);
  text-decoration: none;
}

.nexus-gate-btn.cyan {
  color: #03151a;
  background: linear-gradient(135deg, #22D3EE, #0891b2);
  box-shadow: 0 8px 22px rgba(34, 211, 238, 0.3);
}

.nexus-gate-sub {
  font-size: 0.76rem !important;
  color: var(--muted-2, #5C6478) !important;
}

/* ═══════════════ BLOCOS DE ACHADO ═══════════════
   O Nexus responde em blocos, não em parágrafo corrido: cada achado é
   uma afirmação com número. A faixa de severidade à esquerda deixa
   "alerta" e "informação" distinguíveis numa olhada, sem ler tudo. */
.nx-achado{
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.07);
  border-left:2px solid var(--nx-sev,rgba(255,255,255,.2));
  border-radius:10px;
  padding:.7rem .85rem;
  margin-bottom:.55rem;
}
.nx-achado:last-child{margin-bottom:0}
.nx-achado-hd{display:flex;align-items:flex-start;gap:7px;margin-bottom:.35rem}
.nx-achado-hd b{font-size:12.5px;font-weight:700;line-height:1.35;letter-spacing:-.01em}
.nx-ico{font-size:11px;line-height:1.5;flex-shrink:0;color:var(--nx-sev,inherit)}
.nx-achado p{font-size:12px;line-height:1.6;color:var(--mut,#8B93A7);margin:0}

.nx-alerta  {--nx-sev:#FF4D6A}
.nx-atencao {--nx-sev:#F5B614}
.nx-positivo{--nx-sev:#14F195}
.nx-info    {--nx-sev:#00E5FF}

.nx-intro{font-size:12px;color:var(--mut,#8B93A7);margin:0 0 .6rem;line-height:1.55}
.nx-lista{margin:.5rem 0 0;padding-left:1.1rem}
.nx-lista li{font-size:12px;line-height:1.7;color:var(--mut,#8B93A7)}

/* dentro da bolha do bot, os blocos ocupam a largura toda */
.nexus-msg.bot{max-width:100%}
.nexus-msg.bot p:first-child:last-child{margin:0}
