/* Assistente de dúvidas — widget com movimento curto, proposital e acessível. */

:root {
  --dk-azul: #004c96;
  --dk-azul-escuro: #023768;
  --dk-laranja: #f4941d;
  --dk-tinta: #171a1f;
  --dk-muted: #64748b;
  --dk-linha: #dfe5ee;
  --dk-fundo: #f5f6f8;
  --dk-card: #ffffff;
  --dk-focus: rgba(0, 76, 150, 0.16);
  --motion-fast: 140ms;
  --motion-med: 220ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-press: cubic-bezier(0.2, 0, 0, 1);
}

.assistente__botao {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--dk-laranja);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(2, 32, 100, 0.24);
  z-index: 300;
  display: grid;
  place-items: center;
  font: 800 1.25rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: transform var(--motion-fast) var(--ease-press), box-shadow var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out);
}

.assistente__botao:focus-visible,
.assistente__fechar:focus-visible,
.assistente__enviar:focus-visible,
.assistente__sugestao:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px var(--dk-focus);
}

.assistente__botao--ativo {
  background: var(--dk-azul);
}

.assistente__janela {
  position: fixed;
  right: 1.5rem;
  bottom: 5.5rem;
  width: min(24rem, calc(100vw - 3rem));
  height: min(34rem, calc(100vh - 8rem));
  background: var(--dk-card);
  border: 1px solid rgba(2, 32, 100, 0.08);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(2, 32, 100, 0.22);
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.75rem) scale(0.97);
  transform-origin: bottom right;
  transition: opacity var(--motion-med) var(--ease-out), transform var(--motion-med) var(--ease-out);
}

.assistente__janela--aberta {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.assistente__cabecalho {
  background: linear-gradient(135deg, var(--dk-azul), var(--dk-azul-escuro));
  color: #fff;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.assistente__titulo-grupo {
  min-width: 0;
}

.assistente__titulo {
  font-weight: 750;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.assistente__status {
  margin-top: 0.125rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.75rem;
}

.assistente__fechar {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: background-color var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-press);
}

.assistente__mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--dk-fundo);
}

.assistente__msg {
  max-width: 88%;
  padding: 0.6875rem 0.875rem;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: assistente-msg-in var(--motion-med) var(--ease-out) both;
}

.assistente__msg--bot {
  background: #fff;
  color: var(--dk-tinta);
  align-self: flex-start;
  border: 1px solid rgba(2, 32, 100, 0.08);
}

.assistente__msg--user {
  background: var(--dk-azul);
  color: #fff;
  align-self: flex-end;
}

.assistente__sugestoes {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  overflow-x: auto;
  border-top: 1px solid rgba(2, 32, 100, 0.08);
  background: #fff;
}

.assistente__sugestao {
  flex: 0 0 auto;
  border: 1px solid var(--dk-linha);
  border-radius: 999px;
  background: #fff;
  color: var(--dk-azul-escuro);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 0.45rem 0.65rem;
  transition: border-color var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-press);
}

.assistente__rodape {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(2, 32, 100, 0.08);
  background: #fff;
}

.assistente__campo {
  min-width: 0;
  flex: 1;
  padding: 0.6875rem 0.75rem;
  border: 1px solid var(--dk-linha);
  border-radius: 8px;
  color: var(--dk-tinta);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}

.assistente__campo:focus {
  border-color: var(--dk-azul);
  box-shadow: 0 0 0 3px var(--dk-focus);
}

.assistente__enviar {
  border: 0;
  border-radius: 8px;
  background: var(--dk-laranja);
  color: #fff;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 750;
  padding: 0 1rem;
  transition: transform var(--motion-fast) var(--ease-press), background-color var(--motion-fast) var(--ease-out), opacity var(--motion-fast) var(--ease-out);
}

.assistente__enviar:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.assistente__carregando {
  align-self: flex-start;
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.75rem 0.875rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(2, 32, 100, 0.08);
}

.assistente__carregando span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--dk-muted);
  opacity: 0.45;
  animation: assistente-pulse 900ms var(--ease-out) infinite;
}

.assistente__carregando span:nth-child(2) {
  animation-delay: 120ms;
}

.assistente__carregando span:nth-child(3) {
  animation-delay: 240ms;
}

@media (hover: hover) and (pointer: fine) {
  .assistente__botao:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 20px 44px rgba(2, 32, 100, 0.28);
  }

  .assistente__fechar:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .assistente__sugestao:hover {
    border-color: rgba(0, 76, 150, 0.4);
    transform: translateY(-1px);
  }

  .assistente__enviar:hover:not(:disabled) {
    background: #df7f10;
  }
}

@keyframes assistente-msg-in {
  from {
    opacity: 0;
    transform: translateY(0.35rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes assistente-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 0.95;
    transform: translateY(-2px);
  }
}

@media (max-width: 520px) {
  .assistente__botao {
    right: 1rem;
    bottom: 1rem;
  }

  .assistente__janela {
    right: 1rem;
    bottom: 5rem;
    width: calc(100vw - 2rem);
    height: min(32rem, calc(100vh - 7rem));
  }

  .assistente__rodape {
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistente__botao,
  .assistente__janela,
  .assistente__fechar,
  .assistente__sugestao,
  .assistente__campo,
  .assistente__enviar {
    transition-duration: 1ms;
  }

  .assistente__msg,
  .assistente__carregando span {
    animation: none;
  }
}

/* FAQ estático — lista de perguntas em coluna */
.assistente__faq-lista {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.assistente__faq-pergunta {
  width: 100%;
  text-align: left;
  border: 1px solid var(--dk-linha);
  border-radius: 8px;
  background: #fff;
  color: var(--dk-azul-escuro);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.7rem 0.875rem;
  transition: border-color var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out);
}

.assistente__faq-pergunta:hover {
  border-color: var(--dk-azul);
  background: var(--dk-fundo);
}

.assistente__faq-voltar {
  width: 100%;
  text-align: left;
  border: 1px solid var(--dk-linha);
  border-radius: 8px;
  background: var(--dk-fundo);
  color: var(--dk-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.6rem 0.875rem;
  margin-top: 0.25rem;
  transition: border-color var(--motion-fast) var(--ease-out);
}

.assistente__faq-voltar:hover {
  border-color: var(--dk-azul);
  color: var(--dk-azul);
}
