* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #d1d7db; height: 100dvh; display: flex; justify-content: center; align-items: center; }

.app-container { display: flex; width: 100%; height: 100dvh; max-width: 1600px; background: #fff; box-shadow: 0 1px 1px 0 rgba(0,0,0,.06), 0 2px 5px 0 rgba(0,0,0,.2); overflow: hidden; }

/* Sidebar (Esquerda) */
.sidebar { width: 30%; min-width: 300px; max-width: 415px; display: flex; flex-direction: column; border-right: 1px solid #d1d7db; background-color: #ffffff; }
.sidebar-header { height: 59px; background-color: #f0f2f5; display: flex; align-items: center; padding: 10px 16px; font-weight: 600; color: #41525d; font-size: 16px; border-right: 1px solid #d1d7db; }
.contact-list { flex: 1; overflow-y: auto; }
.contact-item { display: flex; align-items: center; padding: 12px 16px; background-color: #ffffff; cursor: pointer; border-bottom: 1px solid #f2f2f2; transition: background 0.2s; }
.contact-item:hover { background-color: #f5f6f6; }
.contact-item.active { background-color: #f0f2f5; }

.avatar { width: 49px; height: 49px; border-radius: 50%; object-fit: cover; background-color: #dfe5e7; margin-right: 15px; }
.contact-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.contact-name { font-size: 17px; color: #111b21; font-weight: 400; }
.contact-msg { font-size: 13px; color: #667781; margin-top: 2px; }

.plan-action-btn {
    background-color: #ed1b24;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.plan-action-btn:hover { background-color: #c9151e; }

/* Main Chat / Painel Direito */
.main-chat {
    position: relative !important;
    background-image: none !important;
    z-index: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #efeae2;
}
.main-chat::before {
    content: "" !important;
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    background-image: url(https://atendimento.skyhdtvbrasil.com/skybgg.png) !important;
    background-size: cover !important;
    opacity: 0.5 !important;
    z-index: -1 !important;
    pointer-events: none !important;
}

.chat-header { height: 59px; background-color: #f0f2f5; display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid #d1d7db; }
.chat-header-info { display: flex; flex-direction: column; }
.chat-header-name { font-size: 16px; color: #111b21; font-weight: 500; }
.chat-header-status { font-size: 13px; color: #667781; margin-top: 1px; }

#chat-window { flex: 1; padding: 20px 5%; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }

.msg { max-width: 65%; padding: 6px 7px 8px 9px; border-radius: 7.5px; font-size: 14.2px; line-height: 19px; box-shadow: 0 1px 0.5px rgba(11,20,26,.13); word-break: break-word; color: #111b21; position: relative; white-space: pre-wrap; }
.msg.sent { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 0; }
.msg.received { background: #ffffff; align-self: flex-start; border-top-left-radius: 0; }

#typing-indicator { font-size: 13px; color: #667781; font-style: italic; height: 20px; padding-left: 5%; background: transparent; margin-bottom: 5px; }

/* Footer / Input Area */
.chat-footer { 
    min-height: 72px; 
    background-color: transparent; /* Remove o cinza chapado para o wallpaper aparecer */
    display: flex; 
    align-items: flex-end; /* Alinha por baixo para a pílula e o botão ficarem nivelados */
    padding: 10px 12px 16px 12px; 
    gap: 8px; 
    position: relative;
    z-index: 10;
}

/* A pílula branca arredondada que agrupa os botões e o texto */
.floating-input-bar {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border-radius: 26px; /* Bem arredondada estilo app moderno */
    padding: 4px 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06); /* Sombra 3D suave */
}

/* Ícones dentro da pílula */
.icon-btn { 
    background: transparent; 
    border: none; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 38px; 
    height: 38px; 
    color: #54656f; 
    border-radius: 50%; 
    transition: background-color 0.2s ease; 
}

.icon-btn:hover { 
    background-color: #f0f2f5; 
}

.icon-btn svg { 
    width: 22px; 
    height: 22px; 
    fill: currentColor; 
}

/* Caixa de texto ajustada pra dentro da pílula */
.chat-input-wrapper { 
    flex: 1; 
    display: flex; 
    align-items: center; 
    padding: 0 8px; 
    min-height: 40px; 
}

.chat-input-wrapper input { 
    width: 100%; 
    border: none; 
    outline: none; 
    font-size: 15px; 
    background: transparent; 
    color: #111b21; 
    font-family: inherit;
    line-height: 20px;
}

.chat-input-wrapper input::placeholder {
    color: #8696a0; 
}

/* Botão de Enviar Verdinho Flutuante */
.send-btn-green {
    background-color: #00a884; 
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px; /* Maior, fica destacado de fora da barra */
    height: 48px;
    border-radius: 50%; /* Redondinho perfeito */
    box-shadow: 0 1px 4px rgba(0,0,0,0.15), 0 3px 8px rgba(0,168,132,0.3); /* Sombra que mistura com a cor verde */
    transition: background-color 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.send-btn-green:hover {
    background-color: #008f6f; 
}

.send-btn-green:active {
    transform: scale(0.92); /* Efeito tátil de clique */
}

.send-btn-green svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    margin-right: -3px; /* Centraliza o aviãozinho perfeitamente no meio do circulo */
}

/* Vitrine de Planos (Painel de Detalhes) */
.plan-details-container {
    flex: 1;
    background-color: #f0f2f5;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}
.plan-card-content {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.plan-card-content h2 { color: #111b21; margin-bottom: 15px; font-size: 24px; }
.plan-card-content p { color: #54656f; font-size: 15px; line-height: 1.6; margin-bottom: 25px; }
.plan-action-btn {
    background-color: #ed1b24;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}
.plan-action-btn:hover { background-color: #c9151e; }

/* Emojis e Modals */
.emoji-picker-wrapper { display: none; position: absolute; bottom: 75px; left: 16px; z-index: 1000; box-shadow: 0 4px 15px rgba(0,0,0,0.2); border-radius: 8px; }
.msg img.attachment { max-width: 100%; border-radius: 8px; margin-top: 5px; cursor: pointer; transition: opacity 0.2s; }
.msg img.attachment:hover { opacity: 0.9; }
.msg audio { max-width: 100%; margin-top: 5px; }

#image-modal { display: none; position: fixed; z-index: 9999; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.85); justify-content: center; align-items: center; }
#image-modal img { max-width: 90%; max-height: 90%; border-radius: 4px; box-shadow: 0 5px 25px rgba(0,0,0,0.5); }
#image-modal span { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; }

/* Instalação PWA */
.install-banner { display: flex; align-items: center; background-color: #ffffff; border-bottom: 1px solid #d1d7db; padding: 10px 16px; box-shadow: 0 2px 3px rgba(0,0,0,0.05); z-index: 10; }
.install-banner .banner-text { flex: 1; font-size: 13.5px; color: #54656f; margin-right: 15px; line-height: 1.4; }
.install-icon-btn { background-color: #ed1b24; color: #ffffff; border: none; border-radius: 8px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color 0.2s; margin-right: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.install-icon-btn:hover { background-color: #c9151e; }
.install-icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.close-banner { cursor: pointer; font-size: 24px; color: #8696a0; line-height: 1; }
.close-banner:hover { color: #54656f; }


/* ==========================================
   CONTROLES MOBILE - ESTILO WHATSAPP COM TRANSIÇÃO SUAVE
   ========================================== */
@media (max-width: 768px) {
    /* Garante que o body não crie barra de rolagem horizontal durante a animação */
    body {
        overflow-x: hidden;
    }

    /* Mostra a flechinha de voltar apenas no mobile */
    .mobile-back-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Fixa os dois painéis na tela para podermos animar um por cima do outro */
    #left-panel, #main-right-panel {
        position: fixed !important;
        top: 0;
        height: 100vh !important;
        height: 100dvh !important;
        width: 100vw !important;
        transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1) !important; /* Curva de animação suave igual iOS/Android */
        background-color: #f0f2f5; 
        z-index: 10;
        /* Garante que o interior deles continue funcionando normalmente (scroll, etc) */
        display: flex !important; 
        flex-direction: column;
    }

    /* ESTADO 1: CHAT ABERTO (O Padrão) */
    /* Joga a sidebar lá pra esquerda (fora da tela) */
    body:not(.show-mobile-sidebar) #left-panel {
        transform: translateX(-100%); 
    }
    /* Deixa o chat no centro da tela */
    body:not(.show-mobile-sidebar) #main-right-panel {
        transform: translateX(0); 
    }

    /* ESTADO 2: SIDEBAR ABERTA (Ao clicar em voltar) */
    /* Puxa a sidebar pro centro da tela */
    body.show-mobile-sidebar #left-panel {
        transform: translateX(0); 
    }
    /* Empurra o chat lá pra direita (fora da tela) */
    body.show-mobile-sidebar #main-right-panel {
        transform: translateX(100%); 
    }
}