/* Lista de Mensajes (Bandeja) */
.mensaje-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.mensaje-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.mensaje-item.sistema {
    border-left-color: #2a5c5d;
    background: #f0f7f7;
}

.mensaje-item.unread {
    font-weight: 600;
}

.mensaje-avatar {
    width: 50px;
    height: 50px;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 15px;
}

.mensaje-info h4 { margin: 0; color: #1e293b; font-size: 1rem; }
.mensaje-info p { margin: 4px 0 0; color: #64748b; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mensaje-fecha { font-size: 0.75rem; color: #94a3b8; }

/* --- MODAL DE CHAT --- */
#modal-chat {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: none; /* Se activa con flex desde JS */
    justify-content: center;
    align-items: center;
    z-index: 100000 !important; /* Por encima de todo */
}

/* Cuando JS lo activa */
#modal-chat.active-chat {
    display: flex !important;
}

.modal-content-chat {
    width: 95%;
    max-width: 450px;
    height: 85vh;
    background: white !important;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
}

/* Contenedor de burbujas */
#chat-mensajes-lista {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Burbujas */
.msg-bubble {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.msg-bubble.mio {
    align-self: flex-end;
    background: #2a5c5d !important;
    color: white !important;
    border-bottom-right-radius: 4px;
}

.msg-bubble.otro {
    align-self: flex-start;
    background: #e9ecef !important;
    color: #333 !important;
    border-bottom-left-radius: 4px;
}
