/* Ventor UI — everything here references MudBlazor palette variables so both themes stay in sync.
   Colours live in Theme/VentorTheme.cs; this file is layout, type utilities and a few components. */

:root {
    --v-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --v-radius: 10px;
    --v-radius-sm: 6px;
    --v-bottom-nav: 64px;
}

html, body { height: 100%; }
body { background: var(--mud-palette-background); color: var(--mud-palette-text-primary); }

/* ---- type utilities ---- */
.mono { font-family: var(--v-mono); font-size: 0.875em; letter-spacing: 0.01em; }
.mono input, .mono textarea, .mono .mud-input-slot { font-family: var(--v-mono) !important; letter-spacing: 0.02em; }
.muted { color: var(--mud-palette-text-secondary); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---- page scaffolding ---- */
.v-page { max-width: 1120px; margin: 0 auto; }
.v-page-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
.v-page-header .v-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.v-page-header .v-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.v-section { margin-bottom: 16px; }
.v-section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

/* Outlined cards, no drop shadows. */
.v-card { background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-lines-default); border-radius: var(--v-radius); }
.v-card-pad { padding: 16px; }
@media (max-width: 600px) { .v-card-pad { padding: 12px; } }

/* ---- VentorId chip: the human-facing ID, always monospace, always the accent ---- */
.v-id {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--v-mono); font-weight: 600; font-size: 0.8125rem; letter-spacing: 0.04em;
    padding: 2px 8px; border-radius: 999px;
    color: var(--mud-palette-primary); background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 35%, transparent);
    white-space: nowrap;
}
.v-id.v-id-container { color: var(--mud-palette-secondary); background: color-mix(in srgb, var(--mud-palette-secondary) 12%, transparent); border-color: color-mix(in srgb, var(--mud-palette-secondary) 35%, transparent); }
.v-id button { all: unset; cursor: pointer; display: inline-flex; line-height: 0; }

/* ---- item / container cards ---- */
.v-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.v-tile {
    display: flex; gap: 12px; align-items: stretch; padding: 10px; text-decoration: none; color: inherit;
    background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-lines-default); border-radius: var(--v-radius);
    transition: border-color .15s ease, background-color .15s ease; cursor: pointer; min-width: 0;
}
.v-tile:hover, .v-tile:focus-visible { border-color: var(--mud-palette-primary); background: var(--mud-palette-table-hover); outline: none; }
.v-tile.v-tile-container:hover, .v-tile.v-tile-container:focus-visible { border-color: var(--mud-palette-secondary); }
.v-thumb {
    flex: 0 0 64px; width: 64px; height: 64px; border-radius: var(--v-radius-sm);
    background-color: var(--mud-palette-background-gray); background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center; color: var(--mud-palette-text-disabled);
}
.v-thumb.v-thumb-lg { flex-basis: 96px; width: 96px; height: 96px; }
.v-tile-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; justify-content: center; }
.v-tile-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }

/* ---- photo gallery ---- */
.v-hero-image {
    width: 100%; height: min(52vh, 420px); border-radius: var(--v-radius-sm);
    background: var(--mud-palette-background-gray) center / contain no-repeat;
}
.v-thumb-strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 2px; }
.v-thumb-strip .v-thumb { cursor: pointer; border: 2px solid transparent; }
.v-thumb-strip .v-thumb.selected { border-color: var(--mud-palette-primary); }

/* ---- sticky action bar on editors ---- */
.v-sticky-actions {
    position: sticky; bottom: 0; z-index: 5; margin-top: 16px;
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    padding: 10px 12px; background: color-mix(in srgb, var(--mud-palette-surface) 92%, transparent);
    backdrop-filter: blur(8px); border: 1px solid var(--mud-palette-lines-default); border-radius: var(--v-radius);
}
@media (max-width: 959px) { .v-sticky-actions { bottom: calc(var(--v-bottom-nav) + 8px); } }

/* ---- identifier / property rows ---- */
.v-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--mud-palette-divider-light); }
.v-row:last-child { border-bottom: 0; }
.v-row-label { flex: 0 0 120px; font-weight: 600; font-size: 0.8125rem; color: var(--mud-palette-text-secondary); }
.v-row-field { flex: 1; min-width: 0; }
.v-row-tools { display: flex; gap: 2px; flex-shrink: 0; }
@media (max-width: 600px) { .v-row { flex-wrap: wrap; } .v-row-label { flex-basis: 100%; } }

/* ---- bottom navigation (phones) ---- */
.v-bottom-nav {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; height: var(--v-bottom-nav); z-index: 1200;
    background: var(--mud-palette-appbar-background); border-top: 1px solid var(--mud-palette-lines-default);
    padding-bottom: env(safe-area-inset-bottom);
}
.v-bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--mud-palette-text-secondary); text-decoration: none; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
}
.v-bottom-nav a.active { color: var(--mud-palette-primary); }
.v-bottom-nav a .mud-icon-root { font-size: 24px; }
@media (max-width: 959px) {
    .v-bottom-nav { display: flex; }
    .v-main-pad { padding-bottom: calc(var(--v-bottom-nav) + 16px) !important; }
    .v-desktop-only { display: none !important; }
}
@media (min-width: 960px) { .v-mobile-only { display: none !important; } }

/* ---- global search in the app bar ---- */
.v-appbar-search { max-width: 420px; width: 100%; }
.v-appbar-search .mud-input-root { background: var(--mud-palette-background-gray); border-radius: 999px; }

/* ---- quick-start panel for new items ---- */
.v-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.v-quick-option {
    display: flex; flex-direction: column; gap: 6px; padding: 16px; text-align: left;
    border: 1px solid var(--mud-palette-lines-default); border-radius: var(--v-radius); background: var(--mud-palette-surface);
    cursor: pointer; color: inherit; font: inherit;
}
.v-quick-option:hover:not(:disabled), .v-quick-option:focus-visible { border-color: var(--mud-palette-primary); outline: none; }
.v-quick-option:disabled { opacity: .55; cursor: not-allowed; }
.v-quick-option .mud-icon-root { font-size: 28px; color: var(--mud-palette-primary); }

/* ---- scanner overlay ---- */
.v-scanner video { width: 100%; max-height: 60vh; border-radius: var(--v-radius-sm); background: #000; }

/* ---- misc ---- */
.v-empty { padding: 32px 16px; text-align: center; color: var(--mud-palette-text-secondary); }
.v-empty .mud-icon-root { font-size: 40px; opacity: .5; margin-bottom: 8px; }
.v-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.v-kpi { padding: 14px 16px; }
.v-kpi .v-kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.v-kpi .v-kpi-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mud-palette-text-secondary); }
.v-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 0.8125rem; color: var(--mud-palette-text-secondary); }
.v-breadcrumb a { color: inherit; text-decoration: none; }
.v-breadcrumb a:hover { color: var(--mud-palette-secondary); text-decoration: underline; }
.v-printer-btn { position: fixed; left: 12px; bottom: 12px; z-index: 1210; }
@media (max-width: 959px) { .v-printer-btn { bottom: calc(var(--v-bottom-nav) + 12px); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* In-app update banner (native app) */
.v-update-banner {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 14px;
    border: 1px solid var(--mud-palette-primary); border-radius: 12px;
    background: var(--mud-palette-surface);
    background: color-mix(in srgb, var(--mud-palette-primary) 9%, var(--mud-palette-surface));
}

/* Check-out loans (Properties card) */
.v-loan { border: 1px solid var(--mud-palette-lines-default); border-radius: 10px; padding: 8px 10px; }
.v-loan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 10px; align-items: start; }

/* Sign-in screen */
.v-login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--mud-palette-background); }
.v-login-card { width: min(420px, 100%); padding: 28px; }
.v-login-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.5rem; letter-spacing: -0.01em; margin-bottom: 18px; }

/* People */
.v-person .v-contact-link { color: var(--mud-palette-secondary); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }

/* Public item links */
.v-share-link { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--mud-palette-divider-light); }
.v-share-link:last-of-type { border-bottom: 0; }
.v-recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; padding: 10px 12px; border: 1px dashed var(--mud-palette-lines-default); border-radius: 10px; font-size: 1rem; }
.v-public { min-height: 100vh; background: var(--mud-palette-background); color: var(--mud-palette-text-primary); }
.v-public-page { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; }
.v-public-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.125rem; margin-bottom: 14px; }
.v-public-gallery { margin-bottom: 16px; }
.v-public-gallery > a > img { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: var(--mud-palette-background-gray); }
.v-public-thumbs { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.v-public-thumbs button { border: 2px solid transparent; border-radius: 8px; padding: 0; background: none; cursor: pointer; flex: 0 0 auto; }
.v-public-thumbs button.selected { border-color: var(--mud-palette-primary); }
.v-public-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; display: block; }
.v-public-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.v-public-table th { text-align: left; font-weight: 600; color: var(--mud-palette-text-secondary); padding: 6px 12px 6px 0; width: 38%; vertical-align: top; }
.v-public-table td { padding: 6px 0; border-bottom: 1px solid var(--mud-palette-divider-light); }
.v-public-table tr:last-child td { border-bottom: 0; }

/* Account page */
.v-avatar-link { display: inline-flex; border-radius: 50%; text-decoration: none; }
.v-avatar-link:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }
.v-swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.v-swatch.selected { border-color: var(--mud-palette-text-primary); }
.v-swatch:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }

/* Save / upload status (sticky bar and photo card) */
.v-sticky-status, .v-upload-status { flex-basis: 100%; display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--mud-palette-text-secondary); }
.v-upload-status { margin: 6px 0 10px; }

/* Find photos online */
.v-found-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.v-found { position: relative; border: 2px solid var(--mud-palette-lines-default); border-radius: 10px; padding: 0; background: var(--mud-palette-background-gray); cursor: pointer; overflow: hidden; aspect-ratio: 1; }
.v-found img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v-found.selected { border-color: var(--mud-palette-primary); }
.v-found-check { position: absolute; top: 6px; right: 6px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.v-found.selected .v-found-check { color: var(--mud-palette-primary); }
.v-found-badge { position: absolute; left: 0; right: 0; bottom: 0; font-size: .6875rem; font-weight: 600; padding: 3px 6px; background: rgba(0,0,0,.55); color: #fff; text-align: left; }
.v-loan-returning { display: flex; align-items: center; gap: 8px; border-style: dashed; }

/* New item: gather photos + notes, then create with the assistant */
.v-step { padding: 12px 0; border-top: 1px solid var(--mud-palette-divider-light); }
.v-step-label { font-weight: 600; font-size: .9375rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.v-step-no { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--mud-palette-primary); color: #fff; font-size: .75rem; font-weight: 700; }
.v-pending-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.v-pending-thumb { position: relative; width: 88px; height: 88px; border-radius: 10px; overflow: hidden; border: 1px solid var(--mud-palette-lines-default); background: var(--mud-palette-background-gray); }
.v-pending-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v-pending-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }

/* Clickable history rows */
.v-tx-row { cursor: pointer; border-radius: 8px; transition: background .12s; }
.v-tx-row:hover, .v-tx-row:focus-visible { background: var(--mud-palette-action-default-hover); outline: none; }
.v-link { color: var(--mud-palette-primary); text-decoration: none; }

/* --- Background photo-search pills (bottom right) --- */
.v-jobs { position: fixed; right: 14px; bottom: 14px; z-index: 1250; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
@media (max-width: 959.98px) { .v-jobs { bottom: 82px; } }
.v-job { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-lines-default); box-shadow: 0 4px 14px rgba(0, 0, 0, .22); cursor: pointer; font-size: .8125rem; color: var(--mud-palette-text-primary); }
.v-job b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(200px, 52vw); }
.v-job.done { border-color: var(--mud-palette-success); }
.v-job.failed { border-color: var(--mud-palette-error); }
.v-job .v-job-x { margin: -4px -8px -4px -2px; }

/* --- Scanner: aiming box, sweep line, hit flash --- */
.v-scan-stage { position: relative; border-radius: 10px; overflow: hidden; background: #000; }
.v-scan-stage video { display: block; width: 100%; max-height: 60vh; object-fit: cover; }
.v-scan-mask { position: absolute; inset: 0; pointer-events: none; }
.v-scan-box { position: absolute; left: 50%; top: 50%; width: min(74%, 340px); aspect-ratio: 1.55; transform: translate(-50%, -50%); border-radius: 12px; box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .45); }
.v-scan-box::before, .v-scan-box::after, .v-scan-box .c::before, .v-scan-box .c::after { content: ""; position: absolute; width: 26px; height: 26px; border: 3px solid var(--mud-palette-primary); }
.v-scan-box::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.v-scan-box::after { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.v-scan-box .c::before { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.v-scan-box .c::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.v-scan-line { position: absolute; left: 7%; right: 7%; top: 12%; height: 2px; background: var(--mud-palette-primary); opacity: .85; border-radius: 2px; box-shadow: 0 0 8px var(--mud-palette-primary); animation: v-scan-sweep 2.2s ease-in-out infinite; }
@keyframes v-scan-sweep { 0%, 100% { top: 12%; } 50% { top: 84%; } }
.v-scan-hit .v-scan-box::before, .v-scan-hit .v-scan-box::after, .v-scan-hit .v-scan-box .c::before, .v-scan-hit .v-scan-box .c::after { border-color: var(--mud-palette-success); }
.v-scan-hit .v-scan-line { display: none; }
@media (prefers-reduced-motion: reduce) { .v-scan-line { animation: none; } }

/* Tappable pick-a-person rows (TransferDialog) - a radio list without a popover/select,
   because a select's focused input makes phones zoom/resize and throw the dialog around. */
.v-pick-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin-bottom: 6px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px; cursor: pointer; user-select: none;
}
.v-pick-row:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 1px; }
.v-pick-row-on { border-color: var(--mud-palette-primary); background: rgba(var(--mud-palette-primary-rgb), .08); }

/* Clickable header of a collapsible card section (Stock & pricing on the item page). */
.v-collapse-head { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 28px; flex-wrap: wrap; }
.v-collapse-head:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; border-radius: 6px; }

/* Theme section on Settings: tappable colour swatches. */
.v-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.v-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--mud-palette-lines-inputs); cursor: pointer; padding: 0; }
.v-swatch-on { outline: 2px solid var(--mud-palette-text-primary); outline-offset: 2px; border-color: transparent; }
.v-swatch:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }
.v-swatch-hex { max-width: 130px; }

/* Label editor full-screen mode: covers the app (above app bar / bottom nav, below popovers at 1200
   and dialogs at 1400, so selects and the test-print dialog still appear on top). */
.v-editor-full { position: fixed; inset: 0; z-index: 1150; background: var(--mud-palette-background); overflow: auto; padding: 12px 12px 24px; }

/* While the label editor is full screen, the app chrome leaves entirely - the MudBlazor app bar
   lives at z-index 1300 (above the editor's 1150, which stays below popovers at 1200 so the
   editor's own dropdowns keep working). Hiding chrome beats a z-index arms race. */
body.v-full-open .mud-appbar,
body.v-full-open .v-bottom-nav,
body.v-full-open .v-printer-btn { display: none; }
body.v-full-open .v-main-pad { padding-bottom: 0 !important; }

/* Full screen is about the CANVAS: it takes the whole screen (landscape included), the panels are
   opt-in, and zoom magnifies the label so half-millimetre placement is a comfortable drag. */
.v-editor-full { display: flex; flex-direction: column; overflow: hidden; padding: 8px 8px 4px; }
.v-editor-full > .mud-grid { flex: 1; min-height: 0; margin: 0; width: 100%; flex-direction: column; flex-wrap: nowrap; }
.v-editor-full .v-ed-canvas { order: -1; flex: 1; min-height: 0; padding: 4px !important; display: flex; }
.v-editor-full .v-canvas-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.v-editor-full .v-canvas-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.v-editor-full.v-panels-off .v-ed-left,
.v-editor-full.v-panels-off .v-ed-right { display: none; }
.v-editor-full .v-ed-left, .v-editor-full .v-ed-right { max-height: 42vh; overflow-y: auto; padding: 4px !important; }
@media (min-width: 960px) {
    .v-editor-full > .mud-grid { flex-direction: row; flex-wrap: wrap; }
    .v-editor-full .v-ed-canvas { order: 0; }
}

/* Zoom stepper + nudge pad in the full-screen toolbar. */
.v-zoom { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 8px; padding: 0 2px; }
.v-zoom-val { min-width: 52px; background: none; border: 0; color: inherit; font: inherit; font-size: .8125rem; cursor: pointer; padding: 4px 2px; }
/* Page canvas is a preview you tap to edit; nothing here captures a swipe, so the page scrolls. */
.v-canvas-tapzone { position: absolute; inset: 0; width: 100%; height: 100%; background: none; border: 0; padding: 0; cursor: zoom-in; display: flex; align-items: flex-end; justify-content: flex-end; }
.v-canvas-tapchip { display: inline-flex; align-items: center; gap: 4px; margin: 6px; padding: 3px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: rgba(0,0,0,.55); color: #fff; }
.v-canvas-tapzone:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }

/* On a phone the canvas leads and the elements list sits right under it. */
@media (max-width: 959px) { .v-ed-canvas { order: -1; } }

.v-nudge { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: -4px 0 6px; padding: 4px 6px; border-radius: 8px; background: var(--mud-palette-background-gray); }

/* Tap-to-rename title (label editor). */
.v-title-tap { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border-radius: 8px; padding: 2px 6px; margin-left: -6px; min-width: 0; }
.v-title-tap:hover { background: var(--mud-palette-action-default-hover); }
.v-title-tap:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 1px; }
.v-title-edit { max-width: 320px; }
