/* The companion app (app.html). Single column, no side menu, large touch targets. Colours are tokens, so dark mode - and
   customer colour themes later - only have to change the values here. */
:root {
    --nu-primary: #5e2bb8;
    --nu-primary-dark: #4a2192;
    --nu-accent: #5e2bb8;       /* icons and borders - needs to stand out against the page */
    --nu-bar: #5e2bb8;
    --nu-bg: #f4f2f8;
    --nu-surface: #ffffff;
    --nu-text: #2b2b33;
    --nu-muted: #6c757d;
    --nu-border: #dee2e6;
    --nu-press: #ece6f7;
    --nu-focus-bg: #fbf9ff;
    --bs-primary: #5e2bb8;
    --bs-primary-rgb: 94, 43, 184;
}

[data-bs-theme="dark"] {
    --nu-accent: #b79cf0;
    --nu-bar: #2a1a52;
    --nu-bg: #15131c;
    --nu-surface: #211e2b;
    --nu-text: #efecf5;
    --nu-muted: #a7a2b5;
    --nu-border: #393446;
    --nu-press: #2e2840;
    --nu-focus-bg: #2a2538;
    --bs-primary: #b79cf0;
    --bs-primary-rgb: 183, 156, 240;
}

/* min-height, not height: a body fixed to the screen's height would carry the sticky bars away once the page scrolled past it */
html { height: 100%; }
body { min-height: 100%; background: var(--nu-bg); color: var(--nu-text); overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }

.btn-primary { --bs-btn-bg: var(--nu-primary); --bs-btn-border-color: var(--nu-primary); --bs-btn-hover-bg: var(--nu-primary-dark); --bs-btn-hover-border-color: var(--nu-primary-dark); --bs-btn-active-bg: var(--nu-primary-dark); --bs-btn-active-border-color: var(--nu-primary-dark); --bs-btn-disabled-bg: var(--nu-primary); --bs-btn-disabled-border-color: var(--nu-primary); }
.btn-outline-primary { --bs-btn-color: var(--nu-accent); --bs-btn-border-color: var(--nu-accent); --bs-btn-hover-bg: var(--nu-press); --bs-btn-hover-color: var(--nu-accent); --bs-btn-hover-border-color: var(--nu-accent); --bs-btn-active-bg: var(--nu-primary); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--nu-primary); }

.nu-busy { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000; background: linear-gradient(90deg, transparent, #fff, transparent), var(--nu-primary); background-size: 40% 100%, 100% 100%; background-repeat: no-repeat; animation: nu-busy 1s linear infinite; }
@keyframes nu-busy { from { background-position: -40% 0, 0 0; } to { background-position: 140% 0, 0 0; } }

.nu-topbar { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; min-height: 60px; padding: env(safe-area-inset-top) 12px 0 4px; background: var(--nu-bar); color: #fff; }
.nu-back { width: 48px; height: 48px; flex: none; border: 0; background: none; color: inherit; font-size: 1.5rem; }
.nu-heading { flex: 1; min-width: 0; padding-left: 4px; }
.nu-title { font-size: 1.25rem; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nu-store { font-size: .85rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The main menu's header: logo on the left, who and where on the right */
.nu-topbar-home { min-height: 72px; padding-left: 16px; padding-right: 4px; background: var(--nu-surface); color: var(--nu-text); border-bottom: 2px solid var(--nu-accent); }
.nu-topbar-home .nu-heading { padding: 0 4px 0 12px; text-align: right; }
.nu-topbar-home .nu-title { font-size: 1.05rem; }
.nu-topbar-home .nu-store { color: var(--nu-muted); opacity: 1; }
.nu-topbar-home .nu-back { color: var(--nu-accent); }
.nu-top-logo { height: 36px; flex: none; }

.nu-screen { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }

.nu-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 280px) { .nu-tiles { grid-template-columns: minmax(0, 1fr); } }
.nu-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 124px; padding: 14px 8px; border: 1.5px solid var(--nu-accent); border-radius: 12px; background: var(--nu-surface); color: var(--nu-text); font-size: 1.05rem; font-weight: 600; line-height: 1.2; }
.nu-tile:active { background: var(--nu-press); }
.nu-tile .bi { font-size: 2.4rem; color: var(--nu-accent); line-height: 1; }
/* Only for real mice - on a touch screen a hover state sticks after the tap */
@media (hover: hover) {
    .nu-tile:hover { background: var(--nu-primary); border-color: var(--nu-primary); color: #fff; }
    .nu-tile:hover .bi { color: #fff; }
}

.nu-list { display: flex; flex-direction: column; gap: 8px; }
.nu-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 14px; border: 1px solid var(--nu-border); border-radius: 12px; background: var(--nu-surface); color: var(--nu-text); font-size: 1.05rem; text-align: left; }
.nu-row:active { background: var(--nu-press); }
.nu-row .bi { font-size: 1.5rem; color: var(--nu-accent); }
.nu-row span { display: flex; flex-direction: column; min-width: 0; }
.nu-row small { color: var(--nu-muted); }
.nu-row-active { border-color: var(--nu-accent); }

.nu-panel { padding: 16px; border: 1px solid var(--nu-border); border-radius: 12px; background: var(--nu-surface); }
.nu-footer { margin-top: 24px; }
.nu-version { margin-top: 10px; color: var(--nu-muted); font-size: .85rem; text-align: center; }
.nu-empty { padding: 48px 16px; color: var(--nu-muted); text-align: center; }
.nu-empty > .bi { display: block; margin-bottom: 8px; font-size: 3rem; color: var(--nu-accent); }

.nu-signin { max-width: 420px; margin: 0 auto; padding-top: 24px; }
.nu-logo { display: block; width: 200px; max-width: 70%; margin: 0 auto 28px; }

/* Make it obvious which box the next scan goes into */
input[data-scan]:focus { background: var(--nu-focus-bg); }
.form-control:focus, .form-check-input:focus { border-color: var(--nu-accent); box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .35); }

/* Scan-a-product screens */
.nu-hint { margin: 0 0 10px; color: var(--nu-muted); font-size: .9rem; }
.nu-hint-center { margin-top: 12px; text-align: center; }
.nu-more { padding: 8px 0 0; color: var(--nu-accent); text-decoration: none; }
/* The side margin and padding leave room for a box's focus glow, which a scrolling panel would otherwise clip */
#nuFindMore { max-height: 55vh; margin: 0 -8px; padding: 8px 8px 6px; overflow-y: auto; }
.nu-row .nu-row-qty { margin-left: auto; flex: none; align-items: flex-end; text-align: right; }
.nu-row-star { margin-left: auto; font-size: 1.1rem !important; color: #e0a800 !important; }
.nu-scanbar { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 900; margin: -16px -16px 12px; padding: 10px 16px; background: var(--nu-bg); border-bottom: 1px solid var(--nu-border); }
.nu-chip { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin-bottom: 8px; padding: 6px 12px; border: 1.5px solid var(--nu-accent); border-radius: 10px; background: var(--nu-surface); color: var(--nu-text); font-weight: 600; }
.nu-chip .bi { color: var(--nu-accent); }
.nu-chip-end { margin-left: auto; }
.nu-sheet { height: auto !important; max-height: 85vh; border-radius: 16px 16px 0 0; background: var(--nu-bg); }
.nu-product { display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 12px; border: 1px solid var(--nu-border); border-radius: 12px; background: var(--nu-surface); }
.nu-product-text { min-width: 0; }
.nu-product h2 { margin: 0 0 2px; font-size: 1.1rem; font-weight: 700; overflow-wrap: anywhere; }
.nu-product small { display: block; color: var(--nu-muted); }
.nu-thumb { position: relative; display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; flex: none; overflow: hidden; border-radius: 10px; background: var(--nu-press); color: var(--nu-accent); font-size: 2rem; }
.nu-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nu-thumb img:not([src]) { display: none; }
.nu-note { padding: 8px 12px; margin-bottom: 12px; border-radius: 10px; background: var(--nu-press); color: var(--nu-text); font-size: .9rem; }
.nu-tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.nu-tabs button { flex: none; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--nu-accent); border-radius: 22px; background: transparent; color: var(--nu-accent); font-weight: 600; }
.nu-tabs button.on { background: var(--nu-primary); border-color: var(--nu-primary); color: #fff; }
.nu-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nu-field { display: flex; flex-direction: column; grid-column: span 2; min-height: 64px; padding: 8px 12px; border: 1px solid var(--nu-border); border-radius: 10px; background: var(--nu-surface); color: var(--nu-text); }
.nu-field-edit { position: relative; padding-right: 34px; text-align: left; }
.nu-field-edit:active { background: var(--nu-press); }
.nu-field-edit > .bi { position: absolute; top: 10px; right: 10px; color: var(--nu-accent); }
.nu-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 3000; transform: translateX(-50%); padding: 10px 24px; border-radius: 24px; background: #198754; color: #fff; font-weight: 600; }
.nu-reasons { max-height: 60vh; overflow-y: auto; }
.nu-span { grid-column: span 2; }
.nu-barcode { flex-direction: row; align-items: center; gap: 8px; }
.nu-barcode > div { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.nu-barcode .btn { flex: none; width: 48px; height: 48px; }
.nu-image { position: relative; }
.nu-image .btn { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; }
.nu-location { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-weight: 600; color: var(--nu-accent); }
.nu-addone { margin: 10px 0 0; font-weight: 600; }
.nu-added { padding: 10px; margin-bottom: 12px; border-radius: 10px; background: #198754; color: #fff; font-size: 1.1rem; font-weight: 700; text-align: center; }
.nu-pad-display { min-height: 64px; padding: 8px 14px; margin-bottom: 8px; overflow: hidden; border: 1px solid var(--nu-border); border-radius: 10px; background: var(--nu-surface); color: var(--nu-text); font-size: 2.4rem; font-weight: 700; line-height: 1.3; text-align: right; white-space: nowrap; }
.nu-pad-fresh { color: var(--nu-muted); }
.nu-pad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.nu-key { min-height: 56px; border: 1.5px solid var(--nu-accent); border-radius: 10px; background: var(--nu-surface); color: var(--nu-text); font-size: 1.6rem; font-weight: 600; touch-action: manipulation; }
.nu-key:active { background: var(--nu-primary); color: #fff; }
.nu-key-alt { background: var(--nu-press); color: var(--nu-accent); }
.nu-field-half { grid-column: span 1; }
.nu-field small { color: var(--nu-muted); }
.nu-field span { font-size: 1.1rem; font-weight: 600; overflow-wrap: anywhere; }
.nu-field-qty span { font-size: 2rem; line-height: 1.15; }
.nu-images { display: grid; grid-column: span 2; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nu-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--nu-border); border-radius: 10px; background: var(--nu-press); }
.nu-accordion { --bs-accordion-bg: var(--nu-surface); --bs-accordion-active-bg: var(--nu-press); --bs-accordion-active-color: var(--nu-text); --bs-accordion-border-color: var(--nu-border); }
.nu-accordion .accordion-button { min-height: 56px; font-weight: 600; }

.nu-log { font-size: .95rem; }
.nu-log div { padding: 8px 0; border-top: 1px solid var(--nu-border); overflow-wrap: anywhere; }
.nu-log small { display: block; color: var(--nu-muted); }

.nu-camera-video { flex: 1; width: 100%; min-height: 0; object-fit: cover; }
.nu-camera-bar { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
