﻿/* loading.css ───── Self-hosted fonts ───── */

/* Figtree — base UI font (regular / 500 / 600 already in /fonts). */
@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/figtree-v9-latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/figtree-v9-latin-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/figtree-v9-latin-600.woff2') format('woff2');
}

/* Manrope — wordmark only (the GoStocktake logo). Scope §11: Manrope 500.*/
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/manrope-v20-latin-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/manrope-v20-latin-600.woff2') format('woff2');
}

/* ───── Loading screen ─────
   Branded first-paint loader. Uses the same wordmark structure as <AppLogo>:
   "Go" + "Stocktake" in Manrope, near-black, with a lime underline under "Go".
   All fonts self-hosted so the splash renders without a network round-trip. */

.sl-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    font-family: 'Figtree', sans-serif;
}

.sl-loader-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
    line-height: 1;
    user-select: none;
    font-family: 'Manrope', sans-serif;
    font-weight: 500;
    letter-spacing: -1.5px;
    font-size: 2.1rem;
    color: #111111;
}

.sl-loader-go {
    /* lime underline accent under "Go" only */
    border-bottom: 3px solid #D9E021;
    padding-bottom: 2px;
}

.sl-loader-stocktake {
    color: #111111;
}

/*.sl-loader-bar-track {
    width: 320px;
    height: 2px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

@media (max-width: 480px) {
    .sl-loader-bar-track {
        width: min(320px, 80vw);
    }
}

.sl-loader-bar-fill {
    height: 100%;
    background: #111111;
    border-radius: 2px;
    width: var(--blazor-load-percentage, 0%);
    transition: width 0.1s ease-in-out;
}*/

/*.sl-loader-bar-track {
    --seg-count: 28;
    --seg-gap: 3px;
    display: flex;
    gap: var(--seg-gap);
    width: 320px;
    height: 10px;
    background: transparent;
    border-radius: 0;
    overflow: visible;*/
    /* mask: only segments up to the load percentage are revealed */
    /*-webkit-mask: linear-gradient( to right, #000 0, #000 var(--blazor-load-percentage, 0%), transparent var(--blazor-load-percentage, 0%) );
    mask: linear-gradient( to right, #000 0, #000 var(--blazor-load-percentage, 0%), transparent var(--blazor-load-percentage, 0%) );
    transition: -webkit-mask 0.15s ease-out, mask 0.15s ease-out;
}

@media (max-width: 480px) {
    .sl-loader-bar-track {
        width: min(320px, 80vw);
    }
}

.sl-loader-bar-fill {
    flex: 1 1 auto;
    height: 100%;*/
    /* a repeating run of discrete count segments */
    /*background-image: repeating-linear-gradient( to right, #111111 0, #111111 calc((100% - (var(--seg-count) - 1) * var(--seg-gap)) / var(--seg-count)), transparent 0, transparent calc((100% - (var(--seg-count) - 1) * var(--seg-gap)) / var(--seg-count) + var(--seg-gap)) );
    width: 100%;
    border-radius: 0;
    transition: none;
}*/

.sl-loader-cubes {
    --cube-count: 10;
    --cube-size: 28px;
    --cube-gap: 6px;
    display: flex;
    gap: var(--cube-gap);
    /* reveal cubes left-to-right by load percentage */
    -webkit-mask: linear-gradient( to right, #000 0, #000 var(--blazor-load-percentage, 0%), transparent var(--blazor-load-percentage, 0%) );
    mask: linear-gradient( to right, #000 0, #000 var(--blazor-load-percentage, 0%), transparent var(--blazor-load-percentage, 0%) );
    transition: -webkit-mask 0.15s ease-out, mask 0.15s ease-out;
}

.sl-loader-cube {
    flex: 0 0 var(--cube-size);
    width: var(--cube-size);
    height: var(--cube-size);
    border-radius: 7px;
    background: #D9E021;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Figtree', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #111111;
    user-select: none;
}

@media (max-width: 480px) {
    .sl-loader-cubes {
        --cube-size: min(28px, 7vw);
    }
}

.sl-loader-text {
    font-size: 0.9rem;
    font-weight: 400;
    color: #9ca3af;
    letter-spacing: 0.02em;
}

/* ───── Blazor error UI ───── */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ───── Form validation (Blazor default) ───── */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}
