/* Variables CSS */
:root {
    --primary-color: #64B5F6;
    --primary-dark: #1a56db;
    --primary-light: #B3E5FC;
    --secondary-color: #A5D6A7;
    --secondary-dark: #81C784;
    --secondary-light: #E8F5E9;
    --accent-color: #FF6B6B;
    --text-dark: #2C3E50;
    --text-light: #7F8C8D;
    --background: #f7f5f0;
    --white: #FFFFFF;
    --border: #E1E8ED;
    --success: #27AE60;
    --warning: #F39C12;
    --error: #E74C3C;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    
    font-family: 'DM Sans', 'Segoe UI', sans-serif; /* sur body */
    background-color: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Layout général */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation améliorée */
.navbar {
    background: var(--primary-dark);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-brand img.logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    max-width: 150px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent; /* AUCUN FOND */
    color: var(--white);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
    border: none; /* AUCUNE BORDURE */
}


.nav-link i {
    margin-right: 6px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1); /* FOND TRÈS SUBTIL AU SURVOL */
    transform: translateY(-1px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--white);
    font-weight: 500;
    padding: 0.5rem;
    background: transparent; /* AUCUN FOND */
    border-radius: var(--radius-sm);
    border: none; /* AUCUNE BORDURE */
}

/* Cartes de statistiques améliorées */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    flex-shrink: 0;
}

.stat-icon.clients { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); }
.stat-icon.experts { background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark)); }
.stat-icon.orders { background: linear-gradient(135deg, var(--accent-color), #FF5252); }
.stat-icon.revenue { background: linear-gradient(135deg, var(--success), #229954); }

.stat-info h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-dark);
}

.stat-info p {
    margin: 0.25rem 0 0 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

.stat-trend {
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.trend-positive { color: var(--success); }
.trend-negative { color: var(--error); }

/* Interface de chat améliorée */
.chat-interface {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 0;
    height: 70vh;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.conversation-list {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: var(--white);
}

.conversation-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.conversation-item:hover {
    background: var(--background);
}

.conversation-item.active {
    background: var(--primary-light);
    border-right: 3px solid var(--primary-color);
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: bold;
    flex-shrink: 0;
}

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

.conversation-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.conversation-preview {
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 1rem 1.5rem;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-user-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.status-online { color: var(--success); }
.status-offline { color: var(--text-light); }
.status-typing { color: var(--primary-color); }

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--background);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    position: relative;
    animation: messageSlide 0.3s ease;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.5rem;
}

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

.message-sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    position: relative;
}

.message-sent::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--primary-dark);
    transform: rotate(-20deg);
}

.message-received {
    align-self: flex-start;
    background: linear-gradient(135deg, var(--white), #f8f9fa);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-md);
    position: relative;
}

.message-received::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--border);
    transform: rotate(20deg);
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
    text-align: right;
}

.chat-input-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--white);
}

.chat-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    max-height: 120px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Boutons améliorés */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary-dark);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-error {
    background: var(--error);
    color: var(--white);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.service-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.service-buttons .btn {
    flex: 1;
    min-width: 0; /* Permet aux boutons de se réduire uniformément */
}

/* Pour les écrans très petits */
@media (max-width: 480px) {
    .service-buttons {
        flex-direction: column;
    }
}

/* Messages flash améliorés */
.flash-messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.flash-message {
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.flash-success {
    background: var(--success);
    color: var(--white);
}

.flash-warning {
    background: var(--warning);
    color: var(--white);
}

.flash-error {
    background: var(--error);
    color: var(--white);
}

.flash-info {
    background: var(--primary-color);
    color: var(--white);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* États de chargement */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-light);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Badges et tags */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #D5F4E6; color: var(--success); }
.badge-warning { background: #FDEBD0; color: var(--warning); }
.badge-error { background: #FADBD8; color: var(--error); }

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Responsive amélioré */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    .chat-interface {
        grid-template-columns: 300px 1fr;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .chat-interface {
        grid-template-columns: 1fr;
        height: 80vh;
    }

    .conversation-list {
        display: none;
    }

    .conversation-list.mobile-open {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
        background: var(--white);
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .message {
        max-width: 85%;
    }

    .flash-messages {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .nav-brand span {
        display: none;
    }

    .nav-links {
        gap: 0.75rem;
    }

    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .chat-header, .chat-input-container {
        padding: 1rem;
    }

    .chat-messages {
        padding: 1rem;
    }
}



/* Cloche de notifications */

/* ============================================ */
/* STYLES POUR LES NOTIFICATIONS - CORRIGÉ */
/* ============================================ */

.notification-container {
    position: relative;
    display: inline-block;
}

.notification-wrapper {
    position: relative;
}

.notification-bell {
    position: relative;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent !important; /* AUCUN FOND */
    color: var(--white) !important;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
    border: none; /* AUCUNE BORDURE */
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.1) !important; /* FOND TRÈS SUBTIL AU SURVOL */
    transform: translateY(-1px);
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #0bbd13;
    color: white;
    min-width: 20px;
    height: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    line-height: 1;
    padding: 0;
    transition: all 0.3s ease;
}

.notification-badge:not([data-count="0"]):not([data-count="1"]):not([data-count="2"]):not([data-count="3"]):not([data-count="4"]):not([data-count="5"]):not([data-count="6"]):not([data-count="7"]):not([data-count="8"]):not([data-count="9"]) {
    min-width: 24px;
    height: 24px;
    font-size: 0.7rem;
}

.notification-bell:hover .notification-badge {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}@keyframes pulse-glow {
    0% { transform: scale(1); box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3); }
    50% { transform: scale(1.1); box-shadow: 0 4px 16px rgba(231, 76, 60, 0.6); }
    100% { transform: scale(1); box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3); }
}

.notification-badge.pulse {
    animation: pulse-glow 0.6s ease-in-out;
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    margin-top: 10px;
}

.unread-badge-small { /* BADGE DANS LA LISTE DE NOTIFICATIONS */
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border-radius: 12px;
    min-width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 0 6px;
    border: 1.5px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.unread-badge { /* BADGE DANS LA LISTE DES UTILISATEURS */
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.notification-header h4 {
    margin: 0;
    color: #495057;
    font-size: 1.1em;
}

.close-notifications {
    cursor: pointer;
    font-size: 1.5em;
    color: #6c757d;
    line-height: 1;
    background: none;
    border: none;
    padding: 0;
}

.close-notifications:hover {
    color: #495057;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background 0.2s ease;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: #f0f7ff;
    border-left: 3px solid #0d6efd;
}

.notification-sender {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.notification-preview {
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.75em;
    color: #adb5bd;
}

.notification-footer {
    padding: 12px 20px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

/* INDICATEUR VISUEL POUR NOTIFICATIONS NON LUES */
.notification-item {
    position: relative;
    padding: 12px 15px 12px 40px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #f8fafc;
    border-left: 4px solid #3498db;
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(52, 152, 219, 0.4);
}

.view-all {
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.view-all:hover {
    text-decoration: underline;
}

.notification-empty {
    padding: 30px 20px;
    text-align: center;
    color: #6c757d;
}

.notification-empty i {
    font-size: 2em;
    margin-bottom: 10px;
    opacity: 0.5;
}

.notification-loading {
    padding: 30px 20px;
    text-align: center;
    color: #6c757d;
}

.notification-loading i {
    font-size: 1.5em;
    margin-bottom: 10px;
}

/* Animation pour le badge */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notification-badge.has-notifications {
    animation: pulse 1s ease-in-out;
}

/* ============================================ */
/* STYLES SPÉCIFIQUES AU CHAT - FUSIONNÉS */
/* ============================================ */

/* Page de chat */
.chat-page {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: calc(100vh - 80px);
}

.chat-container {
    display: flex;
    height: calc(100vh - 120px);
    gap: 20px;
}

/* Colonne de gauche */
.left-column {
    flex: 1;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}

.left-column-header {
    background: var(--primary-dark);
    color: var(--white);
    padding: 20px;
    text-align: center;
}

.left-column-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafbfc;
}

/* Styles pour la colonne gauche */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dark);
}

.welcome-message i {
    font-size: 3.5em;
    margin-bottom: 20px;
    color: var(--text-light);
    opacity: 0.8;
}

.welcome-message h2 {
    margin-bottom: 15px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1.4em;
}

.welcome-message p {
    line-height: 1.6;
    color: var(--text-light);
    max-width: 400px;
    margin: 0 auto;
    font-size: 0.95em;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    background: var(--white);
}

.user-item:hover {
    background: var(--background);
    transform: translateX(3px);
    box-shadow: var(--shadow-md);
}

.user-item.active {
    background: #e7f1ff;
    border-left: 3px solid var(--primary-color);
}

.user-avatar-small {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 0.9em;
}

.avatar-client { background: linear-gradient(135deg, var(--success), #20c997); }
.avatar-expert { background: linear-gradient(135deg, var(--warning), #ff922b); }
.avatar-admin { background: linear-gradient(135deg, var(--error), #e35d6a); }

.user-info-small {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
    font-size: 0.95em;
}

.user-role {
    font-size: 0.75em;
    color: var(--text-light);
    background: var(--background);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75em;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.online { background: var(--success); }
.offline { background: var(--text-light); }

/* Colonne de droite (chat) */
.right-column {
    flex: 2;
}

/* Améliorations du chat-widget existant */
.chat-widget {
    height: 100%;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
}

.chat-header {
    padding: 18px 25px;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

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

.interlocutor-avatar {
    width: 45px;
    height: 45px;
    background: var(--primary-dark); /* Au lieu de var(--text-light) */
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    color: var(--white);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    margin-top: 3px;
}

.last-seen {
    font-size: 0.75em;
    color: #adb5bd;
    margin-top: 1px;
}

/* Améliorations des messages */
.messages-container {
        flex: 1;
        padding: 20px;
        overflow-y: auto;
        background: #fafbfc;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

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

.message {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    position: relative;
    animation: messageSlide 0.3s ease;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.5rem;
}

.message.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.message.received {
    align-self: flex-start;
    background: linear-gradient(135deg, var(--white), #f8f9fa);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-md);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7em;
    margin-top: 2px;
    color: var(--text-light);
    padding: 0 4px;
}

.message.sent .message-meta {
    justify-content: flex-end;
    padding-right: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.message.received .message-meta {
    justify-content: flex-start;
    padding-left: 8px;
}

.read-receipt {
    color: var(--success);
}

/* Indicateur de frappe */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-light);
    font-style: italic;
    font-size: 0.9em;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dot {
    width: 5px;
    height: 5px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-3px); }
}

/* Zone de saisie améliorée */
.chat-input-container {
    padding: 18px 25px;
    background: var(--white);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 0.95em;
    transition: all 0.3s ease;
    max-height: 120px;
    min-height: 44px;
    background: #fafbfc;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
    background: var(--white);
}

.send-btn {
    background: var(--primary-dark);
    color: var(--white);
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-weight: 500;
}

.send-btn:hover {
    background: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* États vides */
.empty-chat {
    text-align: center;
    color: var(--text-light);
    margin: auto;
    padding: 40px;
}

.empty-chat i {
    font-size: 3.5em;
    margin-bottom: 20px;
    color: var(--border);
}

/* Gestion des fichiers */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.file-btn {
    background: var(--background);
    border: 1px dashed var(--border);
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    white-space: nowrap;
    font-size: 0.9em;
}

.file-btn:hover {
    background: var(--border);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.attachment-preview {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-bottom: 8px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-type-icon {
    width: 36px;
    height: 36px;
    background: var(--text-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.1em;
}

.attachment-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
    font-size: 0.9em;
}

.attachment-size {
    font-size: 0.75em;
    color: var(--text-light);
}

.remove-file {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background 0.3s ease;
    font-size: 0.9em;
}

.remove-file:hover {
    background: #ffeaea;
}

/* Messages avec fichiers */
.attachment-container {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px;
    background: var(--white);
}

.message.sent .attachment-container {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.attachment-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-icon {
    width: 36px;
    height: 36px;
    background: var(--background);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1.1em;
}

.message.sent .attachment-icon {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.attachment-details {
    flex: 1;
}

.message.sent .attachment-name,
.message.sent .attachment-size {
    color: var(--white);
}

.download-btn {
    background: var(--primary-dark);
    color: var(--white);
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.3s ease;
    font-size: 0.85em;
}

.download-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

.message.sent .download-btn {
    background: rgba(255, 255, 255, 0.3);
}

.message.sent .download-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Modal de prévisualisation d'image */
.image-preview-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
}

.image-preview-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
}

.close-preview {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--white);
    font-size: 35px;
    font-weight: 300;
    cursor: pointer;
    z-index: 2001;
    opacity: 0.8;
}

.close-preview:hover {
    color: #ccc;
    opacity: 1;
}

.file-image-preview {
    max-width: 280px;
    max-height: 280px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.file-image-preview:hover {
    transform: scale(1.02);
}

/* Scrollbar personnalisée pour le chat */
.messages-container::-webkit-scrollbar,
.left-column-content::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track,
.left-column-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb,
.left-column-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.left-column-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive pour le chat */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: auto;
    }

    .left-column, .right-column {
        flex: none;
    }

    .left-column {
        height: 300px;
        margin-bottom: 20px;
    }

    .right-column {
        height: calc(100vh - 420px);
    }

    .chat-header {
        padding: 1rem;
    }

    .chat-input-container {
        padding: 1rem;
    }

    .message {
        max-width: 85%;
    }
}

/* Header du chat-widget - même couleur que left-column-header */
.chat-widget .chat-header {
    background: var(--primary-dark);
    color: var(--white);
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Compatibilité avec les classes du HTML */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 0.95em;
    transition: all 0.3s ease;
    max-height: 120px;
    min-height: 44px;
    background: #fafbfc;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
    background: var(--white);
}

.input-container {
    padding: 18px 25px;
    background: var(--white);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Styles pour les messages avec fichiers */
.attachment-container {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px;
    background: var(--white);
}

.message.sent .attachment-container {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.attachment-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-icon {
    width: 36px;
    height: 36px;
    background: var(--background);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1.1em;
}

.message.sent .attachment-icon {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.attachment-details {
    flex: 1;
}

.message.sent .attachment-name,
.message.sent .attachment-size {
    color: var(--white);
}

.download-btn {
    background: var(--text-light);
    color: var(--white);
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.3s ease;
    font-size: 0.85em;
}

.download-btn:hover {
    background: #5a6268;
    color: var(--white);
}

.message.sent .download-btn {
    background: rgba(255, 255, 255, 0.3);
}

.message.sent .download-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Styles pour les images dans les messages */
.file-image-preview {
    max-width: 280px;
    max-height: 280px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.file-image-preview:hover {
    transform: scale(1.02);
}

/* Modal de prévisualisation d'image */
.image-preview-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
}

.image-preview-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
}

.close-preview {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--white);
    font-size: 35px;
    font-weight: 300;
    cursor: pointer;
    z-index: 2001;
    opacity: 0.8;
}

.close-preview:hover {
    color: #ccc;
    opacity: 1;
}

/* Scrollbar personnalisée pour compatibilité */
.messages-container::-webkit-scrollbar,
.left-column-content::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track,
.left-column-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb,
.left-column-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.left-column-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive pour compatibilité */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: auto;
    }

    .left-column, .right-column {
        flex: none;
    }

    .left-column {
        height: 300px;
        margin-bottom: 20px;
    }

    .right-column {
        height: calc(100vh - 420px);
    }

    .chat-widget .chat-header {
        padding: 1rem;
    }

    .input-container {
        padding: 1rem;
    }
}

.file-message {
    max-width: 300px;
    margin-bottom: 10px;
}

.file-preview {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.file-preview:hover {
    transform: scale(1.02);
}

.image-preview {
    position: relative;
    max-width: 100%;
}

.image-preview img {
    width: 100%;
    height: auto;
    border-radius: 10px;
}

.file-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-preview:hover .file-overlay {
    opacity: 1;
}

.file-overlay i {
    color: white;
    font-size: 24px;
}

.document-preview {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    border: 2px dashed #dee2e6;
}

.document-preview i {
    font-size: 48px;
    color: #6c757d;
}

.file-info {
    padding: 10px;
}

.file-name {
    font-weight: bold;
    margin-bottom: 5px;
    word-break: break-word;
}

.download-link {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9em;
}

.download-link:hover {
    text-decoration: underline;
}

.file-message + .message-content {
    margin-top: 10px;
}


/* Styles pour les sessions actives */
.sessions-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.session-item:last-child {
    border-bottom: none;
}

.session-item:hover {
    background-color: var(--background);
}

.session-item.current-session {
    background-color: var(--primary-light);
    border-left: 4px solid var(--primary-color);
}

.session-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.session-header h4 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1rem;
}

.session-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.session-badge.current {
    background-color: var(--success);
    color: white;
}

.session-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.session-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.session-detail i {
    width: 16px;
    text-align: center;
    color: var(--text-light);
}

.session-actions {
    display: flex;
    gap: 10px;
}

.loading-sessions {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-sessions {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.error-message {
    text-align: center;
    padding: 20px;
    color: var(--error);
    background-color: rgba(231, 76, 60, 0.1);
    border-radius: var(--radius-md);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .session-item {
        flex-direction: column;
        gap: 15px;
    }

    .session-actions {
        align-self: flex-end;
    }

    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }

    .modal-actions .btn {
        width: 100%;
    }
}