/* =====================================================
   INRADR — Grid — DxGrid/TreeList tokens, header, zebra, hover, filter menu
   inradr-feature layer (adapter): DevExpress / XAF / vendor selectors and tokens only.
   Maps inradr-design values (var(--inradr-*)) onto the framework; no new base values and
   no hex literals. Internal --dxbl-* tokens are set on the element that declares them and
   carry "re-verify on DX upgrade" (full list: inradr-feature/README.md).
   Never target a bare .dxbl-modal (it also matches the XAF skip link).
   ===================================================== */

/* ---- Grid surface, header colours, rows (WP-13) ----
   A's list look through the grid's own tokens. DevExpress declares them on the grid root, which
   both dxbl-grid and dxbl-tree-list carry as .dxbl-grid; the theme class lifts the rule above
   '.dxbl-grid' and its '.dxbl-sm'/'.dxbl-lg' variants. Feature grids (.inradr-table-card__grid, WP-17) override
   at the same specificity from a later file. Row hover needs HighlightRowOnHover; the missing outer
   border and the invisible cell lines come from GridlinesVisible = None (InradrListEditorController, as
   inradr-app; owner decision 2026-10-01). DX keeps the 1px line width and only makes it transparent, so the
   row metrics below stay. Internal tokens: re-verify on DX upgrade. */
.dxbl-theme-fluent .dxbl-grid {
    --dxbl-grid-bg: var(--inradr-color-surface);
    --dxbl-grid-hover-bg: var(--inradr-color-row-selected); /* rows and sortable headers */
    /* OQ-15 (c): a selected row shares the hover tint; hovered, it takes Fluent's primary-deep shade. */
    --dxbl-grid-selection-bg: var(--inradr-color-row-selected);
    --dxbl-grid-selected-hover-bg: var(--dxds-color-surface-primary-deep-rest);
    --dxbl-grid-header-bg: var(--inradr-color-surface);
    --dxbl-grid-header-color: var(--inradr-color-text-primary);
    --dxbl-grid-header-font-weight: var(--inradr-text-list-header-weight);
    --dxbl-grid-text-cell-padding-x: var(--inradr-table-cell-padding-x);
    /* 30px rows: one text line (DX's own --dxbl-grid-text-height, 20px) plus the 1px row line. */
    --dxbl-grid-text-cell-padding-y: calc((var(--inradr-height-table-row) - var(--dxbl-grid-text-height) - 1px) / 2);
}

/* Header row: 13px at line-height 1, no vertical lines, 30px high. Scoped to thead like DX's own
   band rule, so the body keeps its metrics; grids with bands keep their header lines because that
   DX rule is more specific. The header cells hold 20px boxes (sort glyph, filter-menu funnel, select-all
   checkbox), so the padding is sized from DX's text line (--dxbl-grid-text-height), not from the 13px
   font. Re-verify on DX upgrade. */
.dxbl-grid .dxbl-grid-table > thead {
    --dxbl-grid-font-size: var(--inradr-text-list-header-size);
    --dxbl-grid-line-height: var(--inradr-text-list-header-line-height);
    --dxbl-grid-v-line-color: transparent;
    --dxbl-grid-text-cell-padding-y: calc((var(--inradr-height-table-row) - var(--dxbl-grid-text-height)) / 2);
}

/* Zebra: rows with an odd data-visible-index take the muted surface. Keyed on the index value,
   not on :nth-child, so a stripe stays with its row under virtual scrolling and across pages
   (a negative index, e.g. "-1", is no data row). Only the row token is set: DX paints hover,
   selection and focus with its own background rules, which win. :where() keeps this at (0,1,0) -
   DX declares --dxbl-grid-row-bg only on the grid root, so any rule on the row wins, and feature
   grids can restripe without a specificity race. Re-verify on DX upgrade. */
.dxbl-grid :where(.dxbl-grid-table > tbody > tr:is([data-visible-index$="1"], [data-visible-index$="3"], [data-visible-index$="5"], [data-visible-index$="7"], [data-visible-index$="9"]):not([data-visible-index^="-"], .dxbl-grid-group-row)) {
    --dxbl-grid-row-bg: var(--inradr-color-surface-muted);
}

/* ---- Column sizing (OQ-19 a) ----
   Content-sized columns as in A: auto table layout instead of DX's fixed one, and the filler column
   DX adds for the fixed layout is hidden (its td/th and its col.dxbl-grid-hidden-empty-cell).
   A view whose column resizing or virtual scrolling misbehaves falls back to OQ-19 b. */
.dxbl-theme-fluent .dxbl-grid .dxbl-grid-table {
    table-layout: auto;
}

.dxbl-theme-fluent .dxbl-grid .dxbl-grid-table .dxbl-grid-empty-cell {
    display: none;
}

/* ---- Compact grid: CustomCSSClassName="inradr-layout--compact-grid" on a LayoutGroup holding a small table ----
   A summary table in a quarter-width group (the property mask's Mietertragsanalyse) has no room for the filter
   funnels of the content-sized columns above: no funnel buttons, and the headers and the text column may wrap -
   the figures stay on one line. Measured 2026-10-06 at 1920px: 506px of content in a 440px group before, 438px
   after. */
.inradr-layout--compact-grid .dxbl-grid .dxbl-grid-filter-menu-funnel-btn {
    display: none;
}

.inradr-layout--compact-grid .dxbl-grid .dxbl-grid-table :is(th, td:first-child) {
    white-space: normal;
}

/* ---- Static rows: lists whose rows open nothing ([NonNavigableRow]) ----
   InradrListEditorController switches the hover off and adds inradr-grid--static to the grid root; XAF still puts
   cursor-pointer on every data row (DxGridAdapterBase), so the cursor is reset here - inradr-app's detail-view-false.
   Re-verify on DX upgrade. */
.dxbl-grid.inradr-grid--static .dxbl-grid-table > tbody > tr {
    cursor: default;
}

/* ---- Tree list (Tree list capture) ----
   The expand controls float at the top of the first cell. With an expand button they are only as
   tall as its 16px glyph and sit 2px above the text line; one text line of min-height centres
   them in the row, like the 20px placeholder of leaf nodes. Reads an internal token: re-verify
   on DX upgrade. */
.dxbl-grid .dxbl-grid-tree-node-expand-controls-cell > .dxbl-grid-tree-node-expand-controls-container {
    min-height: var(--dxbl-grid-text-height);
}

/* ---- Field reveal in grid cells (CroppedStringPropertyEditor, js/inradr-field-reveal.js) ----
   A truncated value (span.inradr-cropped-string) opens and closes with a click. Its cell wraps while it is
   open, although the grid is .dxbl-grid-nowrap (WP-19): DX sets white-space on the grid root
   ('.dxbl-grid.dxbl-grid-nowrap{white-space:var(--dxbl-grid-white-space)}', core.min.css 26.1.4) and the cells
   inherit it. The rest of the row keeps the row pointer. ANNAHME (WP-00): no view uses the editor yet (no
   CroppedString column in the model), so no cell is captured. Re-verify on DX upgrade. */
.dxbl-grid .dxbl-grid-table > tbody > tr > td:has(.inradr-cropped-expanded) {
    white-space: normal;
    height: auto;
}

.dxbl-grid .dxbl-grid-table > tbody > tr > td .inradr-cropped-string {
    cursor: zoom-in;
}

.dxbl-grid .dxbl-grid-table > tbody > tr > td .inradr-cropped-string.inradr-cropped-expanded {
    cursor: zoom-out;
}

/* ---- Column filter menu (Filter menu capture) ----
   dxbl-dropdown.dxbl-filter-menu-dropdown-root declares both tokens; its dialog paints the shadow.
   Raised elevation instead of Fluent's lg shadow (OQ-32). Re-verify on DX upgrade. */
.dxbl-dropdown.dxbl-filter-menu-dropdown-root {
    --dxbl-dropdown-box-shadow: var(--inradr-elevation-2-shadow);
}

/* Never taller than the viewport minus 100px (A). DX caps low viewports itself (550px up to
   768px, 250px up to 576px), so this applies only above them. No stylesheet reads the token:
   the dropdown's max-height attribute holds 'var(--dxbl-filter-menu-dropdown-max-height)' and
   dx-blazor-all.js writes it into the dropdown's inline style. Re-verify on DX upgrade. */
@media (height > 768px) {
    .dxbl-dropdown.dxbl-filter-menu-dropdown-root {
        --dxbl-filter-menu-dropdown-max-height: calc(100vh - 100px);
    }
}
