/* --- Reset Básico e Fontes --- */
#matchou-chat-container * {
    box-sizing: border-box;
    font-family: Trebuchet MS;
}

/* --- Layout Principal --- */
#matchou-chat-container {
    display: flex;
    max-width: 1200px;
    height: 75vh; 
    min-height: 500px;
    margin: 20px auto;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background-color: #100526;
    color: #f0f0f0;
}

/* =============================================================== */
/* --- COLUNA DA ESQUERDA (ASIDE) --- */
/* =============================================================== */
#matchou-chat-container #chat-user-list {
    width: 30%;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}
#matchou-chat-container .chat-tabs {
    display: flex;
    border-bottom: 1px solid #333;
}
#matchou-chat-container .chat-tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: #aaa;
    padding: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}
#matchou-chat-container .chat-tab-btn:hover {
    color: #fff;
}
#matchou-chat-container .chat-tab-btn.active {
    color: #fff;
    font-weight: bold;
    border-bottom: 2px solid #5a2d82;
}
#matchou-chat-container .tab-icon {
    height: 14px;
    width: auto;
    margin-right: 8px;
}
#matchou-chat-container .chat-tab-btn .notification-badge {
    background-color: #e74c3c;
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    position: absolute;
    top: 10px;
    right: 10px;
}
#matchou-chat-container #chat-user-list .users {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
}
#matchou-chat-container .user-item {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid #282828;
    transition: background-color 0.2s;
}
#matchou-chat-container .user-item:hover, 
#matchou-chat-container .user-item.active {
    background-color: #1f2a40;
}
#matchou-chat-container .user-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}
#matchou-chat-container .user-name {
    font-weight: bold;
    margin: 0;
}
#matchou-chat-container .user-last-message {
    font-size: 13px;
    color: #aaa;
    margin: 2px 0 0 0;
}
#matchou-chat-container .chat-user-list-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid #333;
}
#matchou-chat-container #load-more-conversations {
    background: none;
    border: 1px solid #555;
    color: #aaa;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
}
#matchou-chat-container #load-more-conversations:hover {
    background: #333;
    color: #fff;
}

/* =============================================================== */
/* --- COLUNA DA DIREITA (MAIN) --- */
/* =============================================================== */
#matchou-chat-container #chat-main-window {
    width: 70%;
    display: flex;
    flex-direction: column;
}
#matchou-chat-container #chat-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background-color: #120728;
    border-bottom: 1px solid #333;
    min-height: 80px; 
}
#chat-header-profile-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #f0f0f0;
    flex-grow: 1; 
    margin-left: 10px;
}
#chat-header-profile-link:hover .user-name {
    text-decoration: underline;
}
#matchou-chat-container #chat-header img {
    width: 55px; 
    height: 55px;
    border-radius: 50%;
    margin-right: 10px;
}
#matchou-chat-container #chat-messages-area {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
#matchou-chat-container .message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    position: relative;
}
#matchou-chat-container .message .timestamp {
    font-size: 10px;
    color: #ccc;
    display: block;
    margin-top: 5px;
    text-align: right;
}
#matchou-chat-container .message.received {
    background-color: #1f2a40;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
#matchou-chat-container .message.sent {
    background-color: #1f2a40;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* --- ÁREA DE INPUT --- */
#matchou-chat-container #chat-input-area {
    padding: 10px 15px;
    background-color: #15112e; 
    border-top: 1px solid #333;
    position: relative;
    min-height: 60px; 
    display: flex;
    align-items: center;
}
#matchou-chat-container #chat-input-form {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
}
/* Estilo do Input de Texto */
#matchou-chat-container #chat-input-form textarea {
    flex-grow: 1;
    background-color: #15112e;
    border: 1px solid #444;
    border-radius: 15px; 
    padding: 12px 15px;
    color: #f0f0f0;
    resize: none;
    font-size: 14px;
    height: 45px; 
    margin: 0; 
    line-height: 20px;
}
/* Grupo de Ícones à Esquerda */
.left-icons {
    display: flex;
    align-items: center;
    gap: 8px; 
}
/* Botões de Ação */
#matchou-chat-container .chat-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#matchou-chat-container .chat-action-btn img {
    height: 30px; 
    width: auto;
    display: block;
    opacity: 0.8;
    transition: opacity 0.2s;
}
#matchou-chat-container .chat-action-btn:hover img {
    opacity: 1.0;
}

/* --- MINI MENU FLUTUANTE DE OPÇÕES --- */
.chat-options-wrapper {
    position: relative;
}
#chat-options-menu {
    position: absolute;
    bottom: 60px; /* Acima do botão */
    left: 0;
    background-color: #1a1a2e;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 160px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    z-index: 1000;
}
.menu-option-btn {
    background: transparent;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    border-radius: 8px;
    transition: background 0.2s;
}
.menu-option-btn:hover {
    background-color: #2c2c2c;
}
.menu-option-btn img {
    width: 24px;
    height: 24px;
}
.menu-option-btn span {
    font-size: 14px;
}

#chat-back-btn {
    display: none; 
    background: none;
    border: none;
    color: #f0f0f0;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px 0 0;
    margin-left: -5px;
    opacity: 0.8;
}
#chat-back-btn:hover {
    opacity: 1;
}

.emoji-picker-container {
    position: absolute;
    bottom: 100%;
    left: 0; 
    transform: translateX(15px);
    margin-bottom: 10px;
    z-index: 10;
}

/* =============================================================== */
/* --- ESTILOS PARA A LOJINHA DE PRESENTES (MODAL) --- */
/* CORRIGIDO PARA CENTRALIZAR E REMOVER ERROS */
/* =============================================================== */
#gift-shop-modal,
#matchcoin-shop-modal { 
    display: none; /* Controlado pelo JS */
    position: fixed !important; /* Garante que fica fixo na tela */
    z-index: 10000; /* Z-index alto para ficar acima de tudo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Evita rolagem no fundo */
    background-color: rgba(0,0,0,0.7); /* Fundo escuro */
    color: #333;
}

#gift-shop-modal .modal-content,
#matchcoin-shop-modal .modal-content { 
    background-color: #fefefe;
    border: 1px solid #888;
    border-radius: 12px;
    padding: 20px;
    
    /* CENTRALIZAÇÃO PERFEITA */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0; 
    
    /* Tamanhos */
    width: 90%; 
    max-width: 500px;
    
    /* Proteção para listas grandes */
    max-height: 85vh; 
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

#gift-shop-modal .modal-header,
#matchcoin-shop-modal .modal-header { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

#gift-shop-modal .modal-body,
#matchcoin-shop-modal .modal-body {
    overflow-y: auto; /* Rolagem interna */
    flex-grow: 1;
    padding-right: 5px;
}

#gift-shop-modal .close-modal,
#matchcoin-shop-modal .close-modal { 
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

#gift-shop-modal .close-modal:hover,
#matchcoin-shop-modal .close-modal:hover { 
    color: #000;
}

/* LISTAGEM DE PRESENTES (Grid) */
#gift-list,
#matchcoin-package-list { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding-top: 10px;
}

.gift-item { 
    text-align: center;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    transition: transform 0.2s;
}
.gift-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border-color: #ddd;
}
.gift-item img { 
    max-width: 70px; height: 70px; object-fit: contain; margin-bottom: 5px; 
}
.gift-item .gift-name { font-weight: bold; margin: 5px 0; font-size: 14px; }
.gift-item .gift-cost { font-size: 12px; color: #666; margin-bottom: 5px; }
.gift-item .gift-reward { font-size: 11px; font-weight: bold; color: #27ae60; margin-bottom: 10px; }

.send-gift-btn,
.send-matchcoin-btn { 
    background-color: #5a2d82;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    font-size: 13px;
    font-weight: bold;
    transition: background 0.2s;
}
.send-gift-btn:hover,
.send-matchcoin-btn:hover {
    background-color: #402060;
}

/* =============================================================== */
/* --- ESTILOS DAS MENSAGENS ESPECIAIS --- */
/* =============================================================== */
.message.message-gift,
.message.message-matchcoin { 
    background-color: #2c3e50;
    border: 1px solid #3498db;
    width: 250px;
    max-width: 80%;
    padding: 15px;
    text-align: center;
}
.message-gift p,
.message-matchcoin p { 
    font-size: 13px; margin-top: 0; font-style: italic; 
}
.message-gift img,
.message-matchcoin img { 
    max-width: 100px; height: auto; margin: 10px 0; 
}
.message-gift strong,
.message-matchcoin strong { 
    display: block; font-size: 15px; 
}

.message.message-flirt {
    background-color: #4a2c50; 
    border: 1px solid #8e44ad; 
    width: 250px;
    max-width: 80%;
    padding: 15px;
    text-align: center;
}
.message-flirt p { font-size: 13px; margin-top: 0; font-style: italic; }
.message-flirt img { max-width: 50px; height: auto; margin: 10px 0; }
.message-flirt strong { display: block; font-size: 15px; }

/* =============================================================== */
/* --- ESTILOS DAS MENSAGENS DE FOTO (SIMPLIFICADO) --- */
/* =============================================================== */
.message.message-photo-normal {
    background: none; 
    padding: 5px;
    max-width: 300px; 
}
.message.message-photo-normal .chat-photo-message {
    width: 100%;
    height: auto;
    border-radius: 15px;
    display: block;
}
.message.message-photo-normal p { display: none; }
.message.message-photo-normal .timestamp {
    color: #fff;
    text-shadow: 0 0 3px rgba(0,0,0,0.7);
    position: absolute;
    bottom: 12px;
    right: 22px;
    font-size: 11px;
}

/* =============================================================== */
/* --- ESTILOS DO MURAL DE PRESENTES --- */
/* =============================================================== */
.matchou-gift-wall-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1100px;
    margin: 0 auto;
}

.gift-wall-card {
    background-color: #1a1a2e; 
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    color: #f0f0f0;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.gift-wall-card:hover {
    transform: translateY(-5px); 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.gift-wall-card .gift-wall-image {
    width: 74px; 
    height: 74px;
    object-fit: contain;
    margin-bottom: 10px;
}

.gift-wall-card .gift-wall-name {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin: 0 0 5px 0;
}

.gift-wall-card .gift-wall-sender {
    font-size: 13px;
    color: #aaa;
    margin: 0 0 5px 0;
}

.gift-wall-card .gift-wall-sender strong {
    color: #ccc;
}

.gift-wall-card .gift-wall-date {
    font-size: 12px;
    color: #888;
}

.matchou-message.no-gifts {
    background-color: #1a1a2e;
    border: 1px solid #333;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    color: #aaa;
}
.matchou-message.no-gifts h4 {
    color: #fff;
    margin-top: 0;
}

@media (max-width: 768px) {
    .matchou-gift-wall-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
    .gift-wall-card {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .matchou-gift-wall-container {
        gap: 10px;
        padding: 10px;
    }
}

/* =============================================================== */
/* --- RESPONSIVIDADE PARA CELULAR (CORREÇÃO FINAL DE LARGURA) --- */
/* =============================================================== */
@media (max-width: 768px) {
    
    /* 1. Ajuste do container principal no mobile */
    #matchou-chat-container {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0; 
        z-index: 1000;
        width: 100%; height: 100%; 
        margin: 0; border: none; border-radius: 0;
        flex-direction: column;
    }

    /* CORREÇÃO AQUI: Força a lista e a janela principal a terem 100% de largura */
    #matchou-chat-container #chat-user-list,
    #matchou-chat-container #chat-main-window {
        width: 100% !important; /* Estava 30% antes, por isso ficava espremido */
        height: 100%;
    }

    /* Esconde a lista de usuários quando o chat está aberto */
    #matchou-chat-container.chat-view-active #chat-user-list { display: none; }
    
    /* Mostra a janela principal quando o chat está ativo */
    #matchou-chat-container.chat-view-active #chat-main-window { display: flex; }
    
    /* Esconde a janela principal se estivermos vendo a lista */
    #matchou-chat-container:not(.chat-view-active) #chat-main-window { display: none; }

    /* Ajuste do container do Elementor para não atrapalhar */
    body .elementor-section.elementor-section-boxed > .elementor-container {
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Ajuste do Cabeçalho */
    #matchou-chat-container #chat-header {
        padding: 25px;
        min-height: 65px; 
    }

    /* Botão de voltar */
    #chat-back-btn { display: block; z-index: 2; margin-right: 10px; }

    /* Centraliza nome e foto no topo */
    #chat-header-profile-link {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }

    /* --- CORREÇÃO PRINCIPAL DOS ÍCONES DA BARRA INFERIOR --- */
    #matchou-chat-container .chat-action-btn {
        padding: 5px 4px;
    }

    #matchou-chat-container .chat-action-btn img {
        height: 40px !important; 
        width: 40px !important;  
        object-fit: contain;     
    }

    .left-icons { gap: 8px !important; }

    #matchou-chat-container #chat-input-area {
        min-height: 70px; 
        padding: 5px 10px;
        gap: 5px;
    }
    
    #matchou-chat-container #chat-input-form textarea {
        height: 45px;
        font-size: 16px; 
    }

    /* --- MENU POPUP FIXO NO MOBILE --- */
    #chat-options-menu {
        position: fixed !important;
        bottom: 80px !important; 
        left: 10px !important;
        width: 200px !important;
        z-index: 99999 !important;
        box-shadow: 0 0 50px rgba(0,0,0,0.8) !important;
        border: 1px solid #555 !important;
        background-color: #14263d !important;
    }
}

/* ========================================================================
 * CORREÇÃO DE FLERTES NO CHAT
 * Esconde o texto "alt" de imagens quebradas ou vazias para não duplicar o nome.
 * ======================================================================== */
/* Se a imagem do flerte estiver quebrada ou vazia, torne-a invisível/transparente */
.matchou-chat-message img[src=""],
.matchou-chat-message img:not([src]) {
    display: none !important;
}

/* Truque para esconder o ícone de imagem quebrada e o texto duplicado */
.matchou-chat-message img {
    font-size: 0; /* Esconde o texto ALT */
    color: transparent; /* Esconde a cor do texto */
    display: block; /* Garante que respeita margens */
    margin: 0 auto 5px auto; /* Centraliza */
}

/* Garante que imagens válidas apareçam corretamente */
.matchou-chat-message img[src^="http"] {
    display: block !important;
    font-size: inherit;
    color: inherit;
    width: 100px; /* Tamanho fixo para o flerte */
    height: 100px;
    object-fit: contain;
}