﻿:not(:defined) {
    visibility: hidden;
}

sl-alert {
    z-index: 200;
}

sl-avatar {
    cursor: pointer;
}

sl-card div[slot='header'] {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

sl-input {
    padding-top: 0.5em;
    padding-bottom: 0.5em;
}

sl-button.active::part(base) {
    color: var(--sl-color-primary-800);
}

sl-card div[slot="header"] {
    font-weight: bold;
}

/* Card footer slot — buttons placed directly in the slot (e.g. card.AddFooter(button)). */
sl-card div[slot="footer"] {
    display: flex;
    justify-content: flex-end;
    gap: 1em;
}

/* rw-form-footer hosts the Add/Save (+ consumer) buttons wherever it is placed — a card footer slot,
   inside rw-form-tabs, or standalone — so it lays them out flex-end itself, card-independent
   (its id becomes container_<form>_footer; BL-FORM-063). */
rw-form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1em;
}

/* Nested linked footer inside the WebGuiCard.AddFooter() wrapper fills the wrapper width. */
sl-card div[slot="footer"] > rw-form-footer {
    flex: 1;
}

/* Footer button base: match the framework's inline compact field padding so a consumer button
   (footer-action-function) aligns with Add/Save without replicating that inline style. */
rw-form-footer sl-button {
    padding-top: var(--sl-spacing-2x-small);
    padding-bottom: var(--sl-spacing-2x-small);
}

.listTable {
    border-collapse: collapse;
    width: 100%;
}

    .listTable tr {
        border-bottom: 1px solid #e4e4e7;
    }

        .listTable tr:hover {
            background-color: #99999910;
        }

        .listTable tr.selected {
            background-color: hsl(200.61deg 63.87% 69.61% / 20%);
        }

            .listTable tr.selected:hover {
                background-color: hsl(200.61deg 63.87% 69.61% / 30%);
            }

    .listTable td,
    .listTable th {
        padding: 7px 10px;
    }

    /* A header cell is a <th scope="col"> (BL-GUI-050 / ADR-0010). Cancel the UA th defaults so it renders
       exactly as the <td> it replaced: td computes text-align:start (NOT left - they differ under RTL), and the <strong> already supplies the
       weight - font-weight:inherit is also what keeps a CONTROL in a header cell from inheriting bold. */
    .listTable th {
        text-align: start;
        font-weight: inherit;
    }

        /* BL-FORM-064: clip a header label to its column so a narrow control column (e.g. a 30px
           toggle/action-button) cannot spill its title into the next column under table-layout:fixed. */
        .listTable td strong,
        .listTable th strong {
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

.listGrid {
    display: grid;
    align-items: center;
    width: 100%;
}

.listGridRow {
    display: contents;
}

    .listGridRow:hover > div {
        background-color: #99999910;
    }

    .listGridRow.selected > div {
        background-color: hsl(200.61deg 63.87% 69.61% / 20%);
    }

    .listGridRow.selected:hover > div {
        background-color: hsl(200.61deg 63.87% 69.61% / 30%);
    }

.listGridCell {
    padding: 7px 10px;
    border-bottom: 1px solid #e4e4e7;
    height: 100%;
    display: flex;
    align-items: center;
}

sl-input[data-user-invalid]::part(base) {
    background-color: var(--sl-input-background-color-focus);
    border-color: hsl(0deg 88.7% 48.4%);
    box-shadow: 0 0 0 var(--sl-focus-ring-width) hsl(0deg 88.7% 48.4% / 40%);
}

sl-divider {
    border: revert-layer;
}

/* The suggestion list of createAutoComplete / createCombobox. sl-popup gives its fixed popup part no
   z-index, so a later positioned field (an sl-input's base part) would paint over the open list; stack it
   at the dropdown level, as sl-select and sl-dropdown do for their own popups. */
sl-popup.rw-listbox-popup::part(popup) {
    z-index: var(--sl-z-index-dropdown);
}

/* Overflow / dropdown menu (base createMenu, BL-GUI-040). Shoelace leaves no gap between a prefix-slotted
   icon and the label here, so space the prefix; and colour the danger item — sl-menu-item has no native
   danger variant, so createMenu marks it .rw-menu-item-danger (the rule was missing). BL-GUI-042. */
sl-menu-item::part(prefix) {
    margin-inline-end: var(--sl-spacing-x-small);
}

sl-menu-item.rw-menu-item-danger::part(base) {
    color: var(--sl-color-danger-600);
}

/* BL-GUI-049 / Req 28: the pager (RainworkWebGui.createPager). The host is a PLAIN <nav> — an invented
   custom element would be caught forever by the :not(:defined) FOUC guard at the top of this file, which
   hides it AND everything inside it (visibility inherits). */
.rw-pager {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

    .rw-pager-cluster {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    /* Req 28.2 — the defect this row was filed for: an unconstrained native <select> in a flex row has no
       intrinsic width cap and stretched to the full card (measured 1849px in the originating consumer). The
       bound lives here, not inline, so an app can override it.
       The bound applies to the CONTROL (form-control-input), not to the host: the accessible name has to come
       from the component's own label (design 69.4a), that label sits INSIDE the host, and bounding the host
       would make label and control share the 6rem — a 'Rows/page' label eats ~76px of it and collapses the
       control to a few pixels, leaving the selected size invisible in an empty box. So the host shrink-wraps
       (width:auto, flex:0 0 auto — it still never stretches) and the 6rem lands on the control. */
    .rw-pager sl-select {
        width: auto;
        flex: 0 0 auto;
    }

        /* Req 28.8 / design 69.4a — the size selector is named by the component's OWN label: both wa-select
           and sl-select render a label into shadow DOM and hardcode aria-labelledby="label" onto it, so a
           HOST aria-label / aria-labelledby is ignored. Giving it a real label is therefore the only way to
           get a correct COMPUTED accessible name; these part rules put that label back on one line with the
           control. Both frameworks expose the same parts (form-control, form-control-label,
           form-control-input). */
        .rw-pager sl-select::part(form-control) {
            display: flex;
            align-items: center;
            gap: 0.35rem;
        }

        .rw-pager sl-select::part(form-control-label) {
            margin: 0;
            white-space: nowrap;
            flex: 0 0 auto;
        }

        .rw-pager sl-select::part(form-control-input) {
            flex: 0 0 6rem;
            min-width: 0;
        }

    /* The size selector must stay legible when the pager sits in a narrow card footer. */
    .rw-pager-range,
    .rw-pager-indicator {
        white-space: nowrap;
    }
