/*
 * alignvu UI v2.1: Admin & Security (application/views/admin/configure; js/admin/configure). Lists as FeedTables with
 * a search box, Edit / Delete icon buttons and the pages under them; the New / Edit wizards and summaries as Dialogs.
 * Shared parts: admin_shared.php and js/admin/configure/admin_shared.js. Rules here override css/admin.css and
 * css/application.css where the legacy classes the scripts select on are kept.
 */

/* ---------- Lists ---------- */

.app-admin {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.app-admin__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.app-admin__toolbar .av-search {
    flex: 0 1 360px;
}

.app-admin__toolbar .av-search__box .av-input {
    height: var(--control-height);
}

/* the table scrolls inside its frame on a narrow window rather than widening the page */
.app-admin__frame {
    overflow-x: auto;
}

.app-admin-table tbody th {
    font-weight: 600;
    color: var(--heading-ink);
    text-align: left;
    background: var(--surface);
}

.app-admin-table td,
.app-admin-table tbody th {
    vertical-align: middle;
}

.app-admin-table .app-admin__wrap {
    overflow-wrap: anywhere;
}

/* a row's name: opens it (summary or edit), underlined on hover, as on Connect's lists */
.app-admin .app-admin__link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--heading-ink);
    text-align: left;
    cursor: pointer;
}

.app-admin .app-admin__link:hover,
.app-admin .app-admin__link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.app-admin .app-admin__link:focus-visible {
    outline: 2px solid var(--heading-ink);
    outline-offset: 2px;
}

/* Edit and Delete: icon buttons at the end of the row */
.app-admin-table .app-admin__actions-cell {
    width: 1%;
    white-space: nowrap;
}

.app-admin__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0;
}

/* the pages under the list (generatePaginationPages() spans; css/v21_drilldowns.css styles .app-pages spans) */
.app-admin .pagination.app-admin__pages {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: auto;
    gap: 4px;
    margin: 0;
    font: 400 13px/18px var(--font-display);
}

.app-admin .pagination.app-admin__pages:empty {
    display: none;
}

/* ---------- Dialogs: New / Edit wizards and summaries ---------- */

.modal-content.app-admin-dialog {
    max-height: calc(100vh - 64px);
}

.app-admin-dialog .app-dialog__head .av-text {
    margin: 0;
}

.app-admin-dialog__step {
    margin: 0;
    color: var(--muted);
}

.app-admin-dialog__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* Back and Cancel on the left, the next step or Save on the right */
.app-admin-dialog .app-admin-dialog__actions {
    justify-content: flex-start;
}

.app-admin-dialog .app-admin-dialog__actions > :last-child {
    margin-left: auto;
}

/* a field's error, under it (css/application.css enlarges paragraphs) */
.app-admin-dialog p.av-field__error {
    margin: 0;
    font: 600 12px/16px var(--font-display);
    color: var(--status-removed);
}

/* a search box in a Dialog keeps its border (legacy search input rules take it off) */
.app-admin-dialog .av-search__box .av-input {
    border: 1px solid var(--muted);
}

/* a password field keeps its border (the legacy input[type="password"] rule in css/application.css takes it off) */
.app-admin-dialog input.av-input[type="password"] {
    border: 1px solid var(--muted);
}

/* a form's FormFields two to a row where they fit */
.app-admin-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: var(--space-4);
}

.app-admin-form .av-input,
.app-admin-form .av-select {
    width: 100%;
}

.app-admin-form__radios {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin: 0;
    padding: 0;
    border: 0;
}

.app-admin-form__radios legend {
    width: 100%;
    margin-bottom: 6px;
    padding: 0;
}

/* a list of Checkboxes (user groups, permission groups, users, tasks): columns that fit the Dialog, scrolling inside it */
.app-admin-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 10px var(--space-4);
    max-height: 320px;
    overflow-y: auto;
    padding: 2px;
}

.app-admin-checklist .av-check {
    align-items: flex-start;
    overflow-wrap: anywhere;
}

.app-admin-checklist .av-check input {
    flex: none;
    margin-top: 2px;
}

.app-admin-checklist:empty::before {
    content: "None to show.";
    font: 400 13px/18px var(--font-display);
    color: var(--muted);
}

/* the legacy tabs rule (css/admin.css .tabs) sizes the old tabs: undo it for the v2.1 Tabs */
.app-admin-dialog .av-tabs {
    flex-wrap: wrap;
}

/* ---------- Summaries ---------- */

.app-admin-summary__details {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.app-admin-summary__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-admin-summary__group .av-cardtitle {
    margin: 0;
}

.app-admin-summary__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Users: the Inactive tab has no Status column (its users are all inactive) */
.app-admin-users--inactive .app-admin-users__status {
    display: none;
}
