/* The job page (#232). A job's kind is a plain word since #588 (ui-pages.css). */

/* ---------------------------------------------------------------------------
   The job page (#232)

   An existing job's page: header and status strip, a section list, one section
   at a time, a summary rail, and a save bar that appears on the first change.
   Built on the tokens in ui-tokens.css. Kept in its own file so the page's styles
   travel together.
   --------------------------------------------------------------------------- */

/* ---- header ---- */
.qcb-jobpage-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.qcb-jobpage-id {
    min-width: 0;
    font-size: 0.8125rem;
}

.qcb-jobpage-titlerow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.qcb-jobpage-title {
    margin: 0;
    color: var(--qcb-gray-900);
    overflow-wrap: anywhere;
}

/* The job's project and the connections it reads from and writes to (#381): one
   bordered line of labelled parts, Project | Reads from -> Writes to. Dark text that
   underlines on hover, the connection's type small and grey, an icon per kind. A long
   name is cut short and is whole in the part's tooltip. On the Overview tab since #605. */
.qcb-jobflow {
    width: fit-content;
    max-width: 100%;
}

.qcb-jobflow-seg {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    min-width: 0;
    border-radius: 8px;
    color: var(--qcb-gray-800);
    text-decoration: none;
}

a.qcb-jobflow-seg:hover {
    color: var(--qcb-gray-900);
}

a.qcb-jobflow-seg:hover .qcb-jobflow-name,
a.qcb-jobflow-seg:focus-visible .qcb-jobflow-name {
    text-decoration: underline;
    text-underline-offset: 3px;
}

a.qcb-jobflow-seg:focus-visible {
    outline: 2px solid var(--qcb-teal-600);
    outline-offset: -2px;
}

.qcb-jobflow-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    line-height: 1;
}

.qcb-jobflow-icon--project { color: var(--qcb-gray-500); }
.qcb-jobflow-icon--qlik { color: var(--qcb-blue-600); }
.qcb-jobflow-icon--storage { color: var(--qcb-purple-600); }

/* Every name keeps some room when the line is squeezed, so one long name cannot
   shrink its neighbours to a letter or two. */
.qcb-jobflow-text {
    display: flex;
    flex-direction: column;
    min-width: 6rem;
}

.qcb-jobflow-label {
    white-space: nowrap;
}

.qcb-jobflow-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qcb-jobflow-note {
    flex-shrink: 0;
    white-space: nowrap;
}

.qcb-jobflow-seg--plain {
    cursor: default;
}

.qcb-jobflow-divider {
    flex: 0 0 1px;
    margin: 10px 0;
    background: var(--qcb-gray-200);
}

.qcb-jobflow-arrow {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    padding: 0 2px;
    font-size: 1.125rem;
}

/* On a phone the parts stack, and the arrow points down a backup's line and up a
   restore's. */
@media (max-width: 575.98px) {
    .qcb-jobflow {
        flex-direction: column;
        width: 100%;
    }

    .qcb-jobflow-divider {
        flex-basis: 1px;
        margin: 0 16px;
    }

    .qcb-jobflow-arrow {
        padding: 0;
        line-height: 1;
        transform: rotate(90deg);
    }
}

.qcb-jobpage-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.qcb-jobpage-run {
    display: inline-flex;
    gap: 0.375rem;
}

.qcb-jobpage-stat {
    min-width: 0;
}

.qcb-jobpage-stat-v {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.qcb-jobpage-stat-s {
    margin-top: 0.125rem;
}

.qcb-jobpage-stat-s--clip {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.qcb-jobpage-dot {
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--qcb-gray-300);
}

.qcb-jobpage-dot--run {  box-shadow: 0 0 0 3px var(--qcb-blue-100); }

/* ---- body: section list and the section ----
   The section has the rest of the width: the object table has many columns (#349). */
.qcb-jobpage-body {
    grid-template-columns: 12rem minmax(0, 1fr);
    align-items: start;
}

.qcb-jobpage-nav {
    top: 1rem;
}

.qcb-jobpage-navbtn {
    align-items: center;
    justify-content: space-between;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.qcb-jobpage-navbtn.is-current {
    border-left-color: var(--qcb-teal-600);
}

.qcb-jobpage-navbtn:focus-visible {
    outline: 2px solid var(--qcb-teal-600);
    outline-offset: 2px;
}

.qcb-jobpage-navcount {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--qcb-gray-500);
}

.qcb-jobpage-changed {
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.qcb-jobpage-section[hidden] {
    display: none !important;
}

.qcb-jobpage-section-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--qcb-gray-900);
}

.qcb-jobpage-section-desc {
    font-size: 0.875rem;
    margin: 0 0 1.25rem;
}

.qcb-jobpage-checks {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    font-size: 0.8125rem;
}

.qcb-jobpage-checks li {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.qcb-jobpage-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.625rem 1.25rem;
    margin: 0;
    font-size: 0.875rem;
}

.qcb-jobpage-facts dt {
    color: var(--qcb-gray-500);
    font-weight: 400;
}

.qcb-jobpage-facts dd {
    margin: 0;
    color: var(--qcb-gray-900);
    overflow-wrap: anywhere;
}

.qcb-jobpage-fixed {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    padding: 0 0.5rem;
    white-space: nowrap;
}

/* ---- "everything of these types" or "only what I pick" (#332) ----
   Two equal cards, each a <label> around a real radio button: the browser gives
   them radio semantics and arrow keys, and the radio is the visible indicator. */
.qcb-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0 0 1.25rem;
    padding: 0;
    border: 0;
    min-width: 0;
}

.qcb-choice-opt {
    display: grid;
    grid-template-columns: 1.25rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    margin: 0;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.qcb-choice-opt:has(input:focus-visible) {
    outline: 2px solid var(--qcb-teal-700);
    outline-offset: 2px;
}

.qcb-choice-opt .form-check-input {
    float: none;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0.0625rem 0 0;
}

/* The card shows the focus ring; the radio inside it doesn't need a second one. */
.qcb-choice-opt .form-check-input:focus-visible {
    outline: none;
    box-shadow: none;
}

.qcb-choice-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.qcb-choice-title {
    font-size: 0.9375rem;
}

/* The card is a <label>, and ui-base.css makes every label bold; the line under the
   title is plain text (#349). */
.qcb-choice-desc {
    font-weight: 400;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--qcb-gray-600);
}

/* ---- settings list (#332) ----
   How it runs, on the create wizard and on the job page: one bordered list, one
   row per setting. A row is a label and one plain line on the left, the control on
   the right; on a narrow screen the control drops under the text. */
.qcb-settings {
    background: var(--qcb-surface);
    border: 1px solid var(--qcb-gray-200);
    border-radius: 10px;
    margin-bottom: 1.25rem;
}

.qcb-setting {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding: 0.875rem 1rem;
}

.qcb-setting-text {
    flex: 1 1 16rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.qcb-setting-label {
    display: block;
    margin: 0;
    font-size: 0.9375rem;
}

.qcb-setting-desc {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.qcb-setting-control {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--qcb-gray-600);
}

/* A line under the row that belongs to it: a range problem, a storage check. */
.qcb-setting-status {
    flex: 1 0 100%;
    margin: 0;
    font-size: 0.8125rem;
}

.qcb-setting-detail {
    padding: 0 1rem 1rem;
}

.qcb-setting-detail[hidden] {
    display: none !important;
}

.qcb-setting-note {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--qcb-gray-600);
}

.qcb-setting-sub {
    margin-top: 0.875rem;
}

.qcb-setting-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin: 0.875rem 0 0.75rem;
}

.qcb-setting-fields > div {
    flex: 1 1 14rem;
    min-width: 0;
}

.qcb-input-number {
    width: 9rem;
    max-width: 100%;
}

.qcb-radio-list {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

/* BootstrapBlazor keeps a check label on one line and cuts it off with an ellipsis;
   these carry a sentence and have to wrap, on a phone above all. */
.qcb-radio-list .form-check,
.qcb-setting-detail .form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding-left: 0;
}

.qcb-radio-list .form-check .form-check-input,
.qcb-setting-detail .form-check .form-check-input {
    float: none;
    flex: 0 0 auto;
    margin: 0.1875rem 0 0;
}

.qcb-radio-list .form-check .form-check-input + .form-check-label,
.qcb-setting-detail .form-check .form-check-input + .form-check-label {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    white-space: normal;
    overflow: visible;
}

.qcb-radio-list .form-check + .form-check {
    margin-top: 0.5rem;
}

/* A choice with a hint after its label (#385). The label runs inline, so the "i"
   follows its last word wherever the line wraps, instead of sitting at the far edge
   of a flex row. The input hangs in the padding, as Bootstrap's own does. */
.qcb-radio-list .form-check.qcb-check-with-hint,
.qcb-setting-detail .form-check.qcb-check-with-hint {
    display: block;
    padding-left: 1.625rem;
}

.qcb-radio-list .form-check.qcb-check-with-hint .form-check-input,
.qcb-setting-detail .form-check.qcb-check-with-hint .form-check-input {
    float: left;
    margin: 0.1875rem 0 0 -1.625rem;
}

.qcb-radio-list .form-check.qcb-check-with-hint .form-check-input + .form-check-label,
.qcb-setting-detail .form-check.qcb-check-with-hint .form-check-input + .form-check-label {
    display: inline;
}

.qcb-radio-list .form-check.qcb-check-with-hint > .qcb-hint-wrap,
.qcb-setting-detail .form-check.qcb-check-with-hint > .qcb-hint-wrap {
    vertical-align: -0.125rem;
}

/* A settings row label with a hint beside it (#385). */
.qcb-setting-label-row {
    display: flex;
    align-items: center;
    min-width: 0;
}

.qcb-radio-list legend.qcb-flabel {
    float: none;
    width: auto;
    margin-bottom: 0.5rem;
}

/* The second line of a radio's label: what that choice means, not in brackets. */
.qcb-radio-hint {
    display: block;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--qcb-gray-600);
}

/* ---- the create wizard (#332) ----
   One column, the same width on every step. The header, the stepper, each step's
   card and the buttons all line up on it. It takes the page's width, as the job
   page does, so the object table has room (#349); Basics keeps its fields at a
   readable width (.qcb-wizard-fields). */
.qcb-wizard {
    max-width: none;
}

.qcb-wizard .qcb-page-header {
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.qcb-wizard-panel {
    border-radius: 12px;
    padding: 1.25rem 1.5rem 1.5rem;
}

.qcb-wizard-panel .qcb-step-panel-title {
    font-size: 1.0625rem;
    font-weight: 700;
}

.qcb-wizard-panel .qcb-step-panel-desc {
    font-size: 0.875rem;
}

/* Basics: the fields at a readable width, not stretched across the card. */
.qcb-wizard-fields {
    max-width: 36rem;
}

/* The source panel (#784) is rows of choices, which need more room than a field does:
   at the fields' width its segments wrapped onto two lines (#786). */
.qcb-wizard-fields:has(> .rsp) {
    max-width: 52rem;
}

.qcb-wizard-fields .form-fixed {
    width: 100%;
    max-width: 100%;
}

.qcb-wizard .qcb-form-actions {
    justify-content: flex-end;
    border-top: 0;
    padding-top: 0;
    margin-top: 1.25rem;
}

.qcb-wizard .qcb-form-actions .qcb-wizard-back {
    margin-right: auto;
}

/* ---- review (#332) ---- */
.qcb-review-sentence {
    margin: 0 0 1.25rem;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    line-height: 1.55;
}

.qcb-review-group {
    padding: 1rem 0;
    border-top: 1px solid var(--qcb-gray-200);
}

.qcb-review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    margin-bottom: 0.625rem;
}

.qcb-review-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--qcb-gray-900);
}

.qcb-review-problems {
    margin: 0 0 1rem;
}

.qcb-review-problems ul {
    margin: 0.5rem 0 0;
    padding-left: 1.125rem;
}

.qcb-review-problems li + li {
    margin-top: 0.375rem;
}

.qcb-review-ready {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    font-weight: 600;
    color: var(--qcb-green-700);
}

/* The objects a job picks, by type (#597): a line per type, a small type listed, a
   bigger one opening to a list that scrolls inside the page. */
.qcb-review-objects {
    margin-top: 0.75rem;
    border-top: 1px solid var(--qcb-gray-200);
}

.qrv-type {
    border-bottom: 1px solid var(--qcb-gray-200);
}

.qrv-line {
    display: grid;
    grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
    align-items: baseline;
    gap: 0.25rem 1rem;
    width: 100%;
    padding: 0.625rem 0;
    font-size: 0.875rem;
    color: var(--qcb-gray-900);
    text-align: left;
}

.qrv-toggle {
    grid-template-columns: 1.25rem minmax(9rem, max-content) minmax(0, 1fr) auto;
    font: inherit;
    font-size: 0.875rem;
    background: none;
    border: 0;
    cursor: pointer;
}

.qrv-arrow {
    color: var(--qcb-gray-500);
}

.qrv-name {
    font-weight: 600;
}

.qrv-count,
.qrv-choices,
.qrv-shown {
    font-weight: 400;
    color: var(--qcb-gray-500);
}

.qrv-choices {
    font-size: 0.8125rem;
}

.qrv-action {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--qcb-teal-700);
}

.qrv-body {
    padding: 0 0 0.875rem 1.75rem;
}

.qrv-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.qrv-filter .form-control {
    flex: 0 1 18rem;
}

.qrv-shown {
    font-size: 0.75rem;
}

.qrv-table {
    font-size: 0.8125rem;
}

/* About ten rows, then it scrolls inside the page; the header stays. */
.qrv-scroll {
    max-height: 21rem;
    overflow: auto;
    border: 1px solid var(--qcb-gray-200);
    border-radius: 6px;
}

.qrv-scroll thead th {
    position: sticky;
    top: 0;
    background: var(--qcb-surface);
}

.qrv-table th {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--qcb-gray-500);
}

.qrv-row-name {
    font-weight: 500;
}

/* ---- under the object type tiles (their own styles: JobTypeTiles.razor.css, #788) ---- */
.qcb-linkbtn {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.qcb-linkbtn:hover {
    text-decoration: underline;
}

.qcb-inline-warning {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: var(--qcb-amber-700);
}

.qcb-note {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
}

/* ---- save bar ---- */
.qcb-savebar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-top: 1.5rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--qcb-gray-200);
    border-radius: 12px;
    transform: translateY(0.75rem);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.18s ease, opacity 0.18s ease, visibility 0s linear 0.18s;
}

.qcb-savebar.is-shown {
    transform: none;
    opacity: 1;
    visibility: visible;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.qcb-savebar-msg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--qcb-gray-900);
}

.qcb-savebar-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
}

.qcb-savebar-actions {
    display: flex;
    gap: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .qcb-savebar,
    .qcb-savebar.is-shown {
        transition: none;
    }
}

/* ---- narrower screens: the section list becomes a scrolling row ---- */
@media (max-width: 1200px) {
    .qcb-jobpage-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .qcb-jobpage-nav {
        grid-column: 1 / -1;
        overflow-x: auto;
    }

    .qcb-jobpage-navbtn {
        white-space: nowrap;
    }

}

@media (max-width: 860px) {
    .qcb-choice {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .qcb-wizard-panel {
        padding: 1rem;
    }

    .qcb-setting {
        padding: 0.75rem;
    }

    .qcb-setting-detail {
        padding: 0 0.75rem 0.75rem;
    }

    .qcb-wizard .qcb-form-actions {
        flex-wrap: wrap;
    }
}

/* ---- the object list's bar and full screen (#349) ----
   "Objects to back up" with its (i). Fetching every type and Full screen are in the
   picker's Actions menu since #671 (picker-layout.css). */
.qcb-objects-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin: 0.25rem 0 0;
}

.qcb-objects-heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.qcb-objects-context {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--qcb-gray-500);
}

/* Full screen: the area covers the window, under dialogs (z-index 1000 and up) and
   the page's loading overlay (999), and the rest of the page is hidden from view and
   from Tab. visibility, not display, so nothing behind it loses its state, and a
   child can be shown again: the area itself, the save bar and any dialog. */
.qcb-objects.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 990;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 1rem 1.5rem 6rem;
    background: var(--qcb-gray-50);
    visibility: visible;
}

.qcb-objects.is-fullscreen .qcb-objects-bar {
    position: sticky;
    top: -1rem;
    z-index: 2;
    margin: -1rem -1.5rem 0;
    padding: 0.75rem 1.5rem;
    background: var(--qcb-surface);
    border-bottom: 1px solid var(--qcb-gray-200);
}

body:has(.qcb-objects.is-fullscreen) {
    overflow: hidden;
}

body:has(.qcb-objects.is-fullscreen) #app-header,
body:has(.qcb-objects.is-fullscreen) .footer,
.qcb-page:has(.qcb-objects.is-fullscreen) {
    visibility: hidden;
}

.qcb-page:has(.qcb-objects.is-fullscreen) .qcb-modal-overlay {
    visibility: visible;
}

/* The save bar stays usable: pinned to the bottom of the window, over the list. */
.qcb-page:has(.qcb-objects.is-fullscreen) .qcb-savebar.is-shown {
    position: fixed;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 1rem;
    z-index: 995;
    margin: 0;
    transform: none;
    visibility: visible;
}

@media (max-width: 640px) {
    .qcb-objects.is-fullscreen {
        padding: 0.75rem 0.75rem 7rem;
    }

    .qcb-objects.is-fullscreen .qcb-objects-bar {
        top: -0.75rem;
        margin: -0.75rem -0.75rem 0;
        padding: 0.625rem 0.75rem;
    }

    .qcb-page:has(.qcb-objects.is-fullscreen) .qcb-savebar.is-shown {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
    }
}
