/* ==========================================
   EGAME MESSENGER (DM) SİSTEMİ
   ========================================== */
.eg-messenger-wrapper {
    display: flex;
    height: calc(100vh - 120px);
    background: rgba(15, 15, 17, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

/* Sol Tərəf - Çat Siyahısı */
.eg-msg-sidebar {
    width: 320px;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.eg-msg-search {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.eg-msg-search input {
    background: transparent;
    border: none;
    color: #fff;
    width: 100%;
    outline: none;
}

.eg-msg-search .material-icons { color: #888; }

.eg-msg-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.eg-msg-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

.eg-msg-item:hover { background: rgba(255, 255, 255, 0.05); }
.eg-msg-item.active { background: rgba(255, 215, 0, 0.1); border-left: 3px solid var(--accent); }

.eg-msg-avatar { position: relative; width: 45px; height: 45px; }
.eg-msg-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.eg-msg-info { flex: 1; overflow: hidden; }
.eg-msg-info h4 { margin: 0 0 4px 0; color: #fff; font-size: 14px; }
.eg-msg-info p { margin: 0; color: #888; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.eg-msg-item.unread .eg-msg-info h4 { color: var(--accent); }
.eg-msg-item.unread .eg-msg-info p { color: #fff; font-weight: 600; }

.eg-msg-time { font-size: 10px; color: #666; position: absolute; top: 12px; right: 12px; }
.eg-msg-badge { background: #ff4d4d; color: #fff; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 10px; position: absolute; right: 12px; top: 25px; }

/* Sağ Tərəf - Çat Pəncərəsi */
.eg-msg-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.eg-chat-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
}

.eg-chat-user {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: 0.2s;
    padding: 5px 10px;
    border-radius: 8px;
}
.eg-chat-user:hover { background: rgba(255, 255, 255, 0.05); }
.eg-chat-user img { width: 40px; height: 40px; border-radius: 50%; }
.eg-chat-user h3 { margin: 0; color: #fff; font-size: 16px; display: flex; align-items: center; gap: 5px; }
.eg-chat-user .verified-icon { font-size: 14px; color: #3498db; }
.eg-chat-user p { margin: 2px 0 0 0; color: #00ff88; font-size: 11px; font-weight: 600; }

.eg-chat-history {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-date-divider { text-align: center; margin: 15px 0; position: relative; }
.chat-date-divider span { background: #1a1a1a; padding: 5px 15px; border-radius: 20px; font-size: 11px; color: #666; z-index: 1; position: relative; }
.chat-date-divider::before { content: ''; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: rgba(255,255,255,0.05); z-index: 0; }

.msg-bubble {
    max-width: 65%;
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
    display: inline-block;
}

.msg-bubble.received {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.msg-bubble.sent {
    background: var(--accent);
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-weight: 600;
}

.msg-time { display: block; font-size: 10px; margin-top: 5px; opacity: 0.7; text-align: right; display: flex; justify-content: flex-end; align-items: center; gap: 4px;}
.msg-bubble.received .msg-time { color: #aaa; text-align: left; justify-content: flex-start;}
.read-tick { font-size: 12px; }

.eg-chat-input-area {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 15px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.eg-chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    color: #fff;
    outline: none;
    transition: 0.3s;
}
.eg-chat-input-area input:focus { border-color: var(--accent); background: rgba(0,0,0,0.5); }

.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--accent);
    border: none;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.send-btn:hover { transform: scale(1.05); }
.icon-btn { background: none; border: none; color: #888; cursor: pointer; transition: 0.2s; }
.icon-btn:hover { color: #fff; }




/* --- Çat Üç Nöqtə (Dropdown) Menyusu --- */
.eg-chat-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: rgba(20, 20, 22, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    width: 200px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    backdrop-filter: blur(15px);
    display: none; /* JS ilə açılıb bağlanacaq */
    flex-direction: column;
    z-index: 100;
    animation: fadeInDown 0.2s ease forwards;
}

.eg-chat-dropdown.show {
    display: flex;
}

.eg-chat-dropdown button {
    background: none;
    border: none;
    color: #ccc;
    padding: 10px 15px;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
}

.eg-chat-dropdown button .material-icons { font-size: 18px; }
.eg-chat-dropdown button:hover { background: rgba(255,255,255,0.05); color: #fff; }
.eg-chat-dropdown button.danger-text { color: #ff4d4d; }
.eg-chat-dropdown button.danger-text:hover { background: rgba(255, 77, 77, 0.1); }
.dropdown-divider { height: 1px; background: rgba(255,255,255,0.05); margin: 5px 0; }

/* --- Emoji Qutusu --- */
.eg-emoji-picker {
    position: absolute;
    bottom: 75px;
    left: 20px;
    background: rgba(20, 20, 22, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    backdrop-filter: blur(15px);
    display: none; /* JS ilə idarə olunur */
    z-index: 100;
    width: 220px;
}

.eg-emoji-picker.show { display: block; }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.emoji-item {
    font-size: 20px;
    text-align: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    transition: 0.2s;
}

.emoji-item:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}



/* ==========================================================================
   EGAME.AZ - MESAJLAR (MESSENGER) MOBİL UYĞUNLAŞDIRMASI
   ========================================================================== */
@media screen and (max-width: 768px) {
    
    /* 1. Messenger Ana Qutusu - Hündürlüyü kilitləyirik ki, daşıb getməsin */
    .eg-messenger-wrapper {
        flex-direction: column !important;
        height: calc(100dvh - 90px) !important; /* Ekranın sonuna yapışır */
        overflow: hidden !important; 
    }

    /* 2. SOL PANEL (Dostlar Siyahısı) - INSTAGRAM KİMİ YAN-YANA (HORIZONTAL) OLUR */
    .eg-msg-sidebar {
        width: 100% !important;
        height: auto !important;
        flex: none !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        background: rgba(10,10,12,0.9) !important;
    }

    .eg-msg-search { padding: 10px 15px !important; height: auto !important; }

    /* Siyahını yan-yana düzürük və barmaqla sürüşdürmək üçün ayarlayırıq */
    .eg-msg-list {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 10px !important;
        gap: 5px !important;
        scrollbar-width: none; /* Scrollbarı gizlədirik */
    }
    .eg-msg-list::-webkit-scrollbar { display: none; }

    /* Kartları dikinə yığcamlaşdırırıq */
    .eg-msg-item {
        flex-direction: column !important;
        padding: 8px !important;
        width: 70px !important;
        min-width: 70px !important;
        text-align: center !important;
        gap: 5px !important;
    }
    
    .eg-msg-item.active { border-left: none !important; background: rgba(255, 215, 0, 0.1) !important; border-radius: 12px !important; }
    .eg-msg-avatar { margin: 0 auto !important; }
    .eg-msg-info { width: 100% !important; }
    .eg-msg-info h4 { font-size: 11px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin:0 !important; }
    .eg-msg-info p, .eg-msg-time { display: none !important; } /* Səliqə üçün mobildə alt yazıları gizlədirik */

    /* 3. SAĞ PANEL (Çat Pəncərəsi) - HÜNDÜRLÜK KİLİDİ */
    .eg-msg-chat-area {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow: hidden !important; /* VACİB: Inputun qaçmasını əngəlləyir */
    }

    .eg-chat-history {
        flex: 1 !important;
        overflow-y: auto !important; /* Ancaq mesajlar sürüşəcək */
        padding: 15px !important;
    }
    
    .msg-bubble { max-width: 85% !important; font-size: 13px !important; }

    /* 4. İNPUT SAHƏSİ - EKRANIN ALTINA BƏRKİDİLİR */
    .eg-chat-input-area {
        flex-shrink: 0 !important; /* VACİB KOD: HEÇ VAXT KİÇİLMƏZ VƏ AŞAĞI QAÇMAZ */
        padding: 10px 15px !important;
        background: #0b0b0e !important;
        border-top: 1px solid rgba(255, 204, 0, 0.1) !important;
    }
    
    .eg-chat-input-area input { font-size: 14px !important; padding: 12px 15px !important; border-radius: 20px !important;}
    .send-btn { width: 42px !important; height: 42px !important; flex-shrink: 0 !important; border-radius: 50% !important; }
    
    /* Emoji Qutusu */
    .eg-emoji-picker { left: 10px !important; right: 10px !important; width: auto !important; bottom: 70px !important; }
}