﻿/* PRINTERS (/settings/printing, hosted as /touch/printers in the café and
   /spa/settings/printing in the salon).

   Touch-first. The page is used standing at a counter with a printer in one hand,
   so every target here is at least 44px and every row that was a table cell is a
   block you can hit with a thumb. It replaces the dense MudPaper/MudSimpleTable
   layout the page shipped with, which was built for a mouse.

   HEAD-NEUTRAL BY CONSTRUCTION, AND ROAST-NEUTRAL WITH IT. Every colour here is
   either a token each head already declares (--ink, --muted, --accent,
   --accent-contrast, --success-accent) or a mix into one of them. Nothing is a
   literal, and there is deliberately no .theme-light block: because the surfaces
   are mixed into --ink, which each head re-declares per roast, the day palette
   falls out of the same rules the night one does. Keep it that way — a literal
   added above would need a twin below, and the twin is what gets forgotten.

   A library stylesheet rather than a .razor.css: scoped CSS from a referenced
   project never reaches these heads (see the notes in MapleCoffee's App.razor),
   so the heads link this from _content/SPC.Blazor/css/. */

.ps-page {
    max-width: 900px;
    /* Tells the touch page chrome how wide this column is, so the title reserves exactly
       the room the fixed Back/Home cluster needs (touch-page-chrome.css). */
    --tph-page-max: 900px;

    /* SURFACES, DERIVED FROM THE INK — not from --panel-border, and not from a
       white overlay with a .theme-light twin.

       --panel-border is 8% alpha. On the café's night roast that is a visible
       hairline; on the day roast it is 8% black on cream, which is nothing, and
       the first build of this page shipped fields that read as white blobs
       floating on a card with no edge at all.

       Mixing into --ink instead solves it once for both: --ink is near-white at
       night and near-black by day, so "16% of the ink" is a real edge either way
       and needs no second declaration. Same trick for the fills — a sunken field
       and a raised panel stay one step apart in whichever roast is on. */
    --ps-edge: color-mix(in srgb, var(--ink) 17%, transparent);
    --ps-edge-soft: color-mix(in srgb, var(--ink) 9%, transparent);
    --ps-sunken: color-mix(in srgb, var(--ink) 5%, transparent);
    --ps-raised: color-mix(in srgb, var(--ink) 2.5%, transparent);
}

/* A card head's copy sets its own measure. Left to the card width these run to
   90-odd characters and read as a wall. */
.ps-page .form-card-desc {
    max-width: 64ch;
}

/* Tighter than the shared default: this page is a stack of small controls, and
   form.css's 0.95rem rhythm was tuned for cards with two or three fields. */
.ps-page .form-card-body {
    gap: 0.8rem;
}

/* ── one print server ────────────────────────────────────────────────────────
   A card of its own, not a row. Three fields on one line was already tight on a
   laptop; on a tablet the name box was thumb-width. Stacked, each field gets a
   full-width target and the address — the thing that is actually mistyped — gets
   the most room. */
.ps-server {
    display: grid;
    gap: 0.6rem;
    padding: 0.85rem 0.95rem 0.95rem;
    border-radius: 0.9rem;
    border: 1px solid var(--ps-edge-soft);
    background: var(--ps-raised);
}

.ps-server + .ps-server {
    margin-top: 0.7rem;
}

.ps-server-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    /* The delete target is taller than the caption beside it, so the row's height
       is the button's. Pulling it up by the difference keeps the caption reading
       as a label on the fields below rather than as a band of its own. */
    margin-top: -0.15rem;
}

.ps-server-ord {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ps-fields {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
}

.ps-field {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.ps-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

/* 48px tall and 1rem text: the two numbers that decide whether this is usable on
   a tablet. 1rem also stops iOS zooming the page when the field takes focus. */
.ps-in {
    width: 100%;
    min-height: 48px;
    padding: 0 0.85rem;
    box-sizing: border-box;
    border-radius: 0.7rem;
    border: 1px solid var(--ps-edge);
    background: var(--ps-sunken);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
}

.ps-in::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.ps-in:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

select.ps-in {
    appearance: none;
    padding-right: 2.4rem;
    /* Chevron drawn from the ink token so it follows the roast. */
    background-image:
        linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position:
        calc(100% - 1.15rem) calc(50% + 2px),
        calc(100% - 0.8rem) calc(50% + 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

/* ── status line under a server ──────────────────────────────────────────── */
.ps-status {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.8rem;
    border-radius: 0.7rem;
    font-size: 0.9rem;
    line-height: 1.35;
    border: 1px solid var(--ps-edge-soft);
    background: var(--ps-sunken);
    color: var(--ink);
}

.ps-status .mud-icon-root {
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.ps-status.is-ok {
    color: var(--success-accent);
    border-color: color-mix(in srgb, var(--success-accent) 40%, transparent);
    background: color-mix(in srgb, var(--success-accent) 10%, transparent);
}

.ps-status.is-bad {
    color: var(--accent-strong, var(--accent));
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    background: color-mix(in srgb, var(--accent) 11%, transparent);
}

/* ── buttons ──────────────────────────────────────────────────────────────
   Plain buttons, never MudButton: app.css forces dark text onto MudButtons, which
   is unreadable on an espresso fill. */
.ps-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.ps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 48px;
    padding: 0 1.15rem;
    border-radius: 0.75rem;
    border: 1px solid var(--ps-edge);
    background: var(--ps-sunken);
    color: var(--ink);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.ps-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--ink) 9%, transparent);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.ps-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.ps-btn--accent {
    color: var(--accent-contrast);
    background: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 82%, black 18%);
}

.ps-btn--accent:hover:not(:disabled) {
    background: color-mix(in srgb, var(--accent) 88%, white 12%);
    border-color: color-mix(in srgb, var(--accent) 82%, black 18%);
}

/* Square, so the trash icon isn't a wide slab beside the fields. */
.ps-btn--icon {
    width: 44px;
    min-height: 44px;
    padding: 0;
    flex: 0 0 auto;
}

.ps-btn--sm {
    min-height: 44px;
    padding: 0 0.9rem;
    font-size: 0.9rem;
}

/* ── printers found ───────────────────────────────────────────────────────
   Was a five-column table. On a tablet the columns collapsed to one word each and
   the Test print button ended up the width of the word "TEST". Each printer is now
   its own block: what it is called, then its facts as a wrapped meta line, then a
   full-height button. */
.ps-printer {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--ps-edge-soft);
}

.ps-printer:first-child {
    padding-top: 0;
}

.ps-printer:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.ps-printer-body {
    flex: 1 1 16rem;
    min-width: 0;
}

.ps-printer-name {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    flex-wrap: wrap;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 700;
}

/* The station half of "counter/receipt" — present but not shouted, since the name
   after the slash is what an operator picks from the dropdowns. */
.ps-printer-station {
    color: var(--muted);
    font-weight: 500;
}

.ps-printer-meta {
    margin-top: 0.2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.35;
}

.ps-printer-warn {
    color: var(--accent-strong, var(--accent));
    font-weight: 600;
}

.ps-empty {
    padding: 0.9rem 1rem;
    border-radius: 0.7rem;
    border: 1px dashed var(--ps-edge);
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.ps-note {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

/* No .theme-light block. Every surface above mixes into --ink, which the head
   re-declares per roast, so the day palette falls out of the same rules — see the
   note on the tokens at the top. The one thing that still needs saying is that the
   accent fill must not pick up a wash: it is already a solid brand colour. */
.ps-btn--accent,
.theme-light .ps-btn--accent {
    background: var(--accent);
}

@media (max-width: 780px) {
    /* Address gets its own line before the name and key share one: it is the long
       value and the one that gets pasted in. */
    .ps-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ps-field--url {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .ps-fields {
        grid-template-columns: 1fr;
    }

    .ps-btn,
    .ps-actions > .ps-btn {
        flex: 1 1 100%;
    }

    .ps-btn--icon {
        flex: 0 0 48px;
    }

    .ps-printer > .ps-btn {
        width: 100%;
    }
}
