/* Couleur personnalisée Vert Ferme pour la sidebar */
.main-sidebar {
    background-color: #1e4d2b !important /*#1e4d2b !important; /* Vert forêt profond */
}
.main-header {
    background-color: rgba(30, 77, 43, 0.8) !important; /* Vert forêt profond #6f42c1 */ 
    border-bottom: 3px solid #f1c40f !important; /* Ligne de rappel "Or/Oeuf" */
    color: #ffffff !important;
}
/* Force la couleur blanche pour les icônes du menu */
.btn-navbar i {
    color: #f1c40f !important;
}
.main-header .form-control-navbar::placeholder {
    color: #f1c40f !important;
}

.main-header .nav-link i, 
.main-header .navbar-nav .nav-link {
    color: #f1c40f !important;
}
/* Texte du logo */
.brand-link {
    background-color: #163a20 !important;
}

/* Style des liens actifs : Jaune Poussin / Jaune d'œuf */
.nav-sidebar .nav-item > .nav-link.active {
    background-color: #f1c40f !important; 
    color: #000000 !important;
    font-weight: bold;
}

/* Indicateur de survol */
.nav-sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Personnalisation des badges de stock dans le menu */
.badge-success {
    background-color: #27ae60 !important;
}



/* ==========================================================================
   1. STRUCTURE, LOGOS ET HEADER (ORIGINAL)
   ========================================================================== */
/* Décaler les items du menu principal */
/* Décaler le texte du menu (icône + label) */
.main-sidebar .nav-sidebar .nav-link {
    padding-left: 1.8rem !important;
}

/* Décaler encore plus les sous-menus */
.main-sidebar .nav-sidebar .nav-treeview .nav-link {
    padding-left: 3rem !important;
}

/* Styles pour les logos de connexion et de marque */
.login-logo img { max-height: 124px !important; width: auto !important; }
.brand-link img { max-height: 40px !important; width: auto !important; }

/* Suppression de la bordure inférieure du header principal */
.main-header { border-bottom: none !important; }

/* Styles généraux des cartes */
.card { 
    border-radius: 10px !important; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important; 
    margin-bottom: 20px; 
    border: none !important;
}

/* Styles des boutons */
.btn { border-radius: 6px !important; font-weight: 500; }

/* Prévention du débordement horizontal */
html, body { 
    /*overflow-x: hidden; 
    width: 100%; 
    */
    overflow-x: hidden !important; 
    width: 100% !important; 
    max-width: 100vw !important; /* Empêche le corps de s'élargir au dézoom */
    position: relative;
    margin: 0;
    padding: 0;
}


/* ==========================================================================
   2. RECHERCHE ET ACTIONS (ORIGINAL - AMÉLIORÉ)
   ========================================================================== */

/* Conteneur des filtres de liste */
#change-list-filters { 
    /*margin-top: -20px;*/
    background: #f8f9fa !important; 
    padding: 5px !important; 
    border-radius: 8px !important; 
    border: 0px solid #dee2e6 !important; 
    margin-bottom: 5px !important;
    width: 100% !important;  
}

/* Conteneur de recherche */
#changelist-search { 
    display: flex !important; 
    flex-wrap: wrap !important; 
    gap: 2px !important; 
}

/* Bouton de soumission de recherche */
#changelist-search button[type="submit"].btn-primary {
    height: 36px !important;
    font-size: 0.9rem !important;
    border-radius: 5px !important;
    border-bottom-color: rgb(21, 165, 137);
    box-shadow: rgba(59, 198, 171, 0.01) 0px 0px 0px 0.0776166px;
    border-left-color: rgb(21, 165, 137);
    border-right-color: rgb(21, 165, 137);
    border-top-color: rgb(21, 165, 137);
    background-color: rgb(22, 170, 141);
}

/* Groupes de formulaire */
#changelist-search .form-group { 
    margin-right: 0px !important; 
    margin-bottom: 0px !important; 
    margin-left : 10px !important
}

/* Barre de recherche */
#searchbar { 
    border: 1px solid #f59e0b !important; 
    border-radius: 20px !important; 
    padding-left: 0px; 
    height: 38px !important;
    font-size: 0.9rem !important;
}

/* Conteneur des actions */
.change-list-actions {
    display: flex; 
    flex-wrap: wrap; 
    align-items: center; 
    gap: 10px;
    background: #ffffff; 
    padding: 12px; 
    border-radius: 8px; 
    border-left: 3px solid #f59e0b;
    margin-bottom: 12px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-left:  3px !important;
    margin-right:  0px !important;
    border-right: 3px solid #f59e0b;
}

/* Section actions */
.actions { 
    display: flex !important; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 10px; 
    width: 100%; 
}

/* Labels des actions */
.actions label { 
    margin-bottom: 0; 
}

/* Sélecteurs des actions */
.actions select { 
    height: 36px !important; 
    border-radius: 5px !important; 
    font-size: 0.9rem; 
    border: 1px solid #ced4da !important;
}

/* Bouton de soumission des actions */
.actions button[type="submit"].btn-primary {
    height: 36px !important;
    padding: 6px 15px !important;
    font-size: 0.9rem !important;
    border-radius: 5px !important;
    margin-right: 5px !important;
    margin-left: 15px !important;
    border-bottom-color: rgb(21, 165, 137);
    box-shadow: rgba(59, 198, 171, 0.01) 0px 0px 0px 0.0776166px;
    border-left-color: rgb(21, 165, 137);
    border-right-color: rgb(21, 165, 137);
    border-top-color: rgb(21, 165, 137);
    background-color: rgb(22, 170, 141);
}

/* Compteur d'actions */
.action-counter {
    font-size: 0.85rem !important;
    color: #6c757d !important;
}


/* ==========================================================================
   3. OPTIMISATION MOBILE (COMPACT)
   ========================================================================== */
@media screen and (max-width: 1024px) and (orientation: portrait), screen and (max-width: 850px) {
    
    /* RÉDUCTION GÉNÉRALE DES MARGES */
    .content {
        padding: 5px !important;
        margin-top: 0px !important;
    }
    
    div.content.border-bottom.mb-2{
        /*margin-bottom: -10px !important;*/
    }
    
    .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    /* 1. Force la ligne du titre à ne pas s'empiler */
    .content-header .row, 
    .content.border-bottom.mb-2 .row {
        display: flex !important;
        flex-direction: row !important; /* Force l'alignement horizontal */
        flex-wrap: nowrap !important;  /* Interdit le retour à la ligne */
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        margin: 0 !important;
        padding:  10px !important;
        padding-bottom: 2px !important;
    }
    /* Layout du header */
    .content.border-bottom.mb-2 .row {
        display: flex !important;
        flex-direction: column !important;
        gap: 1px !important;
        margin: 0 !important;
    }
    
    /* TITRE COMPACT */
    h1.h4 {
        padding: 0 !important;
        margin-left: 0px !important;
        margin-top: 5px !important;
        margin-bottom: 2px !important;
        border: none !important;
        font-size: 1.6rem !important;
        font-weight: 700 !important;
        color: #2c3e50 !important;
        width: 100% !important;
        position: relative !important;
        padding-bottom: 0px !important;
        display: flex !important;
        align-items: center !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    }
    
    /* Masquer le fil d'Ariane */
    .breadcrumb {
        display: none !important;
    }
    
    /* BOUTON AJOUTER COMPACT */
a.btn-success.float-right[href*="add/"] {
    /* 1. ALIGNEMENT INTERNE (CENTRE LE TEXTE ET L'ICÔNE DANS LE BOUTON) */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    
    /* 2. POSITIONNEMENT DU BOUTON À DROITE */
    float: right !important; /* Force le côté droit */
    margin-right: 10px !important; /* Petit espace avec le bord de l'écran */
    margin-left: auto !important; 
    
    /* 3. TAILLE */
    width: 60% !important; /* Réduit un peu pour laisser de la place au titre */
    height: 35px !important;
    
    /* 4. STYLE ET COULEURS */
    padding: 0 !important;
    font-size: 0.9rem !important;
    border-radius: 6px !important;
    background-color: rgb(22, 170, 141) !important;
    border: 1px solid rgb(21, 165, 137) !important;
}
    
    /* SECTION ACTIONS MOBILE COMPACT */
    .change-list-actions {
        border-radius: 8px !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .actions {
        flex-direction: column !important;
        gap: 1px !important;
        align-items: stretch !important;
    }
    
    .actions label {
        width: 100% !important;
        margin: 0 !important;
    }
    
    .actions select {
        width: 100% !important;
        height: 36px !important;
        font-size: 0.9rem !important;
        border-radius: 5px !important;
    }
    
    .actions button[type="submit"].btn-primary {
        width: 100% !important;
        height: 36px !important;
        font-size: 0.9rem !important;
        margin: 2px 0 !important;
        border-radius: 5px !important;
    }
    
    .action-counter {
        width: 100% !important;
        text-align: center !important;
        padding: 0px !important;
        font-size: 0.85rem !important;
        margin-top: 2px !important;
        border-radius: 5px !important;
    }
    
    /* TABLE MOBILE COMPACT */
    .change-list .card { 
        margin-top: 10px !important;
        width: 100% !important; 
        border-radius: 8px !important; 
        box-shadow: 0 2px 6px rgba(0,0,0,0.05) !important;
        border-left: 3px solid #f59e0b !important;
        border-right: 3px solid #f59e0b !important;
    }
    
    .change-list .card-body { 
        padding: 0 !important; 
        overflow-x: auto !important;
    }
    
    #result_list {
        min-width: 600px !important;
    }
    
    #result_list thead th {
        padding: 10px 12px !important;
        font-size: 0.7rem !important;
    }
    
    #result_list tbody td, #result_list tbody th {
        padding: 10px 12px !important;
        font-size: 0.8rem !important;
    }
    
    /* FORMULAIRES MOBILE */
    .content-wrapper { 
        margin-left: 0 !important; 
        padding: 0 !important; 
    }
    
    .change-form .p-5 { 
        padding-left: 12px !important; 
        padding-right: 12px !important; 
    } 
    
    .main-header { 
        margin-left: 0 !important; 
    }
    
    .card-header { 
        text-align: center !important; 
        padding: 12px !important;
    }
    
    .card-title { 
        float: none !important; 
        display: block !important; 
        font-size: 1rem !important;
        margin: 0 !important;
    }
    
    .form-group .row { 
        display: block !important; 
        margin: 0 0 10px 0 !important; 
    }
    
    .form-group label {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        padding: 0 0 4px 0 !important;
        font-size: 0.85rem !important;
        font-weight: 500 !important;
        margin-bottom: 2px !important;
    }
    
    .vTextField, .vLargeTextField, select, .select2-container, input[type="text"], input[type="number"] {
        width: 100% !important;
        text-align: left !important; 
        margin-bottom: 4px !important;
        height: 38px !important;
        border-radius: 6px !important;
        border: 1px solid !important;
        padding: 0 10px !important;
        font-size: 0.9rem !important;
    }
    
    .inline-related { 
        margin-bottom: 12px !important; 
        border-radius: 8px !important;
        padding: 10px !important;
    }
    
    .submit-row {
        display: flex !important; 
        flex-direction: column !important; 
        gap: 6px !important;
        padding: 12px 10px !important; 
        position: sticky !important; 
        bottom: 0 !important;
        background: #fff !important; 
        box-shadow: 0 -2px 10px rgba(0,0,0,0.08) !important; 
        z-index: 1030 !important;
        /*margin-left: -10px !important;
        margin-right: -10px !important;  */
    }
    
    .submit-row .btn { 
        width: 100% !important; 
        margin: 0 !important; 
        height: 40px !important;
        font-size: 0.9rem !important;
        font-weight: 500 !important;
        border-radius: 6px !important;
    }
    
    /* ESPACEMENT ENTRE SECTIONS */
    #content-main > * {
        margin-top: 8px !important;
        margin-bottom: 8px !important;
    }
    
    #content-main > *:first-child {
        margin-top: 0 !important;
    }
    
    #content-main > *:last-child {
        margin-bottom: 0 !important;
    }
    
    /* PAGINATION */
    .dataTables_info,
    .pagination {
        padding: 8px 0 !important;
        margin: 6px 0 !important;
        font-size: 0.85rem !important;
    }

    


    
    /* PETITS ÉCRANS */
    /*
    @media (max-width: 380px) {
        .content {
            padding: 8px !important;
        }
        
        .content.border-bottom.mb-2 {
            padding: 8px !important;
            margin-bottom: 6px !important;
        }
        
        h1.h4 {
            font-size: 1.1rem !important;
        }
        
        a.btn-success.float-right[href*="add/"] {
            padding: 8px 10px !important;
            font-size: 0.85rem !important;
            height: 36px !important;
        }
        
        #change-list-filters,
        .change-list-actions {
            padding: 5px !important;
        }
    }
        */
}


/* ==========================================================================
   4. AMÉLIORATION ONGLETS (ORIGINAL)
   ========================================================================== */
#jazzy-tabs { 
    border-bottom: 1px solid #dee2e6 !important; 
    margin-bottom: 15px !important; 
}

#jazzy-tabs .nav-link {
    font-weight: 500; 
    color: #6c757d; 
    border: none !important;
    border-bottom: 3px solid transparent !important; 
    transition: all 0.3s;
}

#jazzy-tabs .nav-link.active {
    color: #3498db !important; 
    background: transparent !important;
    border-bottom: 3px solid #3498db !important;
}

@media screen and (max-width: 1024px) and (orientation: portrait), screen and (max-width: 850px) {
    #jazzy-tabs { 
        flex-wrap: nowrap !important; 
        overflow-x: auto !important; 
        justify-content: space-around !important; 
        padding-bottom: 2px !important;
    }
    
    #jazzy-tabs .nav-link .tab-text { 
        display: none !important; 
    }
    
    #jazzy-tabs .nav-link i { 
        font-size: 1.2rem; 
        margin: 0 !important; 
    }
}


/* ==========================================================================
   5. OPTIMISATION MOBILE POUR FORMULAIRES
   ========================================================================== */
@media screen and (max-width: 1024px) and (orientation: portrait), screen and (max-width: 850px) {
    
    /* FORMULAIRES MOBILE - RESPONSIVE */
    .form-group .row {
        flex-direction: column !important;
        margin: 0 0 16px 0 !important;
    }
    
    .form-group label {
        text-align: left !important;
        padding: 0 0 8px 0 !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        width: 100% !important;
        margin-bottom: 4px !important;
    }
    
    .form-group div[class*="col-sm-"] {
        width: 100% !important;
        padding: 0 !important;
        align-items: stretch !important;
    }
    
    /* CHAMPS FORMULAIRE MOBILE */
    .vTextField, .vLargeTextField, select, .select2-container, 
    input[type="text"], input[type="number"], input[type="email"], 
    input[type="password"] {
        width: 100% !important;
        height: 46px !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
        border: 2px solid #e2e8f0 !important;
        margin-bottom: 5px !important;
        box-sizing: border-box !important;
        line-height: normal !important;
    }
    
    /* Textarea spécifique */
    textarea {
        width: 100% !important;
        min-height: 120px !important;
        padding: 16px !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
        border: 2px solid #e2e8f0 !important;
        margin-bottom: 5px !important;
        box-sizing: border-box !important;
        line-height: 1.5 !important;
        resize: vertical !important;
    }
    
    /* RELATED WIDGETS MOBILE */
    .related-widget-wrapper {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    
    .related-widget-wrapper select {
        width: 100% !important;
        min-width: 100% !important;
        order: 1 !important;
    }
    
    .related-icon-line {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
        padding: 8px 0 !important;
        width: 100% !important;
        order: 2 !important;
    }
    
    .related-widget-wrapper-link {
        width: 44px !important;
        height: 44px !important;
        border-radius: 10px !important;
    }
    
    .related-widget-wrapper-link img {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* ONGLETS MOBILE */
    #jazzy-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        padding-bottom: 5px !important;
        margin-bottom: 15px !important;
    }
    
    #jazzy-tabs .nav-link {
        padding: 12px 20px !important;
        font-size: 1rem !important;
        white-space: nowrap !important;
    }
    
    #jazzy-tabs .nav-link .tab-text {
        display: inline !important;
    }
    
    #jazzy-tabs .nav-link i {
        font-size: 1.2rem !important;
        margin-right: 8px !important;
    }
    
    /* INLINE RELATED MOBILE */
    .inline-related {
        padding: 12px !important;
        margin-bottom: 12px !important;
        border-radius: 10px !important;
    }
    
    .inline-related .card-header {
        padding: 10px 12px !important;
    }
    
    .inline-related .card-body {
        padding: 12px !important;
    }
    
    /* SECTION BOUTONS MOBILE */
    #jazzy-actions {
        padding: 16px !important;
        margin: 16px 0 !important;
        border-radius: 10px !important;
    }
    
    #jazzy-actions .btn {
        height: 52px !important;
        font-size: 1.1rem !important;
        margin-bottom: 10px !important;
        border-radius: 10px !important;
    }
    
    /* LAYOUT FORMULAIRE MOBILE */
    .change-form .p-5 {
        padding: 0 !important;
    }
    
    .card {
        margin-bottom: 16px !important;
        border-radius: 10px !important;
    }
    
    .card-body {
        padding: 16px !important;
    }
    
    /* ESPACEMENT FORMULAIRE */
    .content .row {
        margin: 0 !important;
    }
    
    .col-12, .col-12.col-lg-9, .col-12.col-lg-3 {
        padding: 0 !important;
        margin-bottom: 16px !important;
    }

     .vTextField, .vLargeTextField, select, .select2-container {
            height: 40px !important;
            font-size: 0.95rem !important;
            padding: 0 0px !important;
        }
        
        input[type="text"], input[type="number"], input[type="email"], 
        input[type="password"], .vTextField, .vLargeTextField {
            padding-left: 8px !important;
            padding-right: 8px !important;
        }
    
    /* POUR TRÈS PETITS ÉCRANS */
    @media (max-width: 380px) {
        .vTextField, .vLargeTextField, select, .select2-container {
            height: 40px !important;
            font-size: 0.95rem !important;
            padding: 0 0px !important;
        }
        
        input[type="text"], input[type="number"], input[type="email"], 
        input[type="password"], .vTextField, .vLargeTextField {
            padding-left: 10px !important;
            padding-right: 10px !important;
        }
        
        #jazzy-tabs .nav-link {
            padding: 10px 16px !important;
            font-size: 0.95rem !important;
        }
        
        #jazzy-actions .btn {
            height: 48px !important;
            font-size: 1rem !important;
        }
        
        .inline-related {
            padding: 10px !important;
        }
    }
}


/* ==========================================================================
   6. BOUTON ICÔNE TOGGLE À DROITE - VERSION CORRIGÉE
   ========================================================================== */
@media screen and (max-width: 1024px) and (orientation: portrait), screen and (max-width: 850px) {
    
    /* 1. Bouton flottant pour filtres */
    .mobile-filter-toggle {
        position: absolute !important;
        top: 124px !important;
        left: 24px !important;
        width: 40px !important;
        height: 40px !important;
        color: rgb(255, 255, 255) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 20px !important;
        cursor: pointer !important;
        z-index: 100 !important;
        box-shadow: 0 3px 10px rgba(0,0,0,0.2) !important;
        border: 2px solid white !important;
    }
    
    @keyframes float {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-5px); }
    }
    
    /* 2. Cacher le formulaire ORIGINAL par défaut sur mobile */
    #change-list-filters {
        display: none !important;
    }
    
    /* 3. Modal des filtres (clone créé par JS) */
    .mobile-filters-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.85) !important;
        z-index: 9998 !important;
        margin: 0 !important;
        padding: 20px !important;
        display: none !important;
        align-items: center !important;
        justify-content: center !important;
        backdrop-filter: blur(5px) !important;
    }
    
    .mobile-filters-modal.active {
        display: flex !important;
        animation: fadeIn 0.3s ease !important;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    /* 4. Contenu du modal */
    .mobile-filters-modal div#mobile-change-list-filters.modal-content {
        background: white !important;
        padding: 30px 25px 25px 25px !important;
        border-radius: 20px !important;
        width: 95% !important;
        max-width: 500px !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        position: relative !important;
        animation: modalSlideIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4) !important;
    }
    
    @keyframes modalSlideIn {
        from {
            opacity: 0;
            transform: translateY(30px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    /* 5. Bouton fermer */
    .modal-close-btn {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        width: 36px !important;
        height: 36px !important;
        background: #f8f9fa !important;
        color: #666 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 18px !important;
        cursor: pointer !important;
        border: none !important;
        outline: none !important;
        transition: all 0.2s ease !important;
        z-index: 10000 !important;
    }
    
    .modal-close-btn:hover {
        background: #e74c3c !important;
        color: white !important;
        transform: rotate(90deg) !important;
    }
    
    /* 6. Titre du modal */
    .modal-title {
        font-size: 1.2rem !important;
        font-weight: 700 !important;
        color: #2c3e50 !important;
        margin-bottom: 25px !important;
        text-align: center !important;
        padding-bottom: 15px !important;
        border-bottom: 2px solid #f1f5f9 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px !important;
    }
    
    .modal-title::before {
        content: "" !important;
        font-size: 1.3rem !important;
    }
    
    /* 7. Style du formulaire dans le modal */
    .mobile-filters-modal #changelist-search,
    .mobile-filters-modal form {
        flex-direction: column !important;
        gap: 18px !important;
        margin: 0 !important;
        display: flex !important;
    }
    
    .mobile-filters-modal .form-group {
        width: 100% !important;
        margin: 0 !important;
    }
    
    /* 8. Style des champs */
    .mobile-filters-modal .form-control,
    .mobile-filters-modal #searchbar,
    .mobile-filters-modal select,
    .mobile-filters-modal .search-filter,
    .mobile-filters-modal input[type="text"],
    .mobile-filters-modal input[type="search"] {
        width: 100% !important;
        height: 46px !important;
        border-radius: 10px !important;
        border: 2px solid #e2e8f0 !important;
        padding: 0 15px !important;
        font-size: 1rem !important;
        background: white !important;
        box-sizing: border-box !important;
    }
    
    /* 9. Bouton recherche */
    .mobile-filters-modal .btn-primary,
    .mobile-filters-modal button[type="submit"] {
        width: 100% !important;
        height: 48px !important;
        background: linear-gradient(135deg, #3498db 0%, #2980b9 100%) !important;
        border: none !important;
        border-radius: 10px !important;
        font-weight: 600 !important;
        font-size: 1rem !important;
        margin-top: 10px !important;
        color: white !important;
        cursor: pointer !important;
    }
    
    /* 10. Conserver TOUS les champs Django visibles */
    .mobile-filters-modal select,
    .mobile-filters-modal option,
    .mobile-filters-modal input,
    .mobile-filters-modal textarea {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* 11. Pour les selects Django */
    .mobile-filters-modal .select2-container {
        width: 100% !important;
        margin-bottom: 5px !important;
    }
}


/* ==========================================================================
   7. STYLES POUR RELATED WIDGETS MOBILE
   ========================================================================== */
@media screen and (max-width: 1024px) and (orientation: portrait), screen and (max-width: 850px) {
    
    /* Conteneur principal des related widgets */
    .related-widget-wrapper.mobile-related-container {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important; 
        align-items: center !important;
        gap: 8px !important;
    }
    
    /* Le menu déroulant prend toute la largeur */
    .related-widget-wrapper.mobile-related-container select, 
    .related-widget-wrapper.mobile-related-container .select2-container {
        flex: 0 0 100% !important; 
        width: 100% !important;
        margin-bottom: 5px !important;
    }
    
    /* Style des boutons (Modifier, Supprimer, etc.) */
    .related-widget-wrapper.mobile-related-container .related-widget-wrapper-link {
        flex: 0 0 auto !important;
        display: inline-flex !important;
        width: 44px !important;
        height: 44px !important;
        background: #fff !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 0 !important;
    }
    
    /* Images dans les boutons */
    .related-widget-wrapper.mobile-related-container .related-widget-wrapper-link img {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
    }
}


/* ==========================================================================
   8. MODALS FULLSCREEN MOBILE
   ========================================================================== */
@media screen and (max-width: 1024px) and (orientation: portrait), screen and (max-width: 850px) {
    
    /* 1. LE CONTENEUR DU MODAL */
    .modal.show {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.7) !important;
        backdrop-filter: blur(5px) !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 1050 !important;
        margin: 0 !important;
        padding: 10px !important;
    }
    
    /* 2. LA BOITE DE DIALOGUE */
    .modal-dialog {
        width: 95% !important;
        max-width: 95% !important;
        height: 85vh !important;
        margin: 0 !important;
        display: flex !important;
        pointer-events: auto !important;
    }
    
    /* 3. LE CONTENU BLANC */
    .modal-content {
        width: 100% !important;
        height: 100% !important;
        border-radius: 20px !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        border: none !important;
        background: white !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
    }
    
    /* 4. LE CORPS SCROLLABLE */
    .modal-body {
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 20px !important;
    }
    
    /* 5. Force l'iframe si présente */
    .modal-body iframe {
        width: 100% !important;
        height: 100% !important;
        border: none !important;
    }
}


/* ==========================================================================
   9. FIX FINAL HEADER ET ICONE USER
   ========================================================================== */

/* Empêcher le décalage vers la droite (padding) injecté par JS */
body.modal-open, 
.modal-open .main-header, 
.modal-open .navbar {
    padding-right: 0 !important;
    margin-right: 0 !important;
    position: fixed;   
}
 
/* Header en mode modal ouvert */
body.modal-open .main-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    margin-top: 0 !important;
}

/* Stabiliser le wrapper pour éviter le saut vertical */
body.modal-open .wrapper {
    position: fixed !important;
    width: 100% !important;
    top: 0 !important;
}

/* Correction spécifique pour l'icône utilisateur à droite */
.modal-open .navbar-nav.ml-auto {
    margin-right: 0 !important;
    padding-right: 15px !important;
}

/* 1. On bloque la racine pour empêcher le calcul de la scrollbar */
html.modal-open, 
body.modal-open {
    overflow: hidden !important;
    width: 100% !important;
    padding-right: 0 !important;
}

/* 2. On force le header à ignorer le padding de Bootstrap */
body.modal-open .main-header,
body.modal-open #jazzy-navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    padding-right: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}







