/*
 * Backend list behavior: stop cell text from wrapping and let the list scroll
 * horizontally instead of compressing every column into the container width.
 * Applied to all backend list widgets (table.data inside .control-list).
 */

/* Allow the list to overflow horizontally and scroll rather than squeezing columns. */
.control-list .list-content {
    overflow-x: auto;
}

/* The table grows to its content width (nowrap) but never narrower than the container. */
.control-list table.data {
    width: auto;
    min-width: 100%;
}

/* Keep each cell on a single line so columns size to their content. */
.control-list table.data > thead > tr > th,
.control-list table.data > tbody > tr > td {
    white-space: nowrap;
}

/*
 * Server-assigned identity fields (e.g. Linked Committee ID / Linked Event ID
 * on the Settings repeaters). These are `readOnly: true` rather than
 * `disabled` because a disabled input is dropped from form submission, and
 * the value is a repeater row's only stable identity across deletes,
 * reorders and inserts - dropping it would rewire rows to the wrong records.
 * readOnly keeps it in the POST but still looks fully editable, which invites
 * an operator to try typing in it. Scoped by cssClass so this never touches
 * other readonly inputs in the backend.
 */
.nsync-assigned-id input {
    background-color: #f0f0f0;
    color: #888;
    cursor: not-allowed;
}

/*
 * Left-align the list search on screens that have no toolbar buttons.
 *
 * Backend\Widgets\Toolbar::makeControlPanel() does not render nothing when a
 * list config omits `buttons` - it emits `<div data-control="toolbar"></div>`.
 * That empty element still occupies the first cell of .control-toolbar and
 * holds the search over to the right, leaving dead space on lists that had
 * their toolbar removed (Sync > Events, Sync > Records).
 *
 * The :has() test matches ONLY a toolbar that rendered with no buttons, so a
 * screen with any button is untouched without having to enumerate controllers
 * here - a list that gains a button later stops matching on its own.
 */
.control-toolbar > .toolbar-item.toolbar-primary:has(> [data-control="toolbar"]:empty) {
    display: none;
}

/*
 * Pin the list-setup icon to the right edge of the list below it.
 *
 * .control-toolbar is display:table, so its cells share the full width. With
 * the empty toolbar cell hidden above, the search cell and the setup cell split
 * what is left - the setup cell ends up ~259px wide while the icon it contains
 * is a 24px block sitting at that cell's LEFT edge, so the icon floated well
 * short of the list's right edge (measured: icon right 1394 vs list right 1629).
 *
 * The icon is a block-level <span> inside an inline <a>, so its containing
 * block is the cell and text-align alone cannot move it - hence margin-left:auto
 * to push it across. text-align is set as well so this still lands correctly if
 * October ever renders that span inline or inline-block, where the auto margin
 * would stop applying.
 *
 * Scoped to .list-header so it only affects list toolbars, never the main nav
 * (which also carries a .control-toolbar class).
 *
 * Verified in the browser: icon right edge 1629 == .list-widget-container right
 * edge 1629 on Sync > Events, Records and Committees.
 */
.list-header .control-toolbar > .toolbar-item.toolbar-setup {
    text-align: right;
}

.list-header .control-toolbar > .toolbar-item.toolbar-setup > a > span {
    margin-left: auto;
}
