/* Styles spéciaux pour améliorer la responsivité sur petits écrans */

/* Meilleur espacement et taille des éléments */
@media (max-width: 768px) {
    /* Optimisation des en-têtes et titres */
    h1 {
      font-size: 1.6rem !important;
      margin-bottom: 15px !important;
    }
    
    h5.mb-0 {
      font-size: 1rem !important;
    }
    
    /* Optimisation des cartes statistiques */
    .card-body h2 {
      font-size: 1.2rem !important;
    }
    
    .card-title {
      font-size: 0.85rem !important;
    }
    
    .card-body .fa-3x {
      font-size: 2em !important; /* Réduire la taille des icônes */
    }
    
    /* Amélioration des marges et padding pour économiser l'espace */
    .container-fluid {
      padding: 10px !important;
    }
    
    .card {
      margin-bottom: 15px !important;
    }
    
    .card-body {
      padding: 12px !important;
    }
    
    .card-header {
      padding: 10px 15px !important;
    }
    
    /* Repositionnement des boutons d'action en haut */
    .d-flex.justify-content-between.align-items-center.mb-4 {
      flex-direction: column !important;
      align-items: flex-start !important;
    }
    
    .d-flex.justify-content-between.align-items-center.mb-4 .btn-group,
    .d-flex.justify-content-between.align-items-center.mb-4 .btn {
      margin-top: 10px !important;
      width: 100% !important;
    }
    
    /* Adaptation des boutons de période */
    .btn-group {
      display: grid !important;
      grid-template-columns: 1fr 1fr !important;
      gap: 5px !important;
      width: 100% !important;
    }
    
    .btn-group .btn {
      margin: 0 !important;
      border-radius: 4px !important;
      white-space: nowrap !important;
    }
    
    /* Amélioration de l'affichage des boutons télécharger graphiques */
    .chart-controls {
      position: relative !important;
      bottom: auto !important;
      margin-top: 10px !important;
    }
    
    .chart-controls button {
      padding: 6px 12px !important;
      width: auto !important;
      font-size: 0.8rem !important;
    }
  }
  
  /* Optimisation spéciale des tableaux pour mobiles */
  @media (max-width: 576px) {
    /* Rendre les tableaux vraiment responsives */
    .table-responsive {
      overflow-x: auto !important;
      -webkit-overflow-scrolling: touch !important;
      max-width: 100% !important;
      border: 1px solid #dee2e6 !important;
      border-radius: 6px !important;
    }
    
    /* Ajout d'indication de défilement horizontal */
    .table-responsive::before {
      content: "← Faire défiler →";
      display: block;
      text-align: center;
      padding: 5px;
      font-size: 0.75rem;
      background-color: #f8f9fa;
      color: #6c757d;
      width: 100%;
      position: sticky;
      left: 0;
    }
    
    /* Ajustements des cellules pour économiser l'espace */
    .table th, .table td {
      padding: 6px !important;
      font-size: 0.85rem !important;
      white-space: nowrap !important;
    }
    
    /* Réduction de la taille des badges */
    .badge {
      font-size: 0.7rem !important;
      padding: 0.3em 0.6em !important;
    }
    
    /* Transformation de l'affichage des graphiques pour économiser l'espace vertical */
    .row.mb-4 {
      flex-direction: column !important;
    }
    
    .col-md-8, .col-md-4, .col-md-6 {
      width: 100% !important;
      margin-bottom: 15px !important;
    }
    
    /* Réduction hauteur des graphiques sur mobile */
    #chartEvolution, #chartTypes, #chartStatuts, #chartVehicules,
    #chartCarburant {
      height: 200px !important;
    }
  }
  
  /* Optimisation des contrôles DataTables sur mobile */
  @media (max-width: 768px) {
    .dataTables_length, .dataTables_filter {
      text-align: left !important;
      margin-bottom: 10px !important;
      width: 100% !important;
    }
    
    .dataTables_paginate {
      text-align: center !important;
      margin-top: 10px !important;
      width: 100% !important;
    }
    
    .dataTables_info {
      text-align: center !important;
      width: 100% !important;
    }
    
    /* Rendez les boutons de contrôle de colonnes plus faciles à toucher */
    .dropdown-menu input[type="checkbox"] {
      width: 20px !important;
      height: 20px !important;
    }
    
    .dropdown-menu label {
      padding: 8px 10px !important;
    }
  }
  
  /* Fix pour le bouton de téléchargement sur les graphiques circulaires */
  .chart-controls {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    justify-content: center !important;
    padding-bottom: 10px !important;
    z-index: 10 !important;
  }
  
  /* Amélioration de la lisibilité des graphiques sur fond blanc */
  #chartTypes, #chartStatuts, #chartCarburant {
    padding-bottom: 30px !important;
  }