/* The object picker, switches, the picker's table and its popovers (from qonnect.css). */

/* Object picker on the job page (#333). The object types are a grouped list on the
   left and the chosen type's objects a table beside it; at a narrow width (the
   picker's own, through the container query, so a narrow page column counts too)
   the list becomes a select above the table. Nothing has a fixed width, so the
   picker never runs out of its container; the table scrolls inside its own box. */
.qots-picker {
    --qots-border: var(--qcb-gray-200);
    --qots-muted: var(--qcb-gray-500);
    --qots-text: var(--qcb-gray-800);
    --qots-accent: var(--qcb-teal-600);
    --qots-accent-strong: var(--qcb-teal-700);
    --qots-accent-soft: var(--qcb-teal-50);
    --qots-surface: var(--qcb-surface, #fff);
    --qots-surface-soft: var(--qcb-gray-50);
    container: qots-picker / inline-size;
    display: grid;
    grid-template-columns: minmax(10rem, 12.5rem) minmax(0, 1fr);
    gap: 1.25rem;
    max-width: 100%;
    min-width: 0;
    margin-top: 1rem;
    color: var(--qots-text);
}

.qots-typeselect {
    display: none;
}

.qots-types {
    min-width: 0;
    border-right: 1px solid var(--qots-border);
    padding-right: 0.75rem;
}

.qots-types-group + .qots-types-group {
    margin-top: 0.875rem;
}

.qots-types-heading {
    margin: 0 0 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--qots-muted);
}

.qots-types-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.qots-type {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.qots-type:hover {
    background: var(--qcb-gray-100);
}

.qots-type.is-active {
    color: var(--qots-accent-strong);
    font-weight: 700;
    background: var(--qots-accent-soft);
    border-left-color: var(--qots-accent);
}

.qots-type-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.qots-type-count {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--qots-muted);
    font-variant-numeric: tabular-nums;
}

.qots-type-count.has-picks {
    color: var(--qots-accent-strong);
    font-weight: 600;
}

.qots-panels,
.qots-panel {
    min-width: 0;
}

/* One type */
.qots {
    min-width: 0;
}

.qots-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.qots-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    min-width: 0;
}

.qots-title-text {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.qots-count {
    font-size: 0.875rem;
    color: var(--qots-muted);
    font-variant-numeric: tabular-nums;
}

.qots-head-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* The Data Files tab's note on personal data files (#458). */
.qots-personal {
    margin-bottom: 0.625rem;
}

.qots-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--qots-border);
    border-radius: 6px;
    background: var(--qots-surface);
    color: var(--qcb-gray-600);
    font-size: 1rem;
    cursor: pointer;
}

.qots-icon-btn:hover:not(:disabled) {
    background: var(--qots-surface-soft);
    color: var(--qots-text);
}

.qots-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qots-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.qots-search {
    position: relative;
    flex: 1 1 16rem;
    min-width: 0;
}

.qots-search > i {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--qots-muted);
    pointer-events: none;
}

.qots-search .form-control {
    padding-left: 2rem;
}

.qots-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 0;
    margin: 0;
    padding-left: 0;
    white-space: nowrap;
}

/* A switch that reads as one: BootstrapBlazor sizes .form-check-input to a 1em
   dot, which looked like a radio button. */
.qots-switch .form-check-input {
    float: none;
    width: 2.25rem;
    height: 1.25rem;
    margin: 0;
    border: 1px solid var(--qcb-gray-400);
    border-radius: 1rem;
    background-color: var(--qcb-gray-300);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-position: left center;
    background-repeat: no-repeat;
    background-size: contain;
    cursor: pointer;
    transition: background-position 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.qots-switch .form-check-input:focus,
.qots-switch .form-check-input:focus:not(:checked) {
    border-color: var(--qcb-gray-400);
    box-shadow: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* --qots-accent is set by the object picker; a switch elsewhere (the job page's
   "Personal data files", #461) falls back to the same teal. */
.qots-switch .form-check-input:checked {
    background-color: var(--qots-accent, var(--qcb-teal-600));
    border-color: var(--qots-accent, var(--qcb-teal-600));
    background-position: right center;
}

.qots-switch .form-check-input:focus-visible {
    outline: 2px solid var(--qots-accent, var(--qcb-teal-600));
    outline-offset: 2px;
}

.qots-switch .form-check-label {
    font-size: 0.875rem;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    .qots-switch .form-check-input {
        transition: none;
    }
}

.qots-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.qots-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
}

.qots-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 0.75rem;
    margin-top: 0.625rem;
}

.qots-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 0;
}

.qots-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    padding: 0.125rem 0.25rem 0.125rem 0.625rem;
    border: 1px solid var(--qcb-teal-100);
    border-radius: 999px;
    background: var(--qots-accent-soft);
    color: var(--qots-accent-strong);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.qots-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: inherit;
    cursor: pointer;
}

.qots-chip-remove:hover {
    background: var(--qcb-teal-100);
}

.qots-link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--qots-accent-strong);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.qots-link-btn:hover {
    color: var(--qcb-teal-700);
    text-decoration-thickness: 2px;
}

.qots-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    min-height: 2.25rem;
    margin: 0.5rem 0 0.375rem;
}

.qots-status-text {
    font-size: 0.8125rem;
    color: var(--qots-muted);
    font-variant-numeric: tabular-nums;
}

.qots-bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

/* Each column as wide as its content, and the table scrolls sideways inside its box
   when that is wider than the picker. Squeezed to the picker's width, every row
   wrapped to several lines. */
.qots-table .table {
    width: max-content;
    min-width: 100%;
    margin-bottom: 0;
    table-layout: auto;
}

.qots-table .table th,
.qots-table .table td {
    white-space: nowrap;
    vertical-align: middle;
}

.qots-table .table th {
    font-size: 0.8125rem;
}

.qots-th {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* BootstrapBlazor draws the sort arrow at the right edge of a sortable header;
   room for it, so it never sits on the filter button. */
.qots-table th .is-sort .qots-th {
    padding-right: 1.25rem;
}

.qots-funnel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    color: var(--qcb-gray-400);
    cursor: pointer;
}

.qots-funnel:hover {
    color: var(--qots-text);
    background: var(--qcb-gray-100);
}

/* A filtered column: filled icon, accent colour and a tinted box, so it does not
   rely on colour alone. */
.qots-funnel.is-active {
    color: var(--qots-accent-strong);
    background: var(--qots-accent-soft);
    border-color: var(--qcb-teal-100);
}

.qots-pick {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    border: 1.5px solid var(--qcb-gray-500);
    cursor: pointer;
}

.qots-pick:checked {
    background-color: var(--qots-accent);
    border-color: var(--qots-accent);
}

.qots-table tr.qots-row-picked > td {
    background-color: var(--qots-accent-soft);
}

.qots-missing {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.0625rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.qots-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    color: var(--qots-muted);
}

/* Popovers: a column's filter, Filters, Columns. Rendered outside the table, which
   scrolls in its own box and would cut them off, and placed next to their button by
   object-picker.js. */
.qots-popover-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: transparent;
}

.qots-popover {
    position: fixed;
    z-index: 1061;
    width: min(20rem, calc(100vw - 1rem));
    max-height: min(28rem, calc(100vh - 2rem));
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid var(--qots-border);
    border-radius: 10px;
    background: var(--qots-surface);
    color: var(--qots-text);
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
}

.qots-popover--wide {
    width: min(26rem, calc(100vw - 1rem));
}

/* Hidden until objectPicker.place() has put it under its button and marked it (#612):
   rendered before it is placed, it showed for a moment at the bottom left. If the
   script never runs, the animation shows it anyway after 0.4 s. */
.qots-popover:not([data-placed]) {
    visibility: hidden;
    animation: qots-popover-reveal 0s linear 0.4s forwards;
}

@keyframes qots-popover-reveal {
    to {
        visibility: visible;
    }
}

.qots-popover:focus-visible {
    outline: 2px solid var(--qots-accent);
    outline-offset: 2px;
}

.qots-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.qots-popover-head .qots-icon-btn {
    width: 1.75rem;
    height: 1.75rem;
    border-color: transparent;
}

.qots-popover-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
}

.qots-popover-hint {
    margin: 0.375rem 0 0.5rem;
    font-size: 0.75rem;
    color: var(--qots-muted);
}

.qots-textfilter {
    display: flex;
    gap: 0.375rem;
}

.qots-textfilter .qots-match {
    flex: 0 0 auto;
    width: auto;
}

.qots-textfilter .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.qots-checklist-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.375rem;
}

.qots-checklist {
    margin: 0;
    padding: 0;
    list-style: none;
}

.qots-checklist li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.qots-checklist .form-check-input {
    flex-shrink: 0;
    margin: 0;
}

.qots-checklist label {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.875rem;
    cursor: pointer;
}

.qots-checklist-count {
    color: var(--qots-muted);
    font-variant-numeric: tabular-nums;
}

/* The darker teal: white on the shared teal-600 is 3.7:1, short of 4.5:1 for text
   this size. */
.qots-popover .qcb-btn-primary {
    background-color: var(--qcb-teal-700);
    border-color: var(--qcb-teal-700);
}

.qots-filter-section + .qots-filter-section {
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--qots-border);
}

.qots-filter-section-title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
}

.qots-filter-summary {
    margin: 0 0 0.5rem;
    padding-left: 1.125rem;
    font-size: 0.8125rem;
}

/* Keyboard focus is always visible on the picker's own controls. */
.qots-type:focus-visible,
.qots-icon-btn:focus-visible,
.qots-funnel:focus-visible,
.qots-chip-remove:focus-visible,
.qots-link-btn:focus-visible,
.qots-pick:focus-visible {
    outline: 2px solid var(--qots-accent);
    outline-offset: 2px;
}

/* Narrow: the list becomes a select above the table. */
@container qots-picker (max-width: 640px) {
    .qots-typeselect {
        display: block;
        grid-column: 1 / -1;
    }

    .qots-types {
        display: none;
    }

    .qots-panels {
        grid-column: 1 / -1;
    }
}

@supports not (container-type: inline-size) {
    @media (max-width: 767.98px) {
        .qots-picker {
            grid-template-columns: minmax(0, 1fr);
        }

        .qots-typeselect {
            display: block;
        }

        .qots-types {
            display: none;
        }
    }
}

/* Phone: a popover is a sheet along the bottom of the screen. */
@media (max-width: 575.98px) {
    .qots-popover {
        left: 0 !important;
        right: 0;
        top: auto !important;
        bottom: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 14px 14px 0 0;
    }

    .qots-popover-backdrop {
        background: rgba(17, 24, 39, 0.3);
    }
}

/* Tabs */
.tabs {
    --bb-tabs-item-active-color: var(--qcb-teal-700);
    --bb-tabs-item-hover-color: var(--qcb-teal-700);
    --bb-tabs-bar-bg: var(--qcb-teal-700);
}

.content {
    padding-top: 1.1rem;
}

/*Slider */
.slider {
    /*background: var(--qcb-brand-blue) !important;*/
}

input:checked + .slider {
/*    background: var(--qcb-brand-blue) !important;
*/}

.switch {
    margin-inline-end: 1.5rem !important;
}
/* The pager (#607, ObjectPicker/PickerPager.razor): on the toolbar row above the
   table, pushed to its end. Which rows the page shows, first / previous / next /
   last, and how many rows a page holds. It wraps under the search when narrow. */
.qots-pager {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 0.75rem;
    margin-left: auto;
    font-size: 0.8125rem;
    color: var(--qots-muted, var(--qcb-text-muted));
}

.qots-pagerange {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.qots-pager-buttons {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.qots-page-btn {
    width: 1.875rem;
    height: 1.875rem;
}

.qots-rows {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.qots-rows-label {
    margin: 0;
    font-weight: 400;
    white-space: nowrap;
}

.qots-rows-select {
    width: auto;
    min-width: 4.25rem;
}

/* BootstrapBlazor's own page links under the table: the table still pages through
   them (PageIndex, QueryAsync), but the pager above is the one people use (#607). */
.qots-table .nav-pages {
    display: none !important;
}
