.agente-flutuante {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a56db, #0f3b8a);
    color: white;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 10px 35px rgba(26, 86, 219, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    animation: agentePulse 2.5s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agente-flutuante:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 15px 45px rgba(26, 86, 219, 0.5);
}

.agente-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: agenteBadge 1.5s infinite;
}

@keyframes agentePulse {
    0%, 100% { box-shadow: 0 10px 35px rgba(26, 86, 219, 0.4); }
    50% { box-shadow: 0 10px 35px rgba(26, 86, 219, 0.15); }
}

@keyframes agenteBadge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

:root {
    --agente-bg: #0d172a;
    --agente-borda: #1e2f4d;
    --agente-header-bg: linear-gradient(135deg, #13274f, #0d1b38);
    --agente-header-border: #1e3563;
    --agente-header-texto: #ffffff;
    --agente-header-sub: #93c5fd;
    --agente-btn-fechar-bg: rgba(255, 255, 255, 0.08);
    --agente-btn-fechar-cor: #cbd5e1;
    --agente-btn-fechar-hover-bg: rgba(255, 255, 255, 0.18);
    --agente-btn-fechar-hover-cor: #ffffff;
    --agente-chat-bg: #0b1323;
    --agente-bot-avatar-bg: #1a3668;
    --agente-bot-avatar-cor: #60a5fa;
    --agente-bot-bubble-bg: #13223d;
    --agente-bot-bubble-text: #f1f5f9;
    --agente-bot-bubble-border: #1e3660;
    --agente-user-avatar-bg: #2563eb;
    --agente-user-avatar-cor: #ffffff;
    --agente-user-bubble-bg: #1f6feb;
    --agente-user-bubble-text: #ffffff;
    --agente-user-bubble-border: #388bfd;
    --agente-input-area-bg: #0d172a;
    --agente-input-area-border: #1b2b46;
    --agente-input-bg: #13223d;
    --agente-input-border: #1e3660;
    --agente-input-text: #f8fafc;
    --agente-input-placeholder: #7388a9;
    --agente-input-focus-bg: #17294a;
    --agente-input-focus-border: #3b82f6;
    --agente-btn-enviar-bg: #1f6feb;
    --agente-btn-enviar-hover: #388bfd;
    --agente-sugestao-bg: #13223d;
    --agente-sugestao-text: #93c5fd;
    --agente-sugestao-border: #1e3660;
    --agente-sugestao-hover-bg: #1d4ed8;
    --agente-sugestoes-bar-bg: #0d172a;
    --agente-sugestoes-bar-border: #1b2b46;
    --agente-typing-bg: #13223d;
    --agente-typing-dot: #60a5fa;
    --agente-scrollbar-thumb: #1e3660;
}

html.light-theme {
    --agente-bg: #ffffff;
    --agente-borda: #cbd5e1;
    --agente-header-bg: linear-gradient(135deg, #1a56db, #0f3b8a);
    --agente-header-border: transparent;
    --agente-header-texto: #ffffff;
    --agente-header-sub: rgba(255, 255, 255, 0.9);
    --agente-btn-fechar-bg: rgba(255, 255, 255, 0.15);
    --agente-btn-fechar-cor: #ffffff;
    --agente-btn-fechar-hover-bg: #ffffff;
    --agente-btn-fechar-hover-cor: #1a56db;
    --agente-chat-bg: #f8fafc;
    --agente-bot-avatar-bg: #1a56db;
    --agente-bot-avatar-cor: #ffffff;
    --agente-bot-bubble-bg: #ffffff;
    --agente-bot-bubble-text: #1e293b;
    --agente-bot-bubble-border: #e2e8f0;
    --agente-user-avatar-bg: #64748b;
    --agente-user-avatar-cor: #ffffff;
    --agente-user-bubble-bg: #1a56db;
    --agente-user-bubble-text: #ffffff;
    --agente-user-bubble-border: #1a56db;
    --agente-input-area-bg: #ffffff;
    --agente-input-area-border: #e2e8f0;
    --agente-input-bg: #f8fafc;
    --agente-input-border: #e2e8f0;
    --agente-input-text: #0f172a;
    --agente-input-placeholder: #94a3b8;
    --agente-input-focus-bg: #ffffff;
    --agente-input-focus-border: #1a56db;
    --agente-btn-enviar-bg: #1a56db;
    --agente-btn-enviar-hover: #0f3b8a;
    --agente-sugestao-bg: #ffffff;
    --agente-sugestao-text: #475569;
    --agente-sugestao-border: #e2e8f0;
    --agente-sugestao-hover-bg: #1a56db;
    --agente-sugestoes-bar-bg: #fafbfc;
    --agente-sugestoes-bar-border: #f1f5f9;
    --agente-typing-bg: #ffffff;
    --agente-typing-dot: #94a3b8;
    --agente-scrollbar-thumb: #cbd5e1;
}

.agente-modal {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 25px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 10000;
    animation: agenteFadeIn 0.25s ease;
}

@keyframes agenteFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.agente-modal-conteudo {
    width: 440px;
    height: 650px;
    max-height: 80vh;
    background: var(--agente-bg);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--agente-borda);
    color: var(--agente-bot-bubble-text);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.agente-header {
    height: 72px;
    background: var(--agente-header-bg);
    color: var(--agente-header-texto);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--agente-header-border);
    transition: background 0.3s ease;
}

.agente-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agente-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    color: #ffffff;
}

.agente-info h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 1px;
    color: var(--agente-header-texto);
}

.agente-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--agente-header-sub);
    opacity: 0.95;
}

.agente-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: agenteOnline 1.5s infinite;
}

.agente-status .status-dot.offline {
    background: #ef4444;
    animation: none;
}

@keyframes agenteOnline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.agente-fechar {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--agente-btn-fechar-bg);
    color: var(--agente-btn-fechar-cor);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agente-fechar:hover {
    background: var(--agente-btn-fechar-hover-bg);
    color: var(--agente-btn-fechar-hover-cor);
}

.agente-mensagens {
    flex: 1;
    padding: 18px 20px;
    overflow-y: auto;
    background: var(--agente-chat-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: background 0.3s ease;
}

.agente-mensagens::-webkit-scrollbar {
    width: 5px;
}

.agente-mensagens::-webkit-scrollbar-thumb {
    background: var(--agente-scrollbar-thumb);
    border-radius: 10px;
}

.agente-mensagens::-webkit-scrollbar-track {
    background: transparent;
}

.msg-bot, .msg-user {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: agenteMsg 0.3s ease;
}

@keyframes agenteMsg {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-user {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 15px;
    flex-shrink: 0;
}

.msg-bot .msg-avatar {
    background: var(--agente-bot-avatar-bg);
    color: var(--agente-bot-avatar-cor);
}

.msg-user .msg-avatar {
    background: var(--agente-user-avatar-bg);
    color: var(--agente-user-avatar-cor);
}

.msg-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.6;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.msg-bot .msg-bubble {
    background: var(--agente-bot-bubble-bg);
    color: var(--agente-bot-bubble-text);
    border: 1px solid var(--agente-bot-bubble-border);
}

.msg-bot .msg-bubble strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
    color: inherit;
}

.msg-bot .msg-bubble p {
    margin: 4px 0;
    color: var(--agente-bot-bubble-text);
}

.msg-bot .msg-bubble p:last-child {
    margin-bottom: 0;
}

.msg-user .msg-bubble {
    background: var(--agente-user-bubble-bg);
    color: var(--agente-user-bubble-text);
    border: 1px solid var(--agente-user-bubble-border);
}

.msg-user .msg-bubble strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
    color: var(--agente-user-bubble-text);
}

.msg-user .msg-bubble p {
    margin: 4px 0;
    color: var(--agente-user-bubble-text);
}

.msg-user .msg-bubble p:last-child {
    margin-bottom: 0;
}

.agente-sugestoes {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.agente-sugestao {
    padding: 5px 14px;
    border: 1px solid var(--agente-sugestao-border);
    border-radius: 16px;
    background: var(--agente-sugestao-bg);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--agente-sugestao-text);
}

.agente-sugestao:hover {
    background: var(--agente-sugestao-hover-bg);
    color: white;
    border-color: var(--agente-sugestao-hover-bg);
}

.agente-sugestoes-rapidas {
    padding: 8px 20px;
    border-top: 1px solid var(--agente-sugestoes-bar-border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    background: var(--agente-sugestoes-bar-bg);
    flex-shrink: 0;
}

.agente-sugestoes-rapidas span {
    font-size: 11px;
    color: var(--agente-input-placeholder);
    margin-right: 4px;
}

.agente-sugestao-rapida {
    padding: 4px 12px;
    background: var(--agente-sugestao-bg);
    border: 1px solid var(--agente-sugestao-border);
    border-radius: 14px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--agente-sugestao-text);
    white-space: nowrap;
}

.agente-sugestao-rapida:hover {
    background: var(--agente-sugestao-hover-bg);
    border-color: var(--agente-sugestao-hover-bg);
    color: white;
}

.agente-categorias {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.agente-categoria {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: white;
    cursor: default;
}

.agente-categoria.adm { background: #1a56db; }
.agente-categoria.pro { background: #059669; }
.agente-categoria.geral { background: #7c3aed; }
.agente-categoria.ajuda { background: #d97706; }

.agente-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: var(--agente-typing-bg);
    border-radius: 14px;
    width: 56px;
    border: 1px solid var(--agente-bot-bubble-border);
}

.agente-typing span {
    width: 7px;
    height: 7px;
    background: var(--agente-typing-dot);
    border-radius: 50%;
    animation: agenteTyping 1.4s infinite;
}

.agente-typing span:nth-child(2) { animation-delay: 0.2s; }
.agente-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes agenteTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.agente-input-area {
    padding: 12px 20px;
    border-top: 1px solid var(--agente-input-area-border);
    display: flex;
    gap: 10px;
    background: var(--agente-input-area-bg);
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.agente-input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid var(--agente-input-border);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--agente-input-bg);
    color: var(--agente-input-text);
}

.agente-input::placeholder {
    color: var(--agente-input-placeholder);
}

.agente-input:focus {
    outline: none;
    border-color: var(--agente-input-focus-border);
    background: var(--agente-input-focus-bg);
    color: var(--agente-input-text);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.25);
}

.agente-enviar {
    padding: 10px 18px;
    background: var(--agente-btn-enviar-bg);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agente-enviar:hover {
    background: var(--agente-btn-enviar-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(26, 86, 219, 0.25);
}

.agente-enviar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.msg-error .msg-bubble {
    background: #fee2e2;
    color: #991b1b;
}

.msg-error .msg-bubble code {
    background: #fecaca;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

@media (max-width: 600px) {
    .agente-modal {
        padding: 0;
        align-items: flex-end;
    }

    .agente-modal-conteudo {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .agente-flutuante {
        right: 18px;
        bottom: 18px;
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .agente-sugestoes-rapidas {
        padding: 6px 12px;
    }

    .agente-sugestao-rapida {
        font-size: 10px;
        padding: 3px 10px;
    }
}

html.acesso-alto-contraste:not(.light-theme) .agente-modal-conteudo {
    background: #0a0e14;
    color: #ffffff;
    border-color: #ffffff;
}

html.acesso-alto-contraste:not(.light-theme) .agente-mensagens {
    background: #000000;
    color: #ffffff;
}

html.acesso-alto-contraste:not(.light-theme) .agente-mensagens .msg-bubble {
    background: #161b22;
    color: #ffffff;
    border: 1px solid #ffffff;
}

html.acesso-alto-contraste:not(.light-theme) .agente-mensagens .msg-user .msg-bubble {
    background: #1f6feb;
    color: #ffffff;
    border: 1px solid #ffffff;
}

html.acesso-alto-contraste:not(.light-theme) .agente-sugestao,
html.acesso-alto-contraste:not(.light-theme) .agente-sugestao-rapida {
    background: #000000;
    color: #79c0ff;
    border-color: #79c0ff;
}

html.acesso-alto-contraste:not(.light-theme) .agente-input {
    background: #000000;
    color: #ffffff;
    border-color: #ffffff;
}

html.acesso-alto-contraste:not(.light-theme) .agente-input::placeholder {
    color: #c9d1d9;
}

html.light-theme.acesso-alto-contraste .agente-modal-conteudo {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
}

html.light-theme.acesso-alto-contraste .agente-header {
    background: #004bb5;
    border-bottom: 2px solid #000000;
    color: #ffffff;
}

html.light-theme.acesso-alto-contraste .agente-header h2,
html.light-theme.acesso-alto-contraste .agente-info h2,
html.light-theme.acesso-alto-contraste .agente-titulo h3,
html.light-theme.acesso-alto-contraste .agente-status,
html.light-theme.acesso-alto-contraste .agente-status span {
    color: #ffffff;
}

html.light-theme.acesso-alto-contraste .agente-avatar {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

html.light-theme.acesso-alto-contraste .agente-btn-fechar,
html.light-theme.acesso-alto-contraste .agente-fechar {
    color: #ffffff;
    background: transparent;
}

html.light-theme.acesso-alto-contraste .agente-btn-fechar:hover,
html.light-theme.acesso-alto-contraste .agente-fechar:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

html.light-theme.acesso-alto-contraste .agente-mensagens {
    background: #ffffff;
    color: #000000;
}

html.light-theme.acesso-alto-contraste .agente-mensagens .msg-bubble {
    background: #f0f4f9;
    color: #000000;
    border: 1px solid #000000;
}

html.light-theme.acesso-alto-contraste .agente-mensagens .msg-user .msg-bubble {
    background: #003bb3;
    color: #ffffff;
    border: 1px solid #000000;
}

html.light-theme.acesso-alto-contraste .agente-sugestao,
html.light-theme.acesso-alto-contraste .agente-sugestao-rapida {
    background: #ffffff;
    color: #003bb3;
    border: 2px solid #003bb3;
    font-weight: 700;
}

html.light-theme.acesso-alto-contraste .agente-input-area {
    background: #f0f4f9;
    border-top: 2px solid #000000;
}

html.light-theme.acesso-alto-contraste .agente-input {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
}

html.light-theme.acesso-alto-contraste .agente-input::placeholder {
    color: #374151;
}

html.light-theme.acesso-alto-contraste .agente-btn-enviar {
    background: #003bb3;
    border: 2px solid #000000;
    color: #ffffff;
}
