/* Styles pour les tableaux de la page operations */

/* Optimisation responsive du tableau des opérations */
#operationsTable {
    font-size: 0.875rem; /* Réduction de la taille de police */
    table-layout: fixed; /* Force la table à respecter les largeurs définies */
    width: 100%;
}

#operationsTable th, 
#operationsTable td {
    padding: 0.5rem 0.25rem; /* Réduction du padding */
    vertical-align: middle;
    white-space: nowrap; /* Empêche le retour à la ligne dans les cellules */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Largeurs fixes pour les colonnes principales */
#operationsTable th:nth-child(1) { width: 120px; }  /* Référence - élargie pour afficher le code complet */
#operationsTable th:nth-child(2) { width: 60px; }  /* Type */
#operationsTable th:nth-child(3) { width: 120px; } /* Client */
#operationsTable th:nth-child(4) { width: 130px; } /* Véhicule */
#operationsTable th:nth-child(5) { width: 70px; }  /* Catégorie */
#operationsTable th:nth-child(6) { width: 70px; }  /* Départ */
#operationsTable th:nth-child(7) { width: 70px; }  /* Retour */
#operationsTable th:nth-child(8) { width: 90px; }  /* Dates */
#operationsTable th:nth-child(9) { width: 80px; }  /* Prix */
#operationsTable th:nth-child(10) { width: 80px; } /* Statut */
#operationsTable th:nth-child(11) { width: 80px; } /* Paiement */
#operationsTable th:nth-child(12) { width: 90px; } /* Actions */

/* Permettre le texte sur plusieurs lignes pour certaines colonnes */
#operationsTable td:nth-child(1),  /* Référence - permettre le retour à la ligne */
#operationsTable td:nth-child(3),  /* Client */
#operationsTable td:nth-child(4),  /* Véhicule */
#operationsTable td:nth-child(8) { /* Dates */
    white-space: normal;
    line-height: 1.2;
}

/* Styles compacts pour les badges */
#operationsTable .badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.3rem;
    line-height: 1.1;
}

/* Optimisation pour grands écrans (affichage complet) */
@media (min-width: 1400px) {
    #operationsTable {
        font-size: 0.9rem;
    }
    
    #operationsTable th, 
    #operationsTable td {
        padding: 0.6rem 0.4rem;
    }
}

/* Optimisation pour tablettes */
@media (max-width: 1200px) {
    /* Masquer les colonnes moins importantes sur les écrans moyens */
    #operationsTable th:nth-child(5),  /* Catégorie */
    #operationsTable td:nth-child(5) {
        display: none;
    }
    
    #operationsTable th:nth-child(6),  /* Ville départ */
    #operationsTable td:nth-child(6),
    #operationsTable th:nth-child(7),  /* Ville retour */
    #operationsTable td:nth-child(7) {
        display: none;
    }
    
    /* Réajuster les largeurs sans ces colonnes */
    #operationsTable th:nth-child(3) { width: 140px; } /* Client plus large */
    #operationsTable th:nth-child(4) { width: 150px; } /* Véhicule plus large */
}

/* Optimisation pour tablettes petites */
@media (max-width: 992px) {
    #operationsTable {
        font-size: 0.8rem;
    }
    
    /* Masquer encore plus de colonnes */
    #operationsTable th:nth-child(8),  /* Dates détaillées */
    #operationsTable td:nth-child(8) {
        display: none;
    }
    
    /* Réajuster les largeurs */
    #operationsTable th:nth-child(3) { width: 130px; } /* Client */
    #operationsTable th:nth-child(4) { width: 140px; } /* Véhicule */
    #operationsTable th:nth-child(12) { width: 100px; } /* Actions plus larges */
}

/* Optimisation pour mobiles */
@media (max-width: 768px) {
    #operationsTable {
        font-size: 0.75rem;
    }
    
    /* Réduire encore le padding sur mobile */
    #operationsTable th, 
    #operationsTable td {
        padding: 0.25rem 0.15rem;
    }
    
    /* Adapter les largeurs pour mobile */
    #operationsTable th:nth-child(1) { width: 100px; }  /* Référence - maintenir une largeur suffisante */
    #operationsTable th:nth-child(2) { width: 50px; }  /* Type */
    #operationsTable th:nth-child(3) { width: 110px; } /* Client */
    #operationsTable th:nth-child(4) { width: 120px; } /* Véhicule */
    #operationsTable th:nth-child(9) { width: 70px; }  /* Prix */
    #operationsTable th:nth-child(10) { width: 70px; } /* Statut */
    #operationsTable th:nth-child(11) { width: 70px; } /* Paiement */
    #operationsTable th:nth-child(12) { width: 80px; } /* Actions */
    
    /* Badges encore plus compacts sur mobile */
    #operationsTable .badge {
        font-size: 0.65rem;
        padding: 0.1rem 0.25rem;
    }
}

/* Optimisation pour très petits écrans */
@media (max-width: 576px) {
    /* Masquer encore plus de colonnes sur très petits écrans */
    #operationsTable th:nth-child(10),  /* Statut */
    #operationsTable td:nth-child(10),
    #operationsTable th:nth-child(11),  /* Paiement */
    #operationsTable td:nth-child(11) {
        display: none;
    }
    
    /* Largeurs ultra-compactes */
    #operationsTable th:nth-child(1) { width: 85px; }  /* Référence - garder une largeur raisonnable */
    #operationsTable th:nth-child(2) { width: 45px; }  /* Type */
    #operationsTable th:nth-child(3) { width: 100px; } /* Client */
    #operationsTable th:nth-child(4) { width: 110px; } /* Véhicule */
    #operationsTable th:nth-child(9) { width: 65px; }  /* Prix */
    #operationsTable th:nth-child(12) { width: 75px; } /* Actions */
    
    /* Taille de police encore plus petite */
    #operationsTable {
        font-size: 0.7rem;
    }
    
    /* Padding minimal */
    #operationsTable th, 
    #operationsTable td {
        padding: 0.2rem 0.1rem;
    }
    
    /* Badges ultra-compacts */
    #operationsTable .badge {
        font-size: 0.6rem;
        padding: 0.05rem 0.2rem;
    }
    
    /* Boutons d'actions ultra-compacts */
    #operationsTable .btn-sm {
        padding: 0.15rem 0.25rem;
        font-size: 0.65rem;
    }
    
    /* Icônes des boutons seulement */
    #operationsTable .btn-sm i {
        font-size: 0.7rem;
    }
}

/* Style pour forcer la table à ne pas dépasser */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Boutons d'actions compacts */
#operationsTable .btn-sm {
    padding: 0.2rem 0.35rem;
    font-size: 0.7rem;
    line-height: 1.2;
}

/* Client nom avec ellipsis */
#operationsTable .client-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Véhicule info compacte */
#operationsTable .vehicle-info {
    max-width: 100%;
    overflow: hidden;
}

#operationsTable .vehicle-info .fw-medium {
    font-size: 0.8rem;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

#operationsTable .vehicle-info small {
    font-size: 0.7rem;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Actions flex sans wrap */
#operationsTable .d-flex.flex-nowrap {
    min-width: 0;
}

#operationsTable .d-flex.flex-nowrap .btn {
    flex-shrink: 0;
}

/* Scrollbar personnalisée pour la table responsive */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Styles des lignes du tableau d'opérations */
#operationsTable tbody tr:nth-child(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

#operationsTable tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.05);
}

#operationsTable tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

/* Styles pour les cartes de type d'opération */
.operation-type-card {
    height: 100%;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.operation-type-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.btn-check:checked + .operation-type-card {
    transform: translateY(-3px);
    border-width: 2px;
}

.btn-check:checked + .btn-outline-info.operation-type-card {
    background-color: rgba(13, 202, 240, 0.1);
    border-color: #0dcaf0;
}

.btn-check:checked + .btn-outline-success.operation-type-card {
    background-color: rgba(25, 135, 84, 0.1);
    border-color: #198754;
}

.btn-check:checked + .btn-outline-primary.operation-type-card {
    background-color: rgba(13, 110, 253, 0.1);
    border-color: #0d6efd;
}

.operation-types-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.operation-type-option {
    flex: 1;
    min-width: 250px;
}

.operation-type-input {
    display: none;
}

.operation-type-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 100%;
    background-color: #f8f9fa;
}

.operation-type-icon {
    font-size: 2rem;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    width: 50px;
}

.operation-type-details {
    flex: 1;
}

.operation-type-details h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
}

.operation-type-details p {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: #6c757d;
}

.operation-type-input:checked + .operation-type-card {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.3);
}

.operation-type-input:checked + .operation-type-card .operation-type-icon {
    color: #0d6efd;
}

.operation-type-input:checked + .operation-type-card h4 {
    color: #0d6efd;
}

.active-card {
    border-color: #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.1) !important;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.3) !important;
}

.active-card .operation-type-icon {
    color: #0d6efd !important;
}

.active-card h4 {
    color: #0d6efd !important;
}

/* Nouveaux styles pour les boutons de type d'opération */
input.btn-check:checked + .btn .position-absolute {
    transform: scale(1) !important;
}

input.btn-check:checked + .btn.btn-outline-primary {
    background-color: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

input.btn-check:checked + .btn.btn-outline-success {
    background-color: rgba(25, 135, 84, 0.1);
    color: #198754;
}

input.btn-check:checked + .btn.btn-outline-info {
    background-color: rgba(13, 202, 240, 0.1);
    color: #0dcaf0;
}

input.btn-check + .btn {
    transition: all 0.3s ease;
    overflow: hidden;
}

input.btn-check:checked + .btn {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Animation d'apparition pour l'indicateur de sélection */
input.btn-check + .btn .position-absolute {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Styles pour l'autocomplétion des clients */
/* Conteneur parent doit avoir position relative */
.input-group {
    position: relative;
}

.client-search-results {
    /* Position et styles gérés dynamiquement par JavaScript pour éviter les conflits de z-index */
    /* L'élément est attaché au document.body avec un z-index maximal */
    display: none; /* Masqué par défaut */
}

/* Zone spécifique des informations client avec overflow visible */
.card:has(.client-search-results),
.tab-pane:has(.client-search-results) {
    overflow: visible !important;
}

/* Fallback pour les navigateurs qui ne supportent pas :has() */
#general .card-body {
    overflow: visible !important;
}

/* Force overflow visible sur les conteneurs qui pourraient couper les résultats de recherche */
#operationTabsContent {
    overflow: visible !important;
    height: auto !important;
    max-height: 400px !important;
    /* Permettre le scroll interne seulement si le contenu dépasse */
    overflow-x: visible !important;
    overflow-y: auto !important;
}

/* Résultats de recherche client - position et affichage gérés par JavaScript */
#client_search_results {
    display: none; /* Masqué par défaut */
}

/* Bouton de suppression du client sélectionné */
#clear_client_btn {
    border-left: none !important;
    transition: all 0.2s ease;
}

#clear_client_btn:hover {
    background-color: #dc3545 !important;
    color: white !important;
    transform: scale(1.05);
}

/* Amélioration des boutons de navigation des modals */
.modal-footer #prev-tab,
.modal-footer #next-tab,
.modal-footer #submit-operation {
    min-width: 100px;
    transition: all 0.2s ease;
}

.modal-footer #prev-tab:hover,
.modal-footer #next-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modal-footer #submit-operation:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

/* Assurer que les boutons restent bien alignés */
.modal-footer .d-flex div {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Forcer l'affichage correct du modal footer */
.modal-footer {
    display: flex !important;
    position: sticky;
    bottom: 0;
    background-color: #f8f9fa !important;
    border-top: 1px solid #dee2e6;
    z-index: 1000;
}

/* S'assurer que les boutons de navigation sont visibles */
#createOperationModal #prev-tab,
#createOperationModal #next-tab,
#createOperationModal #submit-operation,
#operationModal #prev-tab,
#operationModal #next-tab,
#operationModal #submit-operation {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Forcer spécifiquement le bouton enregistrer à être visible */
#createOperationModal #submit-operation,
#operationModal #submit-operation {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Assurer la cohérence des boutons de navigation dans les deux modals */
#createOperationModal .modal-footer,
#operationModal .modal-footer {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 9999 !important;
    background-color: #f8f9fa !important;
    border-top: 1px solid #dee2e6 !important;
}

#createOperationModal #next-tab,
#operationModal #next-tab,
#createOperationModal #prev-tab,
#operationModal #prev-tab {
    min-width: 80px !important;
}

/* Hauteur limitée pour le contenu des onglets */
#createOperationTabsContent,
#operationModalTabsContent {
    max-height: 350px;
    overflow-y: auto;
}

/* Réduire la hauteur du champ notes pour éviter les débordements */
#operation_notes {
    max-height: 80px !important;
    min-height: 60px !important;
    height: 60px !important;
    resize: vertical;
}

/* ==========================================
   STYLES DE DÉFILEMENT POUR LES MODALS
   ========================================== */

/* Permettre le défilement sur les modals avec une hauteur maximale */
#createOperationModal .modal-dialog,
#operationModal .modal-dialog {
    max-height: 90vh;
    margin: 5vh auto;
}

#createOperationModal .modal-content,
#operationModal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#createOperationModal .modal-body,
#operationModal .modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 150px); /* Laisser de la place pour header et footer */
    padding-right: 15px; /* Espace pour la scrollbar */
}

/* Styles spécifiques pour les conteneurs de contenu */
#createOperationTabsContent,
#operationModalTabsContent {
    overflow: visible; /* Permettre aux dropdowns de sortir */
}

#general {
    overflow: visible; /* Nécessaire pour la recherche client */
}

.operations-modal .tab-content {
    overflow: visible; /* Nécessaire pour les dropdowns */
}

/* Exception spécifique pour la recherche client - doit rester visible */
#general .card:has(#client_search) {
    overflow: visible !important;
}

/* Container de recherche client doit sortir du modal */
.client-search-results {
    overflow: visible !important;
}

/* ==========================================
   STYLES DE SCROLLBAR POUR LES MODALS
   ========================================== */

/* Styles de scrollbar pour les modals */
#createOperationModal .modal-body::-webkit-scrollbar,
#operationModal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#createOperationModal .modal-body::-webkit-scrollbar-track,
#operationModal .modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#createOperationModal .modal-body::-webkit-scrollbar-thumb,
#operationModal .modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#createOperationModal .modal-body::-webkit-scrollbar-thumb:hover,
#operationModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Assurer que les footers restent visibles et collés en bas */
#createOperationModal .modal-footer,
#operationModal .modal-footer {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid #dee2e6;
    z-index: 10;
    flex-shrink: 0;
    margin-top: auto; /* Pousser le footer vers le bas */
}

/* ==========================================
   UNIFORMISER LA HAUTEUR DES ONGLETS - VERSION SIMPLIFIÉE
   ========================================== */

/* Hauteur minimale fixe pour tous les onglets - évite les "sauts" de taille */
#createOperationTabsContent,
#operationModalTabsContent {
    min-height: 400px;
}

#createOperationTabsContent .tab-pane,
#operationModalTabsContent .tab-pane {
    min-height: 400px;
    padding: 10px 0 20px 0; /* Espacement vertical simple */
}

/* Laisser Bootstrap gérer l'affichage des onglets normalement */

/* Transitions fluides entre les onglets */
#createOperationTabsContent .tab-pane.fade,
#operationModalTabsContent .tab-pane.fade {
    transition: opacity 0.15s linear;
}

/* Espacement simple pour les cartes */
#createOperationTabsContent .card,
#operationModalTabsContent .card {
    margin-bottom: 15px;
}

#createOperationTabsContent .card:last-child,
#operationModalTabsContent .card:last-child {
    margin-bottom: 0;
}

/* Responsive : ajuster la hauteur sur mobile */
@media (max-width: 768px) {
    #createOperationTabsContent,
    #operationModalTabsContent {
        min-height: 300px;
    }
    
    #createOperationTabsContent .tab-pane,
    #operationModalTabsContent .tab-pane {
        min-height: 300px;
    }
}

/* ==========================================
   STYLES POUR DÉTAILS VÉHICULE DANS ONGLET
   ========================================== */

/* Placeholder véhicule non sélectionné */
#no-vehicle-selected {
    border: 2px dashed #dee2e6;
    background: #f8f9fa;
}

#no-vehicle-selected .card-body {
    min-height: 120px;
}

/* Détails véhicule sélectionné */
#selected-vehicle-details {
    border: 1px solid #0d6efd;
    box-shadow: 0 0.125rem 0.25rem rgba(13, 110, 253, 0.1);
}

#selected-vehicle-details.show {
    animation: slideInUp 0.3s ease-out;
}

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

/* Icône véhicule dans les détails */
#selected-vehicle-details .fas.fa-car {
    color: #6c757d;
    transition: color 0.3s ease;
}

#selected-vehicle-details:hover .fas.fa-car {
    color: #0d6efd;
}

/* Style pour les modals avec défilement */
.modal-dialog-scrollable {
    max-height: calc(100vh - 3.5rem);
}

.modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 3.5rem);
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Responsive pour les petits écrans */
@media (max-width: 768px) {
    #createOperationModal .modal-dialog,
    #operationModal .modal-dialog {
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    #createOperationModal .modal-content,
    #operationModal .modal-content {
        max-height: 95vh;
    }
    
    #createOperationModal .modal-body,
    #operationModal .modal-body {
        max-height: calc(95vh - 120px); /* Moins d'espace pour header/footer sur mobile */
    }
}

/* Style spécifique pour le conteneur de recherche client */
#client_search {
    position: relative;
    z-index: 1;
}

.client-search-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.client-search-item:hover,
.client-search-item.active {
    background-color: #f8f9fa;
}

.client-search-item strong {
    display: block;
    font-size: 1rem;
    color: #333;
}

.client-search-item span {
    display: block;
    font-size: 0.85rem;
    color: #666;
}

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

/* Indication de chargement */
.client-search-loading {
    padding: 10px 15px;
    text-align: center;
    color: #666;
}

/* Ajouts de transitions et animations */
.operation-type-card {
    position: relative;
}

.operation-type-card:after {
    content: "";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.operation-type-card:before {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 15px;
    height: 15px;
    color: white;
    font-size: 10px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.operation-type-option input[type="radio"]:checked + .operation-type-card:after {
    background: var(--bs-success);
    opacity: 1;
    transform: scale(1);
}

.operation-type-option input[type="radio"]:checked + .operation-type-card:before {
    opacity: 1;
    transform: scale(1);
}

/* Styles pour les liens de tri dans les en-têtes */
.table thead th a {
    color: inherit !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.table thead th a:hover {
    color: #0d6efd !important;
    transform: translateY(-1px);
}

.table thead th a i {
    transition: all 0.2s ease;
    opacity: 0.7;
}

.table thead th a:hover i {
    opacity: 1;
    color: #0d6efd !important;
}

/* Indication visuelle pour la colonne triée */
.table thead th a .fa-sort-up,
.table thead th a .fa-sort-down {
    opacity: 1;
    color: #0d6efd !important;
}

/* Responsive pour les icônes de tri */
@media (max-width: 768px) {
    .table thead th a i {
        font-size: 0.7rem;
    }
}

/* Styles pour l'icône de recherche cliquable */
.input-group-text .fa-search {
    cursor: pointer !important;
    transition: all 0.2s ease;
}

.input-group-text .fa-search:hover {
    color: #0d6efd !important;
    transform: scale(1.1);
}

.input-group-text {
    transition: all 0.2s ease;
}

.input-group-text:has(.fa-search:hover) {
    background-color: #e7f1ff !important;
    border-color: #0d6efd !important;
}

/* Indicateur visuel pour l'utilisateur */
.input-group-text .fa-search::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.1);
    transform: scale(0);
    transition: transform 0.2s ease;
}

.input-group-text .fa-search:active::after {
    transform: scale(1);
}

/* Styles pour l'ancre de position du tableau */
#operations-table {
    position: relative;
    top: -100px; /* Offset pour compenser l'en-tête fixe */
    visibility: hidden;
}

/* Styles pour l'indication de chargement lors du tri */
.sort-link.loading {
    pointer-events: none;
    position: relative;
}

.sort-link.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Amélioration de l'expérience de tri */
.sort-link {
    transition: all 0.2s ease;
}

.sort-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

/* ===========================
   STYLES POUR FILTRAGE EXTRAS
   =========================== */

/* Container des filtres d'extras */
.extras-filter-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

/* Boutons de filtre rapide */
.quick-filter {
    transition: all 0.2s ease-in-out;
    border-width: 1px;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin: 2px;
}

.quick-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.quick-filter.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

/* Compteur d'extras */
#extras_count {
    font-size: 0.75rem;
    font-weight: 500;
}

#extras_count.text-info {
    color: #17a2b8 !important;
}

#extras_count.text-warning {
    color: #ffc107 !important;
}

/* Champs de filtrage */
.extras-filter-section .form-control-sm,
.extras-filter-section .form-select-sm {
    font-size: 0.875rem;
    border-radius: 4px;
}

.extras-filter-section .input-group-text {
    background-color: #e9ecef;
    border-color: #ced4da;
    font-size: 0.75rem;
}

/* Animation de chargement pour le select d'extras */
#extra_id.loading {
    background-image: url('data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><circle cx="12" cy="12" r="3" fill="%23007bff"><animate attributeName="r" values="3;5;3" dur="1s" repeatCount="indefinite"/></circle></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

/* Responsive pour les filtres */
@media (max-width: 768px) {
    .quick-filter {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
        margin: 1px;
    }
    
    .extras-filter-section {
        padding: 0.75rem;
    }
    
    .extras-filter-section .row.g-2 {
        --bs-gutter-x: 0.5rem;
    }
}

/* Amélioration de l'accessibilité */
.quick-filter:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Style pour les filtres actifs */
.filter-active {
    position: relative;
}

.filter-active::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    border: 2px solid white;
}

/* Animation des transitions de filtrage */
#extra_id option {
    transition: opacity 0.2s ease-in-out;
}

.extras-filter-section .btn-group-sm .btn {
    --bs-btn-padding-y: 0.25rem;
    --bs-btn-padding-x: 0.5rem;
    --bs-btn-font-size: 0.75rem;
}

/* ========================================
   STYLES POUR LE CONTRÔLE CARBURANT MODERNE
   ======================================== */

/* Conteneur principal du sélecteur de carburant */
.fuel-level-selector {
    position: relative;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    margin: 2px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    user-select: none;
}

/* Mode lecture seule pour le fuel selector */
.fuel-level-selector.readonly {
    background: #f8f9fa;
    pointer-events: none;
    opacity: 0.85;
    cursor: not-allowed;
}

.fuel-level-selector.readonly .fuel-marker {
    cursor: default;
}

.fuel-level-selector.readonly .fuel-gauge {
    opacity: 0.7;
}

/* En-tête du sélecteur */
.fuel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.fuel-title {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
}

.fuel-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    opacity: 0.8;
}

/* Badge du niveau sélectionné */
.fuel-level-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

.fuel-level-badge.empty {
    background: linear-gradient(135deg, #ff7b7b 0%, #d63384 100%);
}

.fuel-level-badge.low {
    background: linear-gradient(135deg, #ffa726 0%, #ff7043 100%);
}

.fuel-level-badge.medium {
    background: linear-gradient(135deg, #ffee58 0%, #ffc107 100%);
    color: #212529;
}

.fuel-level-badge.high {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
}

.fuel-level-badge.full {
    background: linear-gradient(135deg, #42a5f5 0%, #1976d2 100%);
}

/* Jauge de carburant moderne */
.fuel-gauge-container {
    position: relative;
    margin: 4px 0;
}

.fuel-gauge {
    position: relative;
    width: 100%;
    height: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fuel-gauge:hover {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Barre de progression */
.fuel-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,
        #dc3545 0%,
        #fd7e14 12.5%,
        #ffc107 25%,
        #ffeb3b 37.5%,
        #cddc39 50%,
        #8bc34a 62.5%,
        #4caf50 75%,
        #2196f3 87.5%,
        #0d6efd 100%
    );
    border-radius: 14px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* Indicateur de niveau */
.fuel-indicator {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 44px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #007bff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,123,255,0.25);
    transition: all 0.3s ease;
    z-index: 2;
}

.fuel-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: #007bff;
    border-radius: 50%;
}

/* Marqueurs de sélection sous la jauge */
.fuel-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    padding: 0 2px;
}

.fuel-marker {
    cursor: pointer;
    padding: 4px 3px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 24px;
    line-height: 1;
}

.fuel-marker:hover {
    background: #e3f2fd;
    color: #1976d2;
    transform: translateY(-1px);
}

.fuel-marker.active {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
    transform: translateY(-1px);
}

/* Animation de sélection */
@keyframes fuelPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.fuel-gauge.animate {
    animation: fuelPulse 0.5s ease-out;
}

@keyframes markerSelect {
    0% { transform: translateY(-1px) scale(1); }
    50% { transform: translateY(-1px) scale(1.1); }
    100% { transform: translateY(-1px) scale(1); }
}

.fuel-marker.animate {
    animation: markerSelect 0.3s ease-out;
}

/* États d'alerte */
.fuel-gauge.warning {
    border-color: #ffc107;
    background: #fff3cd;
}

.fuel-gauge.danger {
    border-color: #dc3545;
    background: #f8d7da;
}

.fuel-gauge.success {
    border-color: #28a745;
    background: #d4edda;
}

/* Affichage compact pour les listes */
.fuel-display-compact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.fuel-mini-gauge {
    width: 60px;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.fuel-mini-progress {
    height: 100%;
    background: linear-gradient(90deg, #dc3545 0%, #ffc107 50%, #28a745 100%);
    transition: width 0.3s ease;
}

/* Responsive */
@media (max-width: 576px) {
    .fuel-level-selector {
        padding: 16px;
        margin: 4px 0;
    }

    .fuel-gauge {
        height: 28px;
    }

    .fuel-indicator {
        width: 10px;
        height: 40px;
        top: -6px;
        right: -5px;
    }

    .fuel-marker {
        padding: 4px 2px;
        font-size: 0.6rem;
        min-width: 24px;
    }

    .fuel-level-badge {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
}

/* États spéciaux pour l'auto-remplissage */
.fuel-level-selector.auto-filled {
    border: 2px solid #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
    animation: autoFillGlow 2s ease-out;
}

@keyframes autoFillGlow {
    0% {
        border-color: #007bff;
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
    }
    100% {
        border-color: #28a745;
        box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
    }
}

/* Badge d'information automatique */
.fuel-auto-info {
    position: absolute;
    top: -8px;
    right: 8px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    z-index: 10;
    animation: slideInFromTop 0.5s ease-out;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.fuel-auto-info::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #28a745;
}

@keyframes slideInFromTop {
    0% {
        transform: translateY(-10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Info pour premier usage */
.fuel-first-use-info {
    margin: 8px 0;
    border: 1px solid #bee5eb;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    0% {
        transform: translateY(10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation de chargement pour la récupération automatique */
.fuel-level-selector.loading {
    position: relative;
    pointer-events: none;
}

.fuel-level-selector.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 5;
    border-radius: 12px;
}

.fuel-level-selector.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #007bff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    z-index: 6;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Styles pour l'historique (futur) */
.fuel-history-modal .fuel-history-item {
    border-left: 4px solid #007bff;
    padding: 8px 12px;
    margin: 4px 0;
    background: #f8f9fa;
    border-radius: 0 6px 6px 0;
}

.fuel-history-modal .fuel-mini-gauge {
    display: inline-block;
    width: 40px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
}

/* Boutons d'action pour l'interface */
.fuel-action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.fuel-action-buttons .btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-fuel-reset {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    border: none;
    color: white;
}

.btn-fuel-reset:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    color: white;
    transform: translateY(-1px);
}

.btn-fuel-confirm {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
}

.btn-fuel-confirm:hover {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    color: white;
    transform: translateY(-1px);
}

/* Indicateur compact pour l'affichage dans les listes */
.fuel-indicator-compact {
    display: inline-flex;
    gap: 1px;
    align-items: center;
}

.fuel-indicator-compact .fuel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
}

/* Couleurs pour l'indicateur compact */
.fuel-dot.filled-0 { background-color: #dc3545; }
.fuel-dot.filled-1 { background-color: #fd7e14; }
.fuel-dot.filled-2 { background-color: #ffc107; }
.fuel-dot.filled-3 { background-color: #ffeb3b; }
.fuel-dot.filled-4 { background-color: #cddc39; }
.fuel-dot.filled-5 { background-color: #8bc34a; }
.fuel-dot.filled-6 { background-color: #4caf50; }
.fuel-dot.filled-7 { background-color: #2196f3; }
.fuel-dot.filled-8 { background-color: #0d6efd; }

.fuel-dot.empty { background-color: #f8f9fa; }

/* Style pour les tooltips carburant */
.fuel-tooltip {
    font-size: 0.75rem;
    max-width: 200px;
}

/* Alertes de validation carburant */
.fuel-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.fuel-warning .fas {
    margin-right: 0.25rem;
}

/* ============================== */
/* ANIMATIONS AUTO-REMPLISSAGE   */
/* ============================== */

/* Animation pour l'auto-remplissage */
.fuel-level-selector.auto-filled {
    animation: autoFillGlow 2s ease-in-out;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
    border-radius: 8px;
}

@keyframes autoFillGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
        background-color: rgba(40, 167, 69, 0.05);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.3);
        background-color: rgba(40, 167, 69, 0.1);
    }
    100% {
        box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
        background-color: transparent;
    }
}

/* Badge d'information auto-remplissage */
.fuel-auto-info {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    z-index: 10;
    animation: fadeInBounce 0.6s ease-out;
}

@keyframes fadeInBounce {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(10px);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fuel-auto-info .fas {
    margin-right: 4px;
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(10deg); }
}

/* Badge pour premier usage */
.fuel-first-use-info {
    margin-top: 8px;
    animation: slideInFromBottom 0.5s ease-out;
}

@keyframes slideInFromBottom {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================== */
/* NOTIFICATIONS INTELLIGENTES   */
/* ============================== */

/* Container pour les suggestions intelligentes */
.fuel-smart-suggestions {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    position: relative;
    overflow: hidden;
}

.fuel-smart-suggestions::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #007bff, #0d6efd);
}

.fuel-suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 4px 0;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.fuel-suggestion-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
    transform: translateX(4px);
}

.fuel-suggestion-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fuel-suggestion-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.fuel-suggestion-icon.prediction {
    background: linear-gradient(135deg, #17a2b8, #20c997);
    color: white;
}

.fuel-suggestion-icon.history {
    background: linear-gradient(135deg, #6f42c1, #7952b3);
    color: white;
}

.fuel-suggestion-text {
    font-size: 0.85rem;
}

.fuel-suggestion-confidence {
    font-size: 0.7rem;
    color: #6c757d;
}

.fuel-confidence-high { color: #28a745; }
.fuel-confidence-medium { color: #ffc107; }
.fuel-confidence-low { color: #dc3545; }

/* Indicateur de confiance sous forme de barre */
.fuel-confidence-bar {
    width: 40px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.fuel-confidence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s ease;
}

.fuel-confidence-fill.high {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.fuel-confidence-fill.medium {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.fuel-confidence-fill.low {
    background: linear-gradient(90deg, #dc3545, #fd7e14);
}

/* ============================== */
/* HISTORIQUE ET STATISTIQUES    */
/* ============================== */

/* Modal d'historique carburant */
.fuel-history-modal .modal-content {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
}

.fuel-history-timeline {
    position: relative;
    padding-left: 30px;
}

.fuel-history-timeline::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #007bff, #6c757d);
}

.fuel-history-item {
    position: relative;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.fuel-history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.fuel-history-item::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #007bff;
}

.fuel-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.fuel-stat-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.fuel-stat-card:hover {
    border-color: #007bff;
    transform: translateY(-2px);
}

.fuel-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
}

.fuel-stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 4px;
}

/* ============================== */
/* RESPONSIVE DESIGN             */
/* ============================== */

@media (max-width: 768px) {
    .fuel-auto-info {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .fuel-smart-suggestions {
        padding: 8px;
    }

    .fuel-suggestion-item {
        padding: 6px 8px;
    }

    .fuel-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
