/* ============================================
   RESPONSIVE DESIGN - CMS JJ-BAZIN
   Compatible: Mobile, Tablette, PC, TV
   ============================================ */

/* ========== BREAKPOINTS ========== */
/* 
   xs: < 576px (Téléphones)
   sm: ≥ 576px (Grands téléphones)
   md: ≥ 768px (Tablettes)
   lg: ≥ 992px (PC portables)
   xl: ≥ 1200px (PC bureau)
   xxl: ≥ 1400px (Grands écrans / TV)
   4k: ≥ 1920px (Ultra HD / TV)
*/

/* ========== TRÈS PETITS ÉCRANS (Téléphones < 576px) ========== */
@media (max-width: 575.98px) {
    /* Général */
    body {
        font-size: 0.85rem;
    }
    
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    /* Page Title */
    .page-title {
        padding: 15px;
    }
    
    .page-title h2 {
        font-size: 1.2rem;
    }
    
    .page-title h2 i {
        font-size: 1rem;
    }
    
    .breadcrumb {
        font-size: 0.7rem;
    }
    
    /* Cards */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    .card-header h3 {
        font-size: 1rem;
    }
    
    .card-header h5 {
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .card-footer {
        padding: 12px 15px;
        font-size: 0.8rem;
    }
    
    /* Header Video */
    .header-video {
        padding: 30px 0;
    }
    
    .header-video .container {
        padding: 0 10px;
    }
    
    .welcome-text h1 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    .welcome-text p {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .welcome-text .btn-lg {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .director-video {
        border-radius: 8px;
    }
    
    /* Gallery */
    .gallery-item img {
        height: 180px;
    }
    
    .gallery-item .caption {
        padding: 12px;
    }
    
    .gallery-item .caption h5 {
        font-size: 0.95rem;
    }
    
    .gallery-item .caption p {
        font-size: 0.8rem;
    }
    
    /* Stats Cards */
    .card-stats .card-body {
        padding: 15px;
    }
    
    .card-stats .h2 {
        font-size: 1.5rem;
    }
    
    .card-stats .icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .card-stats .btn-sm {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
    
    /* Tables */
    .table-custom {
        font-size: 0.75rem;
    }
    
    .table-custom thead th {
        padding: 8px 10px;
        font-size: 0.65rem;
    }
    
    .table-custom tbody td {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    
    .table-responsive {
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    /* Members */
    .member-card {
        padding: 15px 10px;
        margin-bottom: 10px;
    }
    
    .member-photo {
        width: 80px;
        height: 80px;
        margin-bottom: 10px;
    }
    
    .member-name {
        font-size: 0.85rem;
    }
    
    .member-role {
        font-size: 0.75rem;
    }
    
    /* Blog Articles */
    .article-card .card-img-top {
        height: 180px;
    }
    
    .article-card .card-title {
        font-size: 1.1rem;
    }
    
    .article-card .article-meta {
        font-size: 0.75rem;
        flex-wrap: wrap;
    }
    
    .article-card .article-meta span {
        margin: 2px 0;
    }
    
    .article-card .article-footer {
        flex-direction: column;
        gap: 12px;
    }
    
    .article-card .btn-article {
        width: 100%;
        justify-content: center;
        padding: 8px 20px;
        font-size: 0.85rem;
    }
    
    .article-stats {
        width: 100%;
        justify-content: space-around;
        font-size: 0.75rem;
    }
    
    /* Blog Sidebar */
    .sidebar-blog .media {
        padding: 10px;
    }
    
    .sidebar-blog .media img {
        width: 50px;
        height: 50px;
    }
    
    .sidebar-blog .media h6 {
        font-size: 0.8rem;
    }
    
    /* Activities */
    .card-img-top {
        height: 160px;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    
    .page-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    /* Footer */
    .footer {
        padding: 15px;
        text-align: center;
    }
    
    .footer .row > div {
        text-align: center !important;
        margin-bottom: 10px;
    }
    
    .footer .row > div:last-child {
        margin-bottom: 0;
    }
    
    /* Navbar */
    .navbar-horizontal {
        padding: 10px 15px;
    }
    
    .navbar-brand h4 {
        font-size: 0.9rem;
    }
    
    .navbar-brand img {
        height: 30px;
    }
    
    /* Buttons */
    .btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.65rem;
        padding: 4px 8px;
    }
    
    /* List Group */
    .list-group-item h6 {
        font-size: 0.85rem;
    }
    
    .list-group-item p {
        font-size: 0.75rem;
    }
    
    /* Media */
    .media img {
        width: 45px !important;
        height: 45px !important;
    }
    
    .media h6 {
        font-size: 0.8rem;
    }
}

/* ========== PETITS ÉCRANS (Grands téléphones ≥ 576px) ========== */
@media (min-width: 576px) and (max-width: 767.98px) {
    body {
        font-size: 0.9rem;
    }
    
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .welcome-text h1 {
        font-size: 1.6rem;
    }
    
    .welcome-text p {
        font-size: 1rem;
    }
    
    .gallery-item img {
        height: 220px;
    }
    
    .member-photo {
        width: 100px;
        height: 100px;
    }
    
    .card-stats .h2 {
        font-size: 1.8rem;
    }
    
    .article-card .card-img-top {
        height: 200px;
    }
    
    .article-card .card-title {
        font-size: 1.2rem;
    }
}

/* ========== ÉCRANS MOYENS (Tablettes ≥ 768px) ========== */
@media (min-width: 768px) and (max-width: 991.98px) {
    body {
        font-size: 0.9rem;
    }
    
    .container-fluid {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
    
    /* Sidebar */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1050;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    /* Header Video */
    .header-video {
        padding: 40px 0;
    }
    
    .welcome-text h1 {
        font-size: 1.8rem;
    }
    
    /* Gallery */
    .gallery-item img {
        height: 220px;
    }
    
    /* Stats Cards */
    .card-stats .h2 {
        font-size: 1.8rem;
    }
    
    /* Blog */
    .article-card .card-img-top {
        height: 220px;
    }
    
    .article-card .card-title {
        font-size: 1.3rem;
    }
    
    /* Activities */
    .card-img-top {
        height: 180px;
    }
    
    /* Navbar adjustments */
    .navbar-horizontal {
        padding: 12px 20px;
    }
    
    .navbar-text {
        font-size: 0.8rem;
    }
}

/* ========== GRANDS ÉCRANS (PC Portables ≥ 992px) ========== */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .sidebar {
        width: 230px;
    }
    
    .main-content {
        margin-left: 230px;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .welcome-text h1 {
        font-size: 2.2rem;
    }
    
    .gallery-item img {
        height: 230px;
    }
    
    .card-stats .h2 {
        font-size: 1.8rem;
    }
    
    .member-photo {
        width: 110px;
        height: 110px;
    }
}

/* ========== TRÈS GRANDS ÉCRANS (PC Bureau ≥ 1200px) ========== */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
    }
    
    .welcome-text h1 {
        font-size: 2.5rem;
    }
    
    .gallery-item img {
        height: 250px;
    }
    
    .card-stats .h2 {
        font-size: 2rem;
    }
    
    .container-fluid {
        max-width: 1140px;
        margin: 0 auto;
    }
}

/* ========== ÉCRANS XL (Grands écrans ≥ 1400px) ========== */
@media (min-width: 1400px) and (max-width: 1919.98px) {
    body {
        font-size: 1rem;
    }
    
    .sidebar {
        width: 260px;
    }
    
    .main-content {
        margin-left: 260px;
    }
    
    .container-fluid {
        max-width: 1320px;
        margin: 0 auto;
    }
    
    .welcome-text h1 {
        font-size: 2.8rem;
    }
    
    .gallery-item img {
        height: 280px;
    }
    
    .card-stats .h2 {
        font-size: 2.2rem;
    }
    
    .card-body {
        padding: 30px;
    }
    
    .member-photo {
        width: 130px;
        height: 130px;
    }
    
    .article-card .card-img-top {
        height: 300px;
    }
    
    .article-card .card-title {
        font-size: 1.6rem;
    }
}

/* ========== ULTRA HD / TV 4K (≥ 1920px) ========== */
@media (min-width: 1920px) {
    body {
        font-size: 1.1rem;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        margin-left: 280px;
    }
    
    .container-fluid {
        max-width: 1600px;
        margin: 0 auto;
    }
    
    .welcome-text h1 {
        font-size: 3.2rem;
    }
    
    .welcome-text p {
        font-size: 1.5rem;
    }
    
    .welcome-text .btn-lg {
        padding: 18px 40px;
        font-size: 1.2rem;
    }
    
    .header-video {
        padding: 100px 0;
    }
    
    .gallery-item img {
        height: 350px;
    }
    
    .card-stats .h2 {
        font-size: 2.8rem;
    }
    
    .card-stats .icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .card-body {
        padding: 35px;
    }
    
    .card-header {
        padding: 25px 35px;
    }
    
    .card-header h3 {
        font-size: 1.5rem;
    }
    
    .member-photo {
        width: 160px;
        height: 160px;
        border-width: 5px;
    }
    
    .member-name {
        font-size: 1.3rem;
    }
    
    .member-role {
        font-size: 1rem;
    }
    
    .article-card .card-img-top {
        height: 400px;
    }
    
    .article-card .card-title {
        font-size: 1.8rem;
    }
    
    .article-card .card-text {
        font-size: 1.1rem;
    }
    
    .article-meta {
        font-size: 1rem;
    }
    
    .table-custom {
        font-size: 1rem;
    }
    
    .table-custom thead th {
        padding: 18px 25px;
        font-size: 0.9rem;
    }
    
    .table-custom tbody td {
        padding: 18px 25px;
    }
    
    .page-title {
        padding: 30px 40px;
    }
    
    .page-title h2 {
        font-size: 2rem;
    }
    
    .btn {
        padding: 15px 30px;
        font-size: 1rem;
    }
    
    .btn-lg {
        padding: 18px 40px;
        font-size: 1.2rem;
    }
}

/* ========== ORIENTATION PAYSAGE (Mobile/Tabete) ========== */
@media (max-width: 991.98px) and (orientation: landscape) {
    .header-video {
        padding: 20px 0;
    }
    
    .header-video .row {
        flex-direction: row;
    }
    
    .welcome-text h1 {
        font-size: 1.3rem;
    }
    
    .director-video {
        max-height: 250px;
    }
    
    .gallery-item img {
        height: 150px;
    }
    
    .card-stats {
        margin-bottom: 10px;
    }
}

/* ========== ORIENTATION PORTRAIT (Tablette) ========== */
@media (min-width: 768px) and (max-width: 991.98px) and (orientation: portrait) {
    .gallery-item img {
        height: 250px;
    }
    
    .article-card .card-img-top {
        height: 250px;
    }
}

/* ========== APPAREILS À FORTE DENSITÉ DE PIXELS (Retina) ========== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ========== IMPRESSION ========== */
@media print {
    .sidebar,
    .sidebar-toggle,
    .navbar-horizontal,
    .footer,
    .dark-mode-toggle,
    .btn,
    #downloadPDF {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
    
    .header-video {
        background: white !important;
        color: black !important;
        padding: 20px 0 !important;
    }
    
    a {
        color: black !important;
        text-decoration: underline !important;
    }
    
    .table-custom thead th {
        background: #eee !important;
        color: black !important;
    }
}

/* ========== TOUCH DEVICES ========== */
@media (hover: none) and (pointer: coarse) {
    /* Augmenter la taille des éléments cliquables */
    .btn, 
    .nav-link,
    .page-link,
    .dark-mode-toggle {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Augmenter l'espacement pour éviter les touches accidentelles */
    .nav-link {
        padding: 15px 20px;
    }
    
    .pagination .page-link {
        padding: 12px 18px;
    }
}

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

/* ========== MODE FENÊTRÉ (Pas en plein écran) ========== */
@media (max-width: 991.98px) {
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
}