/* Stock module stylesheet (loaded by App.razor).
   1. Catalogue picker card grid (CatalogueImportWizardModal), on design-system tokens.
   2. Print rules for count sheets, spec sheets and send sheets (functional; keep).
   The pre-redesign .stock-*-modal aliases were removed on 2026-10-08 once no Razor file used them. */

/* Catalogue picker (CatalogueImportWizardModal) */
.stock-catalogue-picker { display: flex; flex-direction: column; gap: 12px; }
.stock-catalogue-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.stock-catalogue-search { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--ui-r-pill); border: 1.5px solid var(--ui-line); background: var(--ui-surface-2); color: var(--ui-muted); width: 340px; max-width: 100%; }
.stock-catalogue-search > i { color: var(--ui-muted); }
.stock-catalogue-search .form-control { border: 0; background: transparent; min-height: 0; line-height: 1.5; padding: 0; }
.stock-catalogue-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stock-catalogue-meta { font-size: 13px; color: var(--ui-muted); }
.stock-catalogue-meta strong { color: var(--ui-ink); }
.stock-catalogue-selected { font-size: 13px; font-weight: 600; color: var(--ui-green-deep); }
.stock-catalogue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.stock-catalogue-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--ui-line-2); border-radius: var(--ui-r-inner); background: var(--ui-surface); text-align: left; cursor: pointer; font: 500 13px var(--ui-font); color: var(--ui-ink); }
.stock-catalogue-card:hover:not(:disabled):not(.is-added):not(.stock-catalogue-card-static) { border-color: var(--ui-mint); }
.stock-catalogue-card-static { cursor: default; }
.stock-catalogue-card:focus-visible { outline: 3px solid rgba(var(--bs-primary-rgb), .25); outline-offset: 2px; }
.stock-catalogue-card.is-selected { border-color: var(--ui-green); background: var(--ui-green-wash-2); }
.stock-catalogue-card.is-added { opacity: .6; cursor: default; background: var(--ui-panel); }
.stock-catalogue-check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--ui-line-hover); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--ui-on-fill); }
.stock-catalogue-card.is-selected .stock-catalogue-check { background: var(--ui-green-fill); border-color: var(--ui-green); }
.stock-catalogue-card.is-added .stock-catalogue-check { background: var(--ui-line-hover); border-color: var(--ui-line-hover); }
.stock-catalogue-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-catalogue-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: var(--ui-r-pill); background: var(--ui-nu-bg); color: var(--ui-nu); }
.stock-catalogue-empty { padding: 28px; border-radius: var(--ui-r-box); border: 1.5px dashed var(--ui-dash); text-align: center; color: var(--ui-muted); font-size: 13px; }
.stock-catalogue-empty > i { display: block; margin-bottom: 8px; color: var(--ui-muted-3); }
.stock-catalogue-pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; font-size: 13px; color: var(--ui-muted); }
.stock-catalogue-page-info strong { color: var(--ui-ink); }
@media (max-width: 575.98px) { .stock-catalogue-grid { grid-template-columns: 1fr; } }

.stock-print-region {
    display: none;
}

@media print {
    /* Hide the whole app, then reveal only the sheet and its descendants. :where() keeps this at zero
       specificity so the reveal rule below still wins. */
    :where(body:has(.stock-count-print-root, .stock-spec-print-root, .stock-print-region)) * {
        visibility: hidden;
    }

    .stock-count-print-root,
    .stock-count-print-root *,
    .stock-spec-print-root,
    .stock-spec-print-root *,
    .stock-print-region,
    .stock-print-region * {
        visibility: visible;
    }

    /*
     * The sheet is absolutely positioned so the (still space-occupying) hidden app chrome doesn't push it down
     * the page. Absolute resolves against the nearest *positioned* ancestor, and the OneUI shell wrappers around
     * the page content are positioned (e.g. .block is position:relative), which would anchor the sheet below the
     * header instead of at the page origin. Flatten that ancestor chain to static so the containing block becomes
     * the page itself and top/left:0 lands at the top-left corner.
     */
    body:has(.stock-count-print-root, .stock-spec-print-root, .stock-print-region) :is(
        #page-container,
        #main-container,
        #content_data_page,
        .content,
        .stock-workspace,
        .stock-shell,
        .stock-shell-content) {
        position: static !important;
    }

    /* Page margins for the stock sheets only; a bare @page would change the margins of every printout. */
    body:has(.stock-count-print-root, .stock-spec-print-root, .stock-print-region) {
        page: stock-sheet;
    }

    .stock-count-print-root {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0 4mm;
        color: #000;
        font-size: 11pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Printable supplier order sheet (Ordering.razor "Ready to send" — Print / PDF). The sheet's on-screen look
     * lives in OrderingOrderSheet.razor.css; here we only lift it to the page origin and force clean black-on-white ink. */
    .stock-print-region {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0 6mm;
        color: #000;
        font-size: 11pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .stock-print-region .stock-send-sheet-table {
        width: 100%;
        border-collapse: collapse;
        margin: 4mm 0;
    }

    .stock-print-region .stock-send-sheet-table th,
    .stock-print-region .stock-send-sheet-table td {
        border: 0.5pt solid #000;
        padding: 1.5mm 2mm;
        color: #000;
    }

    .stock-print-region .stock-send-sheet-table thead th {
        background: #eee;
    }

    /* Printable chef spec sheet (station card) — mirrors the on-paper count-sheet approach. */
    .stock-spec-print-root {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0 4mm;
        color: #000;
        font-size: 11pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .stock-spec-print-root .ssp-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12mm;
        padding-bottom: 3mm;
        margin-bottom: 4mm;
        border-bottom: 1.5pt solid #000;
    }

    .stock-spec-print-root h1 {
        margin: 0;
        font-size: 17pt;
        font-weight: 700;
    }

    .stock-spec-print-root .ssp-sub {
        margin: 1mm 0 0;
        font-size: 11pt;
    }

    .stock-spec-print-root .ssp-meta {
        min-width: 52mm;
        font-size: 10pt;
    }

    .stock-spec-print-root .ssp-meta > div {
        display: flex;
        justify-content: space-between;
        gap: 4mm;
        margin-bottom: 1mm;
    }

    .stock-spec-print-root .ssp-meta span {
        color: #333;
    }

    .stock-spec-print-root h2 {
        margin: 4mm 0 1.5mm;
        font-size: 12pt;
        font-weight: 700;
        border-bottom: 0.75pt solid #666;
        padding-bottom: 1mm;
        break-after: avoid;
        page-break-after: avoid;
    }

    .stock-spec-print-root ul,
    .stock-spec-print-root ol {
        margin: 0 0 3mm;
        padding-left: 6mm;
    }

    .stock-spec-print-root li {
        margin-bottom: 1.5mm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .stock-spec-print-root .ssp-step-meta {
        color: #555;
        font-size: 9.5pt;
    }

    .stock-spec-print-root .ssp-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 3mm;
    }

    .stock-spec-print-root .ssp-table th,
    .stock-spec-print-root .ssp-table td {
        border: 0.5pt solid #999;
        padding: 1.5mm 2mm;
        text-align: left;
        vertical-align: top;
        font-size: 10pt;
    }

    .stock-spec-print-root .ssp-table thead th {
        background: #eee;
        text-transform: uppercase;
        font-size: 9pt;
        letter-spacing: 0.4pt;
    }

    .stock-spec-print-root p {
        margin: 0 0 3mm;
    }

    .stock-count-print-root .scps-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12mm;
        padding-bottom: 3mm;
        margin-bottom: 4mm;
        border-bottom: 1.5pt solid #000;
    }

    .stock-count-print-root .scps-title h1 {
        margin: 0;
        font-size: 16pt;
        font-weight: 700;
    }

    .stock-count-print-root .scps-sub {
        margin: 1mm 0 0;
        font-size: 12pt;
        font-weight: 600;
    }

    .stock-count-print-root .scps-meta {
        min-width: 62mm;
        font-size: 10pt;
    }

    .stock-count-print-root .scps-meta-row {
        display: flex;
        align-items: baseline;
        gap: 3mm;
        margin-bottom: 1.5mm;
    }

    .stock-count-print-root .scps-meta-row > span:first-child {
        flex: 0 0 22mm;
        color: #333;
    }

    .stock-count-print-root .scps-fill {
        flex: 1 1 auto;
        border-bottom: 0.75pt solid #000;
        min-height: 4mm;
    }

    .stock-count-print-root .scps-area {
        margin-bottom: 5mm;
        /* Keep an area's heading with at least the start of its table. */
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .stock-count-print-root .scps-area h2 {
        margin: 0 0 1.5mm;
        font-size: 12pt;
        font-weight: 700;
        border-bottom: 0.75pt solid #666;
        padding-bottom: 1mm;
    }

    .stock-count-print-root .scps-area-count {
        font-size: 9pt;
        font-weight: 400;
        color: #555;
        margin-left: 2mm;
    }

    .stock-count-print-root .scps-table {
        width: 100%;
        border-collapse: collapse;
    }

    .stock-count-print-root .scps-table th,
    .stock-count-print-root .scps-table td {
        border: 0.5pt solid #999;
        padding: 1.5mm 2mm;
        text-align: left;
        vertical-align: middle;
    }

    .stock-count-print-root .scps-table thead th {
        font-size: 9pt;
        text-transform: uppercase;
        letter-spacing: 0.4pt;
        background: #eee;
    }

    .stock-count-print-root .scps-col-unit {
        width: 20mm;
    }

    .stock-count-print-root .scps-col-count {
        width: 32mm;
    }

    /* Rows can break across pages, but never split a single row. */
    .stock-count-print-root .scps-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .stock-count-print-root .scps-product-name {
        font-weight: 600;
    }

    .stock-count-print-root .scps-product-cat {
        display: block;
        font-size: 8.5pt;
        color: #555;
    }

    .stock-count-print-root .scps-unit {
        color: #333;
    }

    /* Empty write-in box for the counted quantity. */
    .stock-count-print-root .scps-box {
        height: 8mm;
    }

    .stock-count-print-root .scps-footer {
        margin-top: 4mm;
        padding-top: 2mm;
        border-top: 0.5pt solid #999;
        font-size: 8.5pt;
        color: #333;
    }

    /* "Where my stock is" report (Counts.razor) — extra columns/sections on top of the scps- sheet styles. */
    .stock-count-print-root .scps-col-total {
        width: 30mm;
    }

    .stock-count-print-root .scps-where-uncounted {
        margin-top: 5mm;
    }

    .stock-count-print-root .scps-where-uncounted-list {
        columns: 3;
        column-gap: 8mm;
        list-style: none;
        margin: 0;
        padding: 0;
        font-size: 9pt;
    }

    .stock-count-print-root .scps-where-uncounted-list li {
        break-inside: avoid;
        padding: 0.5mm 0;
    }

    @page stock-sheet {
        margin: 12mm;
    }
}

/* Print sheets are print-only: never draw them on screen (restored 2026-10-08, dropped in the re-skin). */
@media screen { .stock-count-print-root, .stock-spec-print-root { display: none; } }

/* On screen the printable count / spec sheets stay hidden; the @media print rules above show them. */
@media screen { .stock-count-print-root, .stock-spec-print-root { display: none; } }
