/* --- Estilos do Chatbot (Fase 5) --- */

#sfa-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

#sfa-chatbot-opener {
    width: 60px;
    height: 60px;
    background-color: #0073aa;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

#sfa-chatbot-opener:hover {
    transform: scale(1.1);
}

#sfa-chatbot-window {
    width: 350px;
    height: 500px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 80px;
    right: 0;
}

#sfa-chatbot-header {
    background-color: #0073aa;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#sfa-chatbot-header h3 {
    margin: 0;
    font-size: 16px;
}

#sfa-chatbot-closer {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

#sfa-chatbot-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

.sfa-message p {
    margin: 0;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.sfa-message-ai p {
    background-color: #e5e5ea;
    color: #000;
}

#sfa-chatbot-footer {
    padding: 10px;
    border-top: 1px solid #ddd;
}

#sfa-chatbot-form {
    display: flex;
}

#sfa-chatbot-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
}

#sfa-chatbot-submit {
    background-color: #0073aa;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sfa-hidden {
    display: none !important;
}

/* --- Lógica de Assinatura do Chatbot (CORRIGIDA) --- */

/* Regras para VISITANTE (não-logado) */
.sfa-user-guest #sfa-chatbot-form {
    display: none !important; /* Esconde o formulário com prioridade */
}
.sfa-user-guest #sfa-chatbot-cta {
    display: block; /* Mostra o CTA */
    text-align: center;
    padding: 15px;
}

/* Regras para ASSINANTE (logado) */
.sfa-user-subscriber #sfa-chatbot-form {
    display: flex !important; /* Mostra o formulário com prioridade */
}
.sfa-user-subscriber #sfa-chatbot-cta {
    display: none !important; /* Esconde o CTA com prioridade */
}

/* Estilos do botão CTA (podem já existir, mas garanta que estão aqui) */
#sfa-chatbot-cta p {
    font-size: 14px;
    margin-top: 0;
    margin-bottom: 15px;
}
.sfa-cta-button {
    background-color: #0073aa;
    color: #ffffff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.2s ease;
}
.sfa-cta-button:hover {
    background-color: #005177;
}

/* --- Estilos de Conversa do Chatbot --- */

.sfa-message {
    display: flex;
    flex-direction: column;
}

.sfa-message-ai {
    align-items: flex-start;
}

/* Nova bolha de mensagem do usuário */
.sfa-message-user {
    align-items: flex-end; /* Alinha à direita */
}

.sfa-message-user p {
    background-color: #0073aa; /* Cor primária do WordPress */
    color: #ffffff;
}

/* Indicador de "digitando..." */
.sfa-typing-indicator p {
    padding: 12px 15px;
}
.sfa-typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #999;
    border-radius: 50%;
    display: inline-block;
    animation: sfa-bounce 1.3s infinite;
}
.sfa-typing-indicator span:nth-of-type(2) {
    animation-delay: 0.15s;
}
.sfa-typing-indicator span:nth-of-type(3) {
    animation-delay: 0.3s;
}

@keyframes sfa-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}