/* ============================================================================
   CHAT MODULE - DESIGN UMOA
   Interface moderne, élégante, premium avec identité visuelle UMOA
   Palette: #004AAD (bleu), #F2C94C (or), #FFFFFF (blanc), #F5F7FA (fond neutre)
   Style: WhatsApp/Messenger moderne, arrondi, épuré, responsive
   ============================================================================ */

/* Import de la typographie élégante */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Variables CSS - Thème clair (par défaut) */
:root {
    /* Couleurs principales UMOA */
    --umoa-blue: #004AAD;
    --umoa-gold: #F2C94C;
    --umoa-white: #FFFFFF;
    --umoa-bg-neutral: #F5F7FA;
    
    /* Couleurs du chat - Thème clair */
    --chat-bg-primary: var(--umoa-white);
    --chat-bg-secondary: var(--umoa-bg-neutral);
    --chat-bg-gradient: linear-gradient(135deg, #FFFFFF 0%, #F5F7FA 100%);
    --chat-accent: var(--umoa-blue);
    --chat-accent-hover: #003A8A;
    --chat-gold: var(--umoa-gold);
    --chat-text-primary: #1A1A1A;
    --chat-text-secondary: #6B7280;
    --chat-text-muted: #9CA3AF;
    
    /* Bulles de messages */
    --chat-bubble-sent: var(--umoa-blue);
    --chat-bubble-sent-text: var(--umoa-white);
    --chat-bubble-received: var(--umoa-white);
    --chat-bubble-received-border: #DCE3EB;
    --chat-bubble-received-text: var(--chat-text-primary);
    
    /* Bordures et ombres */
    --chat-border: #E5E7EB;
    --chat-border-light: #F3F4F6;
    --chat-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --chat-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --chat-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --chat-shadow-bubble: 0 2px 8px rgba(0, 74, 173, 0.15);
    
    /* États */
    --chat-online: #10B981;
    --chat-offline: #9CA3AF;
    --chat-error: #EF4444;
    --chat-success: #10B981;
    
    /* Transitions */
    --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --chat-transition-fast: all 0.15s ease-out;
    
    /* Arrondis */
    --chat-radius-sm: 8px;
    --chat-radius-md: 12px;
    --chat-radius-lg: 16px;
    --chat-radius-xl: 20px;
    --chat-radius-full: 50%;
}

/* Variables CSS - Thème sombre */
[data-theme="dark"] {
    --chat-bg-primary: #0D1117;
    --chat-bg-secondary: #161B22;
    --chat-bg-gradient: linear-gradient(135deg, #0D1117 0%, #161B22 100%);
    --chat-accent: var(--umoa-blue);
    --chat-accent-hover: #1E6FD9;
    --chat-gold: var(--umoa-gold);
    --chat-text-primary: #E6EDF3;
    --chat-text-secondary: #8B949E;
    --chat-text-muted: #6E7681;
    
    /* Bulles de messages - Dark */
    --chat-bubble-sent: var(--umoa-blue);
    --chat-bubble-sent-text: var(--umoa-white);
    --chat-bubble-received: #21262D;
    --chat-bubble-received-border: #30363D;
    --chat-bubble-received-text: #E6EDF3;
    
    /* Bordures et ombres - Dark */
    --chat-border: #30363D;
    --chat-border-light: #21262D;
    --chat-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --chat-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --chat-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --chat-shadow-bubble: 0 2px 8px rgba(0, 74, 173, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container principal */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    max-width: 1400px;
    margin: 20px auto;
    background: var(--chat-bg-primary);
    border-radius: var(--chat-radius-xl);
    box-shadow: var(--chat-shadow-lg);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--chat-border);
}

.chat-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Header de la conversation - Épuré et moderne */
.chat-header {
    background: var(--chat-bg-primary);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--chat-border);
    position: relative;
    z-index: 10;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.chat-header .avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--chat-radius-full);
    object-fit: cover;
    border: 2px solid var(--chat-accent);
    box-shadow: var(--chat-shadow-sm);
    transition: var(--chat-transition-fast);
}

.chat-header .avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--chat-shadow-md);
}

.chat-header .avatar.clickable,
.chat-header .avatar-link {
    cursor: pointer;
    display: inline-block;
    transition: var(--chat-transition-fast);
    flex-shrink: 0;
}

.chat-header .avatar-link:hover .avatar {
    transform: scale(1.05);
    box-shadow: var(--chat-shadow-md);
    border-color: var(--chat-accent-hover, var(--chat-accent));
}

.user-name-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    min-width: 0;
    flex-shrink: 1;
}

.user-name-link:hover h3 {
    color: var(--chat-accent);
}

.user-details h3.clickable {
    cursor: pointer;
    transition: var(--chat-transition-fast);
}

.user-details h3.clickable:hover {
    color: var(--chat-accent);
    text-decoration: underline;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-details h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--chat-text-primary);
    line-height: 1.3;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.user-status {
    font-size: 13px;
    color: var(--chat-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    white-space: nowrap;
    flex-shrink: 0;
}

.user-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: var(--chat-radius-full);
    background: var(--chat-online);
    display: inline-block;
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.chat-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    position: absolute;
    top: 0;
    right: 0;
    padding: 16px 24px;
    z-index: 20;
    flex-shrink: 0;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--chat-text-secondary);
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--chat-transition-fast);
    position: relative;
}

.action-btn:hover {
    background: var(--chat-bg-secondary);
    color: var(--chat-accent);
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(0) scale(0.95);
}

.action-btn.active {
    background: var(--chat-accent);
    color: var(--umoa-white);
}

/* Menu dropdown des options */
.chat-options-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--chat-bg-primary);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 1000;
    display: none;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

.chat-options-menu.active {
    display: block;
}

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

.chat-options-menu .menu-item {
    width: 100%;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    background: transparent;
    color: var(--chat-text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--chat-transition-fast);
    text-align: left;
    border-bottom: 1px solid var(--chat-border);
}

.chat-options-menu .menu-item:last-child {
    border-bottom: none;
}

.chat-options-menu .menu-item:hover {
    background: var(--chat-bg-secondary);
    color: var(--chat-accent);
}

.chat-options-menu .menu-item:active {
    background: var(--chat-bg-hover);
    transform: scale(0.98);
}

.chat-options-menu .menu-item svg {
    flex-shrink: 0;
    stroke-width: 2;
}

.chat-options-menu .menu-item[data-action="block"] {
    color: #ef4444;
}

.chat-options-menu .menu-item[data-action="block"]:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.chat-options-menu .menu-item[data-action="delete"] {
    color: #f59e0b;
}

.chat-options-menu .menu-item[data-action="delete"]:hover {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.chat-options-menu .menu-item[data-action="report"] {
    color: #3b82f6;
}

.chat-options-menu .menu-item[data-action="report"]:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

/* Modal de signalement */
.report-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 10002 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.report-modal[style*="display: flex"],
.report-modal.active {
    display: flex !important;
}

.report-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.report-modal-content {
    position: relative;
    background: var(--chat-bg-primary);
    border-radius: var(--chat-radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    animation: slideUp 0.3s ease-out;
    border: 1px solid var(--chat-border);
}

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

.report-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--chat-border);
}

.report-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--chat-text-primary);
}

.report-modal-close {
    background: transparent;
    border: none;
    color: var(--chat-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--chat-radius-sm);
    transition: var(--chat-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.report-modal-close:hover {
    background: var(--chat-bg-secondary);
    color: var(--chat-text-primary);
}

.report-modal-body {
    padding: 24px;
}

.report-modal-body .form-group {
    margin-bottom: 20px;
}

.report-modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--chat-text-primary);
    font-size: 14px;
}

.report-modal-body .required {
    color: #ef4444;
}

.report-modal-body .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    font-size: 14px;
    font-family: inherit;
    background: var(--chat-bg-primary);
    color: var(--chat-text-primary);
    transition: var(--chat-transition-fast);
}

.report-modal-body .form-control:focus {
    outline: none;
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.report-modal-body select.form-control {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Amélioration du select pour tous les écrans */
.report-modal-body select.form-control:hover {
    border-color: var(--chat-accent);
    background-color: var(--chat-bg-secondary);
}

.report-modal-body textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.report-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--chat-border);
}

.report-modal-footer .btn {
    padding: 10px 20px;
    border-radius: var(--chat-radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--chat-transition-fast);
    border: none;
}

.report-modal-footer .btn-secondary {
    background: var(--chat-bg-secondary);
    color: var(--chat-text-primary);
}

.report-modal-footer .btn-secondary:hover {
    background: var(--chat-bg-hover);
}

.report-modal-footer .btn-primary {
    background: var(--chat-accent);
    color: white;
}

.report-modal-footer .btn-primary:hover {
    background: var(--chat-accent-hover, #2563eb);
    transform: translateY(-1px);
}

.report-modal-footer .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive pour la modale */
@media (max-width: 640px) {
    .report-modal {
        padding: 0;
        align-items: flex-end;
        justify-content: flex-end;
    }
    
    .report-modal-content {
        max-width: 100%;
        width: 100%;
        max-height: calc(100vh - calc(64px + env(safe-area-inset-bottom, 0px))); /* Tient compte de la navbar bottom */
        height: auto;
        border-radius: 20px 20px 0 0;
        margin: 0;
        animation: slideUpMobile 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }
    
    @keyframes slideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .report-modal-overlay {
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    
    .report-modal-header {
        padding: 20px;
        position: sticky;
        top: 0;
        background: var(--chat-bg-primary);
        z-index: 10;
        border-bottom: 1px solid var(--chat-border);
    }
    
    .report-modal-header h3 {
        font-size: 20px;
        font-weight: 700;
    }
    
    .report-modal-close {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 12px;
        background: var(--chat-bg-secondary);
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .report-modal-close:active {
        transform: scale(0.95);
        background: var(--chat-bg-hover);
    }
    
    .report-modal-body {
        padding: 24px 20px;
        max-height: calc(100vh - calc(64px + env(safe-area-inset-bottom, 0px)) - 180px); /* Tient compte de la navbar bottom */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .report-modal-body .form-group {
        margin-bottom: 24px;
    }
    
    .report-modal-body label {
        font-size: 15px;
        margin-bottom: 12px;
        font-weight: 600;
    }
    
    /* Design mobile-friendly pour le select */
    .report-modal-body select.form-control {
        width: 100%;
        padding: 16px 20px;
        font-size: 16px; /* Évite le zoom automatique sur iOS */
        border: 2px solid var(--chat-border);
        border-radius: 14px;
        background: var(--chat-bg-primary);
        color: var(--chat-text-primary);
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 16px center;
        background-size: 20px;
        padding-right: 50px;
        min-height: 56px; /* Zone tactile optimale pour mobile */
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .report-modal-body select.form-control:focus {
        outline: none;
        border-color: var(--chat-accent);
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15),
                    0 4px 12px rgba(59, 130, 246, 0.1);
        transform: translateY(-1px);
        background-color: var(--chat-bg-secondary);
    }
    
    .report-modal-body select.form-control:active {
        transform: scale(0.98);
    }
    
    /* Animation pour l'ouverture du select sur mobile */
    .report-modal-body select.form-control option {
        padding: 16px;
        font-size: 16px;
        background: var(--chat-bg-primary);
        color: var(--chat-text-primary);
    }
    
    .report-modal-body textarea.form-control {
        padding: 16px 20px;
        font-size: 16px; /* Évite le zoom automatique sur iOS */
        border: 2px solid var(--chat-border);
        border-radius: 14px;
        min-height: 120px;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .report-modal-body textarea.form-control:focus {
        outline: none;
        border-color: var(--chat-accent);
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15),
                    0 4px 12px rgba(59, 130, 246, 0.1);
        transform: translateY(-1px);
    }
    
    .report-modal-footer {
        padding: 20px;
        flex-direction: column-reverse;
        gap: 12px;
        position: sticky;
        bottom: 0;
        background: var(--chat-bg-primary);
        border-top: 1px solid var(--chat-border);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }
    
    .report-modal-footer .btn {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 14px;
        min-height: 52px; /* Zone tactile optimale pour mobile */
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .report-modal-footer .btn:active {
        transform: scale(0.98);
    }
    
    .report-modal-footer .btn-primary {
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    }
    
    .report-modal-footer .btn-primary:active {
        box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    }
}

/* Optimisations supplémentaires pour iOS et très petits écrans */
@supports (-webkit-touch-callout: none) {
    /* Styles spécifiques iOS */
    .report-modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    .report-modal-body {
        -webkit-overflow-scrolling: touch;
    }
    
    .report-modal-body select.form-control {
        -webkit-appearance: none;
        appearance: none;
    }
}

/* Très petits écrans (moins de 360px) */
@media (max-width: 360px) {
    .report-modal-header {
        padding: 16px;
    }
    
    .report-modal-header h3 {
        font-size: 18px;
    }
    
    .report-modal-body {
        padding: 20px 16px;
    }
    
    .report-modal-footer {
        padding: 16px;
    }
    
    .report-modal-body select.form-control,
    .report-modal-body textarea.form-control {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .report-modal-footer .btn {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px;
    }
}

/* Amélioration pour les écrans en mode paysage mobile */
@media (max-width: 896px) and (max-height: 500px) and (orientation: landscape) {
    .report-modal-content {
        max-height: calc(100vh - calc(64px + env(safe-area-inset-bottom, 0px))); /* Tient compte de la navbar bottom */
        border-radius: 0;
    }
    
    .report-modal-body {
        max-height: calc(100vh - calc(64px + env(safe-area-inset-bottom, 0px)) - 140px); /* Tient compte de la navbar bottom */
    }
}

/* Zone des messages */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--chat-bg-gradient);
    position: relative;
}

.chat-messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-bg-gradient);
    position: relative;
}

.chat-messages-header {
    padding: 16px 24px;
    background: var(--chat-bg-primary);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    position: relative;
}

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

.chat-messages-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--chat-radius-full);
    object-fit: cover;
    border: 2px solid var(--chat-accent);
    box-shadow: var(--chat-shadow-sm);
}

.chat-messages-header-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--chat-text-primary);
    letter-spacing: -0.01em;
}

.chat-messages-header-actions {
    display: flex;
    gap: 4px;
}

/* Zone de messages avec scrollbar custom */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    position: relative;
    background: var(--chat-bg-secondary);
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    scroll-behavior: smooth;
    background: var(--chat-bg-secondary);
}

/* Scrollbar custom élégante */
.chat-messages::-webkit-scrollbar,
.chat-messages-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-messages-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-messages-list::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 10px;
    transition: var(--chat-transition-fast);
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-messages-list::-webkit-scrollbar-thumb:hover {
    background: var(--chat-text-muted);
}

/* Firefox scrollbar */
.chat-messages,
.chat-messages-list {
    scrollbar-width: thin;
    scrollbar-color: var(--chat-border) transparent;
}

/* Messages avec avatars */
.message {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 4px;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

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

/* Avatar pour chaque message */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--chat-radius-full);
    object-fit: cover;
    border: 2px solid var(--chat-border);
    flex-shrink: 0;
    box-shadow: var(--chat-shadow-sm);
    transition: var(--chat-transition-fast);
}

.message.sent .message-avatar {
    order: 2;
}

.message.received .message-avatar {
    order: 0;
}

/* Bulles de messages arrondies - Style WhatsApp */
.message-bubble {
    padding: 12px 16px;
    border-radius: var(--chat-radius-lg);
    position: relative;
    box-shadow: var(--chat-shadow-bubble);
    word-wrap: break-word;
    max-width: 100%;
    transition: var(--chat-transition-fast);
    border: 1px solid transparent;
}

.message.sent .message-bubble {
    background: var(--chat-bubble-sent);
    color: var(--chat-bubble-sent-text);
    border-bottom-right-radius: 4px;
    border-top-right-radius: var(--chat-radius-lg);
    border-top-left-radius: var(--chat-radius-lg);
}

.message.received .message-bubble {
    background: var(--chat-bubble-received);
    border: 1px solid var(--chat-bubble-received-border);
    color: var(--chat-bubble-received-text);
    border-bottom-left-radius: 4px;
    border-top-right-radius: var(--chat-radius-lg);
    border-top-left-radius: var(--chat-radius-lg);
}

.message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: var(--chat-shadow-md);
}

.message-bubble p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: inherit;
    font-weight: 400;
}

.message-bubble strong {
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
    color: inherit;
    font-size: 16px;
}

/* Images et vidéos dans les messages */
.message-image {
    max-width: 320px;
    max-height: 320px;
    min-height: 100px; /* Hauteur minimale pour éviter les sauts de scroll */
    width: auto;
    height: auto;
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    display: block;
    margin-bottom: 8px;
    transition: var(--chat-transition);
    box-shadow: var(--chat-shadow-sm);
    /* Réserver l'espace pendant le chargement */
    background: var(--chat-bg-secondary, #f5f5f5);
    object-fit: contain;
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: var(--chat-shadow-md);
}

.message-bubble video {
    max-width: 320px;
    max-height: 320px;
    min-height: 100px; /* Hauteur minimale pour éviter les sauts de scroll */
    width: auto;
    height: auto;
    border-radius: var(--chat-radius-md);
    display: block;
    margin-bottom: 8px;
    box-shadow: var(--chat-shadow-sm);
    /* Réserver l'espace pendant le chargement */
    background: var(--chat-bg-secondary, #f5f5f5);
}

/* Métadonnées des messages */
.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.8;
}

.message-time {
    font-size: 11px;
    color: inherit;
    opacity: 0.8;
    font-weight: 400;
    letter-spacing: 0.02em;
}

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

.message.received .message-time {
    color: var(--chat-text-muted);
}

.message-status,
.message-status-indicator {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    font-size: 14px;
    line-height: 1;
    min-width: 16px;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.message-status-indicator:hover,
.message-status:hover {
    opacity: 1;
}

/* Statut : Envoyé (une seule coche jaune) */
.message-status-indicator.sent::after,
.message-status.sent::after {
    content: '✓';
    color: #fbbf24; /* Jaune */
    font-weight: normal;
    text-shadow: 0 0 2px rgba(251, 191, 36, 0.3);
}

/* Statut : Reçu (double coche jaune) */
.message-status-indicator.received::after,
.message-status.received::after,
.message-status-indicator.delivered::after,
.message-status.delivered::after {
    content: '✓✓';
    color: #fbbf24; /* Jaune */
    font-weight: 500;
    text-shadow: 0 0 2px rgba(251, 191, 36, 0.3);
}

/* Statut : Lu (double coche vert foncé) */
.message-status-indicator.seen::after,
.message-status.seen::after,
.message-status-indicator.read::after,
.message-status.read::after {
    content: '✓✓';
    color: #15803d; /* Vert foncé */
    font-weight: 600;
    text-shadow: 0 0 2px rgba(21, 128, 61, 0.3);
}

/* Pour les messages envoyés dans les bulles dorées, utiliser une couleur plus visible */
.chat-message.sent .message-status-indicator.seen::after,
.chat-message.sent .message-status.seen::after,
.message.sent .message-status-indicator.seen::after,
.message.sent .message-status.seen::after {
    color: #15803d; /* Vert foncé pour "lu" */
    text-shadow: 0 0 3px rgba(21, 128, 61, 0.4);
}

/* Ancien style pour compatibilité */
.chat-message-status {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    width: 16px;
    height: 16px;
}

.chat-message-status.sent svg {
    fill: #fbbf24; /* Jaune */
    width: 14px;
    height: 14px;
}

.chat-message-status.received svg,
.chat-message-status.delivered svg {
    fill: #fbbf24; /* Jaune */
    width: 16px;
    height: 16px;
}

.chat-message-status.seen svg {
    fill: #15803d; /* Vert foncé */
    width: 16px;
    height: 16px;
}

/* Messages spéciaux */
.offer-message {
    padding: 12px;
}

.offer-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--chat-gold);
    margin: 8px 0;
}

.location-message {
    padding: 12px;
}

.location-message strong {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.location-message .btn,
.location-message .btn-sm,
.location-message .btn-primary {
    background: var(--chat-accent);
    color: var(--umoa-white);
    border: none;
    padding: 8px 16px;
    border-radius: var(--chat-radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--chat-transition-fast);
    margin-top: 8px;
    font-family: 'Inter', sans-serif;
    box-shadow: var(--chat-shadow-sm);
}

.location-message .btn:hover,
.location-message .btn-sm:hover,
.location-message .btn-primary:hover {
    background: var(--chat-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--chat-shadow-md);
}

/* État vide */
.empty-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--chat-text-secondary);
    padding: 60px 40px;
}

.empty-chat svg {
    opacity: 0.3;
    margin-bottom: 24px;
}

.empty-chat p {
    font-size: 16px;
    margin: 0;
    opacity: 0.6;
    font-weight: 400;
}

.empty-chat p:last-child {
    font-size: 14px;
    margin-top: 8px;
    opacity: 0.5;
}

/* Zone de saisie moderne */
.chat-input-area {
    background: var(--chat-bg-primary);
    padding: 16px 24px;
    border-top: 1px solid var(--chat-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    width: 100%;
    padding: 4px 0;
}

.input-actions::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Réduire le gap sur mobile pour économiser l'espace */
@media (max-width: 768px) {
    .input-actions {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .input-actions {
        gap: 6px;
    }
}

@media (max-width: 375px) {
    .input-actions {
        gap: 5px;
    }
}

@media (max-width: 320px) {
    .input-actions {
        gap: 4px;
    }
}

/* Styles de base pour tous les boutons d'action */
.attach-btn,
.emoji-btn,
.camera-btn,
.chat-voice-button {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--chat-bg-primary);
    color: var(--chat-text-secondary);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid var(--chat-border);
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Ombres colorées spécifiques pour chaque bouton */
.attach-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15),
                0 0 0 1px rgba(59, 130, 246, 0.1);
}

.attach-btn svg {
    color: #3b82f6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 1px 2px rgba(59, 130, 246, 0.2));
}

.emoji-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.15),
                0 0 0 1px rgba(251, 191, 36, 0.1);
}

.emoji-btn svg {
    color: #fbbf24;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 1px 2px rgba(251, 191, 36, 0.2));
}

.camera-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15),
                0 0 0 1px rgba(16, 185, 129, 0.1);
}

.camera-btn svg {
    color: #10b981;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 1px 2px rgba(16, 185, 129, 0.2));
}

.chat-voice-button {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15),
                0 0 0 1px rgba(239, 68, 68, 0.1);
}

.chat-voice-button span {
    color: #ef4444;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* États hover avec ombres renforcées */
.attach-btn:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3),
                0 0 0 2px rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.attach-btn:hover svg {
    color: #ffffff;
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.3));
}

.emoji-btn:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #ffffff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.3),
                0 0 0 2px rgba(251, 191, 36, 0.2);
    border-color: #fbbf24;
}

.emoji-btn:hover svg {
    color: #ffffff;
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.3));
}

.camera-btn:hover {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3),
                0 0 0 2px rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.camera-btn:hover svg {
    color: #ffffff;
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.3));
}

.chat-voice-button:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3),
                0 0 0 2px rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.chat-voice-button:hover span {
    color: #ffffff;
    transform: scale(1.1);
}

/* États actifs */
.attach-btn:active,
.emoji-btn:active,
.camera-btn:active,
.chat-voice-button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.attach-btn.active,
.emoji-btn.active {
    background: linear-gradient(135deg, var(--chat-accent) 0%, #003A8A 100%);
    color: var(--umoa-white);
    border-color: var(--chat-accent);
    box-shadow: 0 2px 12px rgba(0, 74, 173, 0.3);
}

.attach-btn.active svg,
.emoji-btn.active svg {
    color: var(--umoa-white);
}

/* Réduire la taille des boutons d'action sur mobile */
@media (max-width: 768px) {
    .attach-btn,
    .emoji-btn,
    .camera-btn,
    .chat-voice-button {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .attach-btn,
    .emoji-btn,
    .camera-btn,
    .chat-voice-button {
        width: 38px;
        height: 38px;
        font-size: 17px;
        border-radius: 10px;
    }
}

@media (max-width: 375px) {
    .attach-btn,
    .emoji-btn,
    .camera-btn,
    .chat-voice-button {
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 9px;
    }
}

@media (max-width: 320px) {
    .attach-btn,
    .emoji-btn,
    .camera-btn,
    .chat-voice-button {
        width: 34px;
        height: 34px;
        font-size: 15px;
        border-radius: 8px;
    }
}

/* Support du thème sombre */
[data-theme="dark"] .attach-btn,
[data-theme="dark"] .emoji-btn,
[data-theme="dark"] .camera-btn,
[data-theme="dark"] .chat-voice-button {
    background: linear-gradient(135deg, #21262D 0%, #161B22 100%);
    border-color: #30363D;
}

[data-theme="dark"] .attach-btn {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2),
                0 0 0 1px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .emoji-btn {
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2),
                0 0 0 1px rgba(251, 191, 36, 0.15);
}

[data-theme="dark"] .camera-btn {
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2),
                0 0 0 1px rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] .chat-voice-button {
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2),
                0 0 0 1px rgba(239, 68, 68, 0.15);
}

/* Bouton de création de commande - Design moderne avec ombre colorée */
.btn-create-order {
    min-width: auto;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, #7B2CBF 0%, #6B21A8 100%);
    color: #ffffff;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid #7B2CBF;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(123, 44, 191, 0.25),
                0 0 0 1px rgba(123, 44, 191, 0.15);
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}

.btn-create-order::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-create-order:hover::before {
    left: 100%;
}

.btn-create-order .order-btn-icon {
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.btn-create-order .order-btn-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 1;
    min-width: 0;
    letter-spacing: 0.01em;
}

.btn-create-order:hover {
    background: linear-gradient(135deg, #6B21A8 0%, #5B1A8A 100%);
    color: #ffffff;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(123, 44, 191, 0.35),
                0 0 0 2px rgba(123, 44, 191, 0.2);
    border-color: #6B21A8;
}

.btn-create-order:hover .order-btn-icon {
    transform: scale(1.1) rotate(-5deg);
}

.btn-create-order:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 6px rgba(123, 44, 191, 0.3);
}

.btn-create-order:focus {
    outline: none;
    box-shadow: 0 2px 10px rgba(123, 44, 191, 0.25),
                0 0 0 3px rgba(123, 44, 191, 0.15);
}

/* Responsive pour le bouton de commande */
@media (max-width: 768px) {
    .btn-create-order {
        height: 40px;
        padding: 8px 14px;
        font-size: 13px;
        gap: 5px;
        border-radius: 10px;
    }
    
    .btn-create-order .order-btn-icon {
        font-size: 16px;
    }
    
    .btn-create-order .order-btn-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .btn-create-order {
        height: 38px;
        padding: 8px 12px;
        font-size: 12px;
        gap: 4px;
        border-radius: 10px;
    }
    
    .btn-create-order .order-btn-icon {
        font-size: 15px;
    }
    
    .btn-create-order .order-btn-text {
        font-size: 12px;
    }
}

@media (max-width: 375px) {
    .btn-create-order {
        height: 36px;
        padding: 8px 10px;
        font-size: 11px;
        gap: 3px;
        border-radius: 9px;
    }
    
    .btn-create-order .order-btn-icon {
        font-size: 14px;
    }
    
    .btn-create-order .order-btn-text {
        font-size: 11px;
    }
}

@media (max-width: 320px) {
    .btn-create-order {
        height: 34px;
        padding: 6px 8px;
        font-size: 10px;
        gap: 2px;
        border-radius: 8px;
    }
    
    .btn-create-order .order-btn-icon {
        font-size: 13px;
    }
    
    .btn-create-order .order-btn-text {
        font-size: 10px;
    }
}

/* Support du thème sombre pour le bouton de commande */
[data-theme="dark"] .btn-create-order {
    background: linear-gradient(135deg, #7B2CBF 0%, #6B21A8 100%);
    box-shadow: 0 2px 10px rgba(123, 44, 191, 0.3),
                0 0 0 1px rgba(123, 44, 191, 0.2);
}

[data-theme="dark"] .btn-create-order:hover {
    background: linear-gradient(135deg, #6B21A8 0%, #5B1A8A 100%);
    box-shadow: 0 4px 16px rgba(123, 44, 191, 0.4),
                0 0 0 2px rgba(123, 44, 191, 0.25);
}

.offer-btn {
    min-width: auto;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, var(--umoa-blue) 0%, #0066CC 100%);
    color: var(--umoa-white);
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--chat-transition-fast);
    border: 1px solid var(--umoa-blue);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 74, 173, 0.25);
    flex-shrink: 1;
}

.offer-btn-icon {
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.offer-btn-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    flex-shrink: 1;
    min-width: 0;
}

/* Réduire la taille du bouton offer sur mobile */
@media (max-width: 768px) {
    .offer-btn {
        padding: 8px 10px;
        font-size: 13px;
        gap: 5px;
        height: 36px;
    }
    
    .offer-btn-icon {
        font-size: 16px;
    }
    
    .offer-btn-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .offer-btn {
        padding: 8px 8px;
        font-size: 12px;
        gap: 4px;
        height: 36px;
    }
    
    .offer-btn-icon {
        font-size: 14px;
    }
    
    .offer-btn-text {
        font-size: 12px;
    }
}

@media (max-width: 375px) {
    .offer-btn {
        padding: 8px 6px;
        font-size: 11px;
        gap: 3px;
        height: 34px;
    }
    
    .offer-btn-icon {
        font-size: 13px;
    }
    
    .offer-btn-text {
        font-size: 11px;
    }
}

@media (max-width: 320px) {
    .offer-btn {
        padding: 8px 5px;
        font-size: 10px;
        gap: 2px;
        height: 32px;
    }
    
    .offer-btn-icon {
        font-size: 12px;
    }
    
    .offer-btn-text {
        font-size: 10px;
    }
}

.attach-btn:hover,
.emoji-btn:hover {
    background: var(--chat-accent);
    color: var(--umoa-white);
    transform: translateY(-2px);
    box-shadow: var(--chat-shadow-sm);
    border-color: var(--chat-accent);
}

.offer-btn:hover {
    background: linear-gradient(135deg, #003A8A 0%, var(--umoa-blue) 100%);
    color: var(--umoa-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 74, 173, 0.35);
    border-color: #003A8A;
}

.attach-btn:active,
.emoji-btn:active {
    transform: translateY(0) scale(0.95);
}

.offer-btn:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 1px 4px rgba(0, 74, 173, 0.3);
}

.attach-btn.active,
.emoji-btn.active {
    background: var(--chat-accent);
    color: var(--umoa-white);
    border-color: var(--chat-accent);
}

.offer-btn.active {
    background: linear-gradient(135deg, #003A8A 0%, var(--umoa-blue) 100%);
    color: var(--umoa-white);
    border-color: #003A8A;
    box-shadow: 0 2px 8px rgba(0, 74, 173, 0.3);
}

/* Animation pulse pour l'enregistrement vidéo */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes recording-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.camera-btn[style*="animation: pulse"] {
    color: var(--umoa-white) !important;
    border-color: #dc3545 !important;
}

/* Timer d'enregistrement vidéo */
.video-recording-timer-overlay {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10001;
    min-width: 180px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: slideDown 0.3s ease-out;
    white-space: nowrap;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.video-recording-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-recording-dot {
    width: 10px;
    height: 10px;
    background: #dc3545;
    border-radius: 50%;
    animation: recording-dot 1s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.8);
}

.video-recording-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffffff;
    opacity: 0.9;
}

.video-recording-time {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #ffffff;
    min-width: 45px;
    text-align: center;
    font-family: 'Inter', monospace;
}

.video-recording-max {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    font-variant-numeric: tabular-nums;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .video-recording-timer-overlay {
        padding: 10px 16px;
        min-width: 160px;
        gap: 10px;
        font-size: 14px;
    }
    
    .video-recording-label {
        font-size: 10px;
    }
    
    .video-recording-time {
        font-size: 16px;
        min-width: 40px;
    }
    
    .video-recording-max {
        font-size: 12px;
    }
    
    .video-recording-dot {
        width: 8px;
        height: 8px;
    }
}

/* Positionnement alternatif si le bouton est en bas */
.chat-input-area .video-recording-timer-overlay {
    bottom: auto;
    top: calc(100% + 12px);
}

.input-actions .video-recording-timer-overlay {
    bottom: auto;
    top: calc(100% + 12px);
}

/* Amélioration du bouton offer dans le thème sombre */
[data-theme="dark"] .offer-btn {
    background: linear-gradient(135deg, var(--umoa-blue) 0%, #1E6FD9 100%);
    box-shadow: 0 2px 8px rgba(0, 74, 173, 0.4);
}

[data-theme="dark"] .offer-btn:hover {
    background: linear-gradient(135deg, #003A8A 0%, var(--umoa-blue) 100%);
    box-shadow: 0 4px 12px rgba(0, 74, 173, 0.5);
}

/* Cacher le bouton offerBtn */
#offerBtn {
    display: none !important;
}

.message-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--chat-bg-secondary);
    border-radius: var(--chat-radius-xl);
    padding: 8px 12px;
    box-shadow: var(--chat-shadow-sm);
    border: 1px solid var(--chat-border);
    transition: var(--chat-transition-fast);
}

.message-form:focus-within {
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.1), var(--chat-shadow-md);
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 16px;
    font-size: 15px;
    color: var(--chat-text-primary);
    background: transparent;
    font-family: 'Inter', sans-serif;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    font-weight: 400;
}

.message-input::placeholder {
    color: var(--chat-text-muted);
    opacity: 0.7;
}

.send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--chat-accent);
    color: var(--umoa-white);
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-fast);
    flex-shrink: 0;
    font-size: 18px;
    box-shadow: var(--chat-shadow-sm);
}

.send-btn:hover {
    background: var(--chat-accent-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--chat-shadow-md);
}

.send-btn:active {
    transform: translateY(0) scale(0.95);
}

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

/* Liste des conversations */
.chat-conversations {
    width: 380px;
    background: var(--chat-bg-primary);
    border-right: 1px solid var(--chat-border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.chat-conversations-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--chat-text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex: 1;
    min-width: 0;
}

.chat-search-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--chat-bg-secondary);
    color: var(--chat-text-secondary);
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-fast);
    border: 1px solid var(--chat-border);
}

.chat-search-btn:hover {
    background: var(--chat-accent);
    color: var(--umoa-white);
    box-shadow: var(--chat-shadow-sm);
    border-color: var(--chat-accent);
}

.chat-search-container {
    padding: 12px 24px;
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--chat-bg-primary);
}

.chat-search-input {
    flex: 1;
    padding: 10px 16px;
    background: var(--chat-bg-secondary);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    color: var(--chat-text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--chat-transition-fast);
}

.chat-search-input:focus {
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.1);
}

.chat-search-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: transparent;
    color: var(--chat-text-secondary);
    border-radius: var(--chat-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-fast);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
}

.chat-search-close:hover {
    background: var(--chat-bg-secondary);
    color: var(--chat-accent);
}

.chat-conversations-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--chat-border) transparent;
}

.chat-conversations-list::-webkit-scrollbar {
    width: 6px;
}

.chat-conversations-list::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 10px;
}

.chat-conversation-item {
    padding: 16px 24px;
    border-bottom: 1px solid var(--chat-border);
    cursor: pointer;
    transition: var(--chat-transition-fast);
    background: var(--chat-bg-primary);
}

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

.chat-conversation-item.active {
    background: rgba(0, 74, 173, 0.08);
    border-left: 3px solid var(--chat-accent);
}

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

.chat-conversation-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.chat-conversation-avatar {
    width: 52px;
    height: 52px;
    border-radius: var(--chat-radius-full);
    object-fit: cover;
    border: 2px solid var(--chat-accent);
    box-shadow: var(--chat-shadow-sm);
}

.chat-conversation-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--chat-accent);
    color: var(--umoa-white);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    box-shadow: var(--chat-shadow-sm);
}

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

.chat-conversation-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-conversation-last-message {
    font-size: 13px;
    color: var(--chat-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.chat-conversation-time {
    font-size: 12px;
    color: var(--chat-text-muted);
    white-space: nowrap;
}

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

.chat-empty-state-icon {
    width: 120px;
    height: 120px;
    opacity: 0.2;
    margin-bottom: 24px;
    color: var(--chat-text-secondary);
}

.chat-empty-state-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 8px;
}

.chat-empty-state-subtext {
    font-size: 14px;
    color: var(--chat-text-secondary);
    opacity: 0.7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--chat-bg-primary);
    border-radius: var(--chat-radius-xl);
    padding: 32px;
    max-width: 450px;
    width: 90%;
    box-shadow: var(--chat-shadow-lg);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--chat-border);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    margin: 0;
    font-size: 22px;
    color: var(--chat-text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: var(--chat-bg-secondary);
    color: var(--chat-text-secondary);
    cursor: pointer;
    border-radius: var(--chat-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-fast);
    font-size: 20px;
    border: 1px solid var(--chat-border);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
}

.modal-close:hover {
    background: var(--chat-accent);
    color: var(--umoa-white);
    border-color: var(--chat-accent);
}

/* Styles pour le mode de livraison */
.delivery-mode-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.delivery-mode-options .radio-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.delivery-mode-options .radio-option:hover {
    border-color: #7B2CBF;
    background: #f8f9ff;
}

.delivery-mode-options .radio-option input[type="radio"] {
    margin-right: 0.75rem;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #7B2CBF;
}

.delivery-mode-options .radio-option label {
    cursor: pointer;
    margin: 0;
    flex: 1;
    font-weight: normal;
}

.delivery-mode-options .radio-option input[type="radio"]:checked + label {
    font-weight: 600;
    color: #7B2CBF;
}

.delivery-mode-options .radio-option:has(input[type="radio"]:checked) {
    border-color: #7B2CBF;
    background: rgba(123, 44, 191, 0.1); /* Violet UMOA - couleur unie avec transparence */
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--chat-text-primary);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--chat-bg-secondary);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    color: var(--chat-text-primary);
    transition: var(--chat-transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.1);
}

.btn-primary {
    background: var(--chat-accent);
    color: var(--umoa-white);
    border: none;
    padding: 14px 28px;
    border-radius: var(--chat-radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--chat-transition-fast);
    width: 100%;
    box-shadow: var(--chat-shadow-sm);
}

.btn-primary:hover {
    background: var(--chat-accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--chat-shadow-md);
}

/* Loading state */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--chat-text-secondary);
    font-size: 14px;
}

.chat-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--chat-border);
    border-top-color: var(--chat-accent);
    border-radius: var(--chat-radius-full);
    animation: spin 0.8s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Typing indicator */
.chat-typing-indicator {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    align-items: center;
    animation: messageSlideIn 0.3s ease;
}

.chat-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--chat-radius-full);
    background: var(--chat-text-secondary);
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Styles pour les messages de type chat (index.php) */
.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 4px;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 70%;
    word-wrap: break-word;
}

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

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

.chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--chat-radius-full);
    object-fit: cover;
    border: 2px solid var(--chat-border);
    flex-shrink: 0;
    box-shadow: var(--chat-shadow-sm);
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message-bubble {
    padding: 12px 16px;
    border-radius: var(--chat-radius-lg);
    box-shadow: var(--chat-shadow-bubble);
    word-wrap: break-word;
    max-width: 100%;
}

/* Quand il y a un composant audio, pas de background sur la bulle */
/* Le composant audio gère son propre style */

.chat-message.sent .chat-message-bubble {
    background: var(--chat-bubble-sent);
    color: var(--chat-bubble-sent-text);
    border-bottom-right-radius: 4px;
}

.chat-message.received .chat-message-bubble {
    background: var(--chat-bubble-received);
    border: 1px solid var(--chat-bubble-received-border);
    color: var(--chat-bubble-received-text);
    border-bottom-left-radius: 4px;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    opacity: 0.7;
    padding: 0 4px;
}

.chat-message-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: inherit;
}

/* Styles pour la barre d'outils */
.chat-input-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.chat-input-button {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--chat-bg-secondary);
    color: var(--chat-text-secondary);
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-fast);
    border: 1px solid var(--chat-border);
}

.chat-input-button:hover {
    background: var(--chat-accent);
    color: var(--umoa-white);
    transform: translateY(-2px);
    box-shadow: var(--chat-shadow-sm);
    border-color: var(--chat-accent);
}

.chat-input-button.active {
    background: var(--chat-accent);
    color: var(--umoa-white);
    border-color: var(--chat-accent);
}

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

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-size: 15px;
    color: var(--chat-text-primary);
    background: var(--chat-bg-secondary);
    border-radius: var(--chat-radius-xl);
    font-family: 'Inter', sans-serif;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    font-weight: 400;
    border: 1px solid var(--chat-border);
    transition: var(--chat-transition-fast);
}

/* Design moderne "pilule" pour mobile */
@media (max-width: 768px) {
    .chat-input {
        border-radius: 25px !important;
        padding: 10px 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .chat-input:focus {
        box-shadow: 0 4px 12px rgba(0, 74, 173, 0.15), 0 0 0 3px rgba(0, 74, 173, 0.1);
    }
    
    /* Position sticky pour le champ de saisie - reste collé au clavier */
    .chat-input-area,
    .chat-input-container {
        position: sticky;
        bottom: 0;
        background: var(--chat-bg-primary);
        z-index: 100;
        padding: 10px 14px;
        border-top: 1px solid var(--chat-border);
        margin-bottom: 0;
    }
    
    /* Aligner les éléments sur la même ligne pour gagner de la hauteur */
    .chat-form,
    .chat-input-form {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    
    /* Réduire la taille des boutons pour qu'ils s'alignent mieux */
    .chat-send-button,
    .camera-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
}

/* Optimisation pour très petits écrans */
@media (max-width: 480px) {
    .chat-input-area,
    .chat-input-container {
        padding: 8px 12px;
    }
}

.chat-input:focus {
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.1);
}

.chat-input::placeholder {
    color: var(--chat-text-muted);
    opacity: 0.7;
}

.chat-send-button {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--chat-accent);
    color: var(--umoa-white);
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-fast);
    flex-shrink: 0;
    box-shadow: var(--chat-shadow-sm);
}

.chat-send-button:hover {
    background: var(--chat-accent-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--chat-shadow-md);
}

.chat-send-button:active {
    transform: translateY(0) scale(0.95);
}

.chat-send-button:disabled {
    background: var(--chat-text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.5;
}

/* Améliorations pour les messages avec médias */
.message-bubble .message-image,
.message-bubble video {
    margin: -12px -16px 8px -16px;
    width: calc(100% + 32px);
    max-width: none;
    border-radius: var(--chat-radius-lg) var(--chat-radius-lg) 0 0;
}

.message-bubble .message-image:last-child,
.message-bubble video:last-child {
    margin-bottom: -12px;
    border-radius: var(--chat-radius-lg);
}

/* Responsive - Parfait pour mobile, tablette et desktop */
@media (max-width: 1024px) {
    .chat-container {
        margin: 0;
        border-radius: 0;
        height: calc(100vh - calc(64px + env(safe-area-inset-bottom, 0px))); /* Tient compte de la navbar bottom sur mobile */
    }
    
    .chat-conversations {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--chat-border);
    }
    
    .chat-messages-area {
        height: 60%;
    }
}

@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - calc(64px + env(safe-area-inset-bottom, 0px))); /* Tient compte de la navbar bottom */
    }
    
    .chat-conversations {
        width: 100%;
        height: 45%;
    }
    
    /* Assurer que les messages ne débordent pas sur mobile */
    .message {
        max-width: 95% !important;
        width: 100%;
        box-sizing: border-box;
    }
    
    .message-bubble {
        max-width: 100% !important;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .chat-messages-area {
        height: 55%;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-header {
        padding: 10px 14px;
        min-height: 56px;
    }
    
    .chat-user-info {
        gap: 10px;
        min-width: 0;
        overflow: hidden;
        padding-right: 60px;
        max-width: calc(100% - 60px);
    }
    
    .chat-header .avatar {
        width: 40px;
        height: 40px;
        border-width: 1.5px;
        flex-shrink: 0;
    }
    
    .user-details {
        gap: 3px;
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }
    
    .user-details h3 {
        font-size: 15px;
        line-height: 1.2;
        max-width: 100%;
    }
    
    .user-status {
        font-size: 12px;
        gap: 5px;
    }
    
    .user-status::before {
        width: 7px;
        height: 7px;
    }
    
    .chat-actions {
        padding: 10px 14px;
        gap: 2px;
    }
    
    .chat-messages {
        padding: 12px 8px;
        gap: 10px;
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chat-messages-list {
        padding: 12px 8px;
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chat-input-area {
        padding: 10px 14px;
    }
    
    .message-bubble {
        padding: 10px 14px;
        font-size: 14px;
        max-width: 100%;
        overflow: hidden;
        word-wrap: break-word;
    }
    
    /* Assurer que les cartes de commande ne débordent pas */
    .message-bubble .chat-message-order {
        max-width: 100% !important;
        width: calc(100% - 0px) !important;
        box-sizing: border-box;
    }
    
    .chat-conversations-header {
        padding: 16px 20px;
    }
    
    .chat-conversations-header h2 {
        font-size: 20px;
    }
    
    .chat-conversation-item {
        padding: 12px 16px;
    }
    
    .chat-conversation-avatar {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .message {
        max-width: 95% !important;
        width: 100%;
        box-sizing: border-box;
    }
    
    .message-bubble {
        max-width: 100% !important;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .chat-header {
        padding: 8px 12px;
        min-height: 52px;
    }
    
    .chat-user-info {
        gap: 8px;
        min-width: 0;
        padding-right: 55px;
        max-width: calc(100% - 55px);
    }
    
    .chat-header .avatar {
        width: 36px;
        height: 36px;
        border-width: 1.5px;
    }
    
    .user-details {
        gap: 2px;
        min-width: 0;
    }
    
    .user-details h3 {
        font-size: 14px;
        line-height: 1.2;
    }
    
    .user-status {
        font-size: 11px;
        gap: 4px;
    }
    
    .user-status::before {
        width: 6px;
        height: 6px;
    }
    
    .chat-actions {
        padding: 8px 12px;
        gap: 2px;
    }
    
    .action-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .message-bubble {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .chat-input-area {
        padding: 8px 12px;
    }
    
    .message-form {
        padding: 6px 10px;
    }
    
    .send-btn,
    .attach-btn,
    .emoji-btn,
    .chat-input-button {
        width: 36px;
        height: 36px;
    }
    
    .offer-btn {
        height: 36px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .offer-btn-icon {
        font-size: 16px;
    }
    
    .offer-btn-text {
        font-size: 12px;
    }
    
    .chat-send-button {
        width: 40px;
        height: 40px;
    }
    
    /* Styles responsive pour les cartes de commande dans les bulles de message */
    .message-bubble .chat-message-order {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Optimisations pour très petits écrans */
@media (max-width: 375px) {
    .chat-header {
        padding: 8px 10px;
        min-height: 50px;
    }
    
    .chat-user-info {
        gap: 6px;
        padding-right: 50px;
        max-width: calc(100% - 50px);
    }
    
    .chat-header .avatar {
        width: 34px;
        height: 34px;
    }
    
    .user-details h3 {
        font-size: 13px;
    }
    
    .user-status {
        font-size: 10px;
        gap: 3px;
    }
    
    .user-status::before {
        width: 5px;
        height: 5px;
    }
    
    .chat-actions {
        padding: 8px 10px;
    }
    
    .action-btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }
}

/* Optimisations pour écrans ultra-petits */
@media (max-width: 320px) {
    .chat-header {
        padding: 6px 8px;
        min-height: 48px;
    }
    
    .chat-user-info {
        gap: 5px;
        padding-right: 45px;
        max-width: calc(100% - 45px);
    }
    
    .chat-header .avatar {
        width: 32px;
        height: 32px;
    }
    
    .user-details h3 {
        font-size: 12px;
    }
    
    .user-status {
        font-size: 9px;
        gap: 3px;
    }
    
    .user-status::before {
        width: 4px;
        height: 4px;
    }
    
    .chat-actions {
        padding: 6px 8px;
    }
    
    .action-btn {
        width: 32px;
        height: 32px;
        font-size: 15px;
    }
}

/* Animations de chargement */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading-skeleton {
    background: linear-gradient(90deg, 
        var(--chat-bg-secondary) 25%, 
        var(--chat-border) 50%, 
        var(--chat-bg-secondary) 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: var(--chat-radius-md);
}

/* Styles pour le chat de livraison */
.delivery-chat {
    background: var(--chat-bg-primary);
    border-radius: var(--chat-radius-lg);
    border: 1px solid var(--chat-border);
    overflow: hidden;
}

.delivery-chat .chat-header {
    background: var(--chat-bg-primary);
    padding: 16px 20px;
    border-bottom: 1px solid var(--chat-border);
}

.delivery-chat .chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--chat-text-primary);
}

.chat-participants {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.participant-badge {
    background: var(--chat-bg-secondary);
    color: var(--chat-text-secondary);
    padding: 4px 12px;
    border-radius: var(--chat-radius-md);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--chat-border);
}

.delivery-chat .chat-messages {
    height: 300px;
    max-height: 300px;
    padding: 16px;
    background: var(--chat-bg-secondary);
}

.chat-input-container {
    padding: 12px 16px;
    background: var(--chat-bg-primary);
    border-top: 1px solid var(--chat-border);
}

.chat-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.delivery-chat .chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-xl);
    background: var(--chat-bg-secondary);
    color: var(--chat-text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.delivery-chat .chat-input:focus {
    outline: none;
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.1);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--chat-accent);
    color: var(--umoa-white);
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-fast);
    font-size: 18px;
    box-shadow: var(--chat-shadow-sm);
}

.chat-send-btn:hover {
    background: var(--chat-accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--chat-shadow-md);
}

.chat-send-btn:active {
    transform: translateY(0) scale(0.95);
}

/* Styles pour les messages d'erreur */
.chat-error-message {
    margin: 10px 0;
    padding: 12px 16px;
    border-radius: var(--chat-radius-md);
    animation: slideDown 0.3s ease-out;
}

.chat-error-error {
    background-color: #FEE2E2;
    border: 1px solid #FECACA;
    color: #DC2626;
}

[data-theme="dark"] .chat-error-error {
    background-color: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
}

.chat-error-info {
    background-color: #DBEAFE;
    border: 1px solid #BFDBFE;
    color: #2563EB;
}

[data-theme="dark"] .chat-error-info {
    background-color: rgba(37, 99, 235, 0.2);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #93C5FD;
}

.chat-error-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-error-icon {
    font-size: 18px;
}

.chat-error-text {
    flex: 1;
    font-size: 14px;
}

.chat-error-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-error-close:hover {
    opacity: 1;
}

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

.send-btn .spinning {
    animation: spin 1s linear infinite;
}

/* Messages d'action (offre, réservation) */
.action-message {
    background: linear-gradient(135deg, rgba(0, 74, 173, 0.1) 0%, rgba(0, 74, 173, 0.05) 100%);
    border: 1px solid rgba(0, 74, 173, 0.2);
    border-radius: var(--chat-radius-md);
    padding: 16px;
    margin: 8px 0;
}

.action-message.pending {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
    border-color: rgba(255, 193, 7, 0.3);
}

.action-message.accepted {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.action-message.refused {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.action-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 15px;
    color: var(--chat-text-primary);
}

.action-message-content {
    margin-bottom: 12px;
}

.action-message-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--chat-gold);
    margin: 8px 0;
}

.action-message-quantity {
    font-size: 18px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin: 8px 0;
}

.action-message-expiry {
    font-size: 13px;
    color: var(--chat-text-secondary);
    margin-top: 8px;
}

.action-message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.action-btn-accept,
.action-btn-refuse {
    flex: 1;
    min-width: 100px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--chat-radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--chat-transition-fast);
    font-family: 'Inter', sans-serif;
    box-shadow: var(--chat-shadow-sm);
}

.action-btn-accept {
    background: #10b981;
    color: white;
}

.action-btn-accept:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--chat-shadow-md);
}

.action-btn-refuse {
    background: #ef4444;
    color: white;
}

.action-btn-refuse:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--chat-shadow-md);
}

.action-btn-accept:disabled,
.action-btn-refuse:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Sélecteur d'emojis */
.emoji-picker {
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.emoji-picker button {
    font-size: 24px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.emoji-picker button:hover {
    background: #f0f0f0;
}

/* Message de fichier */
.message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--chat-bg-secondary);
    border-radius: var(--chat-radius-md);
    margin: 4px 0;
}

.message-file-icon {
    width: 40px;
    height: 40px;
    color: var(--chat-accent);
}

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

.message-file-name {
    font-weight: 600;
    color: var(--chat-text-primary);
    font-size: 14px;
    margin-bottom: 4px;
    word-break: break-word;
}

.message-file-size {
    font-size: 12px;
    color: var(--chat-text-secondary);
}

.message-file-download {
    color: var(--chat-accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--chat-radius-sm);
    transition: var(--chat-transition-fast);
}

.message-file-download:hover {
    background: rgba(0, 74, 173, 0.1);
}

/* Aperçu de fichier image */
.message-image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    transition: transform 0.2s;
}

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

/* Modal amélioré - S'assurer que les propriétés essentielles sont préservées */
.modal[style*="flex"],
.modal[style*="display: flex"],
.modal[style*="display:flex"] {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 10000 !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(4px) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Styles pour les messages de réservation */
.reserve-message {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--chat-radius-md);
    padding: 16px;
    margin: 8px 0;
}

.reserve-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 15px;
    color: var(--chat-text-primary);
}

.reserve-message-details {
    margin: 8px 0;
    font-size: 14px;
    color: var(--chat-text-secondary);
}

.reserve-message-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.reserve-message-status.pending {
    background: rgba(255, 193, 7, 0.2);
    color: #b8860b;
}

.reserve-message-status.accepted {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.reserve-message-status.refused {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

/* ============================================================================
   STYLES POUR LES FICHIERS DANS LES MESSAGES
   ============================================================================ */

/* Container pour les images */
.chat-message-image-container {
    margin: 0;
    border-radius: var(--chat-radius-md);
    overflow: hidden;
    max-width: 100%;
}

.chat-message-image {
    max-width: 100%;
    max-height: 400px;
    min-height: 100px; /* Hauteur minimale pour éviter les sauts de scroll */
    width: auto;
    height: auto;
    border-radius: var(--chat-radius-md);
    cursor: pointer;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
    /* Réserver l'espace pendant le chargement */
    background: var(--chat-bg-secondary, #f5f5f5);
}

.chat-message-image:hover {
    transform: scale(1.02);
}

/* Container pour les vidéos */
.chat-message-video-container {
    margin: 0;
    border-radius: var(--chat-radius-md);
    overflow: hidden;
    max-width: 100%;
    position: relative;
}

.chat-message-video {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--chat-radius-md);
    display: block;
}

/* Lecteur vidéo moderne style Instagram/TikTok */
.modern-video-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -moz-user-select: none;
    -ms-user-select: none;
}

.modern-video-wrapper video {
    width: 100%;
    height: auto;
    max-height: 400px;
    display: block;
    border-radius: 12px;
    background: #000;
    pointer-events: auto;
    object-fit: contain;
}

/* Skeleton loader pour le chargement */
.video-skeleton-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .video-skeleton-loader {
    background: linear-gradient(90deg, #0a0a0a 25%, #1a1a1a 50%, #0a0a0a 75%);
    background-size: 200% 100%;
}

/* Overlay de contrôles */
.video-controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-controls-overlay.visible {
    opacity: 1;
}

/* Bouton Play/Pause centré */
.play-pause-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 3;
    padding: 0;
    margin: 0;
}

.play-pause-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.play-pause-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.play-pause-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.play-pause-btn svg {
    width: 28px;
    height: 28px;
    color: #fff;
    fill: currentColor;
}

/* Barre de progression fine en bas */
.progress-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    pointer-events: none;
    z-index: 3;
}

.progress-bar-custom {
    height: 100%;
    width: 0%;
    min-width: 0;
    max-width: 100%;
    background: #fff;
    transition: width 0.1s linear;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    will-change: width;
}

/* Au toucher, la barre devient plus épaisse */
.modern-video-wrapper:active .progress-bar-container {
    height: 3px;
}

.modern-video-wrapper:active .progress-bar-custom {
    height: 100%;
}

/* Bouton Mute en bas à droite */
.mute-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 3;
    padding: 0;
    margin: 0;
}

.mute-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.mute-btn:active {
    transform: scale(0.95);
}

.mute-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.mute-btn svg {
    width: 20px;
    height: 20px;
    color: #fff;
    fill: currentColor;
}

/* Masquer les contrôles natifs du navigateur */
.modern-video-wrapper video::-webkit-media-controls {
    display: none !important;
}

.modern-video-wrapper video::-webkit-media-controls-enclosure {
    display: none !important;
}

.modern-video-wrapper video::-webkit-media-controls-panel {
    display: none !important;
}

.modern-video-wrapper video::-webkit-media-controls-play-button {
    display: none !important;
}

.modern-video-wrapper video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

/* État d'erreur pour les vidéos */
.modern-video-wrapper.video-error {
    opacity: 0.7;
}

.modern-video-wrapper.video-error video {
    opacity: 0.5;
}

.modern-video-wrapper.video-error .video-controls-overlay {
    display: none;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .play-pause-btn {
        width: 56px;
        height: 56px;
    }
    
    .play-pause-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .mute-btn {
        width: 32px;
        height: 32px;
        bottom: 8px;
        right: 8px;
    }
    
    .mute-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .progress-bar-container {
        height: 3px;
    }
}

/* Container pour les fichiers */
.chat-message-file {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--chat-bg-secondary);
    border-radius: var(--chat-radius-md);
    border: 1px solid var(--chat-border);
    max-width: 100%;
}

.chat-message-file-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    color: var(--chat-accent);
}

.chat-message-file-error {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--chat-radius-md);
    border: 1px solid rgba(239, 68, 68, 0.3);
    max-width: 100%;
}

.chat-message-file-error .chat-message-file-icon {
    color: #ef4444;
}

/* Skeleton loader */
.chat-message-file-skeleton {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--chat-bg-secondary);
    border-radius: var(--chat-radius-md);
    border: 1px solid var(--chat-border);
    max-width: 100%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

[data-theme="dark"] .skeleton-shimmer {
    background: linear-gradient(90deg, #21262D 25%, #30363D 50%, #21262D 75%);
    background-size: 200% 100%;
}

/* Audio player */
.chat-message-audio {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--chat-bg-secondary);
    border-radius: var(--chat-radius-md);
    border: 1px solid var(--chat-border);
    max-width: 100%;
}

/* Conteneur pour les messages audio simples (sans composant ChatAudioMessage) */
.chat-message-audio-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 320px;
}

.chat-message-audio-player {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    outline: none;
}

/* Quand l'audio est dans une bulle, ajuster le style */
.message-bubble .chat-message-audio-container {
    margin: 0;
    padding: 0;
    width: 100%;
}

.message-bubble .chat-message-audio-player {
    width: 100%;
    min-width: 250px;
    max-width: 100%;
}

/* Assurer que les messages audio dans les bulles sont bien visibles */
.message-bubble audio {
    width: 100%;
    height: 40px;
    outline: none;
}

.message-bubble .chat-message-audio-container audio {
    display: block;
    width: 100%;
}

/* Modal pour les images */
.chat-image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    cursor: pointer;
    animation: fadeIn 0.3s ease;
}

.chat-image-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    margin-top: 5%;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

.chat-image-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: color 0.2s;
    line-height: 1;
}

.chat-image-modal-close:hover {
    color: #bbb;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-message-image {
        max-width: 100%;
        max-height: 250px;
    }
    
    .chat-message-video {
        max-width: 100%;
        max-height: 250px;
    }
    
    .chat-message-file {
        padding: 10px;
    }
    
    .chat-message-file-icon {
        width: 40px;
        height: 40px;
    }
    
    .chat-image-modal-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
    
    .chat-image-modal-content {
        max-width: 95%;
        max-height: 85%;
        margin-top: 10%;
    }
}

/* ============================================================================
   CARTES DE RÉPONSE D'OFFRE (OfferResponseCard)
   ============================================================================ */

.offer-response-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    margin: 16px 0;
    border-radius: var(--chat-radius-lg);
    box-shadow: var(--chat-shadow-md);
    animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    border: 2px solid transparent;
    transition: var(--chat-transition);
}

.offer-response-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--chat-shadow-lg);
}

/* Carte acceptée - Vert (#2ecc71) */
.offer-response-accepted {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: #ffffff;
    border-color: #27ae60;
}

/* Carte refusée - Gris (#bdc3c7) */
.offer-response-refused {
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
    color: #2c3e50;
    border-color: #95a5a6;
}

/* Carte contre-offre - Orange (#f39c12) */
.offer-response-counter {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: #ffffff;
    border-color: #e67e22;
}

.offer-response-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--chat-radius-full);
    backdrop-filter: blur(10px);
}

.offer-response-content {
    flex: 1;
    min-width: 0;
}

.offer-response-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.3;
    color: inherit;
}

.offer-response-message {
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px 0;
    opacity: 0.95;
    color: inherit;
}

.offer-response-message strong {
    font-weight: 700;
    font-size: 16px;
    display: inline;
}

.offer-response-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.btn-offer-response {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--chat-radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--chat-transition);
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: #ffffff;
}

.btn-offer-response:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.btn-offer-response:active {
    transform: translateY(0);
}

.btn-offer-response .icon {
    font-size: 18px;
    line-height: 1;
}

/* Bouton paiement (vert) */
.btn-payment {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.btn-payment:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Bouton nouvelle offre (gris) */
.btn-new-offer {
    background: rgba(44, 62, 80, 0.9);
    border: 2px solid rgba(44, 62, 80, 1);
}

.btn-new-offer:hover {
    background: rgba(44, 62, 80, 1);
}

/* Bouton accepter contre-offre (orange clair) */
.btn-accept-counter {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.btn-accept-counter:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Bouton nouvelle contre-offre (orange foncé) */
.btn-new-counter {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-new-counter:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Animation d'entrée */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive pour les cartes de réponse */
@media (max-width: 768px) {
    .offer-response-card {
        padding: 16px;
        margin: 12px 8px;
        max-width: 100%;
    }
    
    .offer-response-icon {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .offer-response-title {
        font-size: 16px;
    }
    
    .offer-response-message {
        font-size: 13px;
    }
    
    .btn-offer-response {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1;
        min-width: 140px;
    }
    
    .offer-response-actions {
        flex-direction: column;
    }
    
    .offer-response-actions .btn-offer-response {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== MODALE CRÉATION COMMANDE - STYLES GÉNÉRAUX ==================== */
.create-order-modal-content {
    padding: 0 !important;
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.create-order-modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #7B2CBF; /* Violet UMOA - couleur unie */
    border-bottom: none;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 2px 10px rgba(123, 44, 191, 0.2);
}

.create-order-modal-header h3 {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
    color: #ffffff;
}

.create-order-modal-header .modal-close {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.create-order-modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.form-section {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    background: #ffffff;
}

.form-section:nth-child(even) {
    background: #fafbfc;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1.25rem 0;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h4::before {
    content: '';
    width: 4px;
    height: 20px;
    background: #7B2CBF; /* Violet UMOA - couleur unie */
    border-radius: 2px;
}

.create-order-form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.create-order-form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.order-items-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: nowrap;
    align-items: stretch;
}

.btn-add-items {
    min-width: 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.btn-add-catalog {
    flex: 1.3;
    max-width: 55%;
}

.btn-add-manual {
    flex: 1;
    max-width: 45%;
}

.btn-add-items .btn-icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.btn-add-items .btn-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.btn-add-catalog {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
}

.btn-add-catalog:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-add-catalog:active {
    transform: translateY(0);
}

.btn-add-manual {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
}

.btn-add-manual:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-add-manual:active {
    transform: translateY(0);
}

.order-items-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.order-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 14px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.order-item:hover {
    border-color: #7B2CBF;
    box-shadow: 0 4px 12px rgba(123, 44, 191, 0.15);
    transform: translateY(-2px);
}

.order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    gap: 0.75rem;
}

.order-item-number {
    font-weight: 600;
    color: #7B2CBF;
    font-size: 0.9rem;
    background: linear-gradient(135deg, rgba(123, 44, 191, 0.12) 0%, rgba(123, 44, 191, 0.08) 100%);
    padding: 0.5rem 0.875rem;
    border-radius: 10px;
    border: 1px solid rgba(123, 44, 191, 0.15);
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.order-item-number:hover {
    background: linear-gradient(135deg, rgba(123, 44, 191, 0.18) 0%, rgba(123, 44, 191, 0.12) 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(123, 44, 191, 0.15);
}

.btn-remove-item,
.btn.btn-danger.btn-sm.btn-remove-item,
button.btn.btn-danger.btn-sm.btn-remove-item {
    width: 35px !important;
    height: 44px !important;
    padding: 0 !important;
    min-width: 35px !important;
    min-height: 44px !important;
    max-width: 35px !important;
    max-height: 44px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.3rem;
    line-height: 1;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.2);
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn-remove-item:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-remove-item:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.25);
}

.order-item-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-item-field-full {
    width: 100%;
}

.order-item-fields-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.order-item-field-quantity {
    flex: 0 0 100px;
    min-width: 100px;
}

.order-item-field-price {
    flex: 1;
    min-width: 150px;
}

.order-item-field-discount {
    width: 100%;
}

.order-totals {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 14px;
    padding: 1.25rem;
    margin-top: 1rem;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.95rem;
}

.total-row:last-child {
    border-bottom: none;
}

.total-row.total-final {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 2px solid #7B2CBF;
    font-size: 1.1rem;
    background: rgba(123, 44, 191, 0.05); /* Violet UMOA - couleur unie avec transparence */
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    border-radius: 8px;
}

.currency-display {
    color: #666;
    font-size: 0.9em;
    margin-left: 0.25rem;
}

.create-order-form-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-top: 2px solid #e9ecef;
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.create-order-form-actions .btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
}

/* ==================== MODALE CRÉATION COMMANDE - VERSION MOBILE ==================== */
@media (max-width: 768px) {
    .create-order-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100vh - calc(64px + env(safe-area-inset-bottom, 0px))) !important; /* Tient compte de la navbar bottom */
        height: calc(100vh - calc(64px + env(safe-area-inset-bottom, 0px))); /* Tient compte de la navbar bottom */
        border-radius: 0 !important;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
    }

    .create-order-modal-header {
        padding: 1.25rem 1rem;
        border-bottom: none;
        background: #7B2CBF; /* Violet UMOA - couleur unie */
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(123, 44, 191, 0.2);
    }

    .create-order-modal-header h3 {
        font-size: 1.15rem;
        color: #ffffff;
    }

    .modal-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.5rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        z-index: 10;
    }

    #createOrderForm {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
    }

    .form-progress {
        position: sticky;
        top: 0;
        z-index: 5;
        background: white;
        padding: 0.5rem 1rem;
        border-bottom: 1px solid #e9ecef;
    }

    .form-section {
        padding: 1.25rem 1rem;
        flex-shrink: 0;
    }

    .form-section:nth-child(even) {
        background: #fafbfc;
    }

    .form-section h4 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        font-weight: 600;
        color: #333;
    }

    .form-control {
        font-size: 16px; /* Prévenir zoom iOS */
        padding: 14px 16px;
        border-radius: 10px;
        border: 1.5px solid #e0e0e0;
    }

    .form-control:focus {
        border-color: #7B2CBF;
        box-shadow: 0 0 0 3px rgba(123, 44, 191, 0.15);
        background: #ffffff;
    }

    .create-order-form-row {
        flex-direction: column;
        gap: 0;
    }

    .create-order-form-row .form-group {
        width: 100%;
        margin-bottom: 1.25rem;
    }

    .order-items-container {
        gap: 1rem;
        padding: 0;
    }

    .order-items-actions {
        flex-direction: row;
        gap: 0.625rem;
        margin-bottom: 1.25rem;
    }

    .btn-add-items {
        padding: 12px 10px;
        font-size: 0.85rem;
        border-radius: 12px;
        min-width: 0;
    }

    .btn-add-catalog {
        flex: 1.2;
        max-width: 52%;
    }

    .btn-add-manual {
        flex: 1;
        max-width: 48%;
    }

    .btn-add-items .btn-icon {
        font-size: 0.95rem;
        flex-shrink: 0;
    }

    .btn-add-items .btn-text {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .btn-add-catalog {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    }

    .btn-add-catalog:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    }

    .btn-add-manual {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    }

    .btn-add-manual:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    }

    .order-item {
        padding: 1.25rem 1rem;
        border-radius: 16px;
        margin-bottom: 1rem;
        border: 2px solid #e9ecef;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .order-item:active {
        transform: scale(0.98);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }

    .order-item-header {
        margin-bottom: 1rem;
        padding-bottom: 0.875rem;
        border-bottom: 2px solid #e9ecef;
        flex-wrap: nowrap;
        gap: 0.75rem;
        align-items: center;
    }

    .order-item-number {
        width: 65px;
        height: 36px;
        font-size: 0.875rem;
        padding: 0;
        border-radius: 12px;
        flex: 0 0 65px;
        min-width: 65px;
        max-width: 65px;
        min-height: 36px;
        max-height: 36px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        letter-spacing: 0.01em;
        background: linear-gradient(135deg, rgba(123, 44, 191, 0.15) 0%, rgba(123, 44, 191, 0.1) 100%);
        border: 1.5px solid rgba(123, 44, 191, 0.2);
        box-sizing: border-box;
    }

    .btn-remove-item,
    .btn.btn-danger.btn-sm.btn-remove-item,
    button.btn.btn-danger.btn-sm.btn-remove-item {
        width: 35px !important;
        height: 44px !important;
        padding: 0 !important;
        min-width: 35px !important;
        min-height: 44px !important;
        max-width: 35px !important;
        max-height: 44px !important;
        font-size: 1.4rem;
        flex-shrink: 0;
        border-radius: 8px;
        background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
        box-shadow: 0 3px 8px rgba(220, 53, 69, 0.25);
        border: none;
        -webkit-tap-highlight-color: rgba(220, 53, 69, 0.2);
    }

    .btn-remove-item:active {
        transform: scale(0.92);
        box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
    }

    .btn-remove-item:hover {
        transform: scale(1.05);
    }

    .order-item-fields {
        gap: 1.125rem;
    }

    .order-item-field-full,
    .order-item-field-discount {
        width: 100%;
        margin-bottom: 0;
    }

    .order-item-fields-row {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 0;
    }

    .order-item-field-quantity,
    .order-item-field-price {
        width: 100%;
        flex: 1;
        margin-bottom: 0;
    }

    .order-item-fields .form-group {
        margin-bottom: 0;
    }

    .order-item-fields .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.625rem;
        font-weight: 600;
        color: #333;
        display: block;
    }

    .order-item-fields .form-control {
        font-size: 16px; /* Prévenir zoom iOS */
        padding: 14px 16px;
        border-radius: 12px;
        border: 2px solid #e0e0e0;
        width: 100%;
        -webkit-appearance: none;
        appearance: none;
        min-height: 48px; /* Touch-friendly minimum height */
        transition: all 0.2s ease;
    }

    .order-item-fields .form-control:focus {
        border-color: #7B2CBF;
        box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.12);
        outline: none;
        background: #ffffff;
    }

    .order-item-fields input[type="number"] {
        font-size: 16px; /* Prévenir zoom iOS */
    }

    .order-item-fields input[type="text"] {
        font-size: 16px; /* Prévenir zoom iOS */
    }

    .order-totals {
        padding: 1rem;
        border-radius: 14px;
        margin-top: 0.75rem;
        border: 2px solid #e9ecef;
    }

    .total-row {
        padding: 0.625rem 0;
        font-size: 0.9rem;
    }

    .total-row.total-final {
        font-size: 1.05rem;
        padding-top: 0.75rem;
        margin-top: 0.5rem;
    }

    .delivery-mode-options {
        gap: 0.75rem;
    }

    .delivery-mode-options .radio-option {
        padding: 1rem;
        border-radius: 12px;
        min-height: 56px;
        display: flex;
        align-items: center;
    }

    .delivery-mode-options .radio-option input[type="radio"] {
        width: 22px;
        height: 22px;
        margin-right: 1rem;
    }

    .delivery-mode-options .radio-option label {
        font-size: 0.95rem;
        cursor: pointer;
        flex: 1;
    }

    .create-order-form-actions {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }

    .create-order-form-actions .btn {
        width: 100%;
        padding: 16px;
        font-size: 1rem;
        border-radius: 12px;
    }

    .create-order-form-actions .btn-secondary {
        order: 2;
    }

    .create-order-form-actions .btn-primary {
        order: 1;
        background: #7B2CBF; /* Violet UMOA - couleur unie */
        box-shadow: 0 4px 12px rgba(123, 44, 191, 0.3);
        color: #ffffff;
    }

    .create-order-form-actions .btn-primary:active {
        transform: scale(0.98);
    }

    .create-order-form-actions .btn-secondary {
        background: #ffffff;
        border: 2px solid #e9ecef;
        color: #4a5568;
    }

    .create-order-form-actions .btn-secondary:active {
        background: #f7fafc;
        transform: scale(0.98);
    }

    .form-text {
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }

    textarea.form-control {
        resize: vertical;
        min-height: 80px;
    }

    /* Amélioration de l'accessibilité tactile */
    .btn,
    .form-control,
    .radio-option {
        -webkit-tap-highlight-color: rgba(123, 44, 191, 0.2);
    }
}

/* ==================== TRÈS PETITS ÉCRANS (≤ 480px) ==================== */
@media (max-width: 480px) {
    .order-item {
        padding: 1rem 0.875rem;
        border-radius: 14px;
    }

    .order-item-header {
        margin-bottom: 0.875rem;
        padding-bottom: 0.75rem;
        gap: 0.625rem;
    }

    .order-item-number {
        width: 65px;
        height: 36px;
        font-size: 0.8rem;
        padding: 0;
        border-radius: 10px;
        flex: 0 0 65px;
        min-width: 65px;
        max-width: 65px;
        min-height: 36px;
        max-height: 36px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        letter-spacing: 0.015em;
        box-sizing: border-box;
    }

    .btn-remove-item,
    .btn.btn-danger.btn-sm.btn-remove-item,
    button.btn.btn-danger.btn-sm.btn-remove-item {
        width: 35px !important;
        height: 44px !important;
        padding: 0 !important;
        min-width: 35px !important;
        min-height: 44px !important;
        max-width: 35px !important;
        max-height: 44px !important;
        font-size: 1.3rem;
        border-radius: 8px;
    }

    .order-item-fields {
        gap: 1rem;
    }

    .order-item-fields .form-group label {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }

    .order-item-fields .form-control {
        padding: 12px 14px;
        font-size: 16px;
        min-height: 46px;
        border-radius: 10px;
    }

    .order-item-fields-row {
        gap: 0.875rem;
    }

    .order-items-container {
        gap: 0.875rem;
    }

    .order-items-actions {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .btn-add-items {
        padding: 11px 8px;
        font-size: 0.8rem;
    }

    .btn-add-items .btn-text {
        font-size: 0.8rem;
    }
}

/* Amélioration pour très petits écrans */
@media (max-width: 360px) {
    .create-order-modal-header {
        padding: 1rem 0.875rem;
    }

    .create-order-modal-header h3 {
        font-size: 1.05rem;
    }

    .form-section {
        padding: 1rem 0.875rem;
    }

    .form-section h4 {
        font-size: 0.95rem;
    }

    .order-items-actions {
        gap: 0.5rem;
    }

    .btn-add-items {
        padding: 12px 8px;
        font-size: 0.75rem;
    }

    .btn-add-catalog {
        flex: 1.15;
        max-width: 53%;
    }

    .btn-add-manual {
        flex: 1;
        max-width: 47%;
    }

    .btn-add-items .btn-icon {
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    .btn-add-items .btn-text {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .order-item {
        padding: 0.875rem;
    }

    .order-totals {
        padding: 0.875rem;
    }

    .create-order-form-actions {
        padding: 0.875rem;
        gap: 0.625rem;
    }

    .create-order-form-actions .btn {
        padding: 14px 12px;
        font-size: 0.9rem;
    }
}

/* Éléments non opérationnels - cachés sur mobile */
@media (max-width: 768px) {
    /* Bouton de basculement de thème - non opérationnel sur mobile */
    #chat-theme-toggle-conv {
        display: none !important;
    }
    
    /* Bouton d'appel vocal - non opérationnel sur mobile */
    .action-btn[title="Appel vocal"] {
        display: none !important;
    }
    
    /* Bouton d'appel vidéo - non opérationnel sur mobile */
    .action-btn[title="Appel vidéo"] {
        display: none !important;
    }
}

/* Amélioration de la visibilité des icônes sur PC (desktop uniquement) */
@media (min-width: 769px) {
    /* Amélioration du bouton d'envoi - icône SVG plus visible */
    .send-btn {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .send-btn svg {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px;
        min-height: 28px;
        color: #ffffff !important;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
        stroke-width: 3;
    }
    
    .send-btn:hover svg {
        transform: scale(1.15);
        filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
    }
    
    /* Amélioration des icônes SVG dans les boutons d'action - TAILLE AUGMENTÉE */
    .attach-btn,
    .emoji-btn,
    .camera-btn,
    .chat-voice-button {
        width: 48px;
        height: 48px;
    }
    
    .attach-btn svg,
    .emoji-btn svg,
    .camera-btn svg,
    .chat-voice-button svg {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px;
        min-height: 28px;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
        stroke-width: 3;
    }
    
    .attach-btn svg {
        color: #2563eb !important;
    }
    
    .emoji-btn svg {
        color: #d97706 !important;
    }
    
    .camera-btn svg {
        color: #059669 !important;
    }
    
    .chat-voice-button svg {
        color: #ef4444 !important;
    }
    
    /* Amélioration des paths SVG pour une meilleure visibilité */
    .attach-btn svg path,
    .emoji-btn svg path,
    .camera-btn svg path,
    .chat-voice-button svg path {
        stroke-width: 3;
    }
    
    /* Amélioration de l'icône emoji dans le bouton de commande */
    .btn-create-order .order-btn-icon {
        font-size: 24px !important;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
        display: inline-block;
        transform: scale(1.15);
        line-height: 1;
    }
    
    .btn-create-order:hover .order-btn-icon {
        transform: scale(1.3) rotate(-5deg);
        filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
    }
    
    /* Amélioration du contraste des boutons d'action sur PC */
    .attach-btn,
    .emoji-btn,
    .camera-btn,
    .chat-voice-button {
        border-width: 2px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1),
                    0 0 0 1.5px rgba(0, 0, 0, 0.05);
    }
    
    .attach-btn {
        border-color: #3b82f6;
    }
    
    .emoji-btn {
        border-color: #fbbf24;
    }
    
    .camera-btn {
        border-color: #10b981;
    }
    
    .chat-voice-button {
        border-color: #ef4444;
    }
    
    /* Amélioration des icônes SVG dans le chat-header (boutons d'action) */
    .chat-header .action-btn {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }
    
    .chat-header .action-btn svg {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px;
        min-height: 26px;
        color: var(--chat-text-secondary);
        filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
        stroke-width: 3;
        transition: all 0.3s ease;
    }
    
    .chat-header .action-btn:hover svg {
        color: var(--chat-accent);
        transform: scale(1.15);
        filter: drop-shadow(0 3px 5px rgba(0, 74, 173, 0.3));
    }
    
    .chat-header .action-btn.active svg {
        color: var(--umoa-white);
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    }
    
    /* Amélioration de l'indicateur de statut en ligne dans le chat-header */
    .user-status::before {
        width: 10px;
        height: 10px;
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    }
}

/* ============================================================================
   BOTTOM SHEET - Sélecteur de fichiers moderne (Mobile)
   ============================================================================ */

.file-picker-bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.file-picker-bottom-sheet.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.bottom-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-picker-bottom-sheet.active .bottom-sheet-backdrop {
    opacity: 1;
}

.bottom-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--chat-bg-primary);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 60vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.file-picker-bottom-sheet.active .bottom-sheet-content {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--chat-text-muted);
    border-radius: 2px;
    margin: 12px auto 8px;
    opacity: 0.5;
}

.bottom-sheet-header {
    padding: 16px 24px 8px;
    text-align: center;
}

.bottom-sheet-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--chat-text-primary);
}

.bottom-sheet-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.file-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--chat-bg-secondary);
    border: 2px solid var(--chat-border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.file-option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 74, 173, 0.1) 0%, rgba(0, 74, 173, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-option-btn:active {
    transform: scale(0.95);
}

.file-option-btn:hover::before,
.file-option-btn:active::before {
    opacity: 1;
}

.file-option-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.gallery-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.documents-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.videos-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.file-option-btn:hover .file-option-icon {
    transform: scale(1.1) rotate(5deg);
}

.file-option-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--chat-text-primary);
    position: relative;
    z-index: 1;
}

.file-option-size {
    font-size: 11px;
    color: var(--chat-text-muted);
    position: relative;
    z-index: 1;
}

/* Progress indicator sur le bouton attach */
.attach-btn {
    position: relative;
    overflow: visible;
}

.attach-btn .progress-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.attach-btn .progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.attach-btn .progress-ring circle {
    fill: none;
    stroke: var(--umoa-white);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.3s ease;
    opacity: 0.8;
}

.attach-btn.uploading {
    pointer-events: none;
    opacity: 0.7;
}

.attach-btn.uploading svg {
    opacity: 0.5;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .bottom-sheet-options {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 20px;
    }
    
    .file-option-icon {
        width: 56px;
        height: 56px;
    }
    
    .file-option-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .file-option-label {
        font-size: 13px;
    }
    
    .file-option-size {
        font-size: 10px;
    }
}

@media (max-width: 375px) {
    .bottom-sheet-options {
        gap: 10px;
        padding: 16px;
    }
    
    .file-option-btn {
        padding: 16px 8px;
    }
    
    .file-option-icon {
        width: 52px;
        height: 52px;
    }
    
    .file-option-icon svg {
        width: 24px;
        height: 24px;
    }
}

/* Dark theme support */
[data-theme="dark"] .bottom-sheet-content {
    background: var(--chat-bg-primary);
    border-top: 1px solid var(--chat-border);
}

[data-theme="dark"] .file-option-btn {
    background: var(--chat-bg-secondary);
    border-color: var(--chat-border);
}

[data-theme="dark"] .bottom-sheet-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

/* Bouton "Retour en bas" flottant */
.chat-scroll-to-bottom {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--chat-accent, #007bff);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    transition-property: opacity, visibility, transform;
}

/* Si le bouton est dans le body (fallback), utiliser fixed */
body > .chat-scroll-to-bottom {
    position: fixed;
}

.chat-scroll-to-bottom.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-scroll-to-bottom:hover {
    background: var(--chat-accent-hover, #0056b3);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.chat-scroll-to-bottom:active {
    transform: translateY(0);
}

.chat-scroll-to-bottom svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Mode sombre */
[data-theme="dark"] .chat-scroll-to-bottom {
    background: var(--chat-accent, #007bff);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .chat-scroll-to-bottom:hover {
    background: var(--chat-accent-hover, #0056b3);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Responsive : ajuster la position sur mobile */
@media (max-width: 768px) {
    .chat-scroll-to-bottom {
        bottom: 80px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
    
    .chat-scroll-to-bottom svg {
        width: 18px;
        height: 18px;
    }
}