/* ux.grid styles */
/* The filtered-column header treatment (funnel glyph, colour, weight) lives in
   `ext-acs-theme.css`, which paints the funnel as an SVG mask via `::before`. The
   legacy `filter_icon.png` background and the italic/#6666CC text rule that used to
   sit here were only invisible because the theme's more specific selector overrode
   them, so they would have resurfaced as a second funnel the moment either side's
   specificity or load order changed. */

/* override the cell padding */
/* this is required to over-ride the 16px left margin that extjs 3.4 gives us */ 
.x-grid3-cell-first .x-grid3-cell-inner {
	padding-left: 4px !important;
}

/* List filter menu (grid column filters that opt in with `acsFilterable`).
   Cap the list and let the browser scroll it: the stock menu is unbounded with
   `overflow: hidden`, so a long list is navigable only by its 24px arrow scrollers,
   which bind no wheel listener. `!important` beats the inline height Ext writes in
   `Menu.constrainScroll`.

   The width cap is what keeps the menu attached to its column. A menu wider than the
   space to the right of its header cannot be aligned there: `getConstrainToXY` pulls it
   back inside the viewport, and it ends up floating mid-screen, detached from the header
   it belongs to. 460px still shows most of a book title on two lines while leaving a
   right-hand column enough room to hang from. Titles wrap; they are not truncated. */
.acs-list-filter-menu {
    max-width: min(38vw, 460px) !important;
}

.acs-list-filter-menu ul.x-menu-list {
    max-height: 500px !important;
    height: auto !important;
    max-width: min(38vw, 460px) !important;
    overflow-y: auto !important;
    overflow-x: hidden;
}

/* Wrap long titles instead of truncating them. Book names often differ only at the
   end ("...Assessment Process (2006)" vs "...Procurement Process (2006)"), which is
   exactly what an ellipsis would hide, and these are checkboxes meant to be compared
   at a glance rather than hovered one at a time. Only a handful of entries wrap, and
   the list scrolls anyway. `height: auto` because ExtJS pins menu items to one line. */
.acs-list-filter-menu a.x-menu-item {
    white-space: normal;
    height: auto !important;
    line-height: 1.4;
    padding-top: 4px;
    padding-bottom: 4px;
}

.acs-list-filter-menu li.x-menu-list-item {
    height: auto !important;
}

.acs-list-filter-menu .x-menu-scroller {
    display: none !important;
}

/* The filter box is the first item inside the scrolling list, so pin it: once you are
   a few hundred entries down, a box that has scrolled out of view is useless. `sticky`
   keeps it in normal flow (so it still sizes to the menu width) while holding it at the
   top of the scroll box. The background is opaque so list items cannot show through. */
/* The row is picked by the box it holds, not by position: a list under the box's
   threshold has no box, and its first option must stay an ordinary row.
   `.x-menu` is repeated to outrank the shell rule
   `.x-menu:not(.header-menu) li.x-menu-list-item:not(.x-hide-display)`, which zeroes
   padding and border on every menu item with `!important`. */
.x-menu.acs-list-filter-menu ul.x-menu-list li.x-menu-list-item:has(> .acs-list-filter-input),
.x-menu.x-menu-floating.acs-list-filter-menu ul.x-menu-list li.x-menu-list-item:has(> .acs-list-filter-input) {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
    background: var(--acs-card-bg, #fff) !important;
    border-bottom: 1px solid var(--acs-border-light, #e2e6ec) !important;
    /* Breathing room below the divider so rows passing under the sticky box read as
       scrolling beneath a header rather than being sliced by it. */
    padding: 6px 6px 8px !important;
    margin-bottom: 2px !important;
}

.acs-list-filter-menu .acs-list-filter-input {
    width: 100%;
    box-sizing: border-box;
}

/* `.x-menu` outranks azzurra's `.x-menu .x-menu-list-item .x-menu-text`, which is white. */
.x-menu.acs-list-filter-menu .x-menu-list-item .acs-list-filter-no-options {
    display: block;
    padding: 6px 12px;
    white-space: nowrap;
    color: var(--acs-text-secondary, #5a6370);
    cursor: default;
}
