/* Epic 13967, story 14609. The on-demand report run areas of the Item Performance page.

   These rules live in a plain stylesheet, not in a scoped .razor.css, because the page and its three
   child components are separate components and Blazor scoped CSS does not cross that line.

   It reuses the shared report look from reports.css. Only what is new to this feature is here: the
   request bar, the status card and the two table footer rows. */

/* ---- Request area ---------------------------------------------------------------------------- */

.oc-rr-request {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
}

.oc-rr-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 11rem;
}

.oc-rr-field--action {
    min-width: 0;
    margin-left: auto;
}

.oc-rr-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
}

.oc-rr-input {
    height: 2.35rem;
    padding: 0 0.6rem;
    font-size: 0.9rem;
    color: #111827;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.oc-rr-input:disabled {
    background: #f3f4f6;
    color: #6b7280;
}

.oc-rr-run {
    height: 2.35rem;
    padding: 0 1.15rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    background: #2563eb;
    border: 1px solid #2563eb;
    border-radius: 6px;
    cursor: pointer;
}

.oc-rr-run:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

/* The reason a disabled button is disabled. It sits under the bar so it is never hidden by a tooltip. */
/* ---- Location picker, story 14610 ------------------------------------------------------------
   Many locations is the point of the feature, so the picker is a scrolling checkbox list rather than a
   select. A region or a unit is a named set of locations: its button ticks the member locations in this
   same list, so the user always sees exactly which stores the run will reach. */

.oc-rr-field--locations {
    min-width: 22rem;
    flex: 1 1 22rem;
}

.oc-rr-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
}

.oc-rr-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    cursor: pointer;
}

.oc-rr-group:hover:not(:disabled) {
    background: #f3f4f6;
}

.oc-rr-group:disabled {
    opacity: 0.55;
    cursor: default;
}

/* Every member picked. */
.oc-rr-group--on {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #93c5fd;
}

/* Some members picked. A dashed edge says "partly", so the next click adding the rest is not a surprise. */
.oc-rr-group--part {
    color: #1d4ed8;
    border-style: dashed;
    border-color: #93c5fd;
}

.oc-rr-group__count {
    font-weight: 500;
    color: #6b7280;
}

.oc-rr-locations {
    display: flex;
    flex-direction: column;
    max-height: 13rem;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.oc-rr-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.88rem;
    color: #111827;
    cursor: pointer;
}

.oc-rr-location:hover {
    background: #f9fafb;
}

.oc-rr-location--on {
    background: #eff6ff;
}

.oc-rr-location__name {
    flex: 1 1 auto;
}

.oc-rr-location__id {
    font-size: 0.75rem;
    color: #9ca3af;
}

.oc-rr-locations__actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.3rem;
    font-size: 0.78rem;
}

.oc-rr-link {
    padding: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1d4ed8;
    background: none;
    border: 0;
    cursor: pointer;
}

.oc-rr-link:disabled {
    color: #9ca3af;
    cursor: default;
}

.oc-rr-locations__count {
    margin-left: auto;
    color: #6b7280;
}

/* ---- Read only parameters, and the email choice inside them --------------------------------- */

.oc-rr-request--readonly {
    background: #f9fafb;
}

.oc-rr-readonly__value {
    margin: 0;
    padding: 0.45rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
}

.oc-rr-field--email {
    flex: 1 1 100%;
    min-width: 0;
    padding-top: 0.35rem;
    border-top: 1px solid #f3f4f6;
}

/* ---- Column chooser, story 14612 ------------------------------------------------------------- */

.oc-colpick {
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.6rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
}

.oc-colpick__head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.45rem;
}

.oc-colpick__title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #374151;
}

.oc-colpick__count {
    margin-left: auto;
    font-size: 0.78rem;
    color: #6b7280;
}

.oc-colpick__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.9rem;
}

.oc-colpick__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #6b7280;
    cursor: pointer;
}

.oc-colpick__item--on {
    color: #111827;
    font-weight: 600;
}

.oc-colpick__item input:disabled {
    cursor: default;
}

.oc-rr-hint {
    margin: -0.35rem 0 0.75rem 0.25rem;
    font-size: 0.82rem;
    color: #6b7280;
}

/* ---- Status area ----------------------------------------------------------------------------- */

.oc-rr-status {
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left-width: 4px;
    border-radius: 9px;
}

.oc-rr-status--busy { border-left-color: #2563eb; }
.oc-rr-status--ok   { border-left-color: #16a34a; }
.oc-rr-status--warn { border-left-color: #d97706; }
.oc-rr-status--bad  { border-left-color: #dc2626; }

.oc-rr-status__head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.oc-rr-status__badge {
    padding: 0.1rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #374151;
    background: #f3f4f6;
    border-radius: 999px;
}

.oc-rr-status__title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 600;
    color: #111827;
}

.oc-rr-status__detail {
    margin: 0.35rem 0 0 0;
    font-size: 0.88rem;
    color: #4b5563;
}

.oc-rr-status__list {
    margin: 0.7rem 0 0 0;
    padding: 0;
    list-style: none;
}

.oc-rr-status__item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-top: 1px solid #f3f4f6;
}

.oc-rr-status__loc {
    font-weight: 600;
    color: #111827;
}

.oc-rr-status__state {
    font-size: 0.82rem;
    color: #4b5563;
}

.oc-rr-state--complete { color: #16a34a; }
.oc-rr-state--nodata   { color: #6b7280; }
.oc-rr-state--error,
.oc-rr-state--timeout  { color: #dc2626; }

.oc-rr-status__reason {
    flex-basis: 100%;
    font-size: 0.82rem;
    color: #6b7280;
}

/* What to do next. It is the line an operator acts on, so it reads darker than the raw reason. */
.oc-rr-status__action {
    flex-basis: 100%;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
}

.oc-rr-status__retry {
    margin-top: 0.7rem;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #2563eb;
    background: #ffffff;
    border: 1px solid #2563eb;
    border-radius: 6px;
    cursor: pointer;
}

/* ---- Results area ---------------------------------------------------------------------------- */

.oc-rr-results {
    padding: 0.9rem 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
}

.oc-rr-results--empty,
.oc-rr-results--loading {
    text-align: center;
    color: #4b5563;
}

.oc-rr-results--empty h3 {
    margin: 0 0 0.35rem 0;
    font-size: 1.05rem;
    color: #111827;
}

.oc-rr-results__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.oc-rr-results__head h3 {
    margin: 0;
    font-size: 1.02rem;
    color: #111827;
}

.oc-rr-results__period {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.oc-rr-table__custom td {
    font-style: italic;
    color: #4b5563;
    background: #fafafa;
}

.oc-rr-table__total td {
    font-weight: 700;
    color: #111827;
    background: #f3f4f6;
}

/* ---- Small screens --------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .oc-rr-field,
    .oc-rr-field--action {
        min-width: 100%;
        margin-left: 0;
    }

    .oc-rr-run {
        width: 100%;
    }
}
