/* SkiffPOS global styles.
   MudBlazor owns component styling - this file hosts the bundled font,
   the WASM boot screen, and a few cross-page helpers. */

@font-face {
    font-family: 'Inter';
    src: url('../fonts/InterVariable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

html, body {
    font-family: 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
    /* Fallback covers the WASM boot screen; once MudThemeProvider renders, the palette var follows the light/dark toggle. */
    background-color: var(--mud-palette-background, #f6f7f9);
}

h1:focus {
    outline: none;
}

/* ---- cross-page helpers ---- */

.text-right {
    text-align: right !important;
}

.skiff-appbar {
    border-bottom: 1px solid var(--mud-palette-divider);
}

.skiff-drawer {
    border-right: 1px solid var(--mud-palette-divider);
}

.skiff-brand {
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

.skiff-page-title {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.skiff-login-bg {
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(79, 70, 229, 0.14), transparent 60%),
        radial-gradient(1000px 500px at 110% 110%, rgba(13, 148, 136, 0.12), transparent 60%),
        var(--mud-palette-background, #f6f7f9);
}

.skiff-nav-header {
    display: block;
    padding: 20px 16px 6px;
    color: var(--mud-palette-text-secondary);
    font-weight: 600 !important;
    letter-spacing: 0.08em !important;
}

/* Filter bars: keep controls packed to the left at their natural width.
   MudBlazor form fields stretch to fill a flex row by default, which would
   otherwise spread the filters across the whole width. */
.skiff-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
}

    .skiff-filter-bar > * {
        flex: 0 0 auto !important;
    }

/* ---- WASM boot screen (shown before Blazor starts) ---- */

.loading-brand {
    position: absolute;
    inset: calc(20vh - 4.5rem) 0 auto 0;
    text-align: center;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #111827;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 7rem;
    height: 7rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e4e6eb;
        stroke-width: 0.5rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #4f46e5;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    inset: calc(20vh + 2.9rem) 0 auto 0.2rem;
    color: #374151;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

@media (prefers-color-scheme: dark) {
    html, body {
        background-color: var(--mud-palette-background, #0f1115);
    }

    .loading-brand {
        color: #e5e7eb;
    }

    .loading-progress circle {
        stroke: #2a2f3a;
    }

    .loading-progress-text {
        color: #9ca3af;
    }
}

/* ---- runtime error bar ---- */

#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;
    color: white;
    border-radius: 8px;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }
