/* ProductDesigner — shared by the web app and the MAUI app. */
:root {
    --accent: #3f56a2;
    --ok: #2f8445;
    --danger: #ff6b6b;
    --muted: #a0a0a0;
    --line: #4a4a4a;
    --surface: #141414;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    background: #000;
    color: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

h2 { margin: 0 0 1.25rem; font-size: 1.5rem; }
h3 { margin: 0 0 1rem; font-size: 1.15rem; }

/* ---------- layout ---------- */
.site-header {
    padding: 1rem;
    text-align: center;
    background: var(--accent);
}
.site-header h1 { margin: 0; font-size: clamp(1.25rem, 3vw, 2rem); }
.site-header a { color: inherit; text-decoration: none; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* ---------- language selection ---------- */
.languages {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    justify-items: center;
}
.languages button {
    width: min(30vh, 40vw);
    aspect-ratio: 1;
    margin: 1rem 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #000;
    font-size: calc(min(30vh, 40vw) * .115);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform .15s ease;
}
.languages button:hover, .languages button:focus-visible { transform: scale(1.04); }
.languages button.current { outline: 4px solid var(--accent); outline-offset: 6px; }

/* ---------- plate preview ---------- */
.plate-wrap { container-type: inline-size; width: 100%; }

.plate {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4.5 / 1;
    padding: 0 3cqw;
    overflow: hidden;
    background: var(--plate-bg);
    color: var(--plate-fg);
    border: 1.4cqw ridge #c9c9c9;
    border-radius: 3.5cqw;
    transition: background-color .2s ease;
}
.plate--editing { cursor: text; }

.plate-text {
    display: flex;
    align-items: center;
    font-family: "Oswald", sans-serif;
    font-size: var(--text-size, 14cqw);
    line-height: 1;
    text-transform: uppercase;
    white-space: pre;
}
.plate-placeholder { opacity: .4; }

.glyphs { display: inline-flex; align-items: center; }
.glyph { display: inline-block; }
.glyph--space { width: .3em; }
.glyph--icon {
    width: 1em; /* overridden inline per icon, see StaticFiles.GlyphStyle */
    height: .82em;
    margin: 0 .05em;
    background: currentColor;
    -webkit-mask-position: center; -webkit-mask-size: contain; -webkit-mask-repeat: no-repeat;
    mask-position: center; mask-size: contain; mask-repeat: no-repeat;
}

.caret {
    display: inline-block;
    width: max(2px, .05em);
    height: .9em;
    margin: 0 -.025em;
    background: currentColor;
    animation: caret-blink 1.05s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

.counter {
    margin: .4rem 0 1rem;
    color: var(--muted);
    font-size: .85rem;
    text-align: right;
}
.counter--full { color: #f5c26b; }

.editor { outline: none; }
.options { margin-top: 1.5rem; }
.options .swatches { gap: .6rem; }

@media (min-width: 1000px) {
    .designer-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr);
        gap: 1.75rem;
        align-items: start;
    }
    .options { margin-top: 0; }
    .options .actions { margin-top: 1rem; }
    /* Keep the plate low enough that keyboard and options fit on a landscape tablet. */
    .plate-wrap { max-width: 100vh; margin: 0 auto; }
}

/* ---------- on-screen keyboard ---------- */
.keyboard {
    display: grid;
    gap: .45rem;
    padding: .75rem;
    border-radius: 14px;
    background: #111;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.kb-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: .45rem; }
.kb-icons { grid-template-columns: repeat(11, 1fr); margin-bottom: .35rem; }

.key {
    min-width: 0;
    height: clamp(44px, 6.5vw, 64px);
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: #2b2b2b;
    color: #fff;
    font-family: "Oswald", sans-serif;
    font-size: clamp(1.05rem, 2.6vw, 1.6rem);
    cursor: pointer;
    box-shadow: 0 2px 0 #000;
}
.key:active:not(:disabled) { background: #4a4a4a; transform: translateY(1px); box-shadow: none; }
.key:disabled { opacity: .35; cursor: default; }
.key--action { background: #3a3a3a; font-family: inherit; }
.key--space { grid-column: span 3; background: #3a3a3a; font-family: inherit; font-size: .95rem; }
.key--icon { display: grid; place-items: center; background: #fff; }
.key--icon:active:not(:disabled) { background: #d8d8d8; }
.icon-glyph {
    width: 70%;
    height: 70%;
    background: #000;
    -webkit-mask-position: center; -webkit-mask-size: contain; -webkit-mask-repeat: no-repeat;
    mask-position: center; mask-size: contain; mask-repeat: no-repeat;
}
@media (max-width: 600px) {
    .keyboard { padding: .4rem; gap: .3rem; }
    .kb-row { gap: .3rem; }
    .kb-icons { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- designer choices ---------- */
.field { margin-bottom: 1.5rem; }

.label {
    display: block;
    margin-bottom: .6rem;
    color: #cfcfcf;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.segmented { display: flex; gap: .5rem; max-width: 420px; }
.segmented button {
    flex: 1;
    padding: .8rem 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: #fff; border-color: #fff; color: #000; font-weight: 700; }

.swatches { display: flex; flex-wrap: wrap; gap: .7rem; }

.swatch {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid #666;
    border-radius: 50%;
    background: var(--c, #fff);
    cursor: pointer;
    transition: transform .12s ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"] { outline: 3px solid #fff; outline-offset: 3px; }


/* ---------- buttons ---------- */
.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 2rem;
}
.hint { margin-right: auto; color: var(--muted); }

.btn {
    display: inline-block;
    padding: .85rem 1.8rem;
    border: 0;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--ok); color: #fff; }
.btn-secondary { background: transparent; color: #fff; border: 1px solid var(--line); }

/* ---------- submit ---------- */
.submit-grid { display: grid; gap: 2rem; }
@media (min-width: 820px) {
    .submit-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.summary {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .5rem 1.25rem;
    margin: 1.5rem 0 0;
}
.summary dt { color: var(--muted); }
.summary dd { display: flex; align-items: center; gap: .5rem; margin: 0; }
.summary-text { font-family: "Oswald", sans-serif; text-transform: uppercase; letter-spacing: .03em; }

.dot {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 1px solid #777;
    border-radius: 50%;
    background: var(--c);
}

.input {
    width: 100%;
    padding: .75rem .9rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: #fff;
    font-size: 1rem;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.input.invalid { border-color: var(--danger); }
.error { margin-top: .35rem; color: var(--danger); font-size: .85rem; }

.alert {
    padding: .75rem 1rem;
    border: 1px solid var(--danger);
    border-radius: 10px;
    background: rgba(255, 107, 107, .12);
}

/* ---------- confirmation ---------- */
.confirm { text-align: center; padding-top: 2rem; }
.order-number { margin: 0 0 2rem; font-size: 2.2rem; font-weight: 700; letter-spacing: .06em; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- notices & small forms ---------- */
.narrow { max-width: 480px; margin: 0 auto; }
.notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.5rem;
    padding: .9rem 1.1rem;
    border-radius: 10px;
}
.notice--warn { border: 1px solid #f5a623; background: rgba(245, 166, 35, .12); }
.notice--ok { border: 1px solid var(--ok); background: rgba(47, 132, 69, .15); }
.input--code { font-size: 2rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.btn-small { padding: .5rem 1rem; font-size: .9rem; }

/* ---------- admin ---------- */
.admin-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    padding: .75rem 1rem;
    background: var(--accent);
}
.admin-brand { font-size: 1.2rem; }
.admin-nav { display: flex; gap: .5rem; }
.admin-nav a { padding: .45rem .9rem; border-radius: 999px; color: #fff; text-decoration: none; }
.admin-nav a.active { background: rgba(255, 255, 255, .2); font-weight: 700; }
.admin-tools { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.lang-chip {
    padding: .3rem .55rem;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font-size: .8rem;
    cursor: pointer;
}
.lang-chip[aria-pressed="true"] { background: #fff; color: #000; }
.admin-tools .btn-secondary { margin-left: .5rem; border-color: rgba(255, 255, 255, .5); }
.admin-main { padding: 1rem; }

.board-bar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.board-bar h2 { margin: 0; }
.live { padding: .25rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.live--on { background: rgba(47, 132, 69, .25); color: #7fd896; }
.live--off { background: rgba(255, 107, 107, .2); color: var(--danger); }

.board { display: grid; grid-template-columns: repeat(var(--columns, 4), minmax(0, 1fr)); gap: .75rem; align-items: start; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } }
.board-column { min-width: 0; padding: .6rem; border-radius: 12px; background: #111; }
.board-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 .6rem;
    padding: .2rem .2rem .5rem;
    border-bottom: 3px solid var(--status);
    font-size: 1rem;
}
.count { padding: .1rem .5rem; border-radius: 999px; background: #2b2b2b; font-size: .8rem; }
.board-empty { margin: .5rem .2rem; color: var(--muted); font-size: .9rem; }

.order-card {
    margin-bottom: .6rem;
    padding: .7rem;
    border: 1px solid #2c2c2c;
    border-radius: 10px;
    background: #1a1a1a;
}
.order-card--new { border-color: #f5c26b; box-shadow: 0 0 0 2px rgba(245, 194, 107, .35); animation: pulse 1.2s ease-in-out 3; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(245, 194, 107, .15); } }
.order-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.order-number { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.order-meta { color: var(--muted); font-size: .8rem; }
.order-colors, .order-readable, .order-customer { margin: .5rem 0 0; font-size: .85rem; }
.order-colors { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; color: #ccc; }
.order-readable { font-family: ui-monospace, Consolas, monospace; color: #ddd; word-break: break-all; }
.order-customer { color: #bbb; word-break: break-word; }
.order-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; margin-top: .7rem; }
.order-actions .btn-primary { margin-left: auto; background: var(--btn, var(--ok)); }

.pair-box { margin-bottom: 2rem; padding: 1.5rem; border-radius: 12px; background: #111; text-align: center; }
.pair-code { font-size: clamp(3rem, 10vw, 5rem); font-weight: 800; letter-spacing: .15em; font-variant-numeric: tabular-nums; }

.devices { width: 100%; border-collapse: collapse; }
.devices th, .devices td { padding: .6rem .5rem; border-bottom: 1px solid #2a2a2a; text-align: left; }
.devices th { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; }
.devices td:last-child { text-align: right; }
