/* ==========================================================
   JEDAX TALK — WHATSAPP DARK DEFINITIVO (100% OPACO)
   ========================================================== */

/* 1. Janela Principal (Totalmente isolada, sem vazar nada do fundo) */
#jdx-talk-window {
    position: fixed;
    top: 8%;
    left: 15%;
    width: 900px;
    height: 600px;
    min-width: 620px;
    min-height: 440px;
    max-width: 96vw;
    max-height: 94vh;
    background-color: #0d1117 !important; /* Preto sólido 100% opaco */
    border: 1px solid rgba(103, 179, 77, 0.5) !important;
    border-top: 3px solid #67B34D !important; /* Linha de destaque Verde Jedax */
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 20px rgba(103, 179, 77, 0.15) !important;
    display: none;
    flex-direction: column;
    z-index: 999999 !important;
    overflow: hidden;
    resize: both; /* Puxe pelo canto para redimensionar */
    font-family: 'Asap', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f0f6fc;
}

/* Modos Maximizado e Minimizado */
#jdx-talk-window.jdx-maximized {
    top: 10px !important;
    left: 10px !important;
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 20px) !important;
    resize: none;
    border-radius: 6px;
}

#jdx-talk-window.jdx-minimized {
    height: 48px !important;
    min-height: 48px !important;
    resize: none;
}
#jdx-talk-window.jdx-minimized .jdx-talk-body { display: none !important; }

/* 2. Barra Superior de Arraste (Cabeçalho da Janela) */
.jdx-talk-bar {
    background-color: #161b22 !important; /* Sólido */
    padding: 10px 16px;
    border-bottom: 1px solid rgba(103, 179, 77, 0.3) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}
.jdx-talk-bar-info { display: flex; align-items: center; gap: 10px; }
.jdx-talk-bar-info img { width: 22px; height: 22px; }
.jdx-talk-bar-info strong {
    font-size: 13px;
    font-weight: 800;
    color: #67B34D;
    letter-spacing: 1px;
}

/* Botões da Janela (Minimizar, Maximizar, Fechar) */
.jdx-talk-controls { display: flex; align-items: center; gap: 6px; }
.jdx-win-btn {
    background: #21262d !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #c1ccd7;
    font-size: 13px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.jdx-win-btn:hover { background: #30363d !important; color: #fff; }
.jdx-win-btn.close:hover { background: #dc3545 !important; color: #fff; border-color: #dc3545 !important; }

/* 3. Corpo Principal (2 Colunas com Separador Forte) */
.jdx-talk-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    background-color: #0d1117 !important;
}

/* Coluna Esquerda (Lista de Contatos e Busca) */
.jdx-talk-sidebar {
    width: 320px;
    min-width: 280px;
    background-color: #11161d !important; /* Cinza grafite sólido */
    border-right: 2px solid rgba(103, 179, 77, 0.3) !important; /* SEPARADOR VERDE DESTACADO */
    display: flex;
    flex-direction: column;
}

.jdx-talk-search {
    padding: 12px;
    background-color: #161b22 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.jdx-talk-search input {
    width: 100%;
    background-color: #0d1117 !important;
    border: 1px solid rgba(103, 179, 77, 0.4) !important;
    border-radius: 20px;
    padding: 8px 14px;
    color: #fff !important;
    outline: none;
    font-size: 13px;
}
.jdx-talk-search input:focus {
    border-color: #67B34D !important;
    box-shadow: 0 0 0 2px rgba(103, 179, 77, 0.25);
}

.jdx-talk-list {
    flex: 1;
    overflow-y: auto;
    background-color: #11161d !important;
}

.jdx-item-contato {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    background-color: #11161d !important;
    transition: background-color 0.15s;
}
.jdx-item-contato:hover { background-color: #1c2128 !important; }
.jdx-item-contato img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #67B34D;
}
.jdx-item-contato strong { display: block; font-size: 14px; color: #fff; }
.jdx-item-contato small { color: #8b949e; font-size: 12px; }

/* Coluna Direita (Área da Conversa) */
.jdx-talk-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #0b0e14 !important; /* Preto profundo sólido */
}

.jdx-chat-header {
    background-color: #161b22 !important;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(103, 179, 77, 0.2) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.jdx-chat-user { display: flex; align-items: center; gap: 12px; }
.jdx-chat-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #67B34D;
}
.jdx-chat-user strong { font-size: 14px; color: #fff; display: block; }
.jdx-chat-user small { color: #67B34D; font-size: 12px; font-weight: 600; }

.jdx-chat-call-btns { display: flex; gap: 10px; }
.jdx-call-btn {
    background-color: #21262d !important;
    border: 1px solid rgba(103, 179, 77, 0.4) !important;
    color: #67B34D !important;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.jdx-call-btn:hover {
    background-color: #67B34D !important;
    color: #0d1117 !important;
    transform: scale(1.08);
}

/* 4. Área de Mensagens (Estilo Balões) */
.jdx-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #080b0f !important; /* Fundo 100% opaco */
}
.jdx-bubble-row { display: flex; width: 100%; }
.jdx-bubble-row.me { justify-content: flex-end; }
.jdx-bubble-row.outro { justify-content: flex-start; }

.jdx-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
}
.jdx-bubble-row.me .jdx-bubble {
    background-color: #4a8d34 !important; /* Verde Jedax ativo */
    color: #fff !important;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.jdx-bubble-row.outro .jdx-bubble {
    background-color: #1c2128 !important;
    color: #f0f6fc !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 2px;
}
.jdx-bubble small {
    display: block;
    text-align: right;
    font-size: 10px;
    opacity: 0.75;
    margin-top: 4px;
}

/* 5. Campo de Digitação e Envio */
.jdx-chat-input-bar {
    padding: 12px 16px;
    background-color: #161b22 !important;
    border-top: 1px solid rgba(103, 179, 77, 0.25) !important;
    display: flex;
    gap: 10px;
    align-items: center;
}
.jdx-chat-input-bar input {
    flex: 1;
    background-color: #0d1117 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 22px;
    padding: 9px 18px;
    color: #fff !important;
    outline: none;
    font-size: 13px;
}
.jdx-chat-input-bar input:focus {
    border-color: #67B34D !important;
}
.jdx-chat-send {
    background-color: #67B34D !important;
    border: none;
    color: #0d1117 !important;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}
.jdx-chat-send:hover {
    background-color: #7bc561 !important;
    transform: scale(1.06);
}

/* Barra de rolagem interna combinando */
#jdx-talk-window ::-webkit-scrollbar { width: 6px; height: 6px; }
#jdx-talk-window ::-webkit-scrollbar-track { background: #0d1117; }
#jdx-talk-window ::-webkit-scrollbar-thumb { background: #21262d; border-radius: 4px; }
#jdx-talk-window ::-webkit-scrollbar-thumb:hover { background: #67B34D; }

/* Botão de Contatos do Celular e Convidar */
.jdx-btn-convite {
    width: 100%;
    margin-top: 8px;
    background-color: #21262d !important;
    border: 1px solid rgba(103, 179, 77, 0.4) !important;
    color: #67B34D !important;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.jdx-btn-convite:hover {
    background-color: #67B34D !important;
    color: #0d1117 !important;
}

/* Tela de Associado Sem App (Aviso com botão de Convite WhatsApp) */
.jdx-card-sem-app {
    margin: auto;
    background-color: #161b22;
    border: 1px solid rgba(103, 179, 77, 0.4);
    border-radius: 14px;
    padding: 30px 24px;
    text-align: center;
    max-width: 380px;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.jdx-btn-zap-convite {
    background-color: #25D366 !important;
    color: #fff !important;
    border: none !important;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 25px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    transition: transform 0.15s;
}
.jdx-btn-zap-convite:hover {
    transform: scale(1.04);
}

/* ==========================================================
   RESPONSIVIDADE COMPLETA PARA CELULAR (MOBILE / PWA)
   ========================================================== */
   .jdx-btn-voltar-mobile { display: none; }

   @media (max-width: 768px) {
       /* No celular: ocupa 100% da tela cheia sem sobrar nem cortar */
       #jdx-talk-window {
           top: 0 !important;
           left: 0 !important;
           width: 100vw !important;
           height: 100% !important;
           height: 100dvh !important;
           max-width: 100vw !important;
           max-height: 100vh !important;
           max-height: 100dvh !important;
           min-width: 0 !important;
           min-height: 0 !important;
           border-radius: 0 !important;
           border: none !important;
           resize: none !important;
       }
   
       .jdx-talk-bar {
           cursor: default !important;
           padding: 8px 14px !important;
       }
       #jdx-btn-min, #jdx-btn-max {
           display: none !important; /* Esconde minimizar/maximizar no celular */
       }
   
       .jdx-talk-body {
           position: relative !important;
           width: 100% !important;
           height: calc(100% - 46px) !important;
       }
   
       /* Na tela inicial do celular: lista de contatos em 100% */
       .jdx-talk-sidebar {
           width: 100% !important;
           min-width: 100% !important;
           border-right: none !important;
       }
   
       /* O chat fica escondido até a pessoa tocar em um contato */
       .jdx-talk-chat {
           display: none !important;
           width: 100% !important;
       }
   
       /* Quando toca em um contato no celular: abre a conversa em 100% da tela */
       #jdx-talk-window.jdx-mobile-chat-ativo .jdx-talk-sidebar {
           display: none !important;
       }
       #jdx-talk-window.jdx-mobile-chat-ativo .jdx-talk-chat {
           display: flex !important;
       }
   
       /* Setinha de voltar do WhatsApp no celular */
       .jdx-btn-voltar-mobile {
           display: inline-flex !important;
           align-items: center;
           justify-content: center;
           background: none !important;
           border: none !important;
           color: #67B34D !important;
           font-size: 22px !important;
           font-weight: 800 !important;
           padding: 0 8px 0 0 !important;
           cursor: pointer;
       }
   }

   /* ==========================================================
   AJUSTE DE TELA CHEIA E CONVERSA NO CELULAR
   ========================================================== */
.jdx-btn-voltar-mobile { display: none; }

@media (max-width: 768px) {
    #jdx-talk-window {
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        min-width: 0 !important;
        min-height: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        resize: none !important;
    }

    #jdx-btn-min, #jdx-btn-max { display: none !important; }

    .jdx-talk-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        border-right: none !important;
    }

    .jdx-talk-chat {
        display: none !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Ao tocar no contato: esconde a lista e abre a conversa com campo de texto e botões */
    #jdx-talk-window.jdx-mobile-chat-ativo .jdx-talk-sidebar {
        display: none !important;
    }
    #jdx-talk-window.jdx-mobile-chat-ativo .jdx-talk-chat {
        display: flex !important;
    }

    .jdx-btn-voltar-mobile {
        display: inline-flex !important;
        background: none !important;
        border: none !important;
        color: #67B34D !important;
        font-size: 24px !important;
        padding-right: 10px !important;
        cursor: pointer;
    }
}

/* Indicador Verde de Mensagens Não Lidas na Lista */
.jdx-badge-unread {
    background-color: #67B34D !important;
    color: #ffffff !important; /* Branco puro de alto contraste */
    font-size: 11px !important;
    font-weight: 800 !important;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
    letter-spacing: 0 !important;
}
.jdx-item-contato.tem-nao-lida strong {
    color: #67B34D !important;
    font-weight: 800;
}
#jdx-chat-messages { overflow-anchor: none; }
/* Talk em janela separada: ocupa a janela inteira */
html.jdx-talk-popup #jdx-talk-window {
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: 100vh !important;
    max-width: 100vw !important; max-height: 100vh !important;
    border-radius: 0 !important; border: none !important;
    resize: none !important; display: flex !important;
}
html.jdx-talk-popup .jdx-talk-bar { cursor: default; }
html.jdx-talk-popup #jdx-btn-min,
html.jdx-talk-popup #jdx-btn-max,
html.jdx-talk-popup #jdx-btn-popout { display: none !important; }