/* ======================================================
   global_responsive_animations.css - ENS-NDJ
   Mise en page responsive globale (sidebar, headers, pied de page),
   animations et impression.

   Tranches (Bootstrap) : mobile < 768 · tablette 768–991.98 · bureau ≥ 992.
   La bascule bureau ↔ mobile est définie UNE fois (section 2) ; les
   tranches de la section 3 ne règlent que les tailles.
   ====================================================== */


/* ======================================================
   1. BUREAU (≥ 992px)
   ====================================================== */
@media (min-width: 992px) {
    body {
        display: grid;
        /* minmax(0, 1fr) et non 1fr : avec 1fr, la colonne ne descend jamais
           sous la largeur de son contenu (header ≈ 1030px) et overflow-x: clip
           masquait la droite de la page sur les écrans < 1440px. */
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }
    .left-panel { display: flex; }
    .right-main-content { grid-column: 2; }
    .desktop-header-wrapper { display: block; }
    .mobile-header-wrapper { display: none !important; }
    .mobile-menu { display: none !important; }
}

/* Portables à écran HiDPI (largeur effective 992–1280px) */
@media (min-width: 992px) and (max-width: 1280px) {
    main.main-content { padding: var(--space-md); }
    .container-right { padding: 0 var(--space-md); }
}


/* ======================================================
   2. BASCULE MOBILE / TABLETTE (< 992px)
   Barre latérale masquée (son contenu passe dans le menu hamburger),
   header mobile à la place du header bureau.
   ====================================================== */
@media (max-width: 991.98px) {
    body { display: block; }
    .left-panel { display: none !important; }
    .right-main-content { grid-column: auto !important; }
    .desktop-header-wrapper { display: none !important; }
    .mobile-header-wrapper { display: block !important; }
}


/* ======================================================
   3. TAILLES PAR TRANCHE
   ====================================================== */

/* Tablette (768–991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .mobile-nav-bar {
        height: 60px;
        padding: 0 var(--space-md);
    }
    .mobile-logo-img { height: 42px; }
    .mobile-lang-btn { padding: 10px 16px; }

    .mobile-menu { top: 68px; }
    .mobile-nav-grid { grid-template-columns: repeat(4, 1fr); }
    .mobile-app-grid { grid-template-columns: repeat(5, 1fr); }

    main.main-content { padding: var(--space-md); }

    .sponsor-banderole { justify-content: center; text-align: center; }
    .footer-info-text { text-align: center; width: 100%; }
    .sponsor-logos { justify-content: center; width: 100%; }
}

/* Mobile standard (481–767.98px) */
@media (min-width: 481px) and (max-width: 767.98px) {
    .mobile-nav-bar {
        height: var(--header-height-mobile);
        padding: 0 var(--space-sm);
        gap: 6px;
    }
    .mobile-logo-img { height: 36px; }

    .mobile-menu { top: var(--header-height-mobile); }
    .mobile-nav-grid { grid-template-columns: repeat(3, 1fr); }
    .mobile-app-grid { grid-template-columns: repeat(4, 1fr); }

    main.main-content { padding: var(--space-md); }

    .sponsor-banderole {
        flex-direction: column;
        text-align: center;
        padding: var(--space-md);
    }
    .footer-info-text { text-align: center; }
    .social-icons-footer { justify-content: center; }
    .sponsor-logos { justify-content: center; }
    .sponsor-logo { height: 40px; }
}

/* Petit mobile (361–480.98px) */
@media (min-width: 361px) and (max-width: 480.98px) {
    .mobile-nav-bar {
        height: 52px;
        padding: 0 6px;
        gap: 4px;
    }
    .mobile-logo-img { height: 32px; }
    .mobile-lang-btn { padding: 6px 10px; font-size: 0.875rem; }

    .mobile-menu { top: 60px; padding: var(--space-sm); }
    .mobile-nav-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .mobile-app-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .mobile-nav-item { padding: var(--space-sm); min-height: 70px; }
    .nav-item-icon { font-size: 1.1rem; }
    .app-item-icon { width: 40px; height: 40px; font-size: 1rem; }

    main.main-content { padding: var(--space-sm); }
    .container-right { padding: 0 var(--space-sm); }

    .sponsor-banderole { padding: var(--space-sm); gap: var(--space-sm); flex-direction: column; }
    .footer-info-text { text-align: center; }
    .social-icons-footer { justify-content: center; }
    .sponsor-logo { height: 35px; }
}

/* Très petit mobile (≤ 360.98px — couvre aussi les largeurs fractionnaires
   360–361px des téléphones Android zoomés, auparavant sans aucune règle) */
@media (max-width: 360.98px) {
    .mobile-nav-bar {
        height: 48px;
        padding: 0 4px;
        gap: 3px;
    }
    .mobile-logo-img { height: 28px; }
    /* 6 boutons de 40px tiennent encore à 320px de large */
    .mobile-home-btn, .mobile-search-btn, .mobile-menu-toggle, .mobile-auth-btn { width: 40px; height: 40px; }
    .mobile-lang-btn { padding: 5px 8px; font-size: 0.8125rem; min-width: 40px; min-height: 40px; }

    .mobile-menu { top: 56px; padding: 8px; }
    .mobile-nav-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
    .mobile-app-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .mobile-nav-item { padding: 8px; min-height: 60px; }
    .nav-item-icon { font-size: 1rem; }
    .app-item-icon { width: 36px; height: 36px; font-size: 0.9rem; }

    main.main-content { padding: 6px; }
    .container-right { padding: 0 6px; }

    .sponsor-banderole { padding: 8px; flex-direction: column; }
    .footer-info-text { text-align: center; }
    .social-icons-footer { justify-content: center; }
    .sponsor-logo { height: 30px; }
    .footer-info-text p { font-size: 0.8125rem; }
}


/* ======================================================
   4. ANIMATIONS ET ACCESSIBILITÉ
   ====================================================== */
.mobile-menu,
.mobile-nav-item,
.mobile-app-item,
.social-link,
.btn-nav-app {
    transition: all 0.2s ease;
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


/* ======================================================
   5. IMPRESSION
   ====================================================== */
@media print {
    .left-panel,
    .mobile-menu,
    .mobile-header-wrapper,
    .desktop-header-wrapper,
    .chad-flag-wrapper,
    .right-fixed-footer {
        display: none !important;
    }
    body { display: block; }
    .right-main-content { grid-column: 1; }
    main.main-content { padding: 0; }
}
