/* =====================================================
   INRADR — Buttons — DxButton secondary/primary mapping and the .inradr-btn adapter
   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).
   ===================================================== */

/* The global mappings below reach every DevExpress button outside the chrome: XAF view and nested
   toolbars, popup footers and DX-internal dialogs (OQ-12 a). Header and footer buttons are excluded with
   :where(), which adds no specificity; their adapters also load last. Focus rings stay Fluent
   (--dxds-color-border-focus-default, 2px, offset 1px) on DX buttons (OQ-02 a), and :focus alone paints no
   tint (OQ-02 b). */

/* ── Secondary: XAF actions and DX secondary buttons ─────────────
   Fluent derives every secondary colour on the button itself from public tokens (core.min.css 26.1.4:
   '.dxbl-btn{--dxbl-btn-secondary-bg:var(--dxds-color-surface-neutral-default-rest);...}' and
   '.dxbl-btn.dxbl-btn-secondary{--dxbl-btn-bg:var(--dxbl-btn-secondary-bg);...}'), so the public tokens are
   overridden on that element. Toolbar buttons read -selected for the pressed fill and the subdued content
   colour for their text ('.dxbl-toolbar>.dxbl-btn-toolbar .dxbl-toolbar-btn.dxbl-btn' and the toolbar-item
   rule), standalone buttons read -active and default content, hence both of each pair. The border token
   also colours the split separator. Toolbar buttons take their weight from base-default, standalone and
   popup buttons from base-strong (Fluent 600), so both become the DS 500. Disabled follows the DS
   contract (OQ-08): muted surface, muted text, DS border. */
.dxbl-btn.dxbl-btn-secondary:where(:not(.inradr-app-header *, .inradr-footer *)) {
    --dxds-color-surface-neutral-default-rest: var(--inradr-color-button-secondary-bg);
    --dxds-color-surface-neutral-default-hovered: var(--inradr-color-button-secondary-hover-bg);
    --dxds-color-surface-neutral-default-active: var(--inradr-color-button-secondary-active-bg);
    --dxds-color-surface-neutral-default-selected: var(--inradr-color-accent-tint-16);
    --dxds-color-border-neutral-default-rest: var(--inradr-color-button-secondary-text);
    --dxds-color-border-neutral-default-hovered: var(--inradr-color-button-secondary-text);
    --dxds-color-border-neutral-default-active: var(--inradr-color-button-secondary-text);
    --dxds-color-content-neutral-default-rest: var(--inradr-color-button-secondary-text);
    --dxds-color-content-neutral-subdued-rest: var(--inradr-color-button-secondary-text);
    --dxds-font-weight-base-default: var(--inradr-text-body-strong-weight);
    --dxds-font-weight-base-strong: var(--inradr-text-body-strong-weight);
    --dxds-color-surface-neutral-default-disabled: var(--inradr-color-button-disabled-bg);
    --dxds-color-content-neutral-default-disabled: var(--inradr-color-button-disabled-text);
    --dxds-color-border-neutral-default-disabled: var(--inradr-color-button-disabled-border);
}

/* Open drop-down (split button, toolbar ellipsis) and checked items carry .dxbl-active (DX 26.1 sources
   Navigation/Common/Components/BaseDropdownItem.razor.cs: IsActive = drop-down open or Active; the 26.1
   snapshots show these buttons only at rest). Inside a split button or button group DX then reads the
   active colours from tokens that are resolved on that container
   ('.dxbl-btn-split{--dxbl-btn-split-contained-secondary-active-bg:var(--dxds-color-surface-secondary-default-selected);...}',
   same for .dxbl-btn-group), so the public tokens are overridden on the container, too. The toolbar
   ellipsis is a dxbl-toolbar-item.dxbl-btn-group (26.1 List snapshot). */
:is(.dxbl-btn-split, .dxbl-btn-group):has(> .dxbl-btn.dxbl-btn-secondary):where(:not(.inradr-app-header *, .inradr-footer *)) {
    --dxds-color-surface-secondary-default-selected: var(--inradr-color-accent-tint-16);
    --dxds-color-border-neutral-default-rest: var(--inradr-color-button-secondary-text);
    --dxds-color-content-secondary-default-rest: var(--inradr-color-button-secondary-text);
}

/* ── Primary: Save, DialogOK (XAF PrimaryToolbarItemsController) ─
   Element-scoped accent (OQ-01): '.dxbl-btn{--dxbl-btn-primary-bg:var(--dxds-color-surface-primary-default-rest);...}'.
   The disabled token feeds XAF's '.xaf-primary-toolbar-btn.dxbl-btn.dxbl-btn-primary.dxbl-disabled'
   rule, which adds opacity .8 (A parity). Flat: no inset shadow. */
.dxbl-btn.dxbl-btn-primary:where(:not(.inradr-app-header *, .inradr-footer *)) {
    --dxds-color-surface-primary-default-rest: var(--inradr-color-button-primary-bg);
    --dxds-color-surface-primary-default-hovered: var(--inradr-color-button-primary-hover-bg);
    --dxds-color-surface-primary-default-active: var(--inradr-color-button-primary-active-bg);
    --dxds-color-surface-primary-default-disabled: var(--inradr-color-button-primary-bg);
    --dxds-color-content-neutral-default-static-dark-rest: var(--inradr-color-button-primary-text);
    --dxds-font-weight-base-default: var(--inradr-text-body-strong-weight);
    --dxds-font-weight-base-strong: var(--inradr-text-body-strong-weight);
}

/* ── Cursor ───────────────────────────────────────────────────────
   DX sets no cursor on .dxbl-btn. Pointer on every enabled button (A parity) at (0,1,0), so DX's more
   specific cursor:default cases (active pager page, text-edit icon button, disabled tab scroller) stay.
   A disabled XAF action shows not-allowed (OQ-08). */
.dxbl-btn:where(:not(:disabled, .dxbl-disabled)):where(:not(.inradr-app-header *, .inradr-footer *)) {
    cursor: pointer;
}

.dxbl-btn.dxbl-disabled:is(.dxbl-btn-secondary, .dxbl-btn-primary):where(:not(.inradr-app-header *, .inradr-footer *)) {
    cursor: not-allowed;
}

/* ── .inradr-btn on DxButton (dashboard card actions, global filter) ─
   The consumers render RenderStyle None ('dxbl-btn' or the unstyled 'dxbl-btn-outline-none'), whose state
   colours DX resolves from the --dxbl-btn-none-* tokens: '.dxbl-btn{--dxbl-btn-hover-bg:var(--dxbl-btn-none-hover-bg);
   --dxbl-btn-active-bg:var(--dxbl-btn-none-active-bg);...}'. DX's :active rule (0,4,0) beats the design's
   '.inradr-btn.inradr-btn--secondary:active', so every state is set here as a token that DX's own paint rules
   read. The design file keeps the rest look; both agree. Own element: accent focus ring, offset 2px
   (OQ-02). Re-verify on DX upgrade. */
.dxbl-btn.inradr-btn {
    --dxbl-btn-border-radius: var(--inradr-radius-sm);
    --dxbl-btn-focus-outline-offset: var(--inradr-focus-ring-offset);
    --dxds-color-border-focus-default: var(--inradr-focus-ring-color);
    --dxds-font-weight-base-default: var(--inradr-text-body-strong-weight);
    --dxds-font-weight-base-strong: var(--inradr-text-body-strong-weight);
}

/* Primary: the "new" buttons of the tenant overview's cards (RenderStyle None, Outline). Accent fill, text on navy,
   accent-hover on hover, accent-dark while pressed. Re-verify on DX upgrade. */
.dxbl-btn.inradr-btn.inradr-btn--primary {
    --dxbl-btn-bg: var(--inradr-color-button-primary-bg);
    --dxbl-btn-color: var(--inradr-color-button-primary-text);
    --dxbl-btn-border-color: var(--inradr-color-button-primary-bg);
    --dxbl-btn-hover-bg: var(--inradr-color-button-primary-hover-bg);
    --dxbl-btn-hover-color: var(--inradr-color-button-primary-text);
    --dxbl-btn-hover-border-color: var(--inradr-color-button-primary-hover-bg);
    --dxbl-btn-active-bg: var(--inradr-color-button-primary-active-bg);
    --dxbl-btn-active-color: var(--inradr-color-button-primary-text);
    --dxbl-btn-active-border-color: var(--inradr-color-button-primary-active-bg);
}

/* Secondary (also .inradr-btn--icon): white, accent border and glyph, tint-8 hover, tint-16 pressed.
   Re-verify on DX upgrade. */
.dxbl-btn.inradr-btn.inradr-btn--secondary {
    --dxbl-btn-bg: var(--inradr-color-button-secondary-bg);
    --dxbl-btn-color: var(--inradr-color-button-secondary-text);
    --dxbl-btn-border-color: var(--inradr-color-button-secondary-text);
    --dxbl-btn-hover-bg: var(--inradr-color-button-secondary-hover-bg);
    --dxbl-btn-hover-color: var(--inradr-color-button-secondary-hover-text);
    --dxbl-btn-hover-border-color: var(--inradr-color-button-secondary-text);
    --dxbl-btn-active-bg: var(--inradr-color-button-secondary-active-bg);
    --dxbl-btn-active-color: var(--inradr-color-button-secondary-text);
    --dxbl-btn-active-border-color: var(--inradr-color-button-secondary-text);
}

/* Text: accent on the transparent RenderStyle None surface, muted hover fill that stays while pressed,
   darker text when pressed. The borders keep the transparent None defaults. Re-verify on DX upgrade. */
.dxbl-btn.inradr-btn.inradr-btn--text {
    --dxbl-btn-color: var(--inradr-color-button-text-color);
    --dxbl-btn-hover-bg: var(--inradr-color-button-text-hover-bg);
    --dxbl-btn-hover-color: var(--inradr-color-button-text-color);
    --dxbl-btn-active-bg: var(--inradr-color-button-text-hover-bg);
    --dxbl-btn-active-color: var(--inradr-color-accent-dark);
}

/* Danger: the delete button of the tenant overview's cards (RenderStyle None, Outline). Filled as inradr-app and
   the spec: danger fill, text on navy, darker fills on hover and while pressed. Re-verify on DX upgrade. */
.dxbl-btn.inradr-btn.inradr-btn--danger {
    --dxbl-btn-bg: var(--inradr-color-button-danger-bg);
    --dxbl-btn-color: var(--inradr-color-button-danger-text);
    --dxbl-btn-border-color: var(--inradr-color-button-danger-border);
    --dxbl-btn-border-width: var(--inradr-button-danger-border-width);
    --dxbl-btn-hover-bg: var(--inradr-color-button-danger-hover-bg);
    --dxbl-btn-hover-color: var(--inradr-color-button-danger-text);
    --dxbl-btn-hover-border-color: var(--inradr-color-button-danger-hover-border);
    --dxbl-btn-active-bg: var(--inradr-color-button-danger-active-bg);
    --dxbl-btn-active-color: var(--inradr-color-button-danger-text);
    --dxbl-btn-active-border-color: var(--inradr-color-button-danger-active-border);
}

/* Enabled=false renders .dxbl-disabled, not .inradr-btn--disabled (the card and table export actions,
   26.1 capture "List-box multi-select classes (WP-15, WP-17)"). DS disabled contract (OQ-08), painted here
   because the design variant rules paint the rest and hover look directly and out-specify DX's
   token-reading paint rules; (0,3,0) to (0,5,0) win without !important. */
.dxbl-btn.inradr-btn.dxbl-disabled,
.dxbl-btn.inradr-btn.dxbl-disabled:hover {
    background-color: var(--inradr-color-button-disabled-bg);
    color: var(--inradr-color-button-disabled-text);
    cursor: not-allowed;
}

.dxbl-btn.inradr-btn.inradr-btn--secondary.dxbl-disabled,
.dxbl-btn.inradr-btn.inradr-btn--secondary.dxbl-disabled:hover {
    border-color: var(--inradr-color-button-disabled-border);
}
