/* Everything visual is driven by the shadcn token set declared in index.html and
   consumed through Tailwind utilities. This file only carries what utilities
   cannot express: the pre-boot loading screen, the Blazor error strip, and the
   few bespoke chrome pieces (mobile tab bar, sidebar scrollbar). */

html,
body {
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

h1:focus {
    outline: none;
}

/* Validation ------------------------------------------------------------- */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid hsl(var(--success));
}

.invalid {
    outline: 1px solid hsl(var(--destructive));
}

.validation-message {
    color: hsl(var(--destructive));
}

/* Blazor error strip ----------------------------------------------------- */

#blazor-error-ui {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    bottom: 0;
    box-shadow: 0 -1px 2px rgb(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 .reload,
#blazor-error-ui .dismiss {
    color: inherit;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    text-decoration: none;
}

.blazor-error-boundary {
    background: hsl(var(--destructive));
    padding: 1rem;
    color: hsl(var(--destructive-foreground));
    border-radius: var(--radius);
}

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

/* Pre-boot loading screen ------------------------------------------------ */

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

.loading-progress circle {
    fill: none;
    stroke: hsl(var(--muted));
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: hsl(var(--primary));
    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: bold;
    color: hsl(var(--foreground));
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

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

code {
    color: hsl(var(--primary));
}

/* Sidebar scroll area ---------------------------------------------------- */

.scrollbar-hide {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--sidebar-border)) transparent;
}

.scrollbar-hide::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-hide::-webkit-scrollbar-thumb {
    background-color: hsl(var(--sidebar-border));
    border-radius: 3px;
}

.scrollbar-hide::-webkit-scrollbar-track {
    background: transparent;
}

/* Mobile tab bar --------------------------------------------------------- */

.mobile-footer-nav {
    display: none;
}

@media (max-width: 767.98px) {
    .mobile-footer-nav {
        display: flex;
    }

    /* Keep page content clear of the fixed tab bar. */
    .app-scroll-region {
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom));
    }
}

/* Toast entrance ---------------------------------------------------------- */

/* Tailwind has no slide-in keyframe, and this is the one thing about a toast the
   utilities cannot express. Everything else about it is utility classes. */
@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateX(1rem);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-enter {
    animation: toast-enter 150ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .toast-enter {
        animation: none;
    }
}
