/* ══════════════════════════════════════════════════════════════
   NOVO OLHAR — Chat de Ajuda IA (Widget flutuante)
   ══════════════════════════════════════════════════════════════ */

/* ── Botão flutuante ──────────────────────────────────────── */
.chat-ajuda-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
}

.chat-ajuda-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(99, 102, 241, .55);
}

.chat-ajuda-fab svg {
    width: 26px;
    height: 26px;
    transition: transform .3s;
}

.chat-ajuda-fab.aberto svg {
    transform: rotate(90deg);
}

/* Pulse ao carregar */
.chat-ajuda-fab::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(99, 102, 241, .4);
    animation: chat-pulse 2s ease-out infinite;
}

.chat-ajuda-fab.aberto::after {
    display: none;
}

@keyframes chat-pulse {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* ── Janela do chat ───────────────────────────────────────── */
.chat-ajuda-window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 9999;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #0e0e12;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-ajuda-window.aberto {
    display: flex;
    animation: chat-slide-up .3s ease-out;
}

@keyframes chat-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ───────────────────────────────────────────────── */
.chat-ajuda-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-ajuda-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-ajuda-header-info {
    flex: 1;
    min-width: 0;
}

.chat-ajuda-header-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.chat-ajuda-header-status {
    font-size: 11px;
    color: rgba(255, 255, 255, .75);
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-ajuda-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

.chat-ajuda-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .7);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color .2s, background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-ajuda-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .15);
}

/* ── Area de mensagens ────────────────────────────────────── */
.chat-ajuda-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .1) transparent;
}

.chat-ajuda-body::-webkit-scrollbar {
    width: 5px;
}

.chat-ajuda-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .1);
    border-radius: 4px;
}

/* Mensagem */
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: chat-msg-in .25s ease-out;
}

@keyframes chat-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-msg.ia {
    align-self: flex-start;
    background: rgba(255, 255, 255, .07);
    color: #e2e2e9;
    border-bottom-left-radius: 4px;
}

.chat-msg.usuario {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Mensagem de boas-vindas */
.chat-msg-welcome {
    text-align: center;
    padding: 20px 16px;
    color: rgba(255, 255, 255, .5);
    font-size: 13px;
}

.chat-msg-welcome strong {
    display: block;
    color: rgba(255, 255, 255, .8);
    font-size: 15px;
    margin-bottom: 6px;
}

/* Typing indicator */
.chat-typing {
    align-self: flex-start;
    display: none;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, .07);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.chat-typing.show {
    display: flex;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .35);
    animation: chat-dot 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes chat-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Input area ───────────────────────────────────────────── */
.chat-ajuda-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, .06);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    background: rgba(0, 0, 0, .2);
}

.chat-ajuda-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    color: #e2e2e9;
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
    outline: none;
    transition: border-color .2s;
}

.chat-ajuda-input::placeholder {
    color: rgba(255, 255, 255, .3);
}

.chat-ajuda-input:focus {
    border-color: rgba(99, 102, 241, .5);
}

.chat-ajuda-send {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .2s;
}

.chat-ajuda-send:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.chat-ajuda-send svg {
    width: 18px;
    height: 18px;
}

/* ── Responsivo ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .chat-ajuda-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chat-ajuda-fab {
        bottom: 16px;
        right: 16px;
    }
}
