/* ISPITS — adaptation mobile */

@media (max-width: 991.98px) {

    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    main,
    .admin-main,
    .admin-content,
    .student-content,
    .card,
    .card-body,
    [class*="col-"] {
        min-width: 0;
    }

    p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    .info-item,
    .news-info,
    .annonce-info {
        overflow-wrap: anywhere;
    }

    img,
    video {
        max-width: 100%;
    }

    /* Menu public */

    .navbar {
        height: auto !important;
        padding: 10px 0;
    }

    .navbar > .container {
        flex-wrap: wrap;
    }

    .navbar-brand {
        max-width: calc(100% - 64px);
        margin-right: 0;
    }

    .navbar .logo-navbar {
        width: 55px !important;
        height: auto !important;
    }

    .navbar .brand-title {
        font-size: 18px;
    }

    .navbar .brand-subtitle {
        font-size: 11px;
        letter-spacing: 1px;
    }

    .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
    }

    .navbar-collapse {
        flex-basis: 100%;
        width: 100%;
    }

    .navbar-nav {
        margin: 12px 0 !important;
        gap: 4px;
    }

    .navbar-nav .nav-link {
        white-space: normal;
        padding: 12px !important;
        min-height: 44px;
    }

    .navbar .dropdown-menu {
        max-width: 100%;
    }

    .navbar .dropdown-item {
        white-space: normal;
        min-height: 44px;
    }

    .navbar .btn-access {
        min-height: 46px;
        white-space: normal;
        margin-bottom: 0;
    }

    /* Menus étudiant et administration */

    .student-sidebar,
    .admin-sidebar {
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        padding: 12px 0;
        overflow: visible !important;
    }

    .admin-wrapper {
        display: block !important;
        overflow: visible !important;
    }

    .student-content,
    .admin-main {
        margin-left: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100vh;
        overflow: visible !important;
    }

    .student-content,
    .admin-content {
        padding: 20px 16px !important;
    }

    .student-sidebar .sidebar-logo,
    .admin-sidebar .sidebar-logo {
        padding: 8px 16px 12px;
    }

    .sidebar-logo img {
        width: 52px !important;
        height: 52px !important;
        margin-bottom: 0;
    }

    .student-sidebar .sidebar-menu,
    .admin-sidebar .sidebar-menu {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 8px 12px;
        margin: 0;
    }

    .sidebar-menu > li {
        margin: 0 !important;
        min-width: 0;
    }

    .sidebar-menu li a,
    .sidebar-menu .logout-btn {
        min-height: 48px;
        padding: 10px !important;
        gap: 8px !important;
        height: 100%;
        white-space: normal;
    }

    .sidebar-menu span,
    .sidebar-menu .logout-btn {
        font-size: 14px !important;
        line-height: 1.4;
    }

    /* En-têtes */

    .dashboard-header,
    .page-header,
    .profile-header,
    .table-header,
    .admin-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 14px;
        height: auto !important;
    }

    .admin-header {
        padding: 16px !important;
    }

    .header-actions,
    .header-right {
        flex-wrap: wrap;
        gap: 10px;
        min-width: 0;
    }

    .search-form {
        width: 100%;
        min-width: 0;
    }

    .search-form .input-group {
        flex-wrap: wrap;
    }

    .search-form .input-group > .form-control {
        min-width: 0;
    }

    .search-form .input-group > button {
        flex-basis: 100%;
        margin: 8px 0 0 !important;
        border-radius: 10px !important;
    }

    /* Statistiques et cartes */

    .stats-container,
    .stats-row,
    .stat-cards,
    .stats-grid,
    .settings-container {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
        width: 100%;
    }

    .stat-card,
    .admin-card {
        height: auto !important;
        min-height: 105px;
        padding: 16px !important;
        gap: 12px !important;
        border-radius: 14px;
    }

    .stat-icon,
    .card-icon,
    .stat-card > i {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px;
        font-size: 21px !important;
        flex-shrink: 0;
    }

    .stat-content,
    .stat-info {
        min-width: 0;
    }

    .stat-card h2,
    .stat-card h3,
    .stat-info h3 {
        font-size: 26px !important;
    }

    .stat-card span {
        font-size: 14px;
    }

    /* Formulaires */

    .search-section {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }

    .search-box,
    .search-input,
    .filter-select {
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
    }

    .form-control,
    .form-select,
    .filter-select,
    .search-input {
        font-size: 16px !important;
        min-height: 46px;
    }

    textarea.form-control {
        height: auto !important;
        min-height: 120px;
    }

    input[type="file"].form-control {
        height: auto !important;
    }

    .btn,
    .btn-add,
    .btn-search,
    .settings-btn,
    .btn-attestation,
    .btn-action,
    .btn-view,
    .btn-edit,
    .btn-delete {
        min-height: 44px;
    }

    .btn {
        white-space: normal;
    }

    .btn-action,
    .btn-view,
    .btn-edit,
    .btn-delete {
        min-width: 44px;
    }

    /* Tableaux */

    .table-responsive,
    .table-card,
    .table-container {
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .table-card,
    .table-container {
        padding: 14px;
    }

    .students-table,
    .admin-table,
    .custom-table,
    .annonces-table {
        min-width: 680px;
    }

    .timetable-table {
        min-width: 850px;
    }

    .annonces-table {
        table-layout: auto;
    }

    .admin-table td:last-child {
        display: table-cell !important;
        height: auto;
    }

    .table-actions,
    .action-buttons,
    .actions-buttons,
    .annonce-actions {
        gap: 8px !important;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
    }

    /* Accueil */

    .hero {
        height: auto !important;
        min-height: 460px;
        padding: 44px 0;
        background-position: center;
    }

    .hero-overlay {
        width: 100%;
        background: rgba(255, 255, 255, 0.90);
    }

    .hero-content {
        max-width: 100%;
        margin-left: 0;
        padding-top: 0;
    }

    .hero h1 {
        font-size: clamp(28px, 6vw, 40px);
    }

    .hero p {
        font-size: 16px;
        line-height: 1.7;
    }

    .hero-buttons {
        flex-wrap: wrap;
        gap: 12px;
    }

    .floating-card {
        position: static;
        width: 100%;
        margin-top: 12px;
    }

    .features {
        margin-top: 20px;
        margin-bottom: 35px;
    }

    .feature-item h5 {
        white-space: normal;
    }

    .news-events,
    .gallery {
        padding: 40px 0;
    }

    .section-title {
        font-size: 27px;
    }

    .access-card,
    .profile-card,
    .settings-card {
        padding: 20px;
    }

    .modules-page,
    .profile-page {
        padding: 0;
    }

    /* Connexion */

    .login-left {
        display: none;
    }

    .login-right {
        width: 100%;
        min-height: 100vh;
        justify-content: center;
        padding: 24px 16px;
    }

    .login-card {
        width: 100%;
        max-width: 520px;
        margin: 0 !important;
        padding: 26px 20px;
        border-radius: 20px;
    }

    .login-brand {
        position: relative;
        top: auto;
        left: auto;
        padding: 16px;
        flex-wrap: wrap;
    }

    /* Pied de page */

    .footer {
        padding: 30px 0 16px;
    }

    .footer-social {
        flex-wrap: wrap;
    }

    .footer-contact li {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 575.98px) {

    .stats-container,
    .stats-row,
    .stat-cards,
    .stats-grid,
    .settings-container {
        grid-template-columns: 1fr !important;
    }

    .news-item,
    .annonce-item {
        flex-direction: column;
        gap: 12px;
    }

    .news-item img,
    .annonce-item img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain;
    }

    .gallery-main,
    .gallery-small {
        width: 100%;
        height: auto;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-btn-primary,
    .hero-btn-secondary {
        justify-content: center;
        min-height: 48px;
    }

    .dashboard-card .card-header,
    .dashboard-card .card-footer {
        flex-wrap: wrap;
        gap: 10px;
    }

    .announcement-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .profile-actions {
        flex-direction: column;
        gap: 12px;
    }

    .stat-item:not(:last-child)::after {
        display: none;
    }
}