

/* ============================================================
   CSS GLOBAL DU CHAT - WISDAK (Version Finale)
   ============================================================ */

/* --- 1. CONTENEUR PRINCIPAL --- */
#chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- 2. HEADER (En haut) --- */
.chat-header {
    flex: 0 0 auto; /* Reste à sa taille */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 10;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-width: 0;
}

.chat-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.chat-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}

.chat-user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.chat-username {
    font-weight: 600;
    font-size: 15px;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.chat-status {
    font-size: 12px;
    color: #6b7280;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-header-btn {
    background: none;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 3. ZONE DES MESSAGES (Au milieu, prend tout l'espace) --- */
.chat-messages {
    flex: 1 1 auto; /* ⚡ Prend tout l'espace disponible entre le header et le footer */
    overflow-y: auto; /* Permet le défilement */
    padding: 15px;
    box-sizing: border-box;
}

/* --- 4. FOOTER (En bas) --- */
.chat-footer {
    flex: 0 0 auto; /* Reste à sa taille */
    background: #ffffff;
    width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
}

.chat-footer-inner {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    background: #f3f4f6;
    border-radius: 24px;
    padding: 4px 8px;
    width: 100%;
    box-sizing: border-box;
}

.chat-attach-btn, .chat-mic-btn, .chat-send-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-send-btn { color: #2c7be5; font-size: 1.1rem; }

.chat-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-textarea {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px 5px;
    resize: none;
    outline: none;
    font-size: 0.95rem;
    max-height: 120px;
    line-height: 1.4;
    box-sizing: border-box;
}

/* --- 5. BULLES DE MESSAGES --- */
.chat-message-wrapper {
    padding: 3px 0;
}

.chat-message-row {
    display: flex;
    width: 100%;
    padding: 2px 0;
    box-sizing: border-box;
}

.chat-message-row.mine { justify-content: flex-end; }
.chat-message-row.other { justify-content: flex-start; }

.chat-bubble-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 85%;
}

.chat-message-row.mine .chat-bubble-wrapper {
    flex-direction: row-reverse; 
}

.chat-bubble {
    word-break: break-word; 
    overflow-wrap: break-word;
    white-space: normal;
    min-width: 50px;
    padding: 8px 14px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    line-height: 1.4;
    font-size: 0.95rem;
    cursor: pointer;
}

.chat-bubble.bubble-mine {
    background: linear-gradient(135deg, #2c7be5, #6c5ce7);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.bubble-other {
    background: #ffffff;
    color: #1a202c;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.chat-bubble-content {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* --- 6. HEURE ET STATUT (VUS) --- */
.chat-time {
    font-size: 0.65rem;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 3px;
    opacity: 0.9;
}

/* ⚡ Messages envoyés : Blanc */
.chat-message-row.mine .chat-time {
    justify-content: flex-end;
    color: #ffffff !important;
}

.chat-message-row.mine .view-indice {
    color: #ffffff !important;
}

/* ⚡ Messages reçus : Noir */
.chat-message-row.other .chat-time {
    justify-content: flex-start;
    color: #1a202c !important;
}

.chat-message-row.other .view-indice {
    color: #1a202c !important;
}

.view-indice {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
    font-size: 0.55rem;
}

/* --- 7. BOUTON OPTIONS (3 POINTS) --- */
.chat-options-wrapper {
    flex-shrink: 0;
    visibility: hidden; 
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.chat-message-row.active .chat-options-wrapper {
    visibility: visible;
    opacity: 1;
}

.chat-options-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0;
}

/* --- CORRECTION CSS APPELS WEBRTC --- */
.call-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 10000; display: flex; align-items: center; justify-content: center;
}
.call-container {
    position: relative; width: 100%; max-width: 800px; height: 80vh;
    display: flex; align-items: center; justify-content: center;
}
#remote-video {
    width: 100%; height: 100%; object-fit: cover; border-radius: 12px;
}
#local-video {
    position: absolute; bottom: 20px; right: 20px; width: 120px; height: 160px;
    object-fit: cover; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.call-controls {
    position: absolute; bottom: -60px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 20px;
}
.call-controls button {
    width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,0.2); color: #fff; font-size: 1.2rem;
    transition: all 0.2s;
}
.call-controls button:hover { background: rgba(255,255,255,0.4); }
.call-controls .end-call { background: #ef4444; }
.call-controls .end-call:hover { background: #dc2626; }

.incoming-call-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 10001; display: flex; align-items: center; justify-content: center;
}
.incoming-call-box {
    background: #fff; padding: 30px; border-radius: 16px; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.incoming-call-box p { font-size: 1.2rem; margin-bottom: 20px; }
.incoming-call-box button { margin: 0 10px; padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; }

/* --- CORRECTION CSS ENREGISTREMENT AUDIO --- */
.chat-mic-btn.recording {
    background: #ef4444 !important;
    color: #fff !important;
    border-radius: 50px !important; /* Plus arrondi */
    padding: 0 15px !important;    /* Plus aéré */
    width: auto !important;        /* S'adapte au contenu */
    min-width: 60px;
    animation: pulse-rec 1s infinite;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-mic-btn.recording .rec-time {
    font-size: 12px;
    font-weight: bold;
    margin-left: 4px;
}

@keyframes pulse-rec {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

#audio-visualizer {
    position: absolute !important;
    right: 80px !important;   /* Plus à gauche pour ne pas toucher le bouton */
    bottom: 10px !important;
    width: 120px !important;
    height: 40px !important;
    border-radius: 8px !important;
    background: #e5e7eb !important;
}

/* --- SIGNAL DE RÉPONSE --- */
.reply_msg_slctd {
    background: #e0f2fe;
    border-left: 4px solid #2c7be5;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #0369a1;
}
.reply_msg_slctd button {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
}



/* ============================================================
   CSS GLOBAL DU CHAT - WISDAK (Version Finale + Ajouts)
   ============================================================ */

/* --- 1. CONTENEUR PRINCIPAL --- */
#chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- 2. HEADER (En haut) --- */
.chat-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 10;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-width: 0;
}

.chat-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.chat-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}

.chat-user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.chat-username {
    font-weight: 600;
    font-size: 15px;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.chat-status {
    font-size: 12px;
    color: #6b7280;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-header-btn {
    background: none;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 3. ZONE DES MESSAGES --- */
.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 15px;
    box-sizing: border-box;
}

/* --- 4. FOOTER (En bas) --- */
.chat-footer {
    flex: 0 0 auto;
    background: #ffffff;
    width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
}

.chat-footer-inner {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    background: #f3f4f6;
    border-radius: 24px;
    padding: 4px 8px;
    width: 100%;
    box-sizing: border-box;
}

.chat-attach-btn, .chat-mic-btn, .chat-send-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-send-btn { color: #2c7be5; font-size: 1.1rem; }

.chat-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-textarea {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px 5px;
    resize: none;
    outline: none;
    font-size: 0.95rem;
    max-height: 120px;
    line-height: 1.4;
    box-sizing: border-box;
}

/* --- 5. BULLES DE MESSAGES --- */
.chat-message-wrapper {
    padding: 3px 0;
}

.chat-message-row {
    display: flex;
    width: 100%;
    padding: 2px 0;
    box-sizing: border-box;
}

.chat-message-row.mine { justify-content: flex-end; }
.chat-message-row.other { justify-content: flex-start; }

.chat-bubble-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 85%;
}

.chat-message-row.mine .chat-bubble-wrapper {
    flex-direction: row-reverse; 
}

.chat-bubble {
    word-break: break-word; 
    overflow-wrap: break-word;
    white-space: normal;
    min-width: 50px;
    padding: 8px 14px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    line-height: 1.4;
    font-size: 0.95rem;
    cursor: pointer;
}

.chat-bubble.bubble-mine {
    background: linear-gradient(135deg, #2c7be5, #6c5ce7);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.bubble-other {
    background: #ffffff;
    color: #1a202c;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.chat-bubble-content {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* --- 6. HEURE ET STATUT (VUS) --- */
.chat-time {
    font-size: 0.65rem;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 3px;
    opacity: 0.9;
}

.chat-message-row.mine .chat-time {
    justify-content: flex-end;
    color: #ffffff !important;
}

.chat-message-row.mine .view-indice {
    color: #ffffff !important;
}

.chat-message-row.other .chat-time {
    justify-content: flex-start;
    color: #1a202c !important;
}

.chat-message-row.other .view-indice {
    color: #1a202c !important;
}

.view-indice {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
    font-size: 0.55rem;
}

/* --- 7. BOUTON OPTIONS (3 POINTS) --- */
.chat-options-wrapper {
    flex-shrink: 0;
    visibility: hidden; 
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.chat-message-row.active .chat-options-wrapper {
    visibility: visible;
    opacity: 1;
}

.chat-options-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0;
}

/* --- CORRECTION CSS APPELS WEBRTC --- */
.call-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 10000; display: flex; align-items: center; justify-content: center;
}
.call-container {
    position: relative; width: 100%; max-width: 800px; height: 80vh;
    display: flex; align-items: center; justify-content: center;
}
#remote-video {
    width: 100%; height: 100%; object-fit: cover; border-radius: 12px;
}
#local-video {
    position: absolute; bottom: 20px; right: 20px; width: 120px; height: 160px;
    object-fit: cover; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.call-controls {
    position: absolute; bottom: -60px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 20px;
}
.call-controls button {
    width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,0.2); color: #fff; font-size: 1.2rem;
    transition: all 0.2s;
}
.call-controls button:hover { background: rgba(255,255,255,0.4); }
.call-controls .end-call { background: #ef4444; }
.call-controls .end-call:hover { background: #dc2626; }

.incoming-call-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 10001; display: flex; align-items: center; justify-content: center;
}
.incoming-call-box {
    background: #fff; padding: 30px; border-radius: 16px; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.incoming-call-box p { font-size: 1.2rem; margin-bottom: 20px; }
.incoming-call-box button { margin: 0 10px; padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; }

/* --- CORRECTION CSS ENREGISTREMENT AUDIO --- */
.chat-mic-btn.recording {
    background: #ef4444 !important;
    color: #fff !important;
    border-radius: 50px !important;
    padding: 0 15px !important;
    width: auto !important;
    min-width: 60px;
    animation: pulse-rec 1s infinite;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-mic-btn.recording .rec-time {
    font-size: 12px;
    font-weight: bold;
    margin-left: 4px;
}

@keyframes pulse-rec {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

#audio-visualizer {
    position: absolute !important;
    right: 80px !important;
    bottom: 10px !important;
    width: 120px !important;
    height: 40px !important;
    border-radius: 8px !important;
    background: #e5e7eb !important;
}

/* --- SIGNAL DE RÉPONSE --- */
.reply_msg_slctd {
    background: #e0f2fe;
    border-left: 4px solid #2c7be5;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #0369a1;
}
.reply_msg_slctd button {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
}

/* ============================================================
   ⚡ AJOUTS (Séparateurs, Recherche, Dropdown, etc.)
   ============================================================ */

/* --- 1. SÉPARATEURS DE DATE --- */
.chat-date-separator {
    text-align: center;
    margin: 16px 0 8px;
    clear: both;
}
.chat-date-separator span {
    display: inline-block;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* --- 2. STATUT D'ENVOI --- */
.msg-status {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    vertical-align: middle;
    line-height: 1;
}
.msg-status-pending {
    opacity: .55;
    color: #94a3b8;
}
.chat-message-row.mine .msg-status-pending {
    color: rgba(255,255,255,.75) !important;
}
.msg-status-failed {
    color: #ef4444;
    cursor: pointer;
}
.msg-status-failed:hover { text-decoration: underline; }

/* --- 3. ALIGNEMENT DES MÉDIAS --- */
.chat-bubble-content img,
.chat-bubble-content video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}
.chat-message-row.mine .chat-bubble-content img,
.chat-message-row.mine .chat-bubble-content video {
    margin-left: auto;
}
.chat-message-row.other .chat-bubble-content img,
.chat-message-row.other .chat-bubble-content video {
    margin-right: auto;
}
.chat-bubble-content audio {
    width: 100%;
    max-width: 260px;
    margin-top: 4px;
}

/* --- 4. PANNEAU DE RECHERCHE --- */
#chat-search-panel {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    animation: slideDown .18s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chat-search-inner { display: flex; align-items: center; gap: 8px; }
#chat-search-input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    background: #fff;
    transition: border-color .15s ease;
}
#chat-search-input:focus { border-color: #2c7be5; box-shadow: 0 0 0 3px rgba(44,123,229,.15); }
.chat-search-close {
    background: none; border: none; color: #64748b; cursor: pointer;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.chat-search-close:hover { background: #e2e8f0; }
#chat-search-results { margin-top: 6px; font-size: 12px; color: #64748b; min-height: 16px; }

/* --- 5. SURLIGNAGE RECHERCHE --- */
.chat-message-wrapper.search-match .chat-bubble { outline: 2px solid #fbbf24; outline-offset: 2px; }
.chat-message-wrapper.search-current .chat-bubble { outline: 2px solid #f59e0b; background: #fef3c7; transition: background .2s; }
.chat-message-wrapper.search-current .chat-bubble.bubble-mine { background: #fbbf24; color: #1f2937; }

/* --- 6. SURLIGNAGE RÉPONSE --- */
.msg_reply {
    background: rgba(0,0,0,.06);
    border-left: 3px solid #2c7be5;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: .85em;
    cursor: pointer;
    opacity: .9;
}
.chat-message-wrapper.highlight-reply .chat-bubble {
    outline: 2px solid #2c7be5;
    outline-offset: 2px;
    transition: outline .2s;
}

/* --- 7. LISTE DES CONVERSATIONS (chat.list.php) --- */
.chat-list-wrapper { display: flex; flex-direction: column; height: 100%; background: #fff; }
.chat-list-header { padding: 12px 16px; border-bottom: 1px solid #e5e7eb; background: #fff; }
.chat-list-title { font-weight: 600; font-size: 15px; color: #1f2937; display: inline-flex; align-items: center; gap: 6px; }
.chat-search-wrapper { position: relative; min-width: 200px; }
.chat-search-wrapper .search-input {
    width: 100%; padding: 8px 34px 8px 14px; border: 1px solid #cbd5e1;
    border-radius: 20px; outline: none; font-size: 13px; background: #f8fafc;
}
.chat-search-wrapper .search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.chat-action-btn { width: 34px; height: 34px; border-radius: 50%; border: none; background: #f1f5f9; color: #475569; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chat-action-btn.primary { background: #2c7be5; color: #fff; }

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

/* ⚡ CORRECTION DU DROPDOWN */
.chat-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 10px 16px; border: none; background: transparent; text-align: left; cursor: pointer;
    position: relative; border-bottom: 1px solid #f1f5f9;
    z-index: 1; /* Important pour que le menu passe au-dessus */
}
.chat-item:hover { background: #f8fafc; }
.chat-item.unread { background: #eff6ff; }
.chat-item.unread .chat-name { font-weight: 700; }

.chat-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-content-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-name { font-weight: 600; font-size: 14px; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 11px; color: #94a3b8; flex-shrink: 0; }
.chat-preview-wrapper { min-width: 0; }
.chat-preview { display: block; font-size: 13px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-unread-badge { background: #2c7be5; color: #fff; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; }

/* ⚡ MENU CONTEXTUEL */
.chat-item-options {
    position: relative;
    z-index: 100; /* Force le menu à passer au-dessus des autres éléments */
}
.chat-item-options .dropdown-menu {
    z-index: 1050 !important;
    position: absolute !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.chat-online-dot {
    position: absolute; bottom: 0; right: 0; width: 12px; height: 12px;
    border-radius: 50%; border: 2px solid #fff;
    background: #cbd5e1; /* Gris par défaut (hors ligne) */
}
.chat-online-dot.online { background: #22c55e; } /* Vert */
.chat-online-dot.offline { background: #cbd5e1; } /* Gris */

/* --- 8. MODAL CONVERSATIONS BLOQUÉES --- */
.chat-block-modal {
    position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 10500;
    display: none; align-items: center; justify-content: center; padding: 16px;
}
.chat-block-modal.active { display: flex; }
.chat-block-modal-content {
    background: #fff; border-radius: 14px; width: 100%; max-width: 480px; max-height: 80vh;
    display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); overflow: hidden;
}
.chat-block-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #e5e7eb; }
.chat-block-modal-header h5 { margin: 0; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.chat-block-modal-close { width: 32px; height: 32px; border-radius: 50%; border: none; background: #f1f5f9; color: #475569; cursor: pointer; }
.chat-block-modal-body { flex: 1; overflow-y: auto; padding: 12px 18px 18px; }

/* --- 9. ÉTAT VIDE --- */
.empty-state { text-align: center; padding: 48px 20px; color: #64748b; }
.empty-state-icon { font-size: 42px; color: #cbd5e1; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: #1f2937; margin-bottom: 4px; }
.empty-state-subtitle { font-size: 13px; margin-bottom: 16px; }
.empty-state-btn { background: #2c7be5; color: #fff; border: none; padding: 10px 18px; border-radius: 10px; cursor: pointer; font-weight: 600; }

.chat-temp-msg {
    opacity: 0.7;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 0.7; transform: translateY(0); }
}