/* ====================================================================
   💬 CHAT.CSS - EKİP İÇİ SOHBET & MESAJLAŞMA (WHATSAPP TARZI)
   ==================================================================== */

.chat-modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chat-modal-content {
    height: 100% !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: none !important;
    border: 0 !important;
}

.chat-app-container {
    display: flex;
    height: 100%;
    overflow: hidden;
    background: #f0f2f5;
}

/* --- SOL PANEL: KİŞİLER & KANALLAR --- */
.chat-sidebar {
    width: 360px;
    min-width: 300px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-sidebar-header {
    padding: 16px;
    background: #ffffff;
    border-bottom: 1px solid #edf2f7;
}

.chat-search-wrap {
    position: relative;
}

.chat-search-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.chat-search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.chat-search-input:focus {
    background: #ffffff;
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.chat-contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.chat-contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s ease;
    user-select: none;
}

.chat-contact-item:hover {
    background: #f1f5f9;
}

.chat-contact-item.active {
    background: #e0e7ff !important;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    flex-shrink: 0;
    margin-right: 12px;
    position: relative;
}

.chat-avatar.group-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chat-contact-info {
    flex: 1;
    min-width: 0;
}

.chat-contact-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.chat-contact-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-contact-time {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-left: 6px;
    white-space: nowrap;
}

.chat-contact-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-contact-lastmsg {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.chat-badge {
    background: #ef4444;
    color: #ffffff;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 7px;
    min-width: 18px;
    text-align: center;
}

/* --- SAĞ PANEL: SOHBET EKRANI --- */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #efeae2;
    background-image: radial-gradient(#d1d7db 1px, transparent 1px);
    background-size: 20px 20px;
}

.chat-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 5;
}

.chat-header-user {
    display: flex;
    align-items: center;
}

.chat-header-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 0;
}

.chat-header-status {
    font-size: 0.75rem;
    color: #10b981;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Mesaj Balonları & Hover Aksiyonları */
.chat-bubble-wrap {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
    margin-bottom: 2px;
}

.chat-bubble-wrap.outbound {
    justify-content: flex-end;
}

.chat-bubble-wrap.inbound {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 72%;
    padding: 8px 12px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-size: 0.92rem;
    line-height: 1.45;
    word-break: break-word;
}

.chat-bubble-wrap.outbound .chat-bubble {
    background: #d9fdd3;
    color: #111b21;
    border-top-right-radius: 2px;
}

.chat-bubble-wrap.inbound .chat-bubble {
    background: #ffffff;
    color: #111b21;
    border-top-left-radius: 2px;
}

/* Üzerine gelince açılan aksiyon butonları */
.chat-msg-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    padding: 0 6px;
}

.chat-bubble-wrap:hover .chat-msg-actions {
    opacity: 1;
}

.chat-bubble-wrap.outbound .chat-msg-actions {
    order: -1;
}

.chat-bubble-wrap.inbound .chat-msg-actions {
    order: 1;
}

.chat-msg-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #64748b;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.15s ease;
}

.chat-msg-btn:hover {
    color: #0f172a;
    background: #f8fafc;
    transform: scale(1.1);
}

.chat-msg-btn.delete-btn:hover {
    color: #ef4444;
    background: #fee2e2;
    border-color: #fca5a5;
}

.chat-msg-btn.edit-btn:hover {
    color: #3b82f6;
    background: #dbeafe;
    border-color: #93c5fd;
}

.chat-sender-name {
    font-size: 0.75rem;
    font-weight: bold;
    color: #0284c7;
    margin-bottom: 3px;
}

.chat-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 4px;
    margin-left: 12px;
    float: right;
}

.chat-edited-badge {
    font-size: 0.65rem;
    font-style: italic;
    color: #64748b;
    margin-right: 2px;
}

/* Ekler */
.chat-attachment-img {
    max-width: 260px;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: transform 0.15s ease;
    object-fit: cover;
    display: block;
}

.chat-attachment-img:hover {
    transform: scale(1.02);
}

.chat-doc-card {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    text-decoration: none;
    color: inherit;
    gap: 8px;
}

.chat-doc-card:hover {
    background: rgba(0,0,0,0.08);
}

.chat-doc-icon {
    font-size: 1.5rem;
    color: #6366f1;
}

.chat-doc-name {
    font-size: 0.8rem;
    font-weight: 600;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-doc-size {
    font-size: 0.7rem;
    color: #64748b;
}

/* Alt Mesaj Yazma Çubuğu */
.chat-footer {
    background: #f0f2f5;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e2e8f0;
}

.chat-editing-banner {
    display: flex;
    align-items: center;
    background: #e0f2fe;
    border-left: 3px solid #0284c7;
    padding: 7px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: #0369a1;
}

.chat-staged-files {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 8px;
}

.chat-staged-chip {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 0.78rem;
    gap: 6px;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.chat-attach-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #64748b;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-attach-btn:hover {
    color: #3b82f6;
    background: #e2e8f0;
}

.chat-textarea {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.92rem;
    resize: none;
    max-height: 120px;
    min-height: 42px;
    line-height: 1.4;
    outline: none;
}

.chat-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.35);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #1ebc59;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    text-align: center;
    padding: 40px;
}

.chat-empty-state i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 16px;
}

/* ====================================================================
   📱 MOBİL UYUM (FULLSCREEN / TAM EKRAN DENEYİMİ)
   ==================================================================== */
@media (max-width: 768px) {
    #modalTeamChat .modal-dialog,
    .chat-modal-dialog {
        max-width: 100% !important;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #modalTeamChat .modal-content,
    .chat-modal-content {
        height: 100% !important;
        height: 100dvh !important;
        border-radius: 0 !important;
        max-height: none !important;
        border: 0 !important;
    }

    .chat-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        height: 100% !important;
    }

    .chat-main {
        display: none !important;
        width: 100% !important;
        height: 100% !important;
    }

    .chat-app-container.conversation-open .chat-sidebar {
        display: none !important;
    }

    .chat-app-container.conversation-open .chat-main {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
    }

    .chat-bubble {
        max-width: 86% !important;
    }

    /* Mobilde dokunmatik kullanım için aksiyon butonlarını her zaman görünür yap */
    .chat-msg-actions {
        opacity: 0.8 !important;
    }

    .chat-msg-btn {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.7rem !important;
    }
}

/* --- SOL MENÜ (SIDEBAR) OKUNMAMIŞ ROZETİ --- */
.nav-link-custom {
    position: relative;
}

/* Genişletilmiş / Hover / Pinned Menü Durumu */
#sidebar:hover .nav-link-custom .chat-nav-badge,
body.sidebar-pinned .nav-link-custom .chat-nav-badge,
#sidebar.mobile-show .nav-link-custom .chat-nav-badge {
    position: static !important;
    margin-left: auto !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    padding: 2px 7px !important;
    border-radius: 10px !important;
    line-height: 1.3 !important;
    display: inline-block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3) !important;
}

/* Daraltılmış / Collapsed Menü Durumu (İkonun sağ üst köşesinde rozet) */
#sidebar:not(:hover):not(.mobile-show) .nav-link-custom .chat-nav-badge {
    position: absolute !important;
    top: 10px !important;
    left: 40px !important;
    margin: 0 !important;
    font-size: 0.65rem !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 4px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
    z-index: 10 !important;
}

.dark-mode #sidebar:not(:hover):not(.mobile-show) .nav-link-custom .chat-nav-badge {
    border-color: #15181e !important;
}

.nav-link-custom .chat-nav-badge.d-none {
    display: none !important;
}

