/**
 * Corrections Globales de Responsivité - DAARA
 * Fichier CSS pour corriger les problèmes de responsivité identifiés
 */

/* ========================================
   IMAGES - Toujours responsives
   ======================================== */
img {
    max-width: 100%;
    height: auto;
}

/* Avatars et images fixes */
.avatar img,
img[style*="width"],
img[style*="height"] {
    max-width: 100%;
    height: auto;
}

/* ========================================
   TABLES - Toujours avec scroll horizontal
   ======================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Masquer certaines colonnes sur mobile */
@media (max-width: 767.98px) {
    .table .d-none-mobile {
        display: none !important;
    }
}

/* Améliorer la lisibilité des tables sur mobile */
@media (max-width: 575.98px) {
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.375rem;
    }
}

/* ========================================
   BOUTONS - Zone de tap suffisante
   ======================================== */
@media (max-width: 575.98px) {
    .btn {
        min-height: 44px;
        font-size: 16px;
        padding: 0.5rem 1rem;
    }
    
    /* Boutons dans les tables sur mobile */
    .table .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .table .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Grouper les boutons d'action */
    .actions {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* ========================================
   FORMULAIRES - Éviter le zoom iOS
   ======================================== */
@media (max-width: 575.98px) {
    .form-control,
    .form-select {
        font-size: 16px !important; /* Évite le zoom automatique sur iOS */
    }
    
    /* Filtres dans les formulaires */
    .filter-field {
        min-width: 150px !important;
        max-width: 100% !important;
    }
    
    /* Champs flex-grow sur mobile */
    .flex-grow-1 {
        flex: 1 1 100%;
        margin-bottom: 0.75rem;
    }
}

/* ========================================
   MODALS - Responsive sur mobile
   ======================================== */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem !important;
    }
    
    .modal-header,
    .modal-footer {
        padding: 1rem !important;
    }
}

/* ========================================
   CARDS & GRIDS - Espacement cohérent
   ======================================== */
@media (max-width: 767.98px) {
    .row [class*="col-"] {
        margin-bottom: 1rem;
    }
    
    /* Cards dans les grilles */
    .card {
        margin-bottom: 1rem;
    }
}

/* ========================================
   TYPOGRAPHY - Tailles adaptées mobile
   ======================================== */
@media (max-width: 575.98px) {
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    h4 {
        font-size: 1.125rem;
    }
    
    .page-title {
        font-size: 1.25rem !important;
    }
}

/* ========================================
   HEADER & BREADCRUMBS - Overflow
   ======================================== */
@media (max-width: 575.98px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    
    .breadcrumb {
        font-size: 0.875rem;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: 0.5rem 0;
    }
    
    /* Masquer le texte utilisateur sur très petits écrans */
    .horizontal-menu .nav-link span {
        display: none;
    }
    
    /* Logo et texte réduits */
    .navbar-brand {
        font-size: 1rem !important;
    }
}

/* ========================================
   PAGINATION - Optimiser l'espace de tap
   ======================================== */
@media (max-width: 575.98px) {
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .pagination .page-link {
        padding: 0.5rem;
        min-width: 44px;
        font-size: 0.875rem;
    }
    
    .pagination-info {
        text-align: center;
        margin-bottom: 0.75rem;
        width: 100%;
    }
}

/* ========================================
   SELECTS & FILTRES - Pleine largeur mobile
   ======================================== */
@media (max-width: 575.98px) {
    .d-flex.gap-2,
    .d-flex.gap-3 {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .form-select.w-auto {
        width: 100% !important;
    }
    
    /* Filtres de recherche */
    .filter-field {
        width: 100% !important;
        margin-bottom: 0.75rem;
    }
}

/* ========================================
   DASHBOARD STATS - Grilles responsive
   ======================================== */
@media (max-width: 767.98px) {
    .col-xxl-3 {
        margin-bottom: 1rem;
    }
}

/* ========================================
   ALERTS & NOTIFICATIONS - Mobile friendly
   ======================================== */
@media (max-width: 575.98px) {
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .alert .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ========================================
   CONTAINERS - Padding adapté
   ======================================== */
@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .content {
        padding: 1rem 0.75rem !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
}

/* ========================================
   UTILITAIRES - Classes helper
   ======================================== */
/* Cacher sur mobile */
@media (max-width: 575.98px) {
    .d-none-mobile {
        display: none !important;
    }
}

/* Afficher uniquement sur mobile */
@media (min-width: 576px) {
    .d-only-mobile {
        display: none !important;
    }
}

/* Cacher sur tablette et mobile */
@media (max-width: 991.98px) {
    .d-none-tablet-mobile {
        display: none !important;
    }
}

/* Afficher uniquement sur desktop */
@media (max-width: 991.98px) {
    .d-only-desktop {
        display: none !important;
    }
}

