/*
 * Αποτελέσματα & εκτυπώσεις — the reports desk's status cards, filter and preview head.
 *
 * The desk keeps components.css's two-pane `.report-desk` / `.report-catalog` shell (the preview
 * still matters, so the split stays); this file only re-shapes the left column into the mockup's
 * status cards and adds the preview panel's own header row. Declared after components.css in the
 * same `spec.components` layer, so a rule here for a class components.css also touches — the
 * catalogue's width and its list spacing — wins by declaration order without `!important`.
 */
@layer spec.components {
    /* ——————————————————————————————————————————————————————
       Subtitle counts — «21 εκτυπώσεις · 12 διαθέσιμες · 6 με εκκρεμότητα · 3 μη εφαρμόσιμες»,
       each figure in its own tone so the count is legible before the words are read.
       —————————————————————————————————————————————————————— */
    .reports-subtitle__count {
        font-weight: var(--weight-semibold);
    }

    .reports-subtitle__count--ok {
        color: var(--ok);
    }

    .reports-subtitle__count--warn {
        color: var(--warn);
    }

    .reports-subtitle__count--stop {
        color: var(--color-neutral-700);
    }

    /* ——————————————————————————————————————————————————————
       Catalogue column — wider than the desk default (~24rem) and scrolling inside itself, per
       §3.2, rather than the page.
       —————————————————————————————————————————————————————— */
    .report-desk {
        grid-template-columns: minmax(18rem, 24rem) minmax(0, 1fr);
    }

    .report-catalog__scroll {
        padding: var(--sp-2);
    }

    .report-catalog__list {
        display: flex;
        flex-direction: column;
        gap: var(--sp-2);
        padding: 0;
        margin: 0;
    }

    .report-catalog__group + .report-catalog__group {
        border-top: 1px solid var(--color-divider);
        margin-top: var(--sp-2);
        padding-top: var(--sp-1);
    }

    /* ——————————————————————————————————————————————————————
       Status cards — ok / warn / stop, per §3.7. Colour comes from the CSS custom properties the
       tone class sets, so the selected state only has to override two of them rather than
       repeating every rule.
       —————————————————————————————————————————————————————— */
    .report-card {
        display: flex;
        flex-direction: column;
        gap: var(--sp-1);
        min-height: 5.75rem;
        padding: var(--sp-2) var(--sp-3);
        background: var(--card-bg, #fff);
        border: 1px solid var(--card-border, var(--color-divider));
        border-left: 3px solid var(--card-mark, var(--color-neutral-500));
        color: var(--spec-ink);
        cursor: pointer;
        touch-action: manipulation;
        transition: background-color var(--dur-fast) var(--ease-standard);
    }

    .report-card:hover {
        background: color-mix(in srgb, var(--card-bg, #fff) 88%, var(--color-neutral-900) 6%);
    }

    .report-card:focus-visible {
        outline: 2px solid var(--color-accent);
        outline-offset: 1px;
    }

    .report-card--ok {
        --card-bg: #fff;
        --card-border: var(--color-divider);
        --card-mark: var(--ok);
        --card-status: var(--ok);
        --card-action: var(--color-accent-700);
        --card-reason: var(--color-neutral-700);
    }

    .report-card--warn {
        --card-bg: var(--warn-t);
        --card-border: var(--warn-b);
        --card-mark: var(--warn);
        --card-status: var(--warn);
        --card-action: var(--warn);
        --card-reason: var(--color-neutral-800);
    }

    .report-card--stop {
        --card-bg: var(--color-neutral-100);
        --card-border: var(--color-divider);
        --card-mark: var(--color-neutral-500);
        --card-status: var(--color-neutral-500);
        --card-action: var(--color-neutral-600);
        --card-reason: var(--color-neutral-700);
        color: var(--color-neutral-700);
    }

    /* Selection wins the tint and the bar, whatever tone the card carries underneath — the same
       accent-100 + accent bar every other selectable row in the app uses (§3.3). */
    .report-card.is-selected {
        --card-bg: var(--color-accent-100);
        --card-mark: var(--color-accent);
        color: var(--color-accent-900);
    }

    .report-card__head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: var(--sp-2);
    }

    .report-card__name {
        font: var(--weight-semibold) 13px/1.3 var(--font-heading);
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .report-card__kind {
        flex: none;
        font: 400 9px/1 var(--font-mono);
        padding: 2px 4px;
        border: 1px solid var(--card-border, var(--color-divider));
        color: var(--color-neutral-700);
        white-space: nowrap;
    }

    .report-card__reason {
        flex: 1;
        font-size: var(--text-xs);
        line-height: var(--leading-snug);
        color: var(--card-reason);
        text-wrap: pretty;
    }

    .report-card__foot {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--sp-2);
        margin-top: auto;
    }

    .report-card__status {
        font: var(--weight-semibold) var(--text-2xs) / 1 var(--font-heading);
        letter-spacing: var(--tracking-caps);
        text-transform: uppercase;
        color: var(--card-status);
        white-space: nowrap;
    }

    .report-card__action {
        font-size: var(--text-xs);
        color: var(--card-action);
        white-space: nowrap;
    }

    a.report-card__action {
        border-bottom: 1px solid currentColor;
        text-decoration: none;
    }

    button.report-card__action {
        background: none;
        border: 0;
        border-bottom: 1px solid currentColor;
        padding: 0;
        margin: 0;
        font-family: inherit;
        cursor: pointer;
    }

    /* ——————————————————————————————————————————————————————
       Preview panel — its own header row, ahead of the sheet.
       —————————————————————————————————————————————————————— */
    .reports-preview-head {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
        gap: var(--sp-3);
        margin-bottom: var(--sp-3);
    }

    .reports-preview-head__title {
        display: flex;
        align-items: center;
        gap: var(--sp-2);
        min-width: 0;
    }

    .reports-preview-head__name {
        font: var(--weight-semibold) 16px/1.3 var(--font-heading);
        overflow-wrap: anywhere;
    }

    .reports-preview-head__kind {
        flex: none;
        font: 400 9px/1 var(--font-mono);
        padding: 2px 5px;
        border: 1px solid var(--color-divider);
        color: var(--color-neutral-700);
        white-space: nowrap;
    }

    .reports-preview-head__actions {
        display: flex;
        gap: var(--sp-2);
        flex: none;
    }

    .reports-preview__scroll {
        --spec-fill-h: calc(100vh - var(--spec-fill-offset, 420px));
    }

    /* The «Σε εξέλιξη» / «Δεν είναι διαθέσιμη» notes read a cancel action inline on the right. */
    .reports-note__cancel {
        margin-left: auto;
        flex: none;
        background: none;
        border: 1px solid currentColor;
        color: inherit;
        font: inherit;
        font-size: var(--text-xs);
        padding: 3px 9px;
        cursor: pointer;
    }
}
