: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);
}

* {
    box-sizing: border-box;
}

h1 {
    width: 100%;

    &:focus {
        outline: none;
    }
}

html,
body,
main:has( header) {
    width: 100dvw;
    height: 100dvh;
    overflow: auto;
}

:where(a:not(.button)) {
    color: var(--blue);
    white-space: nowrap;
    
    .fa-arrow-right {
        transition: all .15s ease-out;
        font-size: .8em;
        position: relative;
        left: 0px;
    }

    &:hover .fa-arrow-right {
        left: .5em;
    }
}

.mb {
    margin-bottom: .5em;
}

.mb-2 {
    margin-bottom: 1em;
}

.mb-0 {
    margin-bottom: 0;
}

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

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

.valid {
    color: green !important; 
}

.invalid {
    color: orangered !important;
}

.text-grey {
    color: grey;
}

.experimental {
    --badge-color: rebeccapurple;
}

/* 
    button styling
*/

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

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

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

    width: fit-content;
    height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    border-radius: 3px;

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

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

    &: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;
        }
    }
}

/* Any div or section that has only buttons will automatically be detected an buttons bar and apply gapping between the buttons */
:where(:is(section, div):has(> :is(.button, button):first-child ~ :is(.button, button):last-child):not(:has(* ~ *:not(.button, button),  .no-default-style))) 
{
    display: flex;
    flex-wrap: wrap;
    gap: .5em;
}

:where(dialog) {
    border: none;
    padding: 1em .5em;
    color: var(--nav-background);

    height: auto;
    overflow-x: hidden;

    width: 100%;
    max-width: 100%;
    max-height: 80%;
    margin-bottom: 0;
    border-radius: 3px 3px 0px 0px;

    container-type: inline-size;

    transition-behavior: allow-discrete;
    transition: all .2s ease-out;


    transform: translateY(0%);
    opacity: 1;

    &[open] {
        display: flex;
        flex-direction: column;

        @starting-style {
            opacity: 0;
            transform: translateY(100%);
        }
    }
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.336);
}

@media screen and (min-width: 500px) {
    dialog {
        padding: 2em;
        max-height: 80%;
        margin: auto;
        max-width: min(95%, 1200px);
        border-radius: 3px;


        transform: translateY(0) scale(1);
        opacity: 1;

        &[open] {
            @starting-style {
                opacity: 0;
                transform: translateY(0%) scale(.5);
            }
        }
    }
}


.badge {
    --badge-background-color: transparent;

    background: var(--badge-background-color);
    border: solid 2px var(--badge-color, black);
    color: var(--badge-color, black);
    padding: 0 .4em;
    white-space: nowrap;
    font-weight: bold;
    vertical-align: center;
    display: inline-flex;
    align-items: center;
    gap: .3em;
    border-radius: 3px;
    line-height: 1.7em;

    & i {
        font-size: 1.1em;
        color: inherit !important;
    }

    &:not(.large) {
        font-size: max(.5em, .8rem);
    }
    
}




table {
  border-collapse: collapse; /* removes spacing between cell borders */
}

section {
    margin-bottom: 1em;
}

.bold,
strong,
b {
    font-weight: bold;
}

hr {
    width: 100%;
    margin: 1em 0;
    border: 0;
    border-top: solid 1px rgb(117, 117, 117);
}

/* 
    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);

    max-width: 550px;
    max-height: 300px;

    opacity: .9;

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

        content: "";

        left: 0;
        bottom: 10px;

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

    .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
*/

:where(ul:not(.no-default-style)) {
    list-style: none;
    border: solid lightgrey 1px;
    border-radius: 3px;

    & > li {
        padding: .5em .75em;
    }

    & > li:not(:last-child) {
        border-bottom: dashed lightgrey 1px;
    }
}

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
*/


#dotnet-compile-error { /* the hot reload is semi broken */
    display: none;
}

#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+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIdUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4N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