/* client/chat.css - Chat estilo WhatsApp em tela cheia para clientes */

:root {
    --wa-bg-chat: #0b141a;
    --wa-panel-bg: #111b21;
    --wa-header-bg: #202c33;
    --wa-input-bg: #2a3942;
    --wa-border: rgba(134, 150, 160, 0.15);
    --wa-green-bubble: #005c4b;
    --wa-receive-bubble: #202c33;
    --wa-green-accent: #00ff88;
    --wa-text-primary: #e9edef;
    --wa-text-secondary: #8696a0;
    --wa-text-time: #8696a0;
    --wa-check-blue: #53bdeb;
}

/* Container Principal do Chat (Full width, sem sidebar lateral de pessoas) */
.wa-chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    min-height: 600px;
    background: var(--wa-panel-bg);
    border-radius: 16px;
    border: 1px solid rgba(0, 255, 136, 0.25);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 255, 136, 0.08);
    overflow: hidden;
    position: relative;
}

/* Header com Abas de Alternância: Grupo Geral e Suporte */
.wa-main-header {
    height: 70px;
    background: var(--wa-header-bg);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--wa-border);
    z-index: 10;
    gap: 15px;
    flex-wrap: wrap;
}

.wa-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.wa-header-avatar.general {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
}

.wa-header-avatar.support {
    background: linear-gradient(135deg, #10b981, #047857);
    color: #fff;
}

.wa-header-title {
    color: var(--wa-text-primary);
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0;
}

.wa-header-sub {
    color: var(--wa-text-secondary);
    font-size: 0.78rem;
    margin: 2px 0 0 0;
}

/* Botões de Alternância no Topo */
.wa-header-tabs {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    padding: 4px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.wa-tab-btn {
    padding: 8px 18px;
    border-radius: 20px;
    border: none;
    background: transparent;
    color: var(--wa-text-secondary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-tab-btn:hover {
    color: #fff;
}

.wa-tab-btn.active {
    background: var(--wa-green-accent);
    color: #0b141a;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.wa-tab-btn .badge {
    background: #ff4444;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* Área de Mensagens */
.wa-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--wa-bg-chat);
    background-image: radial-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 0);
    background-size: 24px 24px;
}

.wa-msg-wrapper {
    display: flex;
    width: 100%;
}

.wa-msg-wrapper.outgoing {
    justify-content: flex-end;
}

.wa-msg-wrapper.incoming {
    justify-content: flex-start;
}

.wa-msg-bubble {
    max-width: 70%;
    min-width: 120px;
    padding: 8px 14px 6px 14px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    word-break: break-word;
}

.wa-msg-wrapper.outgoing .wa-msg-bubble {
    background: var(--wa-green-bubble);
    border-top-right-radius: 2px;
    color: var(--wa-text-primary);
}

.wa-msg-wrapper.incoming .wa-msg-bubble {
    background: var(--wa-receive-bubble);
    border-top-left-radius: 2px;
    color: var(--wa-text-primary);
}

/* Nomes dos participantes em destaque */
.wa-msg-sender-name {
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wa-sender-badge-admin {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid rgba(0, 255, 136, 0.4);
}

.wa-msg-text {
    font-size: 0.94rem;
    line-height: 1.45;
    white-space: pre-wrap;
    margin: 0;
}

.wa-sticker-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin-top: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.wa-sticker-img:hover {
    transform: scale(1.05);
}

.wa-msg-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 0.68rem;
    color: var(--wa-text-time);
}

.wa-msg-check {
    font-size: 0.72rem;
    color: var(--wa-text-time);
}

.wa-msg-check.read {
    color: var(--wa-check-blue);
}

/* Mensagem de Sistema */
.wa-sys-msg-container {
    display: flex;
    justify-content: center;
    margin: 8px 0;
}

.wa-sys-msg {
    background: rgba(32, 44, 51, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    font-size: 0.76rem;
    padding: 5px 14px;
    border-radius: 12px;
    text-align: center;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Barra Inferior de Digitação */
.wa-input-bar {
    min-height: 64px;
    background: var(--wa-header-bg);
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--wa-border);
    position: relative;
    z-index: 10;
}

.wa-icon-btn {
    background: none;
    border: none;
    color: var(--wa-text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-icon-btn:hover, .wa-icon-btn.active {
    color: var(--wa-green-accent);
    background: rgba(0, 255, 136, 0.12);
}

.wa-input-field {
    flex: 1;
    background: var(--wa-input-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    padding: 11px 20px;
    color: var(--wa-text-primary);
    font-size: 0.94rem;
    outline: none;
    transition: border-color 0.2s;
}

.wa-input-field:focus {
    border-color: rgba(0, 255, 136, 0.5);
}

.wa-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--wa-green-accent);
    color: #0b141a;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.2s ease;
    box-shadow: 0 0 14px rgba(0, 255, 136, 0.4);
}

.wa-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.7);
}

/* Painel de Emojis e Stickers */
.wa-picker-container {
    display: none;
    background: #111b21;
    border-top: 1px solid var(--wa-border);
    height: 240px;
    overflow-y: auto;
    padding: 12px 18px;
    position: relative;
    z-index: 10;
}

.wa-picker-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--wa-border);
    padding-bottom: 8px;
}

.wa-picker-tab-btn {
    background: none;
    border: none;
    color: var(--wa-text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 14px;
}

.wa-picker-tab-btn.active {
    background: rgba(0, 255, 136, 0.15);
    color: var(--wa-green-accent);
}

.wa-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 6px;
}

.wa-emoji-btn {
    background: none;
    border: none;
    font-size: 1.45rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: transform 0.1s ease;
}

.wa-emoji-btn:hover {
    background: #202c33;
    transform: scale(1.2);
}

.wa-sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 12px;
}

.wa-sticker-card {
    background: #202c33;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 8px 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.wa-sticker-card:hover {
    border-color: var(--wa-green-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.25);
}

.wa-sticker-card img {
    width: 65px;
    height: 65px;
    object-fit: contain;
    display: block;
    margin: 0 auto 4px auto;
}

.wa-sticker-card span {
    font-size: 0.68rem;
    color: var(--wa-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.wa-closed-banner {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 10px 18px;
    border-radius: 10px;
    margin: 10px 20px 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

/* Botão Flutuante */
.wa-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 2rem;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.5);
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
    border: none;
}

.wa-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.7);
}

.wa-float-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff4444;
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #111;
}

@media (max-width: 768px) {
    .wa-chat-wrapper {
        height: calc(100vh - 100px);
        min-height: 500px;
    }
    .wa-header-tabs {
        width: 100%;
        justify-content: space-between;
    }
    .wa-tab-btn {
        flex: 1;
        justify-content: center;
        padding: 6px 10px;
        font-size: 0.78rem;
    }
    .wa-msg-bubble {
        max-width: 85%;
    }
}

/* Painel e Recursos Exclusivos do Líder da Rede */
.wa-leader-members-btn {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
    border: 1px solid #f59e0b;
    color: #fbbf24;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.wa-leader-members-btn:hover {
    background: #f59e0b;
    color: #000;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.wa-reply-client-btn {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    transition: all 0.2s ease;
}
.wa-reply-client-btn:hover {
    background: #f59e0b;
    color: #000;
}

.wa-reply-context-bar {
    background: rgba(20, 25, 30, 0.95);
    border-top: 1px solid rgba(245, 158, 11, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 16px;
    display: none;
    align-items: center;
    justify-content: space-between;
}

/* Modal / Gaveta Lateral de Membros do Líder */
.wa-leader-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: flex-end;
}
.wa-leader-drawer {
    width: 340px;
    max-width: 90%;
    height: 100%;
    background: #111b21;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0,0,0,0.6);
}
.wa-leader-drawer-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.wa-leader-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.wa-leader-member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
}
.wa-leader-member-item:hover {
    background: rgba(255, 255, 255, 0.06);
}
