/**
 * Styles pour le système de messagerie instantanée
 */

/* Modal overrides - HARMONISÉ AVEC LES AUTRES MODALS */
.modal-dialog {
    max-width: 1200px !important;
    width: 90% !important;
    max-height: 90vh !important;
    margin: 1rem auto !important;
}

.modal-content {
    transform: scale(1.0) !important;
    max-height: 90vh !important;
    overflow: hidden !important;
    pointer-events: auto !important;
}

.modal-body {
    max-height: 75vh !important;
    overflow-y: auto !important;
    padding: 30px !important;
}

/* Container de messagerie - Suppression du décalage */
#messagingContent {
    margin: 0 !important;
    padding: 0 !important;
}

#messagingContent .container-fluid {
    padding: 0 1rem !important; /* Seulement padding horizontal */
    margin: 0 !important;
}

/* Container principal de la messagerie */
.messaging-container {
    display: flex !important;
    height: 100vh !important; /* Utiliser toute la hauteur viewport en mode dédié */
    min-height: 600px !important;
    max-height: 100vh !important;
    background: #1e1e1e !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Liste des conversations */
.conversations-sidebar {
    width: 320px !important;
    min-width: 320px !important;
    border-right: 1px solid #2d2d2d !important;
    display: flex !important;
    flex-direction: column !important;
    background: #252525 !important;
    flex-shrink: 0 !important;
}

.conversations-header {
    padding: 20px;
    border-bottom: 1px solid #2d2d2d;
    background: #2a2a2a;
}

.conversations-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #e0e0e0;
}

.conversations-search {
    padding: 15px;
}

.conversations-search input {
    width: 100%;
    padding: 10px 15px;
    background: #333;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
}

.conversations-search input:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.2);
}

.conversations-search input::placeholder {
    color: #888;
}

/* Liste des conversations */
.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.conversation-item {
    padding: 15px 20px;
    border-bottom: 1px solid #2d2d2d;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.conversation-item:hover {
    background: #2a2a2a;
}

.conversation-item.active {
    background: #00bcd4;
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

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

.conversation-name {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: 12px;
    color: #888;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 11px;
    color: #666;
    margin: 0;
}

.conversation-unread {
    background: #00bcd4;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

/* Zone de conversation principale */
.conversation-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
}

.conversation-header {
    padding: 20px;
    border-bottom: 1px solid #2d2d2d;
    background: #252525;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversation-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.conversation-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.conversation-header-details h6 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.conversation-header-details p {
    margin: 0;
    color: #888;
    font-size: 12px;
}

.conversation-actions {
    display: flex;
    gap: 8px;
}

.conversation-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

/* Zone de messages */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    gap: 10px;
    max-width: 70%;
}

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.received {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.message-content {
    background: #2a2a2a;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

.message.sent .message-content {
    background: #00bcd4;
    color: white;
}

.message.received .message-content {
    background: #2a2a2a;
    color: #fff;
}

.message-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    color: #888;
    margin: 4px 0 0 0;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Zone de saisie */
.message-input-area {
    padding: 20px;
    border-top: 1px solid #2d2d2d;
    background: #252525;
}

.message-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    background: #333;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
}

.message-input:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.2);
}

.message-input::placeholder {
    color: #888;
}

.send-button {
    background: #00bcd4;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.send-button:hover {
    background: #0097a7;
}

.send-button:disabled {
    background: #666;
    cursor: not-allowed;
}

/* Indicateur de frappe */
.typing-indicator {
    padding: 8px 20px;
    color: #888;
    font-size: 12px;
    font-style: italic;
}

/* État vide */
.empty-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    text-align: center;
    padding: 40px;
}

.empty-conversation i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-conversation h5 {
    margin: 0 0 8px 0;
    color: #ccc;
}

.empty-conversation p {
    margin: 0;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .messaging-container {
        height: calc(100vh - 60px);
        border-radius: 0;
    }
    
    .conversations-sidebar {
        width: 280px;
        min-width: 280px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .conversation-header {
        padding: 15px;
    }
    
    .messages-area {
        padding: 15px;
    }
    
    .message-input-area {
        padding: 15px;
    }
}