/* Assistente flutuante (ver assets/js/assistente.js e Views/partials/assistente.php) */

.assistente {
    --ast-azul: #1351b4;
    --ast-azul-escuro: #071d41;
    --ast-cinza: #f3f5f8;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1040; /* abaixo dos modais do Bootstrap (1055) */
    font-size: .875rem;
    line-height: 1.45;
}
.tour-ativo .assistente { display: none; }
.assistente [hidden] { display: none !important; }

.assistente-botao {
    width: 56px; height: 56px; border-radius: 50%;
    border: none; background: var(--ast-azul); color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; cursor: pointer;
    transition: transform .15s, background .15s;
}
.assistente-botao:hover { background: #0c3d85; transform: translateY(-2px); }
.assistente-botao:focus-visible,
.assistente button:focus-visible,
.assistente a:focus-visible,
.assistente-campo:focus-visible { outline: 3px solid #ffcd07; outline-offset: 2px; }

.assistente-janela {
    width: 360px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .28);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.assistente[data-estado="aberto"] .assistente-janela { height: min(540px, calc(100vh - 32px)); }

.assistente-cabecalho {
    background: var(--ast-azul-escuro); color: #fff;
    display: flex; align-items: center; gap: .5rem;
    padding: .6rem .6rem .6rem .9rem;
}
.assistente[data-estado="minimizado"] .assistente-cabecalho { cursor: pointer; }
.assistente-cabecalho .assistente-avatar {
    width: 30px; height: 30px; border-radius: 50%; background: #ffcd07; color: var(--ast-azul-escuro);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem;
}
.assistente-titulo { flex: 1; min-width: 0; }
.assistente-titulo strong { display: block; font-size: .9rem; }
.assistente-titulo small { display: block; font-size: .72rem; color: #b8c7e6; }
.assistente-acao {
    background: transparent; border: none; color: #fff; width: 34px; height: 34px;
    border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.assistente-acao:hover { background: rgba(255, 255, 255, .12); }

.assistente[data-estado="minimizado"] .assistente-corpo { display: none; }
.assistente-corpo { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.assistente-mensagens {
    flex: 1; overflow-y: auto; padding: .85rem; background: var(--ast-cinza);
    display: flex; flex-direction: column; gap: .55rem;
}

.assistente-msg { max-width: 92%; padding: .55rem .75rem; border-radius: 10px; word-wrap: break-word; }
.assistente-msg p { margin: 0 0 .35rem; }
.assistente-msg p:last-child { margin-bottom: 0; }
.assistente-msg-bot { background: #fff; color: #1f2937; align-self: flex-start; border-top-left-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.assistente-msg-usuario { background: var(--ast-azul); color: #fff; align-self: flex-end; border-top-right-radius: 2px; white-space: pre-wrap; }
.assistente-msg a { color: var(--ast-azul); font-weight: 600; font-size: .8rem; }

.assistente-pergunta { font-weight: 700; color: var(--ast-azul-escuro); }
.assistente-resposta { white-space: pre-line; }
.assistente-contato { background: #fff8e1; border: 1px solid #ffe082; border-radius: 6px; padding: .45rem .6rem; color: #5c4b00; }

.assistente-sugestoes { display: flex; flex-direction: column; gap: .35rem; margin-top: .25rem; }
.assistente-sugestao {
    text-align: left; background: #fff; border: 1px solid #c5d4ee; color: var(--ast-azul);
    border-radius: 8px; padding: .4rem .6rem; font-size: .8rem; cursor: pointer;
}
.assistente-sugestao:hover { background: #eef4fc; }

.assistente-ajudou { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; font-size: .8rem; color: #4b5563; }
.assistente-btn-ajudou {
    border: 1px solid #cbd5e1; background: #fff; border-radius: 14px; padding: .15rem .75rem;
    font-size: .78rem; cursor: pointer; min-height: 30px;
}
.assistente-btn-ajudou:hover:not(:disabled) { background: #eef4fc; }
.assistente-btn-ajudou:disabled { opacity: .5; cursor: default; }

.assistente-digitando { display: flex; gap: 4px; padding: .7rem .8rem; }
.assistente-digitando span {
    width: 7px; height: 7px; border-radius: 50%; background: #9ca3af;
    animation: assistente-pulo 1s infinite ease-in-out;
}
.assistente-digitando span:nth-child(2) { animation-delay: .15s; }
.assistente-digitando span:nth-child(3) { animation-delay: .3s; }
@keyframes assistente-pulo { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.assistente-form { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid #e5e7eb; background: #fff; }
.assistente-campo {
    flex: 1; min-width: 0; border: 1px solid #cbd5e1; border-radius: 8px;
    padding: .45rem .65rem; font-size: 16px; /* 16px evita o zoom automático do iPhone */
}
.assistente-enviar {
    border: none; background: var(--ast-azul); color: #fff; border-radius: 8px;
    width: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.assistente-aviso { font-size: .68rem; color: #6b7280; padding: 0 .75rem .5rem; background: #fff; margin: 0; }

.visualmente-oculto {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (max-width: 576px) {
    .assistente { right: 8px; bottom: 8px; left: auto; }
    .assistente[data-estado="aberto"],
    .assistente[data-estado="minimizado"] { left: 8px; }
    .assistente-janela { width: 100%; max-width: none; }
    .assistente[data-estado="aberto"] .assistente-janela { height: min(78vh, calc(100vh - 16px)); }
}

@media print { .assistente { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
    .assistente-botao, .assistente-digitando span { transition: none; animation: none; }
}
