/* Prevent page-level horizontal scroll; keep swipe only inside strips */

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    position: relative;
}

img,
video,
iframe,
svg,
canvas,
table {
    max-width: 100%;
}

/* Utility: intentional horizontal swipe row */
.h-scroll {
    display: flex;
    flex-wrap: nowrap;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.h-scroll::-webkit-scrollbar {
    display: none;
}

.h-scroll > * {
    flex-shrink: 0;
}

/* Known chip / tab strips — scroll inside, never widen the page */
.cm-tabs,
.cm-feed-filters,
.cm-type-chips,
.dashboard-tabs,
.custom-tabs {
    display: flex;
    flex-wrap: nowrap;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cm-tabs::-webkit-scrollbar,
.cm-feed-filters::-webkit-scrollbar,
.cm-type-chips::-webkit-scrollbar,
.dashboard-tabs::-webkit-scrollbar,
.custom-tabs::-webkit-scrollbar {
    display: none;
}

.cm-tabs > *,
.cm-feed-filters > *,
.cm-type-chips > *,
.dashboard-tabs > *,
.custom-tabs > * {
    flex-shrink: 0;
}

.cm-tab,
.cm-filter-chip,
.cm-type-chip,
.dashboard-tabs .nav-link,
.custom-tabs button {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .cm-space,
    .cm-space-body,
    .student-dashboard-section,
    .container,
    main,
    .instructor-content,
    .section,
    .footer,
    .navbar {
        max-width: 100%;
        min-width: 0;
    }

    .nav.nav-tabs:not(.flex-column):not(.zTab-two),
    .nav.nav-pills:not(.flex-column) {
        display: flex;
        flex-wrap: nowrap;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nav.nav-tabs:not(.flex-column):not(.zTab-two)::-webkit-scrollbar,
    .nav.nav-pills:not(.flex-column)::-webkit-scrollbar {
        display: none;
    }

    .nav.nav-tabs:not(.flex-column):not(.zTab-two) > *,
    .nav.nav-pills:not(.flex-column) > * {
        flex-shrink: 0;
    }

    .nav.nav-tabs .nav-link,
    .nav.nav-pills .nav-link {
        white-space: nowrap;
    }

    .cm-space-actions,
    .cm-badge-row {
        display: flex;
        flex-wrap: nowrap;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .cm-space-actions::-webkit-scrollbar,
    .cm-badge-row::-webkit-scrollbar {
        display: none;
    }

    .cm-space-actions > *,
    .cm-badge-row > * {
        flex-shrink: 0;
    }
}
