@charset "UTF-8";

:root {
    --main-bg: #F7F7F7;
    --nav-bg: #F5F5F5;
    --nav-item-bg: #E5E6E8;
    --nav-item-selected-text-color: #121920;
    --nav-item-selected-bg: #E0E1E3;
    --nav-item-text-color: #323940;

    --button-bg: #007ACC;
    --button-highlight: #005FA3;
    --button-text-color: #FFFFFF;

    --error-border: 0.1em solid #ea818b;
    --error-box-shadow: 0 0 0.2em #ea818b;
    --error-text: #DC091E;

    --fine-line: #E8E8E8;

    --input-bg: #FFFFFF;
    --input-border: 0.1em solid #DADDDF;
    --input-box-shadow: 0 0 0.5em #89B2CC88;
    --input-box-shadow-hover: 0 0 0.5em #A8A8A866;
    --input-text-color: #394047;

    --popup-box-shadow: 0 0 1.0em #A8A8A866;

    --table-bg: var(--main-bg);
    --table-button-bg: #FFF;
    --table-head-text: #7f8c9a;
    --table-body-text: #15171A;
    --table-line: #E8E8E9;
    --table-row-highlight: #EFEFF0;
    /* usage: var(--input-bg) */

    /* */
    --sidebar-width: 15em;
}

@font-face {
    font-family: 'IconsMaterial';
    font-style: normal;
    font-weight: normal;
    src:
        url('fonts/MaterialSymbolsRounded-Light.woff2')
        format('woff2');
}

@font-face {
    font-display: swap;
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    src:
        url('fonts/Inter-VariableFont_opsz,wght.ttf')
        format('truetype');
}



/* Default layouts */

html,
body {
    background-color: var(--main-bg);
    color: var(--main-text-color);
    font-family: 'Inter', sans-serif;
    font-size: 1.0rem;
    height: 100%;
    margin: 0;
    padding: 0;
    width: 100%;
}

button:not(select > button),
a.button {
    background: var(--button-bg);
    border: 0.1em solid var(--button-bg);
    border-radius: 0.5em;
    color: var(--button-text-color);
    cursor: pointer;
    display: inline-block;
    font: inherit;
    padding: 0.4em 0.8em;
    text-decoration: none;

    &:not(:disabled):hover {
        background-color: var(--button-highlight);
        text-decoration: none;
    }
}

input,
select,
textarea {
    appearance: none;
    background-color: var(--input-bg);
    border: var(--input-border);
    border-radius: 0.5em;
    box-sizing: border-box;
    color: var(--input-text-color);
    font: inherit;
    line-height: 1.2;
    margin: 0;
    resize: none;

    &[aria-errormessage],
    &[aria-errormessage]:focus {
        border: var(--error-border);
        box-shadow: var(--error-box-shadow);
    }

    &:hover {
        box-shadow: var(--input-box-shadow-hover);
    }

    &:focus {
        border: 0.1em solid #89B2CC;
        outline: none;
        box-shadow: var(--input-box-shadow);
    }

    &:autofill {
        font-size: 1.0rem;
        background-color: var(--input-bg) !important;
        box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
        -webkit-text-fill-color: var(--input-text-color) !important;
    }

    &::placeholder {
       opacity: 0.5;
    }
}

input,
textarea {
    padding: 0.4em 0.8em;
}

select:not(:has(> button:first-child)) {
    appearance: none;
    background-image: url(
        "data:image/svg+xml;utf8,<svg fill='black' viewBox='0 0 10 5' xmlns='http://www.w3.org/2000/svg'><polygon points='0,0 2,0 5,3 8,0 10,0 5,5'/></svg>"
    );
    background-repeat: no-repeat;
    background-position: right 0.6em center;
    background-size: 0.6em 0.3em;
    padding: 0.4em 2.0em 0.4em 0.8em;

    & option:checked {
        font-weight: bold;
    }
}

::picker(select) {
    appearance: base-select;
    background-color: var(--input-bg);
    border: var(--input-border);
    border-radius: 0.4em;
    box-shadow: var(--popup-box-shadow);
    box-sizing: border-box;
    margin-top: 0.2em;
}

select:has(> button:first-child) {
    appearance: base-select;
    /*border: 0.1em solid red; /*var(--table-line);*/
    border-radius: 0.5em;
    color: var(--input-text-color);
    padding: 0.4em 0.6em 0.4em 0.8em;

    &::picker-icon {
        color: var(--input-text-color);
        /*transition: 0.3s rotate;*/
    }

/*
    &:open::picker-icon {
        rotate: -180deg;
    }
*/

    & option {
        padding: 0.2em 0.8em 0.2em 0.8em;
    }

    & option:checked {
        font-weight: bold;
    }

    & option::checkmark {
        display: none;
    }
}


img {
    margin: 0;
    margin-block: 0;
    padding: 0;
}

table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: 100%;
}

/* Main components */

.main-nav {
    background-color: var(--nav-bg);
    border-right: 0.1em solid var(--fine-line);
    box-shadow: 0 0 1.0em var(--nav-bg);
    display: flex;
    flex-direction: column;
    font-weight: 500;
    font-size: 0.9rem;
    height: 100vh;
    left: 0;
    position: fixed;
    top: 0;
    width: var(--sidebar-width);

    search {
        padding: 0.8em 1.2em 0.8em 1em;

        input {
            display: block;
            width: 100%;
        }
    }

    ul {
        list-style-type: none;
        margin: 0;
        overflow: visible;
        padding: 0.8em 1.2em 0.8em 1em; /* top | right | bottom | left */

    }

    li {
        /* border: 1px solid red; */
        padding: 0.1em 0em 0.1em 0em;
        width: 100%;
    }

    li > a {
        align-items: center;
        border-radius: 0.4em;
        color: var(--input-text-color);
        display: flex;
        min-width: 0;
        padding: 0.3em 0em 0.3em 0.4em;
        text-decoration: none;
        vertical-align: center;

        &.selected {
            background-color: var(--nav-item-selected-bg);
            color: var(--nav-item-selected-text-color);
        }

        &:hover {
            background-color: var(--nav-item-bg);
        }

        .icon {
            /*border: 1px solid red;*/
            display: inline-block;
            font-family: "IconsMaterial";
            font-size: 1.2rem;
            margin-right: 0.4em;
            text-align: center;
            width: 1.2em;
        }

        .label {
            margin-top: 0.1em;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }

    ul.bottom {
        margin-top: auto;
        padding-bottom: 2em;
        position: relative;
    }

    li.account {
        position: relative;

        &:focus-within ul.account-menu {
            display: block;
        }
    }

    li.account > a {
        display: flex;
        padding: 0.6em 0.4em 0.6em 0.4em;

        .icon {
            align-items: center;
            background-color: var(--nav-item-bg);
            border-radius: 50%;
            display: flex;
            flex-shrink: 0;
            justify-content: center;
        }

        .content {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .name,
        .mail {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .name {
            font-size: 0.9rem;
            font-weight: bold;
        }

        .mail {
            color: #808080;
            font-size: 0.8rem;
        }
    }

    ul.account-menu {
        background-color: var(--main-bg);
        border: 0.1em solid var(--nav-item-bg);
        bottom: 100%;
        display: none;
        left: 0;
        position: absolute;
        width: calc(100% - 2.2em);
    }
}

.main-frame {
    /*background: var(--main-bg);*/
    height: calc(100% - 2em);
    min-width: 0;
    overflow-y: auto;
    padding: 0 4em 2em calc(var(--sidebar-width) + 4em);
    width: calc(100% - var(--sidebar-width) - 8em);
}

.toolbar {
    background-color: var(--main-bg);
    /*border-bottom: 1px solid red;/**/
    display: flex;
    align-items: center;
    height: 1.2em;
    padding: 2em 0 2em 0;
    position: sticky;
    top: 0;
    z-index: 1000;

    & > .left {
        flex: 1;
    }

    & > .right {
        display: flex;
        font-size: 0.8rem;
        font-weight: 500;
        gap: 1em;
        justify-content: flex-end;

        button:not(select > button),
        a.button {
            margin-left: 1em;
            padding: 0.6em 1.2em 0.6em 1.2em;
        }

        select {
            margin-left: 1em;
            padding-bottom: 0.6em;
            padding-top: 0.6em;
        }

        option {
            font-weight: normal;
        }
    }
}

.table-data {
    table-layout: auto;

    tbody tr:first-child td {
        border-top: 0.1em solid var(--table-line);
    }

    tbody tr td {
        border-bottom: 0.1em solid var(--table-line);
    }

    tbody tr:hover {
        background-color: var(--table-row-highlight);

        td {
            cursor: pointer;
        }
    }

    td, th {
        margin: 0;
        margin-block: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        width: auto;
        white-space: nowrap;

        &.sizable, &.longtext {
            width: 100%;
        }
    }

    th {
        color: var(--table-head-text);
        font-weight: 500;
        font-size: 0.8rem;
        padding: 0.8em 0.8em 0.8em 0.8em;
        text-align: left;
        text-transform: uppercase;
    }

    td {
        color: var(--table-body-text);
        font-size: 1.0rem;
        padding: 0.4em 0.8em 0.4em 0.8em;
    }

    td.button,
    th.button {
        padding: 0em 0.8em 0em 4em;
        text-align: right;
    }

    a {
        color: var(--table-body-text);
        text-decoration: none;
    }

    a.row-button,
    a.row-icon {
        background-color: var(--table-button-bg);
        border: 0.1em solid var(--table-line);
        border-radius: 0.5em;
        color: var(--table-body-text);
        font-family: 'IconsMaterial';
        font-size: 1.2rem;
        padding: 0.3em 0.6em;
    }

    .image-box {
        aspect-ratio: 16 / 9;
        background: #FFF;
        /*border-radius: 50%;*/
        height: 3em;
        overflow: hidden;
    }

    img {
        display: block;
        height: 100%;
        object-fit: contain;
        width: 100%;

        &.zoomed {
            border: 1px solid #ccc;
            box-shadow: 0 2px 6px #0003;
            opacity: 0;
            padding: 0;
            pointer-events: none;
            position: fixed;
            transition:
                opacity .1s linear,
                visibility 0s linear .1s;
            visibility: hidden;
            z-index: 9999;
        }

        &:hover + &.zoomed {
            opacity: 1;
            visibility: visible;

            transition:
                opacity .2s linear .5s,
                visibility 0s;
        }
    }
}



/* Components */

.element-error-message {
    color: var(--error-text);
    font-size: 0.8rem;
    text-align: right;
    padding: 0.4em;
}

.form-buttons,
.form-element {
    padding: 0.5em 0 0.5em 0;


}

.form-element label {
    font-weight: bold;
    font-size: 0.8rem;
    padding: 0.0em 0 0.4em 0;
}

.form-error-message {
    color: var(--error-text);
    font-size: 0.8rem;
    margin: 0.8em 0;
    text-align: center;
}

.nowrap {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}



/* Log and debug frame */

#core-log-frame {
    -webkit-backdrop-filter: blur(0.1em);
    backdrop-filter: blur(0.1em);
    background: #EEEE;
    border: 0.1em solid #0004;
    bottom: 0.5em;
    color: #000;
    font-family: monospace;
    font-size: 10pt;
    right: 1.5em;
    max-height: 40vh;
    max-width: 50vw;
    opacity: 1.0;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 0.5em;
    position: fixed;
    transition: all 0.3s ease;
    white-space: pre-wrap;
    z-index: 9999;

    &.closed {
        max-height: 1em;
        max-width: 4em;
        opacity: 0.25;
        overflow-y: scroll;
    }
}