/* Botão flutuante do WhatsApp */
.whatsapp-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(37, 211, 102, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 9999;
    text-decoration: none;
    animation: buttonPulse 2s infinite;
}

/* Posicionamento à esquerda */
.whatsapp-button-left {
    right: auto;
    left: 20px;
}

.whatsapp-button:hover {
    background-color: #128C7E;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.whatsapp-button.active {
    background-color: #128C7E;
    transform: scale(1.05);
}

.whatsapp-button svg {
    width: 35px;
    height: 35px;
    fill: white;
    position: relative;
    z-index: 2;
}

/* Animação de pulso */
.whatsapp-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #25D366;
    opacity: 0.7;
    animation: pulse 2s infinite;
    z-index: 0;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.2);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

@keyframes buttonPulse {
    0% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    50% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Tooltip */
.whatsapp-button .tooltip {
    position: absolute;
    right: 70px;
    background-color: #fff;
    color: #333;
    padding: 8px 15px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.whatsapp-button .tooltip::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #fff;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.whatsapp-button:hover .tooltip {
    opacity: 1;
    visibility: visible;
    right: 75px;
}

/* Chat widget do formulário */
.whatsapp-modal {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 90%;
    max-width: 380px;
    z-index: 9998;
}

/* Posicionamento do modal à esquerda */
.whatsapp-modal-left {
    right: auto;
    left: 20px;
}

.whatsapp-modal.active {
    display: block;
    animation: slideUpChat 0.3s ease;
}

@keyframes slideUpChat {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.whatsapp-modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
}

/* Seta apontando para o botão */
.whatsapp-modal-content::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #f8f9fa;
}

/* Seta quando modal está à esquerda */
.whatsapp-modal-left .whatsapp-modal-content::after {
    right: auto;
    left: 20px;
}

.whatsapp-modal-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.whatsapp-modal-header h2 {
    color: white;
    font-size: 1.25rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.whatsapp-modal-header svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.whatsapp-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    line-height: 1;
}

.whatsapp-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.whatsapp-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: #f8f9fa;
}

.whatsapp-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.whatsapp-form-group label {
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
}

.whatsapp-form-group label .required {
    color: #e74c3c;
}

.whatsapp-form-group input {
    padding: 0.7rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
    font-family: inherit;
    background: white;
}

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

.whatsapp-form-group input.error {
    border-color: #e74c3c;
}

.whatsapp-form-group .error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    display: none;
}

.whatsapp-form-group input.error + .error-message {
    display: block;
}

.whatsapp-form-submit {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 0.9rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.whatsapp-form-submit:hover {
    background-color: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.whatsapp-form-submit:active {
    transform: translateY(0);
}

.whatsapp-form-submit:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Responsividade */
@media (max-width: 768px) {
    .whatsapp-button {
        width: 55px;
        height: 55px;
        bottom: 15px;
        right: 15px;
    }

    .whatsapp-button-left {
        right: auto;
        left: 15px;
    }

    .whatsapp-button svg {
        width: 30px;
        height: 30px;
    }

    .whatsapp-button .tooltip {
        display: none;
    }

    .whatsapp-modal {
        bottom: 80px;
        right: 15px;
        left: 15px;
        width: auto;
        max-width: none;
    }

    .whatsapp-modal-left {
        right: 15px;
        left: 15px;
    }

    .whatsapp-modal-header h2 {
        font-size: 1.1rem;
    }

    .whatsapp-form {
        padding: 1.25rem;
    }
}

/* Branding "Powered By" */
.whatsapp-powered-by {
    position: fixed;
    bottom: 10px;
    right: 90px;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: #666;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9997;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.whatsapp-powered-by:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.whatsapp-powered-by a {
    color: #666;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.whatsapp-powered-by strong {
    color: #25D366;
    font-weight: 700;
}

.whatsapp-powered-by-left {
    right: auto;
    left: 90px;
}

@media (max-width: 480px) {
    .whatsapp-button-left {
        left: 10px;
    }

    .whatsapp-modal {
        bottom: 75px;
        right: 10px;
        left: 10px;
    }

    .whatsapp-modal-left {
        right: 10px;
        left: 10px;
    }

    .whatsapp-modal-header {
        padding: 1rem 1.25rem;
    }

    .whatsapp-form {
        padding: 1rem;
        gap: 0.875rem;
    }

    .whatsapp-form-group input {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .whatsapp-form-submit {
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    .whatsapp-powered-by {
        bottom: 5px;
        right: 75px;
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }

    .whatsapp-powered-by-left {
        right: auto;
        left: 75px;
    }
}
