/* css/teti-chat.css */

/* --- TELA DE INBOX --- */
.inbox-header {
    padding: 14px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.online-users-scroll {
    display: flex;
    gap: 16px;
    padding: 16px;
    overflow-x: auto;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
    scrollbar-width: none;
}

.online-user-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 64px;
    cursor: pointer;
    flex-shrink: 0;
}

.online-avatar-wrapper {
    position: relative;
    width: 56px;
    height: 56px;
}

.online-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 0 2px #4caf50; /* Anel verde de online */
}

.inbox-list {
    background: var(--bg-card);
    min-height: calc(100vh - 180px);
}

.chat-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-list-item:active { background-color: var(--bg-hover); }

.chat-item-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 14px;
}

.chat-item-info { flex: 1; min-width: 0; }
.chat-item-name { font-weight: 600; font-size: 15px; color: var(--text-main); margin-bottom: 2px; }
.chat-item-last-msg { font-size: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-meta { font-size: 12px; color: var(--text-muted); margin-left: 12px; display: flex; flex-direction: column; align-items: flex-end; }

/* --- TELA DE CHAT (FULLSCREEN) --- */
#chat-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-body);
    z-index: 12000;
    display: none;
    flex-direction: column;
}

#chat-screen.active { display: flex; }

.chat-header {
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    height: 60px;
    flex-shrink: 0;
}

.chat-header-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.chat-header-name { font-weight: 700; font-size: 16px; color: var(--text-main); }
.chat-header-status { font-size: 12px; color: var(--text-muted); }

/* Área de Mensagens */
.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px; /* Mais próximo como WhatsApp */
    background-color: var(--bg-body);
}

.msg-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

.msg-bubble.received {
    align-self: flex-start;
    background-color: var(--bg-card);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.msg-bubble.sent {
    align-self: flex-end;
    background-color: var(--teti-primary); /* Sólido */
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 10px;
    opacity: 0.7;
    text-align: right;
    margin-top: 2px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
}

/* --- BARRA DE INPUT CORRIGIDA --- */
.chat-input-area {
    padding: 8px 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center; /* Centraliza verticalmente */
    gap: 8px;
    min-height: 60px;
    flex-shrink: 0;
}

/* Campo de Texto */
.chat-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-hover);
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    max-height: 100px;
    resize: none;
    font-family: inherit;
}

/* Botões de Ação no Chat (Forçar Redondo) */
.chat-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--teti-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0; /* Impede de amassar */
    transition: background 0.2s;
}

.chat-action-btn:hover {
    background-color: var(--bg-hover);
}

.chat-action-btn .material-icons-round {
    font-size: 24px;
}

/* Ajuste específico para o botão de enviar */
.btn-send-msg {
    background-color: var(--teti-primary);
    color: white;
}
.btn-send-msg:hover {
    background-color: var(--teti-primary-dark);
}

/* Menu de Contexto (Segurar Mensagem) */
.msg-context-menu {
    position: absolute;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    padding: 6px;
    z-index: 13000;
    display: flex;
    gap: 4px;
    border: 1px solid var(--border-color);
}

/* css/teti-chat.css */

/* Garante que o status 'Digitando...' tenha cor de destaque */
.chat-header-status {
    font-size: 12px;
    color: var(--text-muted);
    transition: color 0.3s;
}

/* Removemos estilos conflitantes de botões antigos */
/* Apenas certifique-se de que .chat-action-btn está como enviei na resposta anterior (redondo) */

/* css/teti-chat.css - ADICIONE AO FINAL */

/* --- ANIMAÇÃO DE DIGITANDO (B O L H A) --- */
.typing-bubble {
    background-color: var(--bg-card);
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-left: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 4px;
    display: none; /* Oculto por padrão */
}

.typing-bubble.active {
    display: flex;
    animation: fadeIn 0.3s;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --- MENU DE ANEXOS --- */
.chat-attachment-menu {
    position: absolute;
    bottom: 70px; /* Acima do input */
    left: 12px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 12005;
    border: 1px solid var(--border-color);
    display: none; /* JS controla */
    animation: slideUpFade 0.2s ease;
}

.chat-attachment-menu.open { display: flex; }

.att-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.att-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- GRAVADOR DE ÁUDIO --- */
.audio-timer-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background-color: #f44336;
    border-radius: 50%;
    animation: pulseRed 1s infinite;
}

@keyframes pulseRed {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Estilo para mídias dentro do chat */
.msg-media-img, .msg-media-video {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 4px;
    display: block;
}

.msg-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.05);
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
}

.msg-audio-player {
    width: 200px;
    height: 32px;
}