/* ============================================
   FAMILLE ZIBLI - DESIGN RESPONSIVE COMPLET
   Optimisé pour tous les appareils
   ============================================ */

/* ============================================
   CORRECTION URGENTE - TABLEAUX SCROLLABLES
   ============================================ */

/* Rendre TOUS les tableaux scrollables horizontalement sur mobile */
@media (max-width: 768px) {
    /* Forcer tous les tableaux à être scrollables */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        white-space: nowrap;
    }
    
    /* Envelopper les tableaux qui ne sont pas dans .table-responsive */
    .section table,
    .main-content-wrapper table,
    .content-limited table,
    body table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        white-space: nowrap;
    }
    
    /* S'assurer que les tableaux dans .table-responsive fonctionnent */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .table-responsive table {
        display: table !important;
        width: 100% !important;
        min-width: 100% !important;
        white-space: nowrap !important;
    }
    
    /* Ajuster les cellules pour le scroll horizontal */
    table th,
    table td {
        white-space: nowrap !important;
        padding: 0.75rem 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    /* Afficher une indication de scroll */
    .table-responsive::after {
        content: '← Glisser pour voir plus →';
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: #6b7280;
        padding: 0.5rem;
        background: #f3f4f6;
        margin-top: 0.5rem;
        border-radius: 4px;
    }
    
    /* Améliorer la visibilité de la barre de scroll */
    .table-responsive {
        scrollbar-width: thin !important;
        scrollbar-color: #0066ff #f3f4f6 !important;
    }
    
    .table-responsive::-webkit-scrollbar {
        height: 8px !important;
    }
    
    .table-responsive::-webkit-scrollbar-track {
        background: #f3f4f6 !important;
        border-radius: 4px !important;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: #0066ff !important;
        border-radius: 4px !important;
    }
    
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #0052cc !important;
    }
}

/* Correction supplémentaire pour TOUS les écrans */
/* S'assurer que les tableaux ne débordent jamais de leur conteneur */
.table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Pour les tableaux sans .table-responsive, les rendre scrollables */
table {
    display: table;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    table-layout: auto;
}

/* S'assurer que le contenu des cellules ne force pas le débordement */
table th,
table td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-wrap: break-word;
}

/* Mais permettre le scroll horizontal si nécessaire */
@media (max-width: 1024px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table th,
    table td {
        white-space: nowrap;
        min-width: 100px;
    }
    
    /* Correction spécifique pour le tableau de gestion de stock */
    #table-stock {
        display: table !important;
        width: 100% !important;
        min-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    #table-stock th,
    #table-stock td {
        white-space: nowrap !important;
        min-width: 120px !important;
        padding: 0.75rem 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    /* Forcer le scroll sur les tableaux larges */
    table[style*="width: 100%"] {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* ============================================
       CENTRER LES SECTION-HEADER SUR MOBILE
       ============================================ */
    
    /* Centrer le contenu des section-header */
    .section-header {
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 1rem !important;
        padding: 1.5rem 1rem !important;
    }
    
    /* Centrer le titre h3 */
    .section-header h3,
    .section-header h2 {
        text-align: center !important;
        width: 100% !important;
        margin: 0 !important;
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    
    /* Centrer les boutons/actions */
    .section-header > div {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }
    
    /* Centrer et adapter les boutons dans les section-header */
    .section-header .btn {
        width: 100% !important;
        max-width: 300px !important;
        text-align: center !important;
        justify-content: center !important;
        padding: 0.875rem 1rem !important;
        font-size: 0.9rem !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    /* Pour les section-header avec plusieurs boutons */
    .section-header > div > a,
    .section-header > div > button {
        width: 100% !important;
        max-width: 300px !important;
    }
}

/* ============================================
   CORRECTIONS SPÉCIFIQUES POUR PETITS MOBILES
   ============================================ */
@media (max-width: 480px) {
    /* Section-header - Centrage parfait */
    .section-header {
        text-align: center !important;
        padding: 1rem 0.75rem !important;
    }
    
    .section-header h3,
    .section-header h2 {
        font-size: 1.1rem !important;
        text-align: center !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Centrer les boutons dans section-header */
    .section-header > div {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.625rem !important;
    }
    
    .section-header .btn {
        width: 100% !important;
        max-width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem !important;
    }
    
    /* Section-header spécifique pour "Dernières ventes" */
    .section h3 {
        text-align: center !important;
        display: block !important;
        width: 100% !important;
    }
    
    /* Forcer le centrage du texte dans les sections */
    .section {
        text-align: center !important;
    }
    
    /* Mais garder les tableaux alignés à gauche */
    .section table,
    .section .table-responsive {
        text-align: left !important;
    }
}

/* ============================================
   PAGE HEADER & SECTION HEADER
   ============================================ */

/* Container pour les boutons d'action */
.section-header > div,
.actions-grid {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Page header spécifique */
.page-header {
    text-align: left;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.page-date {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Navigation Grid */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.nav-card {
    padding: 2rem;
    border-radius: 16px;
    transition: all 0.3s ease;
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.actions-grid .btn {
    justify-content: center;
    text-align: center;
}

/* ============================================
   BOUTON MENU HAMBURGER MOBILE
   ============================================ */
.mobile-menu-toggle {
    display: none;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    min-width: 5.5rem;
    height: 2.8rem;
    background: linear-gradient(135deg, #0066ff 0%, #00c6ff 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    padding: 0 1rem;
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 102, 255, 0.3);
}

/* Texte "Menu" dans le bouton */
.mobile-menu-toggle::before {
    content: 'Menu';
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* Conteneur pour les lignes hamburger */
.mobile-menu-toggle .hamburger-lines {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 1.2rem;
    height: 1rem;
    position: relative;
}

.mobile-menu-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Cacher le bouton hamburger quand le menu est ouvert */
.mobile-menu-toggle.active {
    display: none !important;
}

.mobile-menu-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: #ffffff;
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

/* Animation du hamburger en X */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ============================================
   MENU MOBILE OVERLAY
   ============================================ */
@media (max-width: 768px) {
    /* Afficher le bouton hamburger */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Navigation en overlay sur mobile */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 300px;
        height: 100vh;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 251, 252, 0.98) 100%);
        backdrop-filter: blur(20px);
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 5rem 1.5rem 2rem;
    }
    
    .main-nav.active {
        right: 0;
    }
    
    /* Overlay sombre quand le menu est ouvert */
    .main-nav.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        animation: fadeIn 0.3s ease;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    /* Liste de navigation */
    .nav-list {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    }
    
    .nav-item:last-child {
        border-bottom: none;
    }
    
    .nav-link {
        padding: 1rem 0.75rem !important;
        justify-content: flex-start;
        border-radius: 8px;
        margin-bottom: 0.25rem;
    }
    
    .nav-link:hover {
        background: rgba(102, 126, 234, 0.08);
    }
    
    .nav-icon {
        font-size: 1.5rem;
    }
    
    .nav-text {
        font-size: 1rem;
        font-weight: 500;
    }
    
    .dropdown-caret {
        display: none;
    }
    
    /* Dropdowns sur mobile */
    .dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        padding: 0.5rem 0 0.5rem 2rem;
        margin: 0.25rem 0;
        background: rgba(102, 126, 234, 0.05);
        border-radius: 8px;
    }
    
    .nav-item.dropdown.active .dropdown-menu {
        display: block;
        animation: slideDown 0.3s ease;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .dropdown-menu li a {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem;
    }
    
    /* Header adjustments */
    .header-content {
        flex-wrap: wrap;
    }
    
    .logo-section {
        flex: 1;
        min-width: 200px;
    }
    
    /* Section header avec boutons sur mobile */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .section-header > h2,
    .section-header > h3 {
        width: 100%;
        font-size: 1.25rem;
    }
    
    .section-header > div {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .section-header > div .btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    /* Pour les sections avec 3 boutons */
    .section-header > div .btn:nth-child(3) {
        grid-column: 1 / -1;
    }
}

/* ============================================
   BREAKPOINTS
   ============================================ */
/* 
   - xs: 0-480px (Petits téléphones)
   - sm: 481-640px (Téléphones normaux)
   - md: 641-768px (Grands téléphones / Petites tablettes)
   - lg: 769-1024px (Tablettes)
   - xl: 1025-1280px (Petits ordinateurs)
   - 2xl: 1281px+ (Ordinateurs)
*/

/* ============================================
   1. PETITS TÉLÉPHONES (0-480px)
   ============================================ */

/* Très petits écrans (iPhone SE, etc.) */
@media (max-width: 360px) {
    .section-header > div {
        grid-template-columns: 1fr;
    }
    
    .section-header > div .btn {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .section-header > div .btn .btn-icon {
        display: inline;
        font-size: 1rem;
        margin-bottom: 0;
        margin-right: 0.25rem;
    }
    
    .section-header > div .btn span:not(.btn-icon) {
        display: inline;
        font-size: 0.85rem;
    }
}

@media (min-width: 361px) and (max-width: 480px) {
    /* === SECTION HEADER AVEC BOUTONS === */
    
    /* Header principal */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    
    .section-header > h2,
    .section-header > h3 {
        width: 100%;
        font-size: 1.1rem;
        line-height: 1.3;
    }
    
    .section-header > div {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }
    
    .section-header > div .btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 0.875rem;
        font-size: 0.85rem;
        min-height: 48px;
        text-align: center;
    }
    
    .section-header > div .btn .btn-icon {
        display: block;
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    
    .section-header > div .btn span:not(.btn-icon) {
        display: block;
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    /* Pour les sections avec 3 boutons : 2 sur première ligne, 1 sur deuxième ligne */
    .section-header > div .btn:nth-child(3) {
        grid-column: 1 / -1;
    }
    
    /* Pour les sections avec 4 boutons : 2x2 */
    .section-header > div .btn:nth-child(3),
    .section-header > div .btn:nth-child(4) {
        grid-column: auto;
    }
    
    /* === PAGE HEADER & NAVIGATION === */
    
    /* Page header compact */
    .page-header {
        padding: 1rem;
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .page-subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    .page-date {
        font-size: 0.85rem;
    }
    
    /* Navigation Grid */
    .nav-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .nav-card {
        padding: 1.25rem;
        text-align: center;
    }
    
    .nav-card-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .nav-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }
    
    .nav-card p {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    .nav-card-action {
        font-size: 0.8rem;
    }
    
    /* Actions Grid */
    .actions-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }
    
    .actions-grid .btn {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    /* === HEADER & NAVIGATION === */
    .header-modern {
        padding: 0.75rem 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo-section {
        width: 100%;
        text-align: center;
    }
    
    .logo-wrapper {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .logo-title {
        font-size: 1.1rem !important;
    }
    
    .logo-subtitle {
        font-size: 0.75rem !important;
        display: none;
    }
    
    .header-divider {
        display: none;
    }
    
    /* Navigation hamburger pour mobile */
    .main-nav {
        width: 100%;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem;
        justify-content: flex-start;
    }
    
    .nav-icon {
        font-size: 1.2rem;
    }
    
    .nav-text {
        font-size: 0.9rem;
    }
    
    .dropdown-caret {
        display: none;
    }
    
    .dropdown-menu {
        position: static;
        display: none;
        min-width: 100%;
        box-shadow: none;
        border: none;
        padding: 0.5rem 0 0.5rem 1rem;
        margin: 0.25rem 0 0 0;
        background: rgba(102, 126, 234, 0.05);
        border-radius: 8px;
    }
    
    .nav-item.dropdown.active .dropdown-menu {
        display: block;
    }
    
    .dropdown-menu li a {
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem;
    }
    
    /* === CONTENU PRINCIPAL === */
    .content-limited {
        max-width: 100%;
        padding: 1rem 0.75rem;
    }
    
    /* === DASHBOARD & CARDS === */
    .dashboard {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-card h3 {
        font-size: 1rem;
    }
    
    .stat-card .value {
        font-size: 1.75rem;
    }
    
    .stat-card p {
        font-size: 0.85rem;
    }
    
    /* === SECTIONS === */
    .section {
        padding: 1.25rem;
        border-radius: 12px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .section-header h2,
    .section-header h3 {
        font-size: 1.25rem;
    }
    
    .section-header .btn {
        width: 100%;
        justify-content: center;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    /* === TABLES === */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    table th,
    table td {
        padding: 0.5rem 0.35rem;
    }
    
    /* Masquer certaines colonnes sur petits écrans */
    table th.hide-mobile,
    table td.hide-mobile {
        display: none;
    }
    
    /* === FORMULAIRES === */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-control {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    .form-control-lg {
        font-size: 1.1rem;
        padding: 0.875rem;
    }
    
    label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    /* === BOUTONS === */
    .btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.25rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    .btn-icon {
        font-size: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* === ALERTES === */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    .alert .close {
        padding: 0.5rem;
        font-size: 1.25rem;
    }
    
    /* === CARDS & PANELS === */
    .card {
        padding: 1.25rem;
        border-radius: 12px;
    }
    
    .card-header {
        padding-bottom: 0.875rem;
        margin-bottom: 0.875rem;
    }
    
    .card-header h3,
    .card-header h4 {
        font-size: 1.1rem;
    }
    
    /* === FILTRES === */
    .filters-premium {
        padding: 1.25rem;
        border-radius: 12px;
    }
    
    .filters-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .filters-title h3 {
        font-size: 1.1rem;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .filter-item {
        padding: 0.875rem;
    }
    
    .filter-input,
    .filter-select {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* === STATS & SUMMARY === */
    .summary-card {
        padding: 1rem;
    }
    
    .summary-label {
        font-size: 0.75rem;
    }
    
    .summary-value {
        font-size: 1.5rem;
    }
    
    /* === RAPPORTS === */
    .rapport-section {
        padding: 1.25rem;
    }
    
    .rapport-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .rapport-card {
        padding: 1rem;
    }
    
    .rapport-table {
        font-size: 0.8rem;
    }
    
    .rapport-table th,
    .rapport-table td {
        padding: 0.5rem 0.35rem;
    }
    
    .rapport-summary {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* === PERIOD FILTERS === */
    .period-filters {
        padding: 1.25rem;
    }
    
    .period-filters-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .period-filters-header h3 {
        font-size: 1.1rem;
    }
    
    .filter-tabs {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .filter-tab {
        flex: 1;
        min-width: 120px;
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
        text-align: center;
    }
    
    .period-inputs {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .period-actions {
        flex-direction: column;
    }
    
    .period-actions .btn {
        width: 100%;
    }
    
    /* === SPACING === */
    .container {
        padding: 0 0.75rem;
    }
    
    .gap-1 { gap: 0.5rem; }
    .gap-2 { gap: 0.75rem; }
    .gap-3 { gap: 1rem; }
    .gap-4 { gap: 1.25rem; }
    
    .p-1 { padding: 0.5rem; }
    .p-2 { padding: 0.75rem; }
    .p-3 { padding: 1rem; }
    .p-4 { padding: 1.25rem; }
    
    .m-1 { margin: 0.5rem; }
    .m-2 { margin: 0.75rem; }
    .m-3 { margin: 1rem; }
    .m-4 { margin: 1.25rem; }
}

/* ============================================
   2. TÉLÉPHONES NORMAUX (481-640px)
   ============================================ */
@media (min-width: 481px) and (max-width: 640px) {
    /* === HEADER & NAVIGATION === */
    
    /* Section header amélioré */
    .section-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 1rem;
    }
    
    .section-header > h2,
    .section-header > h3 {
        font-size: 1.35rem;
        flex: 1;
        min-width: 200px;
    }
    
    .section-header > div {
        flex: 0 0 auto;
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .section-header > div .btn {
        width: auto;
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
    
    /* Pour les sections avec 3 boutons */
    .section-header > div .btn:nth-child(3) {
        grid-column: auto;
    }
    
    /* === PAGE HEADER & GRILLES === */
    
    /* Page header */
    .page-header {
        padding: 1.25rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .page-date {
        font-size: 0.9rem;
    }
    
    /* Navigation Grid */
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .nav-card {
        padding: 1.5rem;
        text-align: center;
    }
    
    .nav-card-icon {
        font-size: 2.25rem;
        margin-bottom: 0.5rem;
    }
    
    .nav-card h3 {
        font-size: 1.15rem;
        margin-bottom: 0.25rem;
    }
    
    .nav-card p {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .nav-card-action {
        font-size: 0.825rem;
    }
    
    /* Actions Grid */
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .actions-grid .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    /* === HEADER & NAVIGATION === */
    
    .header-modern {
        padding: 1rem 0;
    }
    
    .logo-title {
        font-size: 1.25rem !important;
    }
    
    .logo-subtitle {
        font-size: 0.8rem !important;
    }
    
    /* === CONTENU PRINCIPAL === */
    .content-limited {
        padding: 1.25rem 1rem;
    }
    
    /* === DASHBOARD === */
    .dashboard {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    
    /* === SECTIONS === */
    .section {
        padding: 1.5rem;
    }
    
    .section-header {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .section-header > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .section-header .btn {
        width: auto;
    }
    
    /* === TABLES === */
    table {
        font-size: 0.85rem;
    }
    
    table th,
    table td {
        padding: 0.625rem 0.5rem;
    }
    
    /* === FORMULAIRES === */
    .form-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* === BOUTONS === */
    .btn {
        font-size: 0.95rem;
        padding: 0.875rem 1.5rem;
    }
    
    /* === CARDS === */
    .card {
        padding: 1.5rem;
    }
    
    /* === FILTRES === */
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* === RAPPORTS === */
    .rapport-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .rapport-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* === PERIOD FILTERS === */
    .period-inputs {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   3. GRANDS TÉLÉPHONES / PETITES TABLETTES (641-768px)
   ============================================ */
@media (min-width: 641px) and (max-width: 768px) {
    /* === HEADER & NAVIGATION === */
    .logo-title {
        font-size: 1.35rem !important;
    }
    
    .logo-subtitle {
        font-size: 0.85rem !important;
    }
    
    /* === CONTENU PRINCIPAL === */
    .content-limited {
        padding: 1.5rem 1.25rem;
    }
    
    /* === DASHBOARD === */
    .dashboard {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.25rem;
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    /* === SECTIONS === */
    .section {
        padding: 1.75rem;
    }
    
    /* === TABLES === */
    table {
        font-size: 0.9rem;
    }
    
    /* === FORMULAIRES === */
    .form-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    /* === FILTRES === */
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    /* === RAPPORTS === */
    .rapport-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .rapport-summary {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* === PERIOD FILTERS === */
    .period-inputs {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   4. TABLETTES (769-1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    /* === HEADER & NAVIGATION === */
    .logo-title {
        font-size: 1.4rem !important;
    }
    
    .logo-subtitle {
        font-size: 0.9rem !important;
    }
    
    /* Navigation */
    .nav-link {
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem;
    }
    
    .nav-icon {
        font-size: 1.3rem;
    }
    
    .nav-text {
        font-size: 0.95rem;
    }
    
    /* === CONTENU PRINCIPAL === */
    .content-limited {
        padding: 2rem 1.5rem;
    }
    
    /* === DASHBOARD === */
    .dashboard {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.5rem;
    }
    
    .stat-card {
        padding: 1.75rem;
    }
    
    .stat-card h3 {
        font-size: 1.1rem;
    }
    
    .stat-card .value {
        font-size: 2rem;
    }
    
    /* === SECTIONS === */
    .section {
        padding: 2rem;
    }
    
    .section-header h2 {
        font-size: 1.75rem;
    }
    
    /* === TABLES === */
    table {
        font-size: 0.95rem;
    }
    
    table th,
    table td {
        padding: 0.875rem 0.75rem;
    }
    
    /* === FORMULAIRES === */
    .form-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* === CARDS === */
    .card {
        padding: 2rem;
    }
    
    /* === FILTRES === */
    .filters-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    /* === RAPPORTS === */
    .rapport-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .rapport-summary {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    /* === PERIOD FILTERS === */
    .period-inputs {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .filter-tab {
        padding: 0.875rem 1.75rem;
        font-size: 0.95rem;
    }
}

/* ============================================
   5. PETITS ORDINATEURS (1025-1280px)
   ============================================ */
@media (min-width: 1025px) and (max-width: 1280px) {
    /* === CONTENU PRINCIPAL === */
    .content-limited {
        padding: 2.5rem 2rem;
    }
    
    /* === DASHBOARD === */
    .dashboard {
        gap: 1.75rem;
    }
    
    /* === SECTIONS === */
    .section {
        padding: 2.25rem;
    }
    
    /* === FILTRES === */
    .filters-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* === RAPPORTS === */
    .rapport-grid {
        gap: 2.25rem;
    }
}

/* ============================================
   6. OPTIMISATIONS GÉNÉRALES MOBILE
   ============================================ */
@media (max-width: 768px) {
    /* === TOUCH TARGETS === */
    .btn,
    .nav-link,
    .filter-item,
    .stat-card {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* === TEXT SELECTION === */
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* === SCROLL === */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .table-responsive::-webkit-scrollbar {
        display: none;
    }
    
    /* === ORIENTATION === */
    @media (orientation: landscape) {
        .dashboard {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }
    
    /* === SAFE AREA === */
    .header-modern {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    /* === FONT SIZES === */
    html {
        font-size: 14px;
    }
}

/* ============================================
   7. IMPRESSION & ACCESSIBILITÉ
   ============================================ */
@media print {
    .header-modern,
    .main-nav,
    .btn,
    .form-actions,
    .period-filters {
        display: none !important;
    }
    
    .content-limited {
        max-width: 100%;
        padding: 0;
    }
    
    table {
        font-size: 10pt;
    }
    
    .stat-card,
    .card,
    .section {
        break-inside: avoid;
    }
}

/* ============================================
   8. RÉDUCTIONS DE MOUVEMENT
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   9. MODE HAUT CONTRASTE
   ============================================ */
@media (prefers-contrast: high) {
    .btn,
    .card,
    .section,
    .stat-card {
        border-width: 2px;
    }
    
    .nav-link:hover,
    .btn:hover {
        outline: 2px solid currentColor;
        outline-offset: 2px;
    }
}

/* ============================================
   10. UTILITAIRES RESPONSIVE
   ============================================ */
/* Visibility utilities */
@media (max-width: 480px) {
    .hide-xs { display: none !important; }
    .show-xs { display: block !important; }
}

@media (min-width: 481px) and (max-width: 640px) {
    .hide-sm { display: none !important; }
    .show-sm { display: block !important; }
}

@media (min-width: 641px) and (max-width: 768px) {
    .hide-md { display: none !important; }
    .show-md { display: block !important; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hide-lg { display: none !important; }
    .show-lg { display: block !important; }
}

/* Text sizing utilities */
@media (max-width: 480px) {
    .text-xs-xs { font-size: 0.7rem; }
    .text-sm-sm { font-size: 0.8rem; }
    .text-base-mobile { font-size: 0.9rem; }
}

/* Spacing utilities for mobile */
@media (max-width: 768px) {
    .p-mobile-1 { padding: 0.5rem; }
    .p-mobile-2 { padding: 0.75rem; }
    .p-mobile-3 { padding: 1rem; }
    .p-mobile-4 { padding: 1.25rem; }
    
    .m-mobile-1 { margin: 0.5rem; }
    .m-mobile-2 { margin: 0.75rem; }
    .m-mobile-3 { margin: 1rem; }
    .m-mobile-4 { margin: 1.25rem; }
}

/* ============================================
   11. CORRECTIONS SPÉCIFIQUES
   ============================================ */

/* Fix pour les tableaux sur mobile */
@media (max-width: 640px) {
    /* Rendre les tableaux scrollables horizontalement */
    .table-wrapper {
        overflow-x: auto;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    /* Mode carte pour les tableaux sur très petits écrans */
    .table-card-mode {
        display: block;
    }
    
    .table-card-mode thead {
        display: none;
    }
    
    .table-card-mode tbody,
    .table-card-mode tr,
    .table-card-mode td {
        display: block;
        width: 100%;
    }
    
    .table-card-mode tr {
        margin-bottom: 1rem;
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        padding: 0.75rem;
    }
    
    .table-card-mode td {
        text-align: left !important;
        padding: 0.5rem 0;
        border: none;
    }
    
    .table-card-mode td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 0.25rem;
        color: var(--text-secondary);
    }
}

/* Fix pour les formulaires longs */
@media (max-width: 640px) {
    .form-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .form-section-title {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .checkbox-wrapper,
    .radio-wrapper {
        padding: 0.75rem;
    }
}

/* Fix pour les boutons d'action */
@media (max-width: 480px) {
    .action-buttons {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 1rem;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
    }
    
    .action-buttons .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Ajouter du padding en bas au body pour éviter le chevauchement */
    body {
        padding-bottom: 80px;
    }
}

/* ============================================
   12. PERFORMANCE & OPTIMISATION
   ============================================ */

/* Lazy loading des images sur mobile */
@media (max-width: 768px) {
    img {
        content-visibility: auto;
    }
}

/* Optimisation des polices sur mobile */
@media (max-width: 640px) {
    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Réduction des ombres sur mobile pour performance */
@media (max-width: 480px) {
    .stat-card,
    .card,
    .section {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
}

/* ============================================
   13. LANDSCAPE MODE
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .header-modern {
        padding: 0.5rem 0;
    }
    
    .logo-subtitle {
        display: none;
    }
    
    .section {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   FIX MOBILE - TEXTES VISIBLES SUR FOND BLANC
   ============================================ */

/* ============================================
   1. PETITS TÉLÉPHONES (0-480px)
   ============================================ */
@media (max-width: 480px) {
    /* Conteneur principal - Fond blanc */
    .main-content-wrapper {
        background: #ffffff !important;
        min-height: 100vh !important;
        padding: 1rem !important;
        margin: 0 !important;
    }

    /* Page header - Fond blanc */
    .page-header {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-radius: 12px;
        padding: 1rem !important;
        margin-bottom: 1.5rem !important;
        text-align: center;
    }

    .page-header h1 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.25rem !important;
        color: #1f2937 !important;
    }

    .page-subtitle {
        font-size: 0.85rem !important;
        color: #6b7280 !important;
        margin-bottom: 0.25rem !important;
        display: none;
    }

    .page-date {
        font-size: 0.75rem !important;
        color: #9ca3af !important;
        display: none;
    }

    /* Dashboard - Fond blanc */
    .dashboard {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        gap: 0.75rem !important;
    }

    /* Stat cards - Fond blanc */
    .stat-card {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1rem !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
        text-align: center !important;
        color: #1f2937 !important;
    }

    .stat-card h3 {
        font-size: 1rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.5rem !important;
        color: #1f2937 !important;
    }

    .stat-card .value {
        font-size: 1.5rem !important;
        font-weight: 700 !important;
        color: #1f2937 !important;
        margin-bottom: 0.25rem !important;
    }

    .stat-card p {
        font-size: 0.85rem !important;
        color: #6c757d !important;
        margin: 0 !important;
    }

    /* Supprimer les styles inline */
    .stat-card > div[style*="margin-top: 15px; padding-top: 15px; border-top: 1px solid #e5e7eb;"],
    .stat-card > div[style*="margin-top: 15px; padding-top: 15px; border-top: 1px solid #e5e7eb;"] {
        margin-top: 10px !important;
        padding-top: 10px !important;
        border-top: none !important;
    }

    .stat-card > div[style*="margin-top: 15px; padding-top: 15px; border-top: 1px solid #e5e7eb;"] small {
        display: none !important;
    }

    /* Pour les stat_card avec style inline */
    .stat-card[style*="--primary-color"] {
        background: #ffffff !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
    }

    .stat-card.danger {
        border-color: rgba(220, 53, 69, 0.08) !important;
    }

    .stat-card.success {
        border-color: rgba(0, 210, 213, 0.08) !important;
    }

    .stat_card[style*="#f59e0b"] {
        border-color: rgba(245, 158, 11, 0.08) !important;
    }
}

/* ============================================
   2. TÉLÉPHONES NORMAUX (481-640px)
   ============================================ */
@media (min-width: 481px) and (max-width: 640px) {
    /* Conteneur principal - Fond blanc */
    .main-content-wrapper {
        background: #ffffff !important;
        min-height: 100vh !important;
        padding: 1.5rem !important;
        margin: 0 !important;
    }

    /* Page header - Fond blanc */
    .page-header {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-radius: 12px;
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
        text-align: center;
    }

    .page-header h1 {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.25rem !important;
        color: #1f2937 !important;
    }

    .page-subtitle {
        font-size: 1rem !important;
        color: #6b7280 !important;
        margin-bottom: 0.25rem !important;
    }

    .page-date {
        font-size: 0.85rem !important;
        color: #9ca3af !important;
    }

    /* Dashboard - Fond blanc */
    .dashboard {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        padding: 1.5rem !important;
        border-radius: 12px !important;
        gap: 1rem !important;
    }

    /* Stat cards - Fond blanc */
    .stat-card {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1.5rem !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
        text-align: center !important;
        color: #1f2937 !important;
    }

    .stat-card h3 {
        font-size: 0.9rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.5rem !important;
        color: #1f2937 !important;
    }

    .stat-card .value {
        font-size: 2rem !important;
        font-weight: 700 !important;
        color: #1f2937 !important;
        margin-bottom: 0.25rem !important;
    }

    .stat-card p {
        font-size: 0.85rem !important;
        color: #6c757d !important;
        margin: 0 !important;
    }
}

/* ============================================
   3. GRANDS TÉLÉPHONES (641-768px)
   ============================================ */
@media (min-width: 641px) and (max-width: 768px) {
    /* Conteneur principal - Fond blanc */
    .main-content-wrapper {
        background: #ffffff !important;
        min-height: 100vh !important;
        padding: 1.5rem !important;
        margin: 0 !important;
    }

    /* Page header - Fond blanc */
    .page-header {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-radius: 12px;
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
        text-align: center;
    }

    .page-header h1 {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.25rem !important;
        color: #1f2937 !important;
    }

    .page-subtitle {
        font-size: 1rem !important;
        color: #6b7280 !important;
        margin-bottom: 0.25rem !important;
    }

    .page-date {
        font-size: 0.85rem !important;
        color: #9ca3af !important;
    }

    /* Dashboard - Fond blanc */
    .dashboard {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        padding: 1.5rem !important;
        border-radius: 12px !important;
        gap: 1rem !important;
    }

    /* Stat cards - Fond blanc */
    .stat-card {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1.5rem !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
        text-align: center !important;
        color: #1f2937 !important;
    }

    .stat-card h3 {
        font-size: 0.9rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.5rem !important;
        color: #1f2937 !important;
    }

    .stat-card .value {
        font-size: 2rem !important;
        font-weight: 700 !important;
        color: #1f2937 !important;
        margin-bottom: 0.25rem !important;
    }

    .stat-card p {
        font-size: 0.85rem !important;
        color: #6c757d !important;
        margin: 0 !important;
    }
}

/* ============================================
   4. NAVIGATION ET NAV GRID - FOND BLANC
   ============================================ */
@media (max-width: 768px) {
    /* Navigation Grid - Fond blanc */
    .nav-grid {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        gap: 0.75rem !important;
    }

    .nav-card {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1.25rem !important;
        text-align: center;
        color: #1f2937 !important;
    }

    .nav-card-icon {
        font-size: 1.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    .nav-card h3 {
        font-size: 1rem !important;
        margin-bottom: 0.25rem !important;
        color: #1f2937 !important;
    }

    .nav-card p {
        font-size: 0.85rem !important;
        margin-bottom: 0.5rem !important;
        color: #6b7280 !important;
    }

    .nav-card-action {
        font-size: 0.75rem !important;
        color: #0066ff !important;
        background: rgba(0, 102, 255, 0.1) !important;
    }

    /* Actions Grid - Fond blanc */
    .actions-grid {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 0.75rem !important;
        border-radius: 8px !important;
        gap: 0.625rem !important;
    }

    .actions-grid .btn {
        background: white !important;
        border: 1px solid rgba(0, 0, 0, 0.2) !important;
        color: #333333 !important;
        font-weight: 500 !important;
    }

    .actions-grid .btn-success {
        border-color: #28a745 !important;
        color: #28a745 !important;
    }

    .actions-grid .btn-danger {
        border-color: #dc3545 !important;
        color: #dc3545 !important;
    }

    .actions-grid .btn-primary {
        border-color: #007bff !important;
        color: #007bff !important;
    }

    .actions-grid .btn-info {
        border-color: #17a2b8 !important;
        color: #17a2b8 !important;
    }
}

/* ============================================
   5. SECTIONS - FOND BLANC
   ============================================ */
@media (max-width: 768px) {
    /* Section - Fond blanc */
    .section {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1.5rem !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    }

    .section-header {
        margin-bottom: 1.5rem;
    }

    .section-title {
        font-size: 1.5rem !important;
        color: #1f2937 !important;
    }

    /* Table - Fond blanc */
    table {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }

    thead {
        background: #f8f9fa !important;
    }

    th {
        background: #f8f9fa !important;
        color: #1f2937 !important;
    }

    td {
        border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        color: #1f2937 !important;
    }

    tbody tr:hover {
        background: #f8f9fa !important;
    }

    /* Formulaires - Fond blanc */
    .form-control {
        background: #ffffff !important;
        border-color: rgba(0, 0, 0, 0.2) !important;
        color: #1f2937 !important;
    }

    .form-control:focus {
        border-color: #0066ff !important;
        box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1) !important;
    }

    select.form-control {
        background: #ffffff !important;
        color: #1f2937 !important;
    }

    /* Alerts - Fond blanc */
    .alert {
        background: #ffffff !important;
        border-left: 4px solid;
    }

    .alert-success {
        background: #ecfdf5 !important;
        border-color: #00d2d3 !important;
        color: #00a8a8 !important;
    }

    .alert-danger {
        background: #fef2f2 !important;
        border-color: #ff6b6b !important;
        color: #cc4444 !important;
    }

    .alert-warning {
        background: #fffbeb !important;
        border-color: #ffa502 !important;
        color: #cc8400 !important;
    }

    .alert-info {
        background: #eff6ff !important;
        border-color: #54a0ff !important;
        color: #007bff !important;
    }

    /* Info box premium - Fond blanc */
    .info-box-premium {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    }

    .info-content-premium h3 {
        color: #1f2937 !important;
    }

    .info-content-premium p {
        color: #6b7280 !important;
    }

    /* Stat premium cards - Fond blanc */
    .stat-premium-card {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        color: #1f2937 !important;
    }

    .stat-premium-label {
        color: #6b7280 !important;
    }

    .stat-premium-value {
        color: #1f2937 !important;
    }

    /* Filters premium - Fond blanc */
    .filters-premium {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        color: #1f2937 !important;
    }

    .filters-title h3 {
        color: #1f2937 !important;
    }

    .filter-select {
        background: #ffffff !important;
        color: #1f2937 !important;
        border-color: rgba(0, 0, 0, 0.2) !important;
    }

    .filter-select:focus {
        border-color: #0066ff !important;
        box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1) !important;
    }

    .filter-search {
        background: #ffffff !important;
        color: #1f2937 !important;
        border-color: rgba(0, 0, 0, 0.2) !important;
    }

    .filter-search:focus {
        border-color: #0066ff !important;
        box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1) !important;
    }

    /* Table premium - Fond blanc */
    .table-premium-container {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }

    .table-premium-header {
        color: #1f2937 !important;
    }

    .table-premium th {
        background: #f8f9fa !important;
        color: #1f2937 !important;
    }

    .table-premium td {
        color: #1f2937 !important;
    }

    /* Rapport premium - Fond blanc */
    .rapport-section {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }

    .rapport-card {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        color: #1f2937 !important;
    }

    /* Buttons - Fond blanc */
    .btn {
        background: linear-gradient(135deg, #0066ff 0%, #00c6ff 100%) !important;
        color: white !important;
    }

    .btn:hover {
        background: linear-gradient(135deg, #0052cc 0%, #0085ff 100%) !important;
    }

    .btn-success {
        background: linear-gradient(135deg, #00d2d3 0%, #54a0ff 100%) !important;
        color: white !important;
    }

    .btn-danger {
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%) !important;
        color: white !important;
    }

    .btn-warning {
        background: linear-gradient(135deg, #ffa502 0%, #ff7f50 100%) !important;
        color: white !important;
    }

    .btn-info {
        background: linear-gradient(135deg, #54a0ff 0%, #5f27cd 100%) !important;
        color: white !important;
    }

    .btn-secondary {
        background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%) !important;
        color: #1f2937 !important;
    }
}

/* ============================================
   6. CORRECTIONS SPÉCIFIQUES
   ============================================ */

/* Corriger les stat cards avec dégradés */
.stat-card.primary {
    border-color: rgba(0, 102, 255, 0.3) !important;
    border-left: 3px solid #0066ff !important;
}

.stat-card.primary::before {
    background: linear-gradient(135deg, #0066ff 0%, #00c6ff 100%) !important;
}

.stat-card.success {
    border-color: rgba(0, 210, 213, 0.3) !important;
    border-left: 3px solid #00d2d3 !important;
}

.stat-card.success::before {
    background: linear-gradient(135deg, #00d2d3 0%, #54a0ff 100%) !important;
}

.stat-card.danger {
    border-color: rgba(255, 107, 107, 0.3) !important;
    border-left: 3px solid #ff6b6b !important;
}

.stat-card.danger::before {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%) !important;
}

.stat-card.warning {
    border-color: rgba(255, 165, 2, 0.3) !important;
    border-left: 3px solid #ffa502 !important;
}

.stat-card.warning::before {
    background: linear-gradient(135deg, #ffa502 0%, #ff7f50 100%) !important;
}

.stat-card.info {
    border-color: rgba(84, 160, 255, 0.3) !important;
    border-left: 3px solid #54a0ff !important;
}

.stat-card.info::before {
    background: linear-gradient(135deg, #54a0ff 0%, #5f27cd 100%) !important;
}

/* Corriger les nav cards */
.nav-card-primary {
    background: linear-gradient(135deg, #0066ff 0%, #00c6ff 100%) !important;
    color: white !important;
}

.nav-card-success {
    background: linear-gradient(135deg, #00d2d3 0%, #54a0ff 100%) !important;
    color: white !important;
}

.nav-card-info {
    background: linear-gradient(135deg, #54a0ff 0%, #5f27cd 100%) !important;
    color: white !important;
}

.nav-card-warning {
    background: linear-gradient(135deg, #ffa502 0%, #ff7f50 100%) !important;
    color: white !important;
}

/* Corriger les boutons sur fond blanc */
.actions-grid .btn {
    background: linear-gradient(135deg, #0066ff 0%, #00c6ff 100%) !important;
    color: white !important;
    border: 1px solid rgba(0, 102, 255, 0.2) !important;
}

.actions-grid .btn:hover {
    background: linear-gradient(135deg, #0052cc 0%, #0085ff 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3) !important;
}

.actions-grid .btn-success {
    background: linear-gradient(135deg, #00d2d3 0%, #54a0ff 100%) !important;
    color: white !important;
    border-color: #00d2d3 !important;
}

.actions-grid .btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%) !important;
    color: white !important;
    border-color: #ff6b6b !important;
}

.actions-grid .btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    color: white !important;
    border-color: #007bff !important;
}

.actions-grid .btn-info {
    background: linear-gradient(135deg, #54a0ff 0%, #5f27cd 100%) !important;
    color: white !important;
    border-color: #54a0ff !important;
}

/* ============================================
   7. CORRECTIONS POUR LOYERS
   ============================================ */

/* Stat cards spécifiques pour loyers */
.stat-premium-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #1f2937 !important;
}

.stat-premium-label {
    color: #6b7280 !important;
}

.stat-premium-value {
    color: #1f2937 !important;
}

/* Variante bleue pour La Denco */
.stat-premium-blue {
    border-color: rgba(0, 102, 255, 0.2) !important;
}

.stat-premium-blue::before {
    background: linear-gradient(135deg, #0066ff 0%, #00c6ff 100%) !important;
}

/* Variante verte pour Maison Papa */
.stat-premium-green {
    border-color: rgba(0, 210, 213, 0.2) !important;
}

.stat-premium-green::before {
    background: linear-gradient(135deg, #00d2d3 0%, #54a0ff 100%) !important;
}

/* Variante orange pour Chantier */
.stat-premium-orange {
    border-color: rgba(255, 165, 2, 0.2) !important;
}

.stat-premium-orange::before {
    background: linear-gradient(135deg, #ffa502 0%, #ff7f50 100%) !important;
}

/* Info box premium pour loyers */
.info-box-premium {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

.info-content-premium h3 {
    color: white !important;
}

.info-content-premium p {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* ============================================
   8. CORRECTIONS POUR AUTRES PAGES
   ============================================ */

/* Pour s'assurer que tous les textes sont lisibles sur fond blanc */
@media (max-width: 768px) {
    /* Corriger tous les éléments qui pourraient avoir du texte blanc */
    * {
        color: #1f2937 !important;
    }

    /* Exceptions: éléments qui doivent garder leur couleur */
    .nav-icon,
    .nav-card-icon,
    .stat-premium-icon,
    .info-icon-premium {
        color: inherit !important;
    }

    /* Corriger les liens */
    a {
        color: #0066ff !important;
    }

    a:hover {
        color: #0052cc !important;
    }

    /* Corriger les badges */
    .badge {
        color: #1f2937 !important;
    }

    .badge-success {
        background: #ecfdf5 !important;
        color: #00a8a8 !important;
    }

    .badge-danger {
        background: #fef2f2 !important;
        color: #cc4444 !important;
    }

    .badge-warning {
        background: #fffbeb !important;
        color: #cc8400 !important;
    }

    .badge-info {
        background: #eff6ff !important;
        color: #007bff !important;
    }
}

/* ============================================
   9. CORRECTIONS SPÉCIFIQUES POUR GESTION STOCK
   ============================================ */

/* Pour la page gestion_stock.php */
@media (max-width: 768px) {
    /* Conteneur principal - Fond blanc */
    .content-limited-1350 {
        background: #ffffff !important;
        min-height: 100vh !important;
        padding: 1rem !important;
        margin: 0 !important;
    }

    /* Section header - Fond blanc */
    .section-header {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-radius: 12px;
        padding: 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .section-header h2,
    .section-header h3 {
        color: #1f2937 !important;
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }

    /* Dashboard - Fond blanc */
    .dashboard {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        gap: 0.75rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* Stat cards - Fond blanc */
    .stat-card {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1rem !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
        text-align: center !important;
        color: #1f2937 !important;
    }

    .stat-card h3 {
        font-size: 1rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.5rem !important;
        color: #1f2937 !important;
    }

    .stat-card .value {
        font-size: 1.5rem !important;
        font-weight: 700 !important;
        color: #1f2937 !important;
        margin-bottom: 0.25rem !important;
    }

    .stat-card p {
        font-size: 0.85rem !important;
        color: #6c757d !important;
        margin: 0 !important;
    }

    /* Filtres premium - Fond blanc */
    .filters-premium {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        margin-bottom: 1.5rem !important;
    }

    .filters-header {
        background: #ffffff !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding-bottom: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    .filters-title h3 {
        color: #1f2937 !important;
        font-size: 1.1rem !important;
    }

    .filters-icon {
        font-size: 1.5rem !important;
    }

    .filter-item {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 0.75rem !important;
        border-radius: 8px !important;
    }

    .filter-label {
        color: #1f2937 !important;
        font-size: 0.9rem !important;
        font-weight: 500 !important;
    }

    .filter-label-icon {
        font-size: 1.2rem !important;
    }

    .filter-select {
        background: #ffffff !important;
        color: #1f2937 !important;
        border-color: rgba(0, 0, 0, 0.2) !important;
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }

    .filter-select:focus {
        border-color: #0066ff !important;
        box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1) !important;
    }

    .filter-search {
        background: #ffffff !important;
        color: #1f2937 !important;
        border-color: rgba(0, 0, 0, 0.2) !important;
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }

    .filter-search:focus {
        border-color: #0066ff !important;
        box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1) !important;
    }

    .filter-search-icon {
        color: #6b7280 !important;
    }

    .filter-select-icon {
        color: #6b7280 !important;
    }

    .btn-reset-filters {
        background: #f3f4f6 !important;
        color: #1f2937 !important;
        border: 1px solid rgba(0, 0, 0, 0.2) !important;
        padding: 0.5rem 1rem !important;
        border-radius: 6px !important;
        font-size: 0.85rem !important;
    }

    .btn-reset-filters:hover {
        background: #e5e7eb !important;
    }

    .reset-icon {
        font-size: 1rem !important;
    }

    .filters-stats {
        background: #f8f9fa !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 0.75rem !important;
        border-radius: 8px !important;
        margin-top: 1rem !important;
    }

    .filter-stat {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.5rem 0 !important;
    }

    .filter-stat-label {
        color: #6b7280 !important;
        font-size: 0.85rem !important;
    }

    .filter-stat-value {
        color: #1f2937 !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
    }

    /* Section du tableau - Fond blanc */
    .section {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow: visible !important;
    }

    /* Tableau - Fond blanc et scrollable */
    #table-stock {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 0.85rem !important;
    }

    #table-stock thead {
        background: #f8f9fa !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
    }

    #table-stock th {
        background: #f8f9fa !important;
        color: #1f2937 !important;
        padding: 0.75rem 0.5rem !important;
        text-align: left !important;
        border-bottom: 2px solid rgba(0, 0, 0, 0.15) !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
    }

    #table-stock td {
        background: #ffffff !important;
        color: #1f2937 !important;
        padding: 0.75rem 0.5rem !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        white-space: nowrap !important;
    }

    #table-stock tbody tr:hover {
        background: #f8f9fa !important;
    }

    /* Badge styles */
    .badge {
        display: inline-block !important;
        padding: 0.25rem 0.5rem !important;
        border-radius: 4px !important;
        font-size: 0.75rem !important;
        font-weight: 500 !important;
    }

    .badge-success {
        background: #ecfdf5 !important;
        color: #00a8a8 !important;
    }

    .badge-danger {
        background: #fef2f2 !important;
        color: #cc4444 !important;
    }

    .badge-warning {
        background: #fffbeb !important;
        color: #cc8400 !important;
    }

    /* Boutons dans le tableau */
    .stock-row .btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
        margin: 0.25rem !important;
        min-height: 36px !important;
    }

    /* Alert info */
    .alert-info {
        background: #eff6ff !important;
        border: 1px solid rgba(0, 102, 255, 0.2) !important;
        color: #007bff !important;
        padding: 1rem !important;
        border-radius: 8px !important;
    }

    .alert-info a {
        color: #0052cc !important;
        text-decoration: underline !important;
    }

    /* Corriger le fond sombre de .table-responsive - Sélecteur ultra-spécifique */
    .table-responsive,
    .table-responsive > table,
    .table-responsive > table > thead,
    .table-responsive > table > tbody,
    .table-responsive > table > thead > tr,
    .table-responsive > table > tbody > tr {
        background: #ffffff !important;
    }
    
    /* Forcer le fond blanc sur tous les éléments du tableau */
    .table-responsive * {
        background-color: #ffffff !important;
    }
    
    /* Exceptions: les éléments qui doivent avoir un fond différent */
    .table-responsive > table > thead > tr > th {
        background: #f8f9fa !important;
    }
    
    .table-responsive > table > tbody > tr:hover > td {
        background: #f8f9fa !important;
    }
}

/* Pour tablettes (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    /* Conteneur principal - Fond blanc */
    .content-limited-1350 {
        background: #ffffff !important;
        min-height: 100vh !important;
        padding: 1.5rem !important;
        margin: 0 !important;
    }

    /* Dashboard - Fond blanc */
    .dashboard {
        padding: 1.5rem !important;
        gap: 1rem !important;
    }

    /* Stat cards - Fond blanc */
    .stat-card {
        padding: 1.5rem !important;
    }

    /* Tableau - Meilleure lisibilité */
    #table-stock {
        font-size: 0.9rem !important;
    }

    #table-stock th,
    #table-stock td {
        padding: 0.875rem 0.75rem !important;
    }

    /* Corriger le fond sombre de .table-responsive */
    .table-responsive {
        background: #ffffff !important;
    }
}

/* Pour très petits écrans (0-360px) */
@media (max-width: 360px) {
    /* Masquer certaines colonnes du tableau */
    #table-stock th:nth-child(6),
    #table-stock th:nth-child(7),
    #table-stock th:nth-child(8),
    #table-stock td:nth-child(6),
    #table-stock td:nth-child(7),
    #table-stock td:nth-child(8) {
        display: none !important;
    }

    /* Ajuster les filtres */
    .filters-grid {
        grid-template-columns: 1fr !important;
    }

    .filter-item {
        width: 100% !important;
    }

    /* Corriger le fond sombre de .table-responsive */
    .table-responsive {
        background: #ffffff !important;
    }
}
