/* ==========================================================================
   ESPACE FONDE - CSS MOBILE DÉDIÉ (360p, 480p, 520p, <= 768px)
   ========================================================================== */

@media (min-width: 769px) {
    .campus-mobile-bar,
    .campus-drawer-overlay,
    .mobile-drawer-close-row,
    .btn-drawer-close,
    .drawer-user-profile-card,
    .drawer-notifications-block {
        display: none !important;
    }
}

@media (max-width: 768px) {
    body {
        display: block !important;
        width: 100% !important;
        min-height: 100vh !important;
        overflow-x: hidden !important;
        font-size: 12px !important;
    }

    .campus-mobile-bar {
        display: flex !important;
        width: 100% !important;
        background: #ffffff !important;
        border-bottom: 2px solid var(--border-theme) !important;
        padding: 8px 12px !important;
        align-items: center !important;
        justify-content: space-between !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1005 !important;
        box-shadow: 0 4px 15px rgba(10, 44, 112, 0.15) !important;
    }

    body.theme-dark .campus-mobile-bar {
        background: #0c1a2e !important;
        border-bottom-color: #25446b !important;
    }

    .btn-mobile-nav {
        color: #ffffff !important;
        border: none !important;
        padding: 7px 11px !important;
        border-radius: 7px !important;
        font-size: 11.5px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
        white-space: nowrap !important;
    }
    .btn-nav-left {
        background: linear-gradient(135deg, #0A2C70 0%, #1547B5 100%) !important;
    }
    .btn-nav-right {
        background: linear-gradient(135deg, #FF7A00 0%, #ea580c 100%) !important;
    }

    .mobile-school-title-center {
        font-size: 13.5px !important;
        font-weight: 800 !important;
        color: #0A2C70 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 44% !important;
    }
    body.theme-dark .mobile-school-title-center {
        color: #F8FAFC !important;
    }

    header.top-campus-header {
        display: none !important;
    }
    header.top-campus-header.drawer-open {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 310px !important;
        max-width: 86vw !important;
        height: 100vh !important;
        z-index: 1050 !important;
        overflow-y: auto !important;
        background: #ffffff !important;
        border-right: 2px solid var(--border-theme) !important;
        box-shadow: 10px 0 30px rgba(0,0,0,0.3) !important;
        padding: 18px 16px !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
    body.theme-dark header.top-campus-header.drawer-open {
        background: #132a45 !important;
        border-right-color: #25446b !important;
    }

    .header-right-widgets .user-profile-widget {
        display: none !important;
    }

    /* DATE & HEURE MOBILE AJUSTÉE AVEC ESPACE VERS ANNÉE : À CONFIGURER */
    .header-right-widgets {
        width: 100% !important;
        margin-top: 6px !important;
        margin-bottom: 12px !important;
        display: block !important;
    }
    .header-right-widgets .datetime-pill {
        width: 100% !important;
        font-size: 11px !important;
        padding: 6px 12px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 6px !important;
        border-radius: var(--radius-sm, 6px) !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
    }
    .header-right-widgets .datetime-pill i {
        font-size: 11px !important;
    }

    .drawer-user-profile-card {
        background: var(--bg-card-inner) !important;
        border: 1.5px solid var(--border-theme) !important;
        border-radius: var(--radius-sm, 8px) !important;
        padding: 8px 12px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        width: 100% !important;
        margin: 4px 0 8px 0 !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
    }
    .drawer-user-left {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        overflow: hidden !important;
    }
    .drawer-user-details {
        display: flex !important;
        flex-direction: column !important;
    }
    .drawer-user-role {
        font-size: 9.5px !important;
        font-weight: 800 !important;
        color: var(--secondary) !important;
        text-transform: uppercase !important;
    }
    .drawer-user-name {
        font-size: 12.5px !important;
        font-weight: 800 !important;
        color: var(--text-main) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .btn-drawer-profile-edit {
        background: #0A2C70 !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 6px !important;
        padding: 5px 12px !important;
        font-size: 11.5px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        flex-shrink: 0 !important;
    }

    aside.sidebar {
        display: none !important;
    }
    aside.sidebar.drawer-open {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: 310px !important;
        max-width: 86vw !important;
        height: 100vh !important;
        z-index: 1050 !important;
        overflow-y: auto !important;
        background: #ffffff !important;
        border-left: 2px solid var(--border-theme) !important;
        box-shadow: -10px 0 30px rgba(0,0,0,0.3) !important;
        padding: 18px 16px !important;
        border-radius: 0 !important;
    }
    body.theme-dark aside.sidebar.drawer-open {
        background: #132a45 !important;
        border-left-color: #25446b !important;
    }

    .campus-drawer-overlay {
        display: none;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.6) !important;
        z-index: 1040 !important;
        backdrop-filter: blur(2px) !important;
    }
    .campus-drawer-overlay.active {
        display: block !important;
    }

    .mobile-drawer-close-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 12px !important;
        padding-bottom: 8px !important;
        border-bottom: 1.5px solid var(--border-theme) !important;
    }
    .drawer-section-label {
        font-size: 13px !important;
        font-weight: 800 !important;
        color: var(--secondary) !important;
        text-transform: uppercase !important;
    }
    .btn-drawer-close {
        background: transparent !important;
        border: none !important;
        color: var(--text-muted-col) !important;
        font-size: 26px !important;
        cursor: pointer !important;
        line-height: 1 !important;
    }

    .main {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    #overview-view {
        padding: 12px 10px !important;
        width: 100% !important;
    }

    /* GRILLE STRICTEMENT À 2 MODULES PAR LIGNE SUR MOBILE */
    .module-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .card.btn-trigger-module-view {
        padding: 14px 12px !important;
        min-height: 175px !important;
        border-radius: 12px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    .card-icon-wrapper {
        width: 36px !important;
        height: 36px !important;
        border-radius: 8px !important;
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }

    .card h4 {
        font-size: 13.5px !important;
        font-weight: 800 !important;
        margin: 0 0 4px 0 !important;
        line-height: 1.25 !important;
    }

    .card p {
        font-size: 11px !important;
        line-height: 1.35 !important;
        margin: 0 0 10px 0 !important;
        min-height: 30px !important;
    }

    .card-action-bar {
        font-size: 11px !important;
        padding-top: 8px !important;
        border-top: 1.5px dashed var(--border-theme) !important;
    }

    .header-top-row,
    .header-bottom-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    .meta-pills-list {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
    }
    .meta-pill {
        width: 100% !important;
        justify-content: flex-start !important;
        padding: 7px 12px !important;
        font-size: 12px !important;
    }

    .btn-theme-toggle {
        width: 100% !important;
        justify-content: center !important;
        padding: 8px 12px !important;
    }
}

@media (max-width: 480px) {
    .module-grid {
        gap: 8px !important;
    }
    .card.btn-trigger-module-view {
        padding: 12px 10px !important;
        min-height: 165px !important;
    }
    .card h4 {
        font-size: 12.5px !important;
    }
    .card p {
        font-size: 10px !important;
        line-height: 1.3 !important;
    }
    .card-action-bar {
        font-size: 10px !important;
    }
}

@media (max-width: 360px) {
    .btn-mobile-nav span {
        display: none !important;
    }
    .btn-mobile-nav {
        padding: 6px 9px !important;
        font-size: 13px !important;
    }
    .mobile-school-title-center {
        max-width: 60% !important;
        font-size: 12px !important;
    }
}
