/* Viewport-sticky horizontal scrollbar for #changelist-form .results */
/* Django admin changelist boxes (.actions, .paginator, .object-tools) ship with
   default box-sizing: content-box and inner padding. When the parent matches
   the viewport width exactly, the padding pushes the box ~5px past the right
   edge and triggers a page-level horizontal scrollbar. Forcing border-box +
   max-width: 100% clamps them to the parent width. */
.paginator,
.actions,
.object-tools {
    box-sizing: border-box;
    max-width: 100%;
}

.sticky-hscroll {
    position: fixed;
    /* JS sets --sticky-hscroll-h to the actually-rendered scrollbar height in
       CSS px so the thumb fits at any browser zoom (Linux/GNOME scrollbars
       scale with 1/zoom, e.g. ~20 CSS px at 80% zoom). 16px is the fallback. */
    height: var(--sticky-hscroll-h, 16px);
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 999;
    display: none;
}

.sticky-hscroll.needed.in-viewport {
    display: block;
}

#changelist-form .results.sticky-hscroll-active {
    margin-bottom: calc(var(--sticky-hscroll-h, 16px) + 2px);
}

/* Native scrollbar is suppressed only when the sticky overlay is actually
   useful. If the overlay is hidden (no overflow / too small to be useful)
   the native scrollbar of .results stays visible as a fallback. */
#changelist-form .results.sticky-hscroll-suppress-native {
    scrollbar-width: none;
}

#changelist-form .results.sticky-hscroll-suppress-native::-webkit-scrollbar {
    display: none;
}
