/* Outdoors, one hand, bright sun: high contrast, big targets, no decoration for its
   own sake. Everything below earns its place by making something easier to read at
   arm's length or easier to hit without looking. */
:root {
    /* Fallback behind the concrete texture, sampled from it so a slow image load
       does not flash a different colour */
    --paper: #A9B9C6;
    --surface: #FFFFFF;
    --surface-2: #F7F9FA;

    --ink: #14202A;
    --ink-2: #435765;
    --muted: #748894;
    --line: #E1E8EC;
    --line-strong: #CBD6DC;

    /* The Danbase green carries every positive and active state, so the app reads as
       one thing rather than a slate app with a green hover */
    --brand: #67a226;
    --brand-dark: #55871f;
    --brand-tint: #F1F7EA;
    --brand-line: #D3E5BC;

    --btn: #384046;
    --btn-hover: #67a226;
    --btn-ink: #FFFFFF;

    --stop: #A3302B;
    --stop-bg: #FBEBE9;
    --stop-line: #EFC9C5;
    --ok: #2C7350;
    --ok-bg: #E9F3EC;
    --wait: #8A5A0B;
    --wait-bg: #FDF3E0;
    --wait-line: #EFDCB4;

    --accent: #67a226;
    --accent-ink: #FFFFFF;

    /* Two shadows rather than one: a tight contact shadow to seat the element and a
       wide soft one for depth. A single mid shadow reads as a blur. */
    --lift: 0 1px 2px rgba(20, 32, 42, .08), 0 6px 20px -6px rgba(20, 32, 42, .18);
    --lift-sm: 0 1px 2px rgba(20, 32, 42, .10), 0 2px 6px -2px rgba(20, 32, 42, .12);

    --radius: 14px;
    --radius-sm: 9px;

    /* The system stack for everything the user has to read. It costs no download on a
       phone with one bar of signal, and it is the font their OS already renders best. */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Poppins stands in for the wordmark face: geometric, single storey 'a', circular
       bowls. Used only where type is large - body text stays on the system font,
       because a thin geometric face at 14px in sunlight is not readable. */
    --font-brand: "Poppins", var(--font);
}

/* Self hosted rather than pulled from Google: the app has to work on a forecourt with
   one bar of signal, and a third party request is one more thing to fail. Latin subset
   only, which still covers ae, oe and aa. Licence in wwwroot/fonts/OFL.txt. */
@font-face {
    font-family: "Poppins";
    src: url('../fonts/poppins-200-latin.woff2') format('woff2');
    font-weight: 200;
    font-style: normal;
    /* swap, not block: the header text shows immediately in the system font and
       reflows when Poppins lands, rather than being invisible while it loads */
    font-display: swap;
}

@font-face {
    font-family: "Poppins";
    src: url('../fonts/poppins-600-latin.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--paper) url('../img/bg-concrete.jpg') repeat;
    color: var(--ink);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

.boot { padding: 40px; color: var(--muted); }

.shell { min-height: 100dvh; display: flex; flex-direction: column; }

/* White, because the wordmark is near-black and would vanish on a coloured bar.
   The green rule underneath is what ties it to the rest of the app. */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 10px;
    padding: env(safe-area-inset-top, 0) 16px 0;
    height: calc(60px + env(safe-area-inset-top, 0px));
    background: var(--surface); color: var(--ink);
    border-bottom: 3px solid var(--brand);
    box-shadow: 0 2px 12px rgba(20, 33, 42, .16);
}
.logo { height: 30px; width: auto; display: block; flex: 0 0 auto; }

/* Takes the spacer role the wordmark used to have, so the chip and the log out
   icon stay pinned right */
/* ExtraLight with positive tracking, which is how the wordmark is drawn - a hairline
   geometric face set tight turns into a smear */
.appname {
    margin-right: auto; margin-left: 1px;
    font-family: var(--font-brand);
    font-size: 21px; font-weight: 200; letter-spacing: .012em;
    color: var(--ink); white-space: nowrap;
}

.chip {
    background: var(--brand-tint); color: var(--brand-dark);
    border: 1px solid var(--brand-line); border-radius: 999px;
    padding: 7px 15px; font-size: 15px; font-weight: 600;
    transition: background-color .12s ease;
}
@media (hover: hover) { .chip:hover { background: #E7F1D9; } }
.chip:active { background: #E7F1D9; }

.link-btn {
    background: none; border: 0; color: var(--ink-2); font-size: 15px;
    text-decoration: underline; text-underline-offset: 3px; padding: 8px;
}
.link-btn.danger { color: var(--stop); }

/* Square and 44px so it is still a thumb target with no label to widen it */
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; width: 44px; height: 44px; padding: 0;
    background: none; border: 1px solid transparent; border-radius: 10px;
    color: var(--ink-2);
    transition: background-color .12s ease, color .12s ease;
}
.icon-btn svg {
    width: 22px; height: 22px;
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); color: var(--ink); } }
.icon-btn:active { background: var(--surface-2); color: var(--ink); }
.icon-btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(103, 162, 38, .35); }

.content { flex: 1; padding: 18px 16px calc(28px + env(safe-area-inset-bottom, 0px)); }

/* Lifted off the texture rather than sitting flat on it */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px 20px; max-width: 640px; margin: 0 auto;
    box-shadow: var(--lift);
}

/* Headings carry the brand face, but at 600 rather than the wordmark's hairline -
   these are read outdoors, not admired on a letterhead */
h1 {
    font-family: var(--font-brand);
    font-size: 24px; line-height: 1.2; letter-spacing: -.012em;
    font-weight: 600; margin: 0 0 6px;
}
.muted { color: var(--muted); margin: 0 0 18px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 16px; }

/* Left bar rather than a full tint: the message stays readable in sun and the colour
   still registers peripherally */
.error, .success {
    padding: 12px 14px; border-radius: var(--radius-sm); margin: 14px 0;
    border: 1px solid transparent; border-left-width: 4px;
}
.error { background: var(--stop-bg); color: var(--stop); border-color: var(--stop-line); border-left-color: var(--stop); }
.success { background: var(--ok-bg); color: var(--ok); border-color: var(--brand-line); border-left-color: var(--ok); }

.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .search input {
    width: 100%; font-size: 17px; padding: 13px 14px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.field input::placeholder, .search input::placeholder { color: var(--muted); }
.field input:focus-visible, .search input:focus-visible {
    outline: 0; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(103, 162, 38, .22);
}

.check { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 50px; padding: 13px 20px; font-size: 17px; font-weight: 600;
    border: 1px solid var(--btn); border-radius: var(--radius-sm);
    background: var(--btn); color: var(--btn-ink);
    box-shadow: var(--lift-sm);
    transition: background-color .12s ease, border-color .12s ease, transform .06s ease;
}

/* Guarded, because on a touch screen :hover sticks after a tap until you tap
   somewhere else - a phone would otherwise leave the last button green */
@media (hover: hover) {
    .btn:hover:not(:disabled) { background: var(--btn-hover); border-color: var(--btn-hover); }
}
.btn:active:not(:disabled) {
    background: var(--btn-hover); border-color: var(--btn-hover);
    transform: translateY(1px);
}
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(103, 162, 38, .35), var(--lift-sm); }
.btn-block { display: flex; width: 100%; margin-top: 12px; }
.btn-small { min-height: 42px; padding: 9px 15px; font-size: 15px; border-radius: 8px; }
.btn:disabled { opacity: .5; box-shadow: none; }

/* Secondary: same footprint, quieter, so two buttons side by side still say which
   one is the one you want */
.btn-ghost {
    background: var(--surface); color: var(--ink); border-color: var(--line-strong);
    box-shadow: none;
}
@media (hover: hover) { .btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); color: var(--ink); } }
.btn-ghost:active:not(:disabled) { background: var(--surface-2); border-color: var(--muted); color: var(--ink); }

/* Outlined until touched, then solid: destructive enough to be unmistakable, quiet
   enough that it does not compete with Send on every row */
.btn-danger {
    background: var(--surface); color: var(--stop); border-color: var(--stop-line);
    box-shadow: none;
}
@media (hover: hover) { .btn-danger:hover:not(:disabled) { background: var(--stop); border-color: var(--stop); color: #FFF; } }
.btn-danger:active:not(:disabled) { background: var(--stop); border-color: var(--stop); color: #FFF; }
.btn-danger:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(163, 48, 43, .32); }

.choices { display: grid; gap: 12px; }

/* The chevron is the affordance: without it these read as panels rather than as
   something you tap */
.choice {
    position: relative;
    display: flex; flex-direction: column; gap: 4px; text-align: left;
    min-height: 96px; padding: 18px 46px 18px 20px;
    border: 1px solid var(--line-strong); border-left: 4px solid var(--brand);
    border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
    box-shadow: var(--lift-sm);
    transition: background-color .12s ease, border-color .12s ease, transform .06s ease;
}
.choice::after {
    content: ""; position: absolute; right: 20px; top: 50%;
    width: 10px; height: 10px; margin-top: -5px;
    border-right: 2.5px solid var(--muted); border-bottom: 2.5px solid var(--muted);
    transform: rotate(-45deg);
}
@media (hover: hover) { .choice:hover { background: var(--brand-tint); border-left-color: var(--brand-dark); } }
.choice:active { background: var(--brand-tint); transform: translateY(1px); }
.choice:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(103, 162, 38, .35), var(--lift-sm); }
.choice-title { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.choice-sub { color: var(--muted); font-size: 15px; }

.search { margin: 0 0 16px; }

.list { list-style: none; margin: 14px 0 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:last-child { border-bottom: 1px solid var(--line); }

.row {
    display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 68px; padding: 13px 0; background: none; border: 0;
    text-align: left; color: var(--ink);
    transition: background-color .12s ease;
}
@media (hover: hover) { .row:not(.static):hover { background: var(--surface-2); } }
.row:not(.static):active { background: var(--surface-2); }
.row.static { cursor: default; }
.row-main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.row-title { font-weight: 650; letter-spacing: -.01em; }
.row-sub { color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* Plate reads as an identifier, so give it the mono-ish treatment */
.row-plate {
    align-self: flex-start; font-size: 13px; font-weight: 700; letter-spacing: .06em;
    color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-strong);
    border-radius: 4px; padding: 2px 7px; margin: 1px 0;
    font-variant-numeric: tabular-nums;
}
.row-date { color: var(--muted); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Indented past the thumbnail so the buttons line up with the title rather than
   floating under the picture */
.row-actions {
    display: flex; gap: 8px; align-items: center;
    padding: 0 0 14px 76px;
}

/* The poster frame off the video. Black underneath so a slow load does not flash
   white, and 16:9 so it matches what was filmed. */
.row-thumb {
    flex: 0 0 auto; width: 64px; height: 40px; border-radius: 7px;
    object-fit: cover; background: #0B1116;
    border: 1px solid var(--line-strong); display: block;
}

/* Same footprint as the thumbnail on purpose: the row must not reflow when the
   poster appears part way through processing */
.row-media {
    flex: 0 0 auto; width: 64px; height: 40px; border-radius: 7px;
    background: var(--surface-2); border: 1px solid var(--line-strong);
    display: flex; align-items: center; justify-content: center;
}
.row-media::after {
    content: ""; width: 0; height: 0; margin-left: 3px;
    border-left: 11px solid var(--muted);
    border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
.row-media.ready { background: var(--brand-tint); border-color: var(--brand-line); }
.row-media.ready::after { border-left-color: var(--brand-dark); }
.row-media.bad { background: var(--stop-bg); border-color: var(--stop-line); }
.row-media.bad::after { border-left-color: var(--stop); }

/* Status as a pill rather than another grey clause in the subtitle: at a glance,
   colour and shape say whether the video can be sent yet */
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 13px; font-weight: 650; letter-spacing: .01em;
    padding: 2px 9px; border-radius: 999px; border: 1px solid transparent;
    white-space: nowrap;
}
.pill-wait { background: var(--wait-bg); color: var(--wait); border-color: var(--wait-line); }
.pill-bad { background: var(--stop-bg); color: var(--stop); border-color: var(--stop-line); }
.pill-ok { background: var(--brand-tint); color: var(--brand-dark); border-color: var(--brand-line); }

/* Turns "behandles" from a label into something visibly in progress, which is the
   difference between waiting and wondering whether it is stuck */
.pill-wait::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: currentColor; animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Nothing here yet should look deliberate rather than broken */
.empty { text-align: center; padding: 30px 20px; color: var(--muted); }
.empty-mark {
    width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 14px;
    background: var(--surface-2); border: 1px solid var(--line-strong);
    display: flex; align-items: center; justify-content: center;
}
.empty-mark::after {
    content: ""; width: 0; height: 0; margin-left: 4px;
    border-left: 14px solid var(--line-strong);
    border-top: 9px solid transparent; border-bottom: 9px solid transparent;
}

.capture {
    display: block; margin: 18px 0; border: 2px dashed var(--brand-line);
    border-radius: var(--radius); background: var(--brand-tint); text-align: center;
    padding: 36px 20px;
    transition: background-color .12s ease, border-color .12s ease;
}
@media (hover: hover) { .capture:hover { background: #E9F2DC; border-color: var(--brand); } }
.capture:active { background: #E9F2DC; border-color: var(--brand); }
.capture input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.capture-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.capture-title { font-size: 19px; font-weight: 650; color: var(--brand-dark); }

.picked { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 16px 0; overflow: hidden; }
.picked-row { display: flex; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.picked-row:nth-child(odd) { background: var(--surface-2); }
.picked-row:last-child { border-bottom: 0; }
.picked-row span { color: var(--muted); min-width: 84px; }
.picked-row b { font-weight: 650; }
.wrap { overflow-wrap: anywhere; }

.progress {
    height: 12px; background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 999px; overflow: hidden; margin: 18px 0 6px;
}
.progress-bar {
    height: 100%; background: var(--brand);
    transition: width .2s linear;
}

.preview { width: 100%; border-radius: var(--radius-sm); background: #000; margin: 0 0 14px; }
.preview.hidden { display: none; }

/* Recording state: unmistakable at arm's length in daylight */
.rec { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 15px; }
.rec-dot {
    width: 13px; height: 13px; border-radius: 50%; background: var(--stop);
    box-shadow: 0 0 0 4px rgba(163, 48, 43, .16);
    animation: recpulse 1.4s ease-in-out infinite;
}
.rec-time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; }
.rec-size { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
@keyframes recpulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

#blazor-error-ui {
    display: none; position: fixed; inset: auto 0 0 0; padding: 14px;
    background: var(--stop-bg); color: var(--stop); border-top: 3px solid var(--stop);
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .rec-dot, .pill-wait::before { animation: none; }
}
