/* === Mobile small (≤576px) === */
@media(max-width: 576px) {

    /* Listing cards → 1 seule colonne */
    .dash-grid-six,
    .dash-grid-cinq,
    .dash-grid-quatre,
    .dash-grid-trois,
    .dash-grid-deux {
        grid-template-columns: repeat(1, 1fr) !important;
    }

    /* Stats → scroll horizontal (remplace le grid par flex) */
    .stats-scroll {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 12px;
        padding-bottom: 6px;
    }
    .stats-scroll::-webkit-scrollbar { display: none; }
    .stats-scroll > .card {
        min-width: 92px;
        flex-shrink: 0;
    }

    /* Stats compactes sur mobile : icônes + textes réduits (tous espaces/onglets) */
    .stats-scroll .card-body {
        padding: 0.4rem !important;
    }
    .stats-scroll .card-body .gap-6 {
        gap: 5px !important;
        margin-bottom: 0 !important;
    }
    .stats-scroll .round-48 {
        width: 22px !important;
        height: 22px !important;
    }
    .stats-scroll .round-48 iconify-icon {
        font-size: 10px !important;
    }
    .stats-scroll h6 {
        font-size: 0.72rem !important;
        margin-bottom: 0 !important;
    }
    .stats-scroll small,
    .stats-scroll .fs-11 {
        font-size: 0.55rem !important;
        line-height: 1.05;
    }

    /* Bouton d'ajout dans la barre de filtre → FAB flottant */
    .filter-btn .btn-primary {
        position: fixed !important;
        bottom: 84px;
        right: 16px;
        z-index: 1031;
        border-radius: 50% !important;
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        padding: 0 !important;
        /* le libellé "Ajouter" est un nœud texte nu : font-size:0 le masque */
        font-size: 0 !important;
        line-height: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        box-shadow: 0 4px 14px rgba(0, 0, 0, .25) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .filter-btn .btn-primary span { display: none !important; }
    /* on ne garde que l'icône, recentrée et sans marge */
    .filter-btn .btn-primary i,
    .filter-btn .btn-primary iconify-icon {
        margin: 0 !important;
        font-size: 1.5rem !important;
        line-height: 1 !important;
    }

    /* Bulle chat séance → au-dessus de la nav bar */
    .seance-chat-bubble {
        bottom: 88px !important;
        right: 16px !important;
    }
}

/* === Tablette / mobile medium (≤900px) === */
@media(max-width: 900px) {

    .dash-grid-six,
    .dash-grid-quatre,
    .dash-grid-cinq,
    .dash-grid-trois,
    .grid-deux,
    .grid-six,
    .grid-cinq,
    .grid-quatre {
        grid-gap: 10px;
        border-radius: 15px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
        padding: 0;
    }

    .img-logo img {
        width: 70px;
    }

    .custom-pb {
        padding-bottom: 30px !important;
    }
}

/* === Mobile medium (≤800px) === */
@media(max-width: 800px) {
    .fs-15 {
        font-size: calc(1rem + 1.4vw) !important;
    }

    .grid-trois,
    .dash-grid-six,
    .dash-grid-quatre,
    .dash-grid-cinq,
    .dash-grid-trois,
    .dash-grid-deux,
    .grid-six,
    .grid-cinq,
    .grid-deux,
    .grid-quatre {
        grid-gap: 10px;
        border-radius: 15px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
        padding: 0;
    }

    .sec-title__title {
        font-size: 22px;
        line-height: 24px;
    }

    .auth-block {
        width: 90%;
        left: 5%;
        right: 5%;
        top: 5%;
    }

    .custom-sm-padding {
        padding: 25px !important;
    }

    .logo-img {
        text-align: center;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding: 8px;
    }

    .body-wrapper {
        margin-right: 0px !important;
        margin-left: 0px !important;
    }

    .filter-btn {
        text-align: center;
        justify-content: center !important;
    }

    .filter-btn .btn {
        display: inline-block !important;
        margin-bottom: 5px;
        padding: 6px 7px !important;
    }

    .sm-none {
        display: none !important;
    }

    .none-desktop {
        display: block !important;
    }

    .pwa {
        z-index: 9000 !important;
    }

    .pwa.alert .btn-close {
        left: 0 !important;
        top: -5px;
    }

    .pwa .navbar-brand {
        line-height: 1;
        margin-left: 30px;
    }

    .pwa .navbar-brand img {
        width: 20px !important;
        height: 20px !important;
    }

    .admin .pwa.alert .btn-close {
        left: 0 !important;
        top: 11px;
    }
    .body-wrapper{
        min-height: auto!important;
    }
}

/* === Actions des cards regroupées en menu kebab (mobile ≤767px) === */
@media (max-width: 767.98px) {
    .card-actions-dd {
        position: relative;
        display: inline-block;
    }
    .card-actions-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 6px 16px;
        border: 0;
        border-radius: 999px;
        font-size: .85rem;
        line-height: 1;
        color: #fff;
        background-color: var(--bs-primary, #44bcec);
    }
    .card-actions-toggle:hover,
    .card-actions-toggle:focus,
    .card-actions-toggle:active {
        color: #fff;
        background-color: var(--bs-primary, #44bcec);
        filter: brightness(.95);
    }
    .card-actions-toggle i { font-size: 1.15rem; }
    .card-actions-toggle::after { display: none; } /* pas de caret BS */

    .card-actions-menu {
        min-width: 184px;
        padding: 6px;
        border: 0;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
        z-index: 1055;
    }
    .card-actions-menu .dropdown-item {
        border-radius: 8px;
        padding: 10px 12px;
        font-size: .9rem;
        white-space: nowrap;
    }
    .card-actions-menu .dropdown-item i { font-size: 1.05rem; opacity: .85; }
    .card-actions-menu .dropdown-item.text-danger i { opacity: 1; }
    .card-actions-menu form {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    .card-actions-menu form .dropdown-item { width: 100%; text-align: left; }

    /* Cas .card-footer transformé en menu d'actions (matières, bâtiments, classes…) */
    .card-footer.card-actions-dd {
        text-align: right;
        display: block;
    }
    /* Évite que le menu déroulant soit coupé par la card */
    .card:has(.card-actions-dd) { overflow: visible; }
}
