/* Variáveis de Cores (Definidas no container pai para fácil acesso) */
#propagan-chatbot-container {
    --whatsapp-green: #25D366;
    --whatsapp-dark-green: #128C7E;
    --whatsapp-header: #075E54;
    --whatsapp-light: #DCF8C6;
    --whatsapp-bg: #ECE5DD;
}

/* Ícone flutuante do WhatsApp */
.whatsapp-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--whatsapp-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(37, 211, 102, 0.6);
    z-index: 9999;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.whatsapp-icon:hover {
    background-color: var(--whatsapp-dark-green);
}

.whatsapp-icon img {
    width: 30px;
    height: 30px;
}

/* Contêiner principal do chat: INICIA ESCONDIDO, o JS irá mostrar/esconder */
.whatsapp-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none; /* ESSENCIAL: Inicia escondido */
    flex-direction: column;
    overflow: hidden;
}

.whatsapp-chat-container.active {
    display: flex;
}

/* Cabeçalho do Chat */
.whatsapp-chat-header {
    background-color: var(--whatsapp-header);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.profile span {
    font-weight: 500;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* Área de Mensagens do Chat */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--whatsapp-bg);
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%239C92AC' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
    }

    .message {
        max-width: 80%;
        margin-bottom: 15px;
        position: relative;
    }

    .message-content {
        padding: 10px 15px;
        border-radius: 18px;
        font-size: 14px;
        line-height: 1.4;
        word-wrap: break-word;
    }

    .bot-message {
        align-self: flex-start;
    }

    .bot-message .message-content {
        background-color: white;
        border-top-left-radius: 0;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    }

    .user-message {
        align-self: flex-end;
    }

    .user-message .message-content {
        background-color: var(--whatsapp-light);
        border-top-right-radius: 0;
        color: #111;
    }

    .message-time {
        font-size: 11px;
        color: #999;
        margin-top: 5px;
        text-align: right;
    }
    
    /* Estilos para a exibição de produtos no chatbot */
    .product-card {
        background-color: #f0f0f0; /* Fundo cinza claro para os produtos */
        border-radius: 10px;
        padding: 10px;
        margin-top: 10px;
        display: flex;
        align-items: flex-start; /* Alinha itens ao topo */
        gap: 10px;
        flex-wrap: wrap; /* Permite que o conteúdo quebre em telas menores */
        box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Sombra suave */
    }

    .product-card img {
        width: 80px; /* Tamanho menor da imagem */
        height: 80px;
        object-fit: cover;
        border-radius: 5px;
        flex-shrink: 0; /* Impede que a imagem encolha */
    }

    .product-details {
        flex-grow: 1; /* Permite que os detalhes ocupem o espaço disponível */
    }

    .product-details h4 {
        margin: 0 0 5px;
        font-size: 15px;
        color: #333;
    }

    .product-details p {
        margin: 0 0 5px;
        font-size: 13px;
        color: #555;
    }
    .product-details .price {
        font-weight: bold;
        color: var(--whatsapp-dark-green); /* Cor para "Consulte seu vendedor" */
    }
    .product-details .stock {
        font-size: 12px;
        color: #777;
    }
    .product-card a.product-link {
        display: inline-block;
        background-color: var(--whatsapp-green);
        color: white;
        padding: 5px 10px;
        border-radius: 5px;
        text-decoration: none;
        font-size: 13px;
        margin-top: 5px;
        word-break: break-all; /* Garante que URLs longas quebrem a linha */
    }
    .product-card a.product-link:hover {
        background-color: var(--whatsapp-dark-green);
    }

/* Contêiner do formulário de lead (inicial) */
.lead-form-container {
    padding: 15px;
    background-color: white;
    border-radius: 10px;
    margin: 10px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex; /* ESSENCIAL: Garante que o formulário apareça por padrão */
    flex-direction: column;
    gap: 12px;
}

/* Estilo para o formulário em si (dentro do container) */
#propagan-lead-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#propagan-lead-form .form-group {
    margin-bottom: 0;
}

#propagan-lead-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

#propagan-lead-form input:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

#form-submit-button {
    padding: 12px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

#form-submit-button:hover {
    background: linear-gradient(135deg, #128C7E, #075E54);
    transform: translateY(-2px);
}

/* Contêiner de Input de Mensagem: SEMPRE visível quando o chat principal é aberto */
.chat-input-container {
    display: flex; /* ESSENCIAL: Garante que esteja visível por padrão */
    padding: 10px;
    background-color: #f5f5f5;
    border-top: 1px solid #e5e5e5;
}

#chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#send-button {
    margin-left: 10px;
    padding: 0 20px;
    background-color: var(--whatsapp-green);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

#send-button:hover {
    background-color: var(--whatsapp-dark-green);
}

/* Botão de Atendimento Humano: INICIA ESCONDIDO, o JS irá mostrar/esconder */
.human-attendant {
    padding: 15px;
    text-align: center;
    background-color: #f5f5f5;
    border-top: 1px solid #e5e5e5;
    display: none; /* ESSENCIAL: Inicia escondido */
}

#start-human-chat {
    padding: 10px 20px;
    background-color: var(--whatsapp-green);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

#start-human-chat:hover {
    background-color: var(--whatsapp-dark-green);
}

/* Estilos para o formulário simples (shortcode) */
.propagan-simple-form {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.propagan-simple-form .form-group {
    margin-bottom: 15px;
}

.propagan-simple-form input,
.propagan-simple-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.propagan-simple-form textarea {
    min-height: 100px;
}

.propagan-simple-form input:focus,
.propagan-simple-form textarea:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.propagan-simple-form button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.propagan-simple-form button:hover {
    background: linear-gradient(135deg, #128C7E, #075E54);
    transform: translateY(-2px);
}

/* Animação de digitação do Chatbot */
.typing-indicator {
    display: flex;
    align-items: center;
    background-color: white;
    padding: 10px 15px;
    border-radius: 18px;
    border-top-left-radius: 0;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    width: fit-content;
}

.dot-flashing {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #999;
    color: #999;
    animation: dotFlashing 1s infinite alternate;
    animation-delay: 0s;
}

.dot-flashing::before, .dot-flashing::after {
    content: '';
    display: inline-block;
    position: absolute;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #999;
    color: #999;
    animation: dotFlashing 1s infinite alternate;
}

.dot-flashing::before {
    left: -15px;
    animation-delay: .2s;
}

.dot-flashing::after {
    left: 15px;
    animation-delay: .4s;
}

@keyframes dotFlashing {
    0% { background-color: #999; }
    50%, 100% { background-color: #e0e0e0; }
}