/* WhatsApp Chat Flutuante - VERSÃO PLUGIN WORDPRESS */

/* CSS Crítico - Mobile First */
.wp-whatsapp-button {
    position: fixed !important;
    bottom: 40px !important;
    right: 40px !important;
    width: 60px !important;
    height: 60px !important;
    background-color: rgba(0,200,0,1) !important;
    color: white !important;
    border-radius: 50px !important;
    border: 0 !important;
    cursor: pointer !important;
    z-index: 2147483646 !important; /* << elevado para ficar sempre clicável */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    font-size: 30px !important;
    transition-duration: 0.5s !important;
    animation: pulse 3s infinite !important;
    outline: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: rgba(0,200,0,.3) !important;
    touch-action: manipulation !important;
    pointer-events: auto !important;
    will-change: transform !important;
    text-decoration: none !important;
    overflow: visible !important;
}

.wp-whatsapp-button svg { width: 28px !important; height: 28px !important; fill: currentColor !important; flex-shrink: 0 !important; }
.wp-whatsapp-button:hover { background-color: rgba(0,150,0,1) !important; color: white !important; text-decoration: none !important; }
.wp-whatsapp-button:active { transform: scale(.95) !important; }
.wp-whatsapp-button .my-float { margin: 0 !important; pointer-events: none !important; flex-shrink: 0 !important; }
.wp-whatsapp-button-icon { display: flex !important; align-items: center !important; justify-content: center !important; }
.wp-whatsapp-button-card { display: none !important; align-items: center !important; justify-content: flex-start !important; gap: 10px !important; color: #111827 !important; font-weight: 500 !important; text-align: left !important; position: relative !important; width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; padding: 18px 6px 18px 20px !important; background: #ffffff !important; border-radius: 999px !important; box-shadow: 0 18px 42px rgba(15,23,42,0.12) !important; border: 1px solid rgba(15,23,42,0.04) !important; overflow: hidden !important; transition: transform .18s ease, box-shadow .18s ease !important; }
.wp-whatsapp-button-card-text { display: block !important; font-size: 14px !important; line-height: 1.5 !important; letter-spacing: -0.01em !important; flex: 1 1 auto !important; word-break: break-word !important; white-space: pre-line !important; overflow-wrap: anywhere !important; }
.wp-whatsapp-button-card-avatar { position: relative !important; flex-shrink: 0 !important; display: flex !important; align-items: center !important; justify-content: center !important; width: 50px !important; height: 50px !important; border-radius: 50% !important; overflow: hidden !important; background: #ffffff !important; box-shadow: 0 16px 32px rgba(15,23,42,0.14) !important; border: 2px solid rgba(15,23,42,0.08) !important; margin-left: auto !important; margin-right: 0 !important; }
.wp-whatsapp-button-card-avatar::after { content: ''; position: absolute !important; right: 6px !important; bottom: 6px !important; width: 12px !important; height: 12px !important; border-radius: 50% !important; background: #22c55e !important; border: 2px solid #ffffff !important; }
.wp-whatsapp-button-card-avatar img { width: 100% !important; height: 100% !important; object-fit: cover !important; }
.wp-whatsapp-button-card-initial { display: flex !important; align-items: center !important; justify-content: center !important; width: 100% !important; height: 100% !important; background: #22c55e !important; color: #fff !important; font-weight: 700 !important; font-size: 16px !important; }
.wp-whatsapp-button--card {
    position: fixed !important;
    bottom: 40px !important;
    right: 40px !important;
    width: auto !important;
    min-width: 220px !important;
    max-width: 320px !important;
    height: auto !important;
    padding: 0 !important;
    border-radius: 30px !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    overflow: visible !important;
    animation: none !important;
}
.wp-whatsapp-button--card .wp-whatsapp-button-icon { display: none !important; }
.wp-whatsapp-button--card .wp-whatsapp-button-card { display: flex !important; }
.wp-whatsapp-button--card:hover .wp-whatsapp-button-card { transform: translateY(-2px) !important; box-shadow: 0 20px 46px rgba(15,23,42,0.16) !important; }
.wp-whatsapp-button.wp-whatsapp-hidden { display: none !important; }
.wp-whatsapp-button.wp-whatsapp-hidden { display: none !important; }

@-webkit-keyframes pulse { 0% {-webkit-box-shadow: 0 0 0 0 rgba(0,200,0,1);} 70% {-webkit-box-shadow: 0 0 0 20px rgba(0,200,0,0);} 100% {-webkit-box-shadow: 0 0 0 0 rgba(0,200,0,0);} }
@keyframes pulse { 0% {box-shadow: 0 0 0 0 rgba(0,200,0,1);} 70% {box-shadow: 0 0 0 20px rgba(0,200,0,0);} 100% {box-shadow: 0 0 0 0 rgba(0,200,0,0);} }

.wp-chat-container {
    position: fixed !important;
    inset: 0 !important;
    background: #fff !important;
    z-index: 8999 !important;
    display: none !important;
    flex-direction: column !important;
    overflow: hidden !important;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif !important;
    will-change: transform, opacity !important;
}
.wp-chat-container.active { display: flex !important; animation: slideUp .25s ease-out !important; }

/* Esconder botão quando container está ativo em mobile */
.wp-chat-container.active ~ .wp-whatsapp-button { display: none !important; }

@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

.wp-chat-header { background: rgba(0,200,0,1) !important; color: #fff !important; padding: 15px 20px !important; display: flex !important; justify-content: space-between !important; align-items: center !important; flex-shrink: 0 !important; min-height: 60px !important; box-sizing: border-box !important; }
.wp-chat-agent-info { display: flex !important; align-items: center !important; gap: 12px !important; }
.wp-chat-avatar { position: relative !important; width: 40px !important; height: 40px !important; border-radius: 50% !important; overflow: hidden !important; border: 2px solid rgba(255,255,255,0.3) !important; flex-shrink: 0 !important; background: rgba(255,255,255,0.2) !important; display: flex !important; align-items: center !important; justify-content: center !important; font-size: 20px !important; }
.wp-chat-avatar img { width: 100% !important; height: 100% !important; object-fit: cover !important; display: block !important; }
.wp-chat-agent-details { display: flex !important; flex-direction: column !important; gap: 2px !important; }
.wp-chat-agent-name { font-weight: 600 !important; font-size: 16px !important; margin: 0 !important; color: #fff !important; line-height: 1.2 !important; }
.wp-chat-agent-status { font-size: 12px !important; color: rgba(255,255,255,0.9) !important; margin: 0 !important; display: flex !important; align-items: center !important; gap: 4px !important; }
.wp-chat-agent-status::before { content: '●' !important; color: #00ff00 !important; font-size: 8px !important; }

.wp-close-button { background: rgba(255,255,255,.2) !important; border: 0 !important; color: #fff !important; font-size: 18px !important; cursor: pointer !important; padding: 8px !important; width: 36px !important; height: 36px !important; display: flex !important; align-items: center !important; justify-content: center !important; border-radius: 50% !important; transition: background .2s ease, transform .2s ease !important; touch-action: manipulation !important; will-change: transform !important; flex-shrink: 0 !important; }
.wp-close-button:active { background: rgba(255,255,255,.3) !important; transform: scale(1.1) !important; }

.wp-chat-iframe { flex: 1 !important; border: 0 !important; width: 100% !important; height: 100% !important; background: #f8f9fa !important; }
.wp-chat-iframe-wrapper {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}
.wp-chat-iframe-loading { display: none !important; align-items: center !important; justify-content: center !important; flex: 1 !important; background: #ffffff !important; }
.wp-chat-iframe-loading.show { display: flex !important; }
.wp-loading-spinner { width: 32px !important; height: 32px !important; border: 3px solid #e0e0e0 !important; border-top: 3px solid rgba(0,200,0,1) !important; border-radius: 50% !important; animation: spin 1s linear infinite !important; }
.wp-chat-video { position: relative !important; display: none !important; flex: 1 !important; width: 100% !important; background: #000 !important; align-items: stretch !important; justify-content: stretch !important; }
.wp-chat-video.show { display: flex !important; }
.wp-chat-video-inner { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; overflow: hidden !important; }
.wp-chat-video-frame,
.wp-chat-html5-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    border: 0 !important;
    display: none !important;
    background: #000 !important;
}
.wp-chat-video-frame.show,
.wp-chat-html5-video.show { display: block !important; }
.wp-chat-html5-video { object-fit: cover !important; }
.wp-chat-placeholder { display: none !important; align-items: center !important; justify-content: center !important; text-align: center !important; padding: 24px !important; flex: 1 !important; background: #f1f5f9 !important; color: #475569 !important; font-size: 15px !important; }
.wp-chat-placeholder.show { display: flex !important; }
.wp-chat-video-toggle {
    position: absolute !important;
    right: 18px !important;
    bottom: 18px !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    border: 0 !important;
    background: rgba(15,23,42,0.85) !important;
    color: #fff !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    cursor: pointer !important;
    transition: background .2s ease, transform .2s ease !important;
}
.wp-chat-video-toggle.show { display: flex !important; }
.wp-chat-video-toggle:active { transform: scale(.92) !important; }
.wp-chat-container.tcrm-video-yt .wp-chat-video::before,
.wp-chat-container.tcrm-video-yt .wp-chat-video::after {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    height: 52px !important;
    pointer-events: none !important;
    z-index: 3 !important;
    display: block !important;
}
.wp-chat-container.tcrm-video-yt .wp-chat-video::before {
    top: 0 !important;
    background: linear-gradient(to bottom, rgba(0,0,0,0.85), rgba(0,0,0,0)) !important;
}
.wp-chat-container.tcrm-video-yt .wp-chat-video::after {
    bottom: 0 !important;
    background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0)) !important;
}
.wp-chat-container[data-display-mode="video"] .wp-chat-iframe { display: none !important; }
@keyframes spin { to { transform: rotate(360deg) } }

/* Tablet+ */
@media (min-width: 768px) {
    .wp-whatsapp-button { bottom: 40px !important; right: 40px !important; width: 60px !important; height: 60px !important; }
    .wp-whatsapp-button:hover { background-color: rgba(0,150,0,1) !important; transform: scale(1.05) translateY(-2px) !important; }
    .wp-chat-container {
        bottom: 120px !important; right: 40px !important; left: auto !important; top: auto !important;
        width: 380px !important; height: 550px !important; max-height: calc(100vh - 150px) !important;
        border-radius: 15px !important; box-shadow: 0 10px 40px rgba(0,0,0,.2) !important; border: 1px solid rgba(0,0,0,.1) !important;
    }
    .wp-chat-container.active ~ .wp-whatsapp-button { display: none !important; }
    .wp-chat-container.active ~ .wp-whatsapp-button--card { display: none !important; }
    .wp-chat-container.active { animation: slideIn .25s ease-out !important; }
    @keyframes slideIn { from { opacity: 0; transform: translateY(20px) scale(.95) } to { opacity: 1; transform: translateY(0) scale(1) } }
    .wp-chat-header { padding: 18px 20px !important; }
    .wp-chat-avatar { width: 45px !important; height: 45px !important; font-size: 22px !important; }
    .wp-chat-agent-name { font-size: 17px !important; }
    .wp-chat-agent-status { font-size: 13px !important; }
    .wp-close-button { width: 30px !important; height: 30px !important; padding: 5px !important; }
    .wp-close-button:hover { background: rgba(255,255,255,.3) !important; transform: scale(1.1) !important; }
    .wp-loading-spinner { width: 24px !important; height: 24px !important; border-width: 2px !important; }
}

/* Desktop */
@media (min-width: 1024px) { .wp-chat-container { width: 400px !important; height: 600px !important; } }

/* Telas pequenas */
@media (max-width: 360px) {
    .wp-whatsapp-button { width: 55px !important; height: 55px !important; bottom: 30px !important; right: 20px !important; font-size: 26px !important; }
    .wp-whatsapp-button svg { width: 24px !important; height: 24px !important; }
    .wp-chat-header { padding: 12px 15px !important; }
    .wp-chat-avatar { width: 35px !important; height: 35px !important; font-size: 18px !important; }
    .wp-chat-agent-name { font-size: 15px !important; }
    .wp-chat-agent-status { font-size: 11px !important; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .wp-chat-header { padding: 12px 20px !important; min-height: 50px !important; }
    .wp-chat-avatar { width: 35px !important; height: 35px !important; font-size: 18px !important; }
    .wp-chat-agent-name { font-size: 14px !important; }
    .wp-chat-agent-status { font-size: 11px !important; }
}

/* ——— Mantém o botão oculto quando o chat está aberto ——— */
body.tcrm-video-open .wp-whatsapp-button,
body.tcrm-chat-open .wp-whatsapp-button { display: none !important; }

@media (max-width: 480px) {
    .wp-whatsapp-button--card {
        bottom: 24px !important;
        right: 16px !important;
        max-width: calc(100vw - 32px) !important;
    }
    .wp-whatsapp-button-card {
        padding: 10px 6px 10px 16px !important;
        border-radius: 24px !important;
        gap: 7px !important;
    }
    .wp-whatsapp-button--card .wp-whatsapp-button-card-text { font-size: 13px !important; }
    .wp-whatsapp-button-card-avatar { width: 42px !important; height: 42px !important; box-shadow: 0 12px 24px rgba(15,23,42,0.16) !important; }
}

@media (max-width: 360px) {
    .wp-whatsapp-button--card {
        max-width: calc(100vw - 36px) !important;
    }
    .wp-whatsapp-button-card {
        padding: 8px 4px 8px 14px !important;
        border-radius: 22px !important;
        gap: 6px !important;
    }
    .wp-whatsapp-button--card .wp-whatsapp-button-card-text { font-size: 12px !important; }
    .wp-whatsapp-button-card-avatar { width: 38px !important; height: 38px !important; box-shadow: 0 10px 20px rgba(15,23,42,0.18) !important; }
}
