
/* ========================================
   WEBMASTERS AI ASSISTANT
   Fase 1 - Interface visual
======================================== */

:root {
    --wm-primary: #4f46e5;
    --wm-primary-dark: #3730a3;
    --wm-bg: #ffffff;
    --wm-dark: #0f172a;
    --wm-muted: #64748b;
    --wm-border: #e2e8f0;
    --wm-light: #f8fafc;
    --wm-radius: 20px;
    --wm-shadow: 0 15px 50px rgba(15, 23, 42, .18);
}

/* Container principal */

#wm-chatbot {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 999999;
    font-family: 'Plus Jakarta Sans', Arial, sans-serif;
    color: var(--wm-dark);
}

/* Botão flutuante */

#wm-chatbot-toggle {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #3730a3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(79, 70, 229, .4);
    transition: transform .3s ease, box-shadow .3s ease;
    position: relative;
}

#wm-chatbot-toggle:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 12px 35px rgba(79, 70, 229, .5);
}

#wm-chatbot-toggle svg {
    width: 29px;
    height: 29px;
}

/* Indicador online */

.wm-online-dot {
    position: absolute;
    width: 13px;
    height: 13px;
    background: #22c55e;
    border: 2px solid white;
    border-radius: 50%;
    right: 3px;
    top: 3px;
}

/* Janela de conversa */

#wm-chatbot-window {
    position: absolute;
    bottom: 82px;
    right: 0;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 120px);
    background: var(--wm-bg);
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--wm-radius);
    box-shadow: var(--wm-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}

#wm-chatbot-window.wm-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Cabeçalho */

.wm-chat-header {
    padding: 20px;
    background: linear-gradient(120deg, #4f46e5, #312e81);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wm-chat-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wm-chat-avatar {
    width: 43px;
    height: 43px;
    border-radius: 14px;
    background: rgba(255,255,255,.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
}

.wm-chat-title {
    font-size: 15px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.wm-chat-status {
    font-size: 11px;
    color: #c7d2fe;
    margin-top: 4px;
}

.wm-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* Área das mensagens */

.wm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wm-message {
    max-width: 88%;
    padding: 12px 15px;
    border-radius: 15px;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.wm-message.bot {
    align-self: flex-start;
    background: white;
    color: #334155;
    border: 1px solid var(--wm-border);
    border-bottom-left-radius: 4px;
}

.wm-message.user {
    align-self: flex-end;
    background: var(--wm-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Sugestões rápidas */

.wm-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 14px;
    background: #f8fafc;
}

.wm-chat-suggestion {
    border: 1px solid #c7d2fe;
    background: white;
    color: var(--wm-primary-dark);
    padding: 9px 12px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    transition: .2s ease;
}

.wm-chat-suggestion:hover {
    background: #eef2ff;
    border-color: var(--wm-primary);
}

/* Campo de mensagem */

.wm-chat-input-area {
    padding: 14px;
    background: white;
    border-top: 1px solid var(--wm-border);
}

.wm-chat-form {
    display: flex;
    align-items: center;
    gap: 9px;
}

.wm-chat-input {
    flex: 1;
    min-width: 0;
    height: 43px;
    border: 1px solid var(--wm-border);
    border-radius: 12px;
    padding: 0 13px;
    font-size: 12px;
    outline: none;
    background: #f8fafc;
    color: var(--wm-dark);
    box-sizing: border-box;
}

.wm-chat-input:focus {
    border-color: var(--wm-primary);
    background: white;
}

.wm-chat-send {
    width: 43px;
    height: 43px;
    flex-shrink: 0;
    border: none;
    border-radius: 12px;
    background: var(--wm-primary);
    color: white;
    cursor: pointer;
    font-size: 19px;
    transition: .2s ease;
}

.wm-chat-send:hover {
    background: var(--wm-primary-dark);
}

/* Rodapé */

.wm-chat-footer {
    text-align: center;
    padding: 8px;
    font-size: 10px;
    color: #94a3b8;
    background: white;
}

/* Animação do botão */

@keyframes wm-pulse {
    0%, 100% {
        box-shadow: 0 8px 28px rgba(79,70,229,.35);
    }
    50% {
        box-shadow: 0 8px 35px rgba(79,70,229,.6);
    }
}

#wm-chatbot-toggle {
    animation: wm-pulse 3s infinite;
}

/* Telemóveis */

@media (max-width: 480px) {
    #wm-chatbot {
        right: 15px;
        bottom: 15px;
    }

    #wm-chatbot-window {
        position: fixed;
        width: auto;
        height: auto;
        top: 12px;
        left: 12px;
        right: 12px;
        bottom: 90px;
        max-height: none;
        border-radius: 18px;
    }

    #wm-chatbot-toggle {
        width: 58px;
        height: 58px;
    }
}

/* Acessibilidade: reduzir movimento */

@media (prefers-reduced-motion: reduce) {
    #wm-chatbot *,
    #wm-chatbot *::before,
    #wm-chatbot *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Melhorar leitura das mensagens */

.wm-message {
    white-space: pre-line;
}

/* Espaçamento das sugestões dinâmicas */

.wm-chat-suggestions {
    max-height: 145px;
    overflow-y: auto;
}

/* Foco acessível nos botões */

.wm-chat-suggestion:focus-visible,
.wm-chat-send:focus-visible,
#wm-chatbot-toggle:focus-visible {
    outline: 3px solid #818cf8;
    outline-offset: 3px;
}