/* ============================================
   WhatsApp Bubble Leads - Frontend Styles v6
   Isolamento TOTAL - Abordagem Equilibrada
   ============================================ */

/* Container principal - SEM all: revert */
#whatsapp-bubble-container {
    position: fixed !important;
    z-index: 999999 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

#whatsapp-bubble-container * {
    box-sizing: border-box !important;
}

/* Posicionamento da bolinha */
#whatsapp-bubble-container.whatsapp-bubble-bottom-right {
    bottom: 20px !important;
    right: 20px !important;
}

#whatsapp-bubble-container.whatsapp-bubble-bottom-left {
    bottom: 20px !important;
    left: 20px !important;
}

#whatsapp-bubble-container.whatsapp-bubble-top-right {
    top: 20px !important;
    right: 20px !important;
}

#whatsapp-bubble-container.whatsapp-bubble-top-left {
    top: 20px !important;
    left: 20px !important;
}

/* ============================================
   Bolinha Principal - ISOLAMENTO TOTAL
   ============================================ */

#whatsapp-bubble {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.3s ease !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background-color: #25D366 !important;
    background: #25D366 !important;
    flex-shrink: 0 !important;
    outline: none !important;
    text-decoration: none !important;
    font-style: normal !important;
    font-weight: normal !important;
    line-height: 1 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    position: relative !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    color: white !important;
    font-size: 28px !important;
    text-align: center !important;
}

#whatsapp-bubble::-moz-focus-inner {
    border: none !important;
    padding: 0 !important;
}

#whatsapp-bubble:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2) !important;
}

#whatsapp-bubble:active {
    transform: scale(0.95) !important;
}

#whatsapp-bubble:focus {
    outline: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Ícone dentro da bolinha */
#whatsapp-bubble i,
#whatsapp-bubble svg {
    color: white !important;
    font-size: 28px !important;
    width: 28px !important;
    height: 28px !important;
    display: inline-block !important;
    border: none !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    text-decoration: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    line-height: 1 !important;
}

#whatsapp-bubble .fa,
#whatsapp-bubble .fab,
#whatsapp-bubble .fas,
#whatsapp-bubble .far,
#whatsapp-bubble .fal,
#whatsapp-bubble .fad {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    outline: none !important;
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* ============================================
   Animações da Bolinha
   ============================================ */

.whatsapp-bubble-animation-pulse {
    animation: whatsapp-pulse 2s infinite !important;
}

@keyframes whatsapp-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7) !important;
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 211, 102, 0) !important;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0) !important;
    }
}

.whatsapp-bubble-animation-bounce {
    animation: whatsapp-bounce 1s infinite !important;
}

@keyframes whatsapp-bounce {
    0%, 100% {
        transform: translateY(0) !important;
    }
    50% {
        transform: translateY(-10px) !important;
    }
}

.whatsapp-bubble-animation-none {
    animation: none !important;
}

/* ============================================
   Chat
   ============================================ */

#whatsapp-chat {
    position: absolute !important;
    bottom: 80px !important;
    right: 0 !important;
    width: 380px !important;
    height: 520px !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: whatsapp-chat-open 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

#whatsapp-bubble-container.whatsapp-bubble-bottom-left #whatsapp-chat {
    right: auto !important;
    left: 0 !important;
}

#whatsapp-bubble-container.whatsapp-bubble-top-right #whatsapp-chat {
    bottom: auto !important;
    top: 80px !important;
}

#whatsapp-bubble-container.whatsapp-bubble-top-left #whatsapp-chat {
    bottom: auto !important;
    top: 80px !important;
    right: auto !important;
    left: 0 !important;
}

@keyframes whatsapp-chat-open {
    from {
        opacity: 0 !important;
        transform: scale(0.8) !important;
    }
    to {
        opacity: 1 !important;
        transform: scale(1) !important;
    }
}

/* ============================================
   Chat Header
   ============================================ */

.whatsapp-chat-header {
    padding: 18px 16px !important;
    color: white !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    border: none !important;
    margin: 0 !important;
    background: linear-gradient(135deg, #25D366 0%, #20ba58 100%) !important;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.15) !important;
}

.whatsapp-chat-header h3 {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: white !important;
    padding: 0 !important;
    letter-spacing: 0.3px !important;
}

/* ============================================
   Botão Fechar - ISOLAMENTO TOTAL
   ============================================ */

#whatsapp-chat-close,
.whatsapp-chat-close {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    color: white !important;
    font-size: 24px !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: opacity 0.2s !important;
    flex-shrink: 0 !important;
    outline: none !important;
    margin: 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    position: relative !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    box-sizing: border-box !important;
}

#whatsapp-chat-close::-moz-focus-inner,
.whatsapp-chat-close::-moz-focus-inner {
    border: none !important;
    padding: 0 !important;
}

#whatsapp-chat-close:hover,
.whatsapp-chat-close:hover {
    opacity: 0.8 !important;
}

#whatsapp-chat-close:focus,
.whatsapp-chat-close:focus {
    outline: none !important;
}

#whatsapp-chat-close i,
.whatsapp-chat-close i {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    outline: none !important;
    color: white !important;
    font-size: 24px !important;
}

/* ============================================
   Chat Messages
   ============================================ */

.whatsapp-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 16px !important;
    background: #f8f8f8 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin: 0 !important;
    border: none !important;
}

.whatsapp-message {
    margin: 0 !important;
    display: flex !important;
    animation: whatsapp-message-appear 0.3s ease !important;
    padding: 0 !important;
}

@keyframes whatsapp-message-appear {
    from {
        opacity: 0 !important;
        transform: translateY(10px) !important;
    }
    to {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
}

.whatsapp-message.user {
    justify-content: flex-end !important;
}

.whatsapp-message.bot {
    justify-content: flex-start !important;
}

.whatsapp-message-text {
    max-width: 80% !important;
    padding: 11px 14px !important;
    border-radius: 12px !important;
    word-wrap: break-word !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    border: none !important;
    font-family: inherit !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

.whatsapp-message.user .whatsapp-message-text {
    background: linear-gradient(135deg, #25D366 0%, #20ba58 100%) !important;
    color: white !important;
    border-bottom-right-radius: 0 !important;
    box-shadow: 0 2px 4px rgba(37, 211, 102, 0.2) !important;
}

.whatsapp-message.bot .whatsapp-message-text {
    background: white !important;
    color: #333 !important;
    border-bottom-left-radius: 0 !important;
    border: 1px solid #e8e8e8 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

/* ============================================
   Chat Input
   ============================================ */

.whatsapp-chat-input {
    display: flex !important;
    gap: 10px !important;
    padding: 14px 12px !important;
    border-top: 1px solid #e8e8e8 !important;
    background: #fafafa !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

.whatsapp-chat-input input {
    flex: 1 !important;
    border: 1px solid #ddd !important;
    border-radius: 22px !important;
    padding: 11px 16px !important;
    font-size: 14px !important;
    outline: none !important;
    transition: all 0.3s ease !important;
    font-family: inherit !important;
    margin: 0 !important;
    background: white !important;
    color: #333 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.whatsapp-chat-input input::placeholder {
    color: #999 !important;
}

.whatsapp-chat-input input:focus {
    border-color: #25D366 !important;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15), 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    outline: none !important;
    background: white !important;
}

/* ============================================
   Botão Enviar - ISOLAMENTO TOTAL
   ============================================ */

#whatsapp-chat-send,
.whatsapp-chat-input button,
.whatsapp-chat-input [type="button"],
.whatsapp-chat-input [type="submit"] {
    background: #25D366 !important;
    background-color: #25D366 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    font-size: 16px !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    position: relative !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    box-sizing: border-box !important;
}

#whatsapp-chat-send::-moz-focus-inner,
.whatsapp-chat-input button::-moz-focus-inner,
.whatsapp-chat-input [type="button"]::-moz-focus-inner,
.whatsapp-chat-input [type="submit"]::-moz-focus-inner {
    border: none !important;
    padding: 0 !important;
}

#whatsapp-chat-send:hover,
.whatsapp-chat-input button:hover,
.whatsapp-chat-input [type="button"]:hover,
.whatsapp-chat-input [type="submit"]:hover {
    background: #20ba58 !important;
    background-color: #20ba58 !important;
}

#whatsapp-chat-send:active,
.whatsapp-chat-input button:active,
.whatsapp-chat-input [type="button"]:active,
.whatsapp-chat-input [type="submit"]:active {
    transform: scale(0.95) !important;
}

#whatsapp-chat-send:focus,
.whatsapp-chat-input button:focus,
.whatsapp-chat-input [type="button"]:focus,
.whatsapp-chat-input [type="submit"]:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2) !important;
}

#whatsapp-chat-send i,
.whatsapp-chat-input button i,
.whatsapp-chat-input [type="button"] i,
.whatsapp-chat-input [type="submit"] i {
    font-size: 16px !important;
    color: white !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    outline: none !important;
}

/* ============================================
   Scrollbar Customizado
   ============================================ */

.whatsapp-chat-messages::-webkit-scrollbar {
    width: 6px !important;
}

.whatsapp-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

.whatsapp-chat-messages::-webkit-scrollbar-thumb {
    background: #25D366 !important;
    border-radius: 3px !important;
}

.whatsapp-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #20ba58 !important;
}

/* ============================================
   Responsivo
   ============================================ */

@media (max-width: 480px) {
    #whatsapp-chat {
        width: calc(100vw - 20px) !important;
        height: 70vh !important;
        max-height: 500px !important;
    }

    .whatsapp-message-text {
        max-width: 90% !important;
    }

    #whatsapp-bubble-container {
        bottom: 10px !important;
        right: 10px !important;
        left: auto !important;
        top: auto !important;
    }

    #whatsapp-bubble-container.whatsapp-bubble-bottom-left {
        left: 10px !important;
        right: auto !important;
    }

    #whatsapp-bubble-container.whatsapp-bubble-top-right {
        top: 10px !important;
        right: 10px !important;
    }

    #whatsapp-bubble-container.whatsapp-bubble-top-left {
        top: 10px !important;
        left: 10px !important;
        right: auto !important;
    }

    #whatsapp-chat {
        bottom: 70px !important;
    }

    #whatsapp-bubble-container.whatsapp-bubble-top-right #whatsapp-chat,
    #whatsapp-bubble-container.whatsapp-bubble-top-left #whatsapp-chat {
        bottom: auto !important;
        top: 70px !important;
    }

    #whatsapp-bubble {
        width: 56px !important;
        height: 56px !important;
    }

    #whatsapp-bubble i,
    #whatsapp-bubble svg {
        font-size: 24px !important;
        width: 24px !important;
        height: 24px !important;
    }
}

/* ============================================
   Impressão
   ============================================ */

@media print {
    #whatsapp-bubble-container {
        display: none !important;
    }
}

/* ============================================
   Reset de estilos herdados do tema
   ============================================ */

#whatsapp-bubble-container button,
#whatsapp-bubble-container input,
#whatsapp-bubble-container textarea,
#whatsapp-bubble-container select,
#whatsapp-bubble-container [type="button"],
#whatsapp-bubble-container [type="submit"],
#whatsapp-bubble-container [type="reset"] {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

#whatsapp-bubble-container button::-moz-focus-inner,
#whatsapp-bubble-container [type="button"]::-moz-focus-inner,
#whatsapp-bubble-container [type="submit"]::-moz-focus-inner,
#whatsapp-bubble-container [type="reset"]::-moz-focus-inner {
    border: none !important;
    padding: 0 !important;
}

#whatsapp-bubble-container input::-webkit-outer-spin-button,
#whatsapp-bubble-container input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

#whatsapp-bubble-container input[type=number] {
    -moz-appearance: textfield !important;
}
