
/* Variables */

:root {
    --nav-width: 20em;
}



/* General Layout */

nav {
    position: fixed;
    top: 0px;
    left: 0px;
    bottom: 0px;
    width: var(--nav-width);
    border: 1px solid var(--pico-muted-border-color);
    -webkit-box-shadow: 0px 0px 10px 1px var(--pico-muted-border-color); 
    box-shadow: 0px 0px 10px 1px var(--pico-muted-border-color);
    z-index: 100;
    overflow: auto;
}

main {
    position: fixed;
    top: 0px;
    left: var(--nav-width);
    right: 0px;
    bottom: 0px;
    padding: var(--pico-spacing) calc(var(--pico-spacing) * 1.25);
    background-color: var(--pico-card-background-color);
    overflow: auto;
}

nav .login-container {
    position: absolute;
    top: 50%;
    left: 0px;
    right: 0px;
    padding: var(--pico-spacing);

    a[type=button] {
        display: block;
        width: 99%;
        margin: 0px;
        transform: translate(0%, -50%);
    }

    svg {
        vertical-align: text-top;
    }
}

nav .logout-container {
    position: absolute;
    bottom: 0px;
    left: 0px;
    right: 0px;
    padding: var(--pico-spacing);

    a[type=button] {
        display: block;
        width: 99%;
        margin: 0px;
    }
}

.sidebar {
    padding: var(--pico-spacing);
    padding-bottom: 0px;

    div[role=group] {
        padding: 0px;
        margin: calc(var(--pico-spacing) * 0.25) 0px;

        :first-child {
            text-align: left;
        }
    }

    div[role=group] button {
        flex: 0 0 calc(var(--pico-spacing) * 2.2);
    }

    button, [role=button] {
        &.expand {
            padding: calc(var(--pico-spacing) * 0.25) calc(var(--pico-spacing) * 0.5);
        }
    }

    > button, > [role=button] {
        &.expand {
            margin: calc(var(--pico-spacing) * 0.75) 0px;
            display: block;
            width: 100%;
        }
    }

    svg {
        vertical-align: text-top;
    }
}

svg {
    stroke: var(--pico-color);
}

.icon {
    width: calc(var(--pico-spacing) * 1.2);
    height: calc(var(--pico-spacing) * 1.2);
}



/* Form Grids */

form .grid {
    display: grid;
    grid-template-columns: min-content auto;
    grid-auto-rows: auto;
    grid-column-gap: var(--pico-spacing);
    grid-row-gap: var(--pico-spacing);

    * {
        align-self: center;
    }

    label {
        white-space: nowrap;
    }

    input, select {
        margin: 0px !important;
    }

    .span-full {
        grid-column-start: 1;
        grid-column-end: 3;
    }

    .col-1 {
        grid-column-start: 1;
        grid-column-end: 2;
    }

    .col-2 {
        grid-column-start: 2;
        grid-column-end: 3;
    }

    .submit-buttons {
        display: flex;
        gap: var(--pico-spacing);

        input[type=submit] {
            flex-basis: 30%;
        }

        &.justify-left { justify-content: flex-start; }
        &.justify-right { justify-content: flex-end; }
        &.justify-center { justify-content: center; }
        &.justify-evenly { justify-content: space-evenly; }
    }
}



/* Utility Classes */

.hidden {
    display: none;
}

.text-centered {
    text-align: center;
}

.text-muted {
    opacity: 0.6;
}

[type=button].small {
    margin: 0px;
    padding: calc(var(--pico-spacing) * 0.15);
    min-width: calc(var(--pico-spacing) * 1.75);
}

code.code-outlined {
    border: 1px solid var(--pico-muted-border-color);
}



/* Tree View (based on CC0 code from https://iamkate.com/code/tree-views/) */

.tree {
    --spacing: 1.5rem;
    --radius: 10px;
    padding-left: 0px;
}

.tree span {
    cursor: pointer;
}

.tree li {
    display: block;
    position: relative;
    padding-left: calc(2 * var(--spacing) - var(--radius) - 2px);
}

.tree ul {
    margin-left: calc(var(--radius) - var(--spacing));
    padding-left: 0;
}

.tree ul li {
    border-left: 2px solid var(--pico-muted-border-color);
    white-space: nowrap;
}

.tree ul li:last-child {
    border-color: transparent;
}

.tree ul li::before {
    content: '';
    display: block;
    position: absolute;
    top: calc(var(--spacing) / -2);
    left: -2px;
    width: calc(var(--spacing) + 2px);
    height: calc(var(--spacing) + 1px);
    border: solid var(--pico-muted-border-color);
    border-width: 0 0 2px 2px;
}

.tree summary {
    display: block;
}

.tree summary::marker,
.tree summary::-webkit-details-marker {
    display: none;
}

.tree summary:focus {
    outline: none;
}

.tree summary:focus-visible {
    outline: 1px dotted #000;
}

.tree li::after,
.tree summary::before {
    content: '';
    display: block;
    position: absolute;
    top: calc(var(--spacing) / 2 - var(--radius));
    left: calc(var(--spacing) - var(--radius) - 1px);
    width: calc(2 * var(--radius));
    height: calc(2 * var(--radius));
    border-radius: 4px;
    background: var(--pico-primary);
}

.tree summary::before {
    z-index: 1;
    background: var(--pico-muted-color) url('/static/icons/expand-collapse.svg') 0 0;
}

.tree details[open]>summary::before {
    background-position: calc(-2 * var(--radius)) 0;
}
