:root {
    --text-color-light: rgb(255, 255, 255);
    --text-color-lightgrey: #c8c8c8;
    --text-color-grey: #757575;
    --text-color-darkgrey: #424242;
    --text-color-dark: rgb(0, 0, 0);
    --nav-background: rgb(37, 37, 37);
    --nav-background-lighter: rgb(50, 50, 50);
    --nav-background-light-grey: rgb(238, 238, 238);
    --red: #f03;
    --blue: #2382d9;

    --line-box-shadow: 
        3px 3px 0px 0px white,
        5px 5px 0px 0px rgb(139, 139, 139);

    --line-box-shadow-red: 
        3px 3px 0px 0px white,
        5px 5px 0px 0px var(--red);
        
    --bouncy-timing-function: linear(0, 0.004, 0.016, 0.035, 0.063, 0.098, 0.141 13.6%, 0.25, 0.391, 0.563, 0.765, 1, 0.891 40.9%, 0.848, 0.813, 0.785, 0.766, 0.754, 0.75, 0.754, 0.766, 0.785, 0.813, 0.848, 0.891 68.2%, 1 72.7%, 0.973, 0.953, 0.941, 0.938, 0.941, 0.953, 0.973, 1, 0.988, 0.984, 0.988, 1);
}

h1 {
    width: 100%;
    margin-bottom: 20px;
}

h3 {
    margin-bottom: 15px;
}

h1:focus {
    outline: none;
}

html,
body,
main {
    width: 100dvw;
    height: 100dvh;
    overflow: auto;
}

a:not(.button) {
    color: var(--blue);
    white-space: nowrap;

    &>i {
        position: relative;
        bottom: -1px;
    }
}


.horizontal-scroll {
    width: 100%;
    display: block;

    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
}


/* 
    button styling
*/

:is(button:not(.no-default-style, .quickgrid thead *), a.button) {
    position: relative;
    background: var(--red);
    color: white;
    border: solid var(--red) 2px;

    display: block;
    text-decoration: none;
    font-size: .9rem;
    padding: .4em .8em;
    font-weight: 900;

    white-space: nowrap;
    outline: 2px var(--red) solid;
    outline-offset: -3px;
    width: fit-content;

    transition: outline-offset .3s ease-out,
        background .3s ease-out,
        outline .3s ease-out,
        border .3s ease-out;
    cursor: pointer;

    &:is(:focus, :hover) {
        outline-offset: 3px;
    }

    &:active {
        filter: brightness(.8);
    }

    &.outline:not(:focus, :hover) {

        background: transparent;
        color: var(--red);
        font-weight: bold;
        outline-color: transparent;

    }

    &.small {
        font-size: .7em !important;
    }

    &:disabled {
        opacity: .5;
        cursor: not-allowed;
    }
}


/* button click animation */

:is(button:not(.no-default-style, .quickgrid thead *), a.button):after {
    content: "";
    background: var(--red);
    display: block;

    left: -10px;
    top: -10px;
    position: absolute;

    width: calc(100% + 20px);
    height: calc(100% + 20px);


    opacity: 0;
    transition:
        width .4s ease-out -.15s,
        height .4s ease-out -.15s,
        left .4s ease-out -.15s,
        top .4s ease-out -.15s,
        opacity .3s ease-out;
    z-index: -1;
}

:is(button:not(.no-default-style, .quickgrid thead *), a.button):active:after {

    width: 100%;
    height: 100%;

    left: 0%;
    top: 0%;

    opacity: 1;
    transition-duration: 0s;
}

/* 
    these 2 style rules allow for a "animation" where a button with 2 icons
    switches between them on hover.

    The second icon will replace the first one on hover.

    the ":has(i:nth-child(2))" is to make sure this only happens for buttons with 2 icons and 
    leaves the buttons with only 1 icon alone
*/

:is(button, a.button):has(i:nth-child(2)) {
    
    i:last-of-type {
        display: none;
    }

    &:hover {
        i:first-of-type {
            display: none;
        }
    
        i:last-of-type {
            display: inline-block;
        }
    }
}


/* 
dialog general styling 

uses a :where() so components can easily override the styles
*/

:where(dialog) {
    border: none;
    padding: 20px;
    color: var(--nav-background);
}

/* 
    loading bar when the page is loaded for the first time
*/

.full-screen-background {
    object-fit: cover;
    object-position: center;

    width: 100dvw;
    height: 100dvh;
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--nav-background);

    opacity: .9;

    &::after {
        background: var(--red);
        position: absolute;

        content: "";

        left: 0;
        bottom: 10px;

        height: 5px;
        width: var(--blazor-load-percentage, 0);
    }

}

.loading-screen .percentage {
    position: absolute;
    bottom: 5px;
    background: var(--nav-background);
    z-index: 1;
    padding: 0 10px;
    color: var(--red);

    &::after {
        content: var(--blazor-load-percentage-text, "0%");
    }
}

/* 
    page layout
*/

main {
    position: relative;
    
    display: flex;
    flex-direction: column;
}

@media screen and (min-width: 650px) {

    /* toggle between sidebar and top bar */
    main {
        flex-direction: row;
    }

}



/* 
    unhandled error pop-up
*/

#blazor-error-ui {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);

    display: none;

    width: 100%;
    max-width: 500px;
    padding: 1em;
    border: solid 5px var(--nav-background);
    
    z-index: 999999;
    background: firebrick;
    color: white;

    a {
        color: white;
        cursor: pointer;
    }
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 1%;
    text-decoration: none;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0L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