/* What both hosts share: the colours, type and shapes everything else reads (a host's app.css
   changes them), the motion, the pieces both build their pages from, and the sign-in pages'
   frame. Served as _content/Taufu.AutoBonus.Shared.Web/css/autobonus.css. */

/* Barlow, after the lettering of road signs: page titles, panel titles and the points figures.
   Running text stays in the reader's own system face. The Latin subset only (fonts/OFL.txt). */
@font-face {
    font-family: "Barlow";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/barlow-500.woff2") format("woff2");
}

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

@font-face {
    font-family: "Barlow";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/barlow-700.woff2") format("woff2");
}

/* A cool grey ground, white panels on it, OSK's blue for what can be done and for the figures,
   and its amber for the one mark that says "Bonus". */
:root {
    --ab-brand: #0b4f8a;
    /* The brand as Bootstrap's rgba() needs it; change it with --ab-brand. */
    --ab-brand-rgb: 11, 79, 138;
    --ab-brand-ink: #ffffff;
    --ab-brand-deep: color-mix(in srgb, var(--ab-brand) 72%, black);
    --ab-brand-tint: color-mix(in srgb, var(--ab-brand) 8%, white);
    --ab-accent: #f2a900;
    --ab-accent-ink: #1d2733;
    --ab-ground: #f2f5f8;
    --ab-surface: #ffffff;
    /* The bands inside a panel: a table's headings, a pager. */
    --ab-surface-sunk: #f7f9fb;
    /* What a product picture sits on: white, as the pictures are shot. */
    --ab-picture: #ffffff;
    --ab-border: #dde3ea;
    /* The edge of something to type in, a shade firmer than a panel's. */
    --ab-border-strong: #c7d0da;
    --ab-ink: #17212c;
    --ab-muted: #5f6b78;
    --ab-plus: #18794e;
    --ab-minus: #b02a37;

    --ab-font-display: "Barlow", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --ab-font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;

    /* The shape of a panel and the weight of a page's title; the shop's are rounder and bolder. */
    --ab-panel-radius: 0.75rem;
    --ab-panel-padding: 1.25rem;
    --ab-title-weight: 600;
    --ab-radius-sm: 0.5rem;
    --ab-shadow-sm: 0 1px 2px rgba(16, 34, 52, 0.05);
    --ab-shadow-md: 0 8px 20px -8px rgba(16, 34, 52, 0.22);
    --ab-shadow-lg: 0 18px 44px -12px rgba(16, 34, 52, 0.3);

    /* Motion: short, and eased to settle rather than bounce. */
    --ab-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --ab-fast: 0.14s;
    --ab-slow: 0.26s;

    /* Bootstrap's primary is the brand wherever Bootstrap reads it from a variable: text-primary,
       text-bg-primary, links, btn-link, focus rings, the subtle tints. Where its compiled CSS
       holds its own blue instead (form controls, outline buttons), the rules below say so. */
    --bs-primary: var(--ab-brand);
    --bs-primary-rgb: var(--ab-brand-rgb);
    --bs-primary-text-emphasis: color-mix(in srgb, var(--ab-brand) 60%, black);
    --bs-primary-bg-subtle: color-mix(in srgb, var(--ab-brand) 12%, white);
    --bs-primary-border-subtle: color-mix(in srgb, var(--ab-brand) 35%, white);
    --bs-link-color: var(--ab-brand);
    --bs-link-color-rgb: var(--ab-brand-rgb);
    --bs-link-hover-color: color-mix(in srgb, var(--ab-brand) 80%, black);
    --bs-link-hover-color-rgb: var(--ab-brand-rgb);
    --bs-focus-ring-color: rgba(var(--ab-brand-rgb), 0.25);
    --bs-body-color: var(--ab-ink);
    --bs-body-font-family: var(--ab-font-body);
    /* What inputs, tables, menus and toasts are drawn on: white. The page's own grey is body's. */
    --bs-body-bg: var(--ab-surface);
    --bs-border-color: var(--ab-border);
    --bs-secondary-color: var(--ab-muted);
    --bs-tertiary-bg: var(--ab-surface-sunk);
    --bs-border-radius: 0.5rem;
    --bs-border-radius-sm: 0.375rem;
    --bs-border-radius-lg: 0.75rem;
    /* FreeTable's box: the panel's edge and corners, the headings on the sunk band. */
    --ft-box-border: var(--ab-border);
    --ft-box-radius: var(--ab-panel-radius);
    --ft-box-bg: var(--ab-surface);
    --ft-head-bg: var(--ab-surface-sunk);
}

body {
    background: var(--ab-ground);
    color: var(--ab-ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--ab-font-display);
    text-wrap: balance;
}

/* Bootstrap's grey, which its text-secondary class holds as a fixed colour, is the muted ink. */
.text-secondary {
    color: var(--ab-muted) !important;
}

/* --- Motion ------------------------------------------------------------------------------------ */

/* A page arriving: up a few pixels and in. Only the start is set, so a page at rest is plainly
   itself, and nothing waits on the animation to be seen. */
@keyframes ab-enter {
    from {
        opacity: 0;
        transform: translateY(0.375rem);
    }
}

/* Something opened on a page (a question, a form, an answer): down into place. */
@keyframes ab-reveal {
    from {
        opacity: 0;
        transform: translateY(-0.375rem);
    }
}

/* A count that changed (the cart's). */
@keyframes ab-pop {
    0% {
        transform: scale(0.6);
    }

    60% {
        transform: scale(1.18);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes ab-shimmer {
    from {
        background-position: 100% 0;
    }

    to {
        background-position: -100% 0;
    }
}

/* backwards, not both: once it has run, nothing of it stays on the element (a lasting transform
   would make it the box that position: fixed children measure from). */
.page-enter {
    animation: ab-enter var(--ab-slow) var(--ab-ease) backwards;
}

.reveal {
    animation: ab-reveal var(--ab-slow) var(--ab-ease) backwards;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Bootstrap in the brand ---------------------------------------------------------------------- */

.btn {
    --bs-btn-font-weight: 500;
    transition: color var(--ab-fast) ease, background-color var(--ab-fast) ease, border-color var(--ab-fast) ease,
        box-shadow var(--ab-fast) ease, transform var(--ab-fast) ease;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary {
    --bs-btn-bg: var(--ab-brand);
    --bs-btn-border-color: var(--ab-brand);
    --bs-btn-hover-bg: color-mix(in srgb, var(--ab-brand) 85%, black);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--ab-brand) 85%, black);
    --bs-btn-active-bg: color-mix(in srgb, var(--ab-brand) 75%, black);
    --bs-btn-active-border-color: color-mix(in srgb, var(--ab-brand) 75%, black);
    --bs-btn-disabled-bg: var(--ab-brand);
    --bs-btn-disabled-border-color: var(--ab-brand);
    --bs-btn-focus-shadow-rgb: var(--ab-brand-rgb);
    box-shadow: var(--ab-shadow-sm);
}

/* Also the reward choices in the shop (btn-check), whose chosen one is the "active" look. */
.btn-outline-primary {
    --bs-btn-color: var(--ab-brand);
    --bs-btn-border-color: var(--ab-brand);
    --bs-btn-hover-color: var(--ab-brand-ink);
    --bs-btn-hover-bg: var(--ab-brand);
    --bs-btn-hover-border-color: var(--ab-brand);
    --bs-btn-active-color: var(--ab-brand-ink);
    --bs-btn-active-bg: var(--ab-brand);
    --bs-btn-active-border-color: var(--ab-brand);
    --bs-btn-disabled-color: var(--ab-brand);
    --bs-btn-disabled-border-color: var(--ab-brand);
    --bs-btn-focus-shadow-rgb: var(--ab-brand-rgb);
}

/* The quiet buttons: a white face and the input's edge, ink rather than Bootstrap's grey. */
.btn-outline-secondary {
    --bs-btn-color: var(--ab-ink);
    --bs-btn-bg: var(--ab-surface);
    --bs-btn-border-color: var(--ab-border-strong);
    --bs-btn-hover-color: var(--ab-ink);
    --bs-btn-hover-bg: var(--ab-surface-sunk);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--ab-border-strong) 70%, var(--ab-ink));
    --bs-btn-active-color: var(--ab-ink);
    --bs-btn-active-bg: var(--ab-brand-tint);
    --bs-btn-active-border-color: var(--ab-brand);
    --bs-btn-disabled-color: var(--ab-muted);
    --bs-btn-disabled-bg: var(--ab-surface);
    --bs-btn-disabled-border-color: var(--ab-border);
}

/* A toggle group's chosen button (btn-check, or a filter's btn-primary beside outline ones). */
.btn-check:checked + .btn-outline-secondary {
    border-color: var(--ab-brand);
    background: var(--ab-brand);
    color: var(--ab-brand-ink);
}

.btn-link {
    --bs-btn-focus-shadow-rgb: var(--ab-brand-rgb);
}

.form-control,
.form-select {
    border-color: var(--ab-border-strong);
    transition: border-color var(--ab-fast) ease, box-shadow var(--ab-fast) ease;
}

.form-control::placeholder {
    color: color-mix(in srgb, var(--ab-muted) 75%, white);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: color-mix(in srgb, var(--ab-brand) 50%, white);
    box-shadow: 0 0 0 0.25rem rgba(var(--ab-brand-rgb), 0.18);
}

.form-label {
    margin-bottom: 0.375rem;
    font-weight: 500;
}

.form-text {
    color: var(--ab-muted);
}

.form-check-input {
    border-color: var(--ab-border-strong);
}

.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate {
    border-color: var(--ab-brand);
    background-color: var(--ab-brand);
}

/* A focused switch that is off draws its knob in Bootstrap's light blue, from an image; this one
   is the brand at the same lightness (#0b4f8a half white). */
.form-switch .form-check-input:focus:not(:checked) {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2385a7c4'/%3e%3c/svg%3e");
}

a {
    color: var(--ab-brand);
    text-underline-offset: 0.15em;
}

.badge {
    --bs-badge-font-weight: 600;
    --bs-badge-padding-x: 0.55em;
    letter-spacing: 0.01em;
}

.alert {
    --bs-alert-border-radius: 0.625rem;
}

/* Blazor's FocusOnNavigate puts focus on a page's h1 for screen readers; a ring around a heading
   nobody clicked only looks broken. Blazor's own template hides it the same way. */
h1:focus {
    outline: none;
}

/* --- What both hosts' pages are built from ---------------------------------------------------- */

.page-title {
    margin-bottom: 1rem;
    font-family: var(--ab-font-display);
    font-size: 1.75rem;
    font-weight: var(--ab-title-weight);
    letter-spacing: -0.005em;
    line-height: 1.15;
}

.tabular {
    font-variant-numeric: tabular-nums;
}

/* A figure people read for itself: a balance, a total, a price. */
.figure {
    font-family: var(--ab-font-display);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.875rem;
    color: var(--ab-muted);
    font-size: 0.9375rem;
    text-decoration: none;
    transition: color var(--ab-fast) ease, gap var(--ab-fast) var(--ab-ease);
}

.back-link:hover {
    gap: 0.5rem;
    color: var(--ab-brand);
}

.panel {
    padding: var(--ab-panel-padding);
    border: 1px solid var(--ab-border);
    border-radius: var(--ab-panel-radius);
    background: var(--ab-surface);
    box-shadow: var(--ab-shadow-sm);
}

.panel-title {
    margin-bottom: 0.875rem;
    font-family: var(--ab-font-display);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.005em;
}

/* A panel's title with what it holds (a count, a button) at the other end of the line. */
.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.875rem;
}

.panel-head > .panel-title {
    margin-bottom: 0;
}

/* The buttons that finish a form, at its end, the main one last. */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* A card that is one link as a whole (a reward, an order, a way in from home): in the ink rather
   than the link colour; under the pointer it rises a little, its border the brand. Each use gives
   its own shape. */
.link-card {
    border: 1px solid var(--ab-border);
    background: var(--ab-surface);
    box-shadow: var(--ab-shadow-sm);
    color: var(--ab-ink);
    text-decoration: none;
    transition: border-color var(--ab-fast) ease, box-shadow var(--ab-slow) var(--ab-ease), transform var(--ab-slow) var(--ab-ease);
}

.link-card:hover {
    border-color: color-mix(in srgb, var(--ab-brand) 45%, var(--ab-border));
    box-shadow: var(--ab-shadow-md);
    color: var(--ab-ink);
    transform: translateY(-2px);
}

.link-card:focus-visible {
    outline: 3px solid rgba(var(--ab-brand-rgb), 0.35);
    outline-offset: 2px;
}

/* A product picture's frame: the picture whole on its white, or the placeholder glyph in the
   middle. Each use gives its size, border and corners. */
.picture-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ab-picture);
    color: var(--ab-border-strong);
    overflow: hidden;
}

.picture-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* A parcel on an order, as staff and the member both see it: the truck, then what was sent. */
.order-parcel {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.order-parcel + .order-parcel {
    border-top: 1px solid var(--ab-border);
}

.order-parcel > svg {
    flex-shrink: 0;
    margin-top: 0.25rem;
    color: var(--ab-brand);
}

/* Facts on one line, a dot between each (a parcel's courier, number and day; when an order was
   placed and sent). The dot is drawn here: Razor trims the space a separator in the markup needs,
   and with it the place a narrow line could break; each fact is a block of its own so the line
   breaks between facts ("Pos Laju Malaysia ·" then "EP123456789MY"), never inside one. */
.dot-list > * {
    display: inline-block;
    max-width: 100%;
}

.dot-list > :not(:last-child)::after {
    content: "·";
    margin: 0 0.375rem;
    color: var(--ab-muted);
}

/* What a page shows while it reads (Loading): grey bars in the shape of what is coming. */
.skeleton {
    display: block;
    height: 0.875rem;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--ab-surface-sunk) 0%, color-mix(in srgb, var(--ab-border) 70%, white) 50%, var(--ab-surface-sunk) 100%);
    background-size: 200% 100%;
    animation: ab-shimmer 1.4s linear infinite;
}

/* A bar the size of what it stands for (a picture), its own height set by its use. */
.skeleton.is-block {
    height: auto;
    border-radius: var(--ab-panel-radius);
}

.loading-lines {
    display: grid;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.loading-lines.is-panel {
    padding: var(--ab-panel-padding);
    border: 1px solid var(--ab-border);
    border-radius: var(--ab-panel-radius);
    background: var(--ab-surface);
}

/* A page that has nothing to show yet: a glyph, a line, and the way on. */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.25rem 1.25rem;
    border: 1px dashed var(--ab-border-strong);
    border-radius: var(--ab-panel-radius);
    background: var(--ab-surface);
    color: var(--ab-muted);
    text-align: center;
}

.empty-state > svg {
    color: var(--ab-accent);
}

.empty-state-title {
    color: var(--ab-ink);
    font-family: var(--ab-font-display);
    font-size: 1.125rem;
    font-weight: 600;
}

/* --- The sign-in pages (Pages/Shared/_Layout.cshtml, in this library) ---------------------- */

.signin-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background:
        radial-gradient(60rem 22rem at 50% -6rem, color-mix(in srgb, var(--ab-brand) 10%, transparent), transparent 70%),
        var(--ab-ground);
}

.signin-bar {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.875rem max(1.25rem, env(safe-area-inset-right, 0px)) 0.875rem max(1.25rem, env(safe-area-inset-left, 0px));
    background: var(--ab-brand);
    color: var(--ab-brand-ink);
}

.signin-brand {
    font-family: var(--ab-font-display);
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.signin-brand-mark {
    color: var(--ab-accent);
}

.signin-subtitle {
    opacity: 0.82;
    font-size: 0.9375rem;
}

.signin-main {
    display: flex;
    flex: 1;
    align-items: flex-start;
    justify-content: center;
    padding: 2.75rem max(1rem, env(safe-area-inset-right, 0px)) 2.75rem max(1rem, env(safe-area-inset-left, 0px));
}

.signin-card {
    width: 100%;
    max-width: 25rem;
    border: 1px solid var(--ab-border);
    border-radius: 1rem;
    background: var(--ab-surface);
    box-shadow: var(--ab-shadow-md);
    animation: ab-enter var(--ab-slow) var(--ab-ease) backwards;
}

/* A page to read, not a form: a line a reader's eye can follow. */
.signin-card-wide {
    max-width: 46rem;
}

.signin-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.125rem;
    font-family: var(--ab-font-display);
    font-size: 1.625rem;
    font-weight: 700;
}

.signin-hint {
    color: var(--ab-muted);
    font-size: 0.875rem;
}

.signin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.alert-compact {
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
}

@media (max-width: 575.98px) {
    .signin-main {
        padding-top: 1.5rem;
    }

    .signin-card > .card-body {
        padding: 1.5rem !important;
    }
}

/* --- Blazor's own error strip, shown when the circuit fails for good -------------------------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    padding: 0.75rem max(1.25rem, env(safe-area-inset-right, 0px)) calc(0.75rem + env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
    background: var(--bs-warning-bg-subtle);
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui .reload {
    margin-left: 0.5rem;
}
