:root {
    color-scheme: light dark;
    --background-color: light-dark(#fff, #2c2c2c);
    --shadow-color: light-dark(#2c2c2c, #fff);
    --primary-color: #fff;
    --secondary-color: light-dark(#457b9d, #1d3557);
    --third-color: light-dark(#1d3557, #101c30);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-secondary-color: rgba(34, 36, 38, 0.15);
    --hover-color: rgba(0, 0, 0, 0.1);
    --background-hover-color: light-dark(
        rgba(255, 255, 255, 0.9),
        rgba(0, 0, 0, 0.9)
    );
    --valid-color: #468819;
    --valid-hover-color: #284d10;
    --info-color: #cfbd56;
    --info-hover-color: #776d32;
    --invalid-color: #cc4634;
    --invalid-hover-color: #7f1d1d;
    --input-color: light-dark(#ffffff, #2c2c2c);
    --input-placeholder-color: light-dark(#cacbcb, #545454);
    --deactivated-color: #7f7f7f;
    --nav-menu-width: max(300px, 20%);
    --transition-duration: 0.3s;
}
@media screen and (max-width: 1024px) {
    :root {
        --nav-menu-width: min(
            300px,
            calc(100% - 5em)
        ); /* Nur so breit werden lassen, dass der Menü-Button noch genau sichtbar ist */
    }
}

body {
    font-family: Lato, "Segoe UI", sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

ul,
ol {
    list-style: none;
}

hr.divider {
    margin: 0;
    padding: 0;
    border-top: 2px solid var(--secondary-color);
    border-bottom: 2px solid
        light-dark(var(--third-color), var(--border-secondary-color));
    border-left: 0px;
    border-right: 0px;
}

h1.centered {
    text-align: center;
}

button {
    padding: 1em;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: 0px;
    border-radius: 0.25em;
    transition: var(--transition-duration) ease-in-out;

    &:hover {
        cursor: pointer;
        background-color: var(--third-color);
    }

    &.positive {
        background-color: var(--valid-color);
        &:hover {
            background-color: var(--valid-hover-color);
        }
    }

    &.negative {
        background-color: var(--invalid-color);
        &:hover {
            background-color: var(--invalid-hover-color);
        }
    }
    &.deactivated {
        cursor: not-allowed !important;
        background-color: var(--deactivated-color) !important;
    }

    & i {
        margin-right: 1em;
    }
}

a {
    text-decoration: none;
}

/* Form, Inputs */
input {
    box-sizing: border-box;
    font-size: 1em;
    width: 100%;
    padding: 1em;
    background-color: var(--input-color);
    border: 1px solid var(--secondary-color);
    border-radius: 0 0.25em 0.25em 0;

    &::placeholder {
        color: var(--input-placeholder-color);
    }
}

label:has(input[type="file"]) {
    box-sizing: border-box;
    font-size: 1em;
    width: 100%;
    cursor: pointer;
    background-color: var(--input-color);
    border: 1px solid var(--secondary-color);
    border-radius: 0 0.25em 0.25em 0;
    color: var(--input-placeholder-color);

    & span {
        padding: 1em;
    }
}

input[type="file"] {
    display: none;
}

#remember-me-field {
    display: flex;
    flex-direction: row;
    margin: 0.75em 0;
    line-height: 1em;
}

#remember-me-checkbox {
    box-sizing: border-box;
    height: 1em;
    width: 1em;
    margin: 0 0 0 0.5em;
}

select {
    width: 100%;
    padding-left: 1em;
}

.field {
    display: flex;
    flex-direction: column;
    margin: 0.75em 0;

    & .input {
        display: flex;
        flex-direction: row;
        margin: 0.25em 0;

        & i {
            flex-wrap: nowrap;
            padding: 1em;
            background-color: var(--secondary-color);
            color: white;
            border-radius: 0.25em 0 0 0.25em;
        }
    }

    & .switch-holder {
        width: 100%;
        border: 1px solid var(--secondary-color);
        border-radius: 0 0.25em 0.25em 0;
        align-content: center;

        & .switch {
            margin-left: 1em;
        }
    }

    & .file-upload-text {
        color: light-dark(black, white);
    }
}

.single-submit-button {
    width: 100%;
    margin-bottom: 1em;
}

.disabled {
    display: none;
}

/* Header */
header {
    position: fixed;
    z-index: 2;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    top: 0px;
    left: var(--nav-menu-width);
    width: calc(100% - var(--nav-menu-width));
    height: 4em;
    background: linear-gradient(
        90deg,
        var(--secondary-color) 0%,
        var(--third-color) 100%
    );
    color: var(--primary-color);
    transition: var(--transition-duration) ease;

    &.full-width {
        width: 100%;
        left: 0%;
    }

    & a {
        margin: 0;
        padding: 0;
        font-size: 2em;
        font-weight: bold;
        line-height: 2.125em;
        color: var(--primary-color);
    }

    & i {
        margin: 0;
        padding: 1.325em;

        &:hover {
            cursor: pointer;
            background-color: var(--hover-color);
        }
    }
}

@media screen and (max-width: 1024px) {
    header {
        width: 100%;
    }
}

/* User-Dropdown */
#user-dropdown {
    position: fixed;
    z-index: 1;
    top: 4em;
    right: 0;
    width: var(--nav-menu-width);
    background-color: var(--third-color);
    box-shadow: 0 2px 4px 0 var(--border-color),
        0 2px 10px 0 var(--border-secondary-color);
    border-bottom: 3px solid
        light-dark(var(--third-color), var(--secondary-color));
    border-radius: 0 0 1em 1em;
    display: none;
    flex-direction: column;
    translate: 0 -100%;
    transition-property: display, translate;
    transition-duration: var(--transition-duration);
    transition-timing-function: ease;
    transition-behavior: allow-discrete;

    &.active {
        display: flex; /* Bleibe eingeblendet, solange Mauszeiger über dem Dropdown ist */
        translate: 0 0;

        @starting-style {
            translate: 0 -100%;
        }
    }
    & ul {
        padding: 0;
        margin: 0;

        & li {
            box-sizing: border-box;
            line-height: 4em;
            height: 4em;
            width: 100%;
            cursor: pointer;

            &:hover {
                background-color: var(--hover-color);
            }
            &:last-child {
                border-radius: 0 0 25px 25px;
            }
            & a {
                box-sizing: border-box;
                display: block;
                width: 100%;
                height: 100%;
                color: var(--primary-color);
            }
        }
        & i {
            margin: 1em;
        }
    }
}

@media screen and (max-width: 1024px) {
    #user-dropdown {
        width: 100%;
        text-align: center;
    }
}

/* Navigation */
nav {
    display: block;
    position: fixed;
    z-index: 2;
    top: 0;
    left: 0;
    width: var(--nav-menu-width);
    height: 100%;
    overflow: auto;
    background: linear-gradient(
        180deg,
        var(--secondary-color) 0%,
        var(--third-color) 100%
    );
    border-right: 1px solid var(--border-color);
    box-shadow: inset -1px 0px 0px 0px var(--border-secondary-color);
    color: var(--primary-color);
    text-align: left;
    transition-property: display, left;
    transition-duration: var(--transition-duration);
    transition-timing-function: ease;

    &.hidden-menu {
        left: calc(
            var(--nav-menu-width) * -1
        ); /* negative Breite, um das Menü zu verstecken */
    }

    & ul {
        padding: 0;
        margin: 0;

        & li {
            display: flex;
            justify-content: start;
            overflow: hidden;
            box-sizing: border-box;
            height: 4em;
            width: 100%;
            line-height: 4em;
            padding-left: 1em;
            font-size: 1em;
            cursor: pointer;
            transition: var(--transition-duration) ease;

            &:hover {
                background-color: var(--hover-color);
            }
            & img {
                border-radius: 30px;
                height: 3em;
                width: 3em;
                margin: 0.5em 1em 0.5em 0;
            }
            & i {
                float: right;
                margin: 0 0 0 auto; /* Schiebt Icon ganz rechts an den Rand */
                padding: 1.5em;
            }
            & a {
                box-sizing: border-box;
                display: block;
                width: 100%;
                height: 100%;
                color: var(--primary-color);
            }
        }

        & hr {
            margin: 0;
            padding: 0;
            border-top: 1px solid var(--border-secondary-color);
            border-bottom: 1px solid var(--border-color);
        }
    }
}

.accordion {
    transition: var(--transition-duration) ease;

    &.active {
        background: var(--hover-color);
    }
}
.panel {
    padding-left: 1em;
    background: var(--hover-color);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-duration) ease;
}

/* Main Content */
#content {
    display: flex;
    justify-content: space-between;
    position: absolute;
    box-sizing: border-box;
    top: 5.5em;
    left: calc(var(--nav-menu-width) + 1.5em);
    right: 1.5em;
    bottom: 1.5em;
    width: auto;
    height: auto;
    transition: left var(--transition-duration) ease;

    &.full-width {
        left: 1.5em;
    }
}
.container-box {
    padding: 1em;
    margin: 0 auto;
    width: 100%;
    &.medium-sized {
        width: 800px;
    }
    height: auto;
    overflow: auto;
    border-top: 3px solid light-dark(var(--third-color), var(--secondary-color));
    border-radius: 0.25em;
    box-shadow: 0 2px 4px 0 var(--border-color),
        0 2px 10px 0 var(--border-secondary-color);
}
@media screen and (max-width: 1024px) {
    #content {
        left: 1.5em;
    }
}
#mobile-content-overlay {
    display: none;
    position: fixed;
    z-index: -1;
    left: 0;
    right: 0;
    top: 4em;
    bottom: 0;
    width: auto;
    height: auto;
    background-color: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition-property: display, left, opacity;
    transition: var(--transition-duration);
    transition-behavior: allow-discrete;

    @media screen and (max-width: 1024px) {
        display: none;
        &.active {
            display: block;
            left: var(--nav-menu-width);
            opacity: 1;
            z-index: 2;

            @starting-style {
                left: 0;
                opacity: 0;
            }
        }
    }
}

/* Tabelle */
table {
    margin: 1em auto;
    width: 100%;
    background-color: var(--shadow-color);
    border-radius: 0.25em;

    & th {
        padding: 1em;
        background-color: var(--background-hover-color);
        color: light-dark(black, white);
        text-align: start;
        width: 30%;
    }
    & td {
        padding: 1em;
        background-color: var(--background-color);
        color: light-dark(black, white);
    }
}

/* Dialoge */
dialog {
    box-sizing: border-box;
    padding: 0;
    width: min(80%, 550px);
    border-radius: 0.5em;
    border: 1px solid light-dark(black, white);
    box-shadow: 0 2px 4px 0 var(--border-color),
        0 2px 10px 0 var(--border-secondary-color);
    text-align: start;
    transition: var(--transition-duration) ease;
    transition-behavior: allow-discrete;
    opacity: 0;
    transform: scale(0.75);

    & *:not(i, span) {
        margin: 0; /* Margin 0, damit Dialog über backdrop geschlossen werden kann. Sonst könnte man in die Margins klicken, um´s zu schließen */
        padding: 1em;
    }
    & .content {
        padding: 2em 1em; /* Hauptinhalt etwas mehr Platz nach oben und unten */
        margin: 0; /* Spezifischerer Selektor, um sicherzustellen, dass der Content auch kein margin hat*/
    }
    & h3 {
        background-color: var(--third-color);
        color: white;
        margin: 0;
        border-bottom: 1px solid light-dark(black, white);
    }
    & form {
        background-color: rgba(0, 0, 0, 0.1);
        border-top: 1px solid light-dark(black, white);
    }
    &::backdrop {
        background-color: rgba(0, 0, 0, 0);
        transition: var(--transition-duration) ease allow-discrete;
    }
    & button[type="submit"] {
        border: 0px;
        border-radius: 0.25em;
        margin-right: 1em;
        background-color: var(--valid-color);
        color: var(--primary-color);

        &:hover {
            cursor: pointer;
            background-color: var(--valid-hover-color);
        }
    }
    & button[formmethod="dialog"] {
        border: 0px;
        border-radius: 0.25em;
        background-color: var(--invalid-color);
        color: var(--primary-color);

        &:hover {
            cursor: pointer;
            background-color: var(--invalid-hover-color);
        }
    }
}

dialog[open] {
    opacity: 1;
    transform: scale(1);

    @starting-style {
        opacity: 0;
        transform: scale(0.75);
    }

    &::backdrop {
        background-color: rgba(0, 0, 0, 0.8);

        @starting-style {
            background-color: rgba(0, 0, 0, 0);
        }
    }
}

dialog.error-dialog {
    & h3 {
        background-color: var(--invalid-color);
    }
}

dialog.info-dialog {
    & h3 {
        background-color: var(--info-color);
    }
}

/* Toggle Checkbox */
label.switch {
    display: inline-block;
    height: 1.5em;
    position: relative;
    width: 3em;

    & input {
        display: none;

        &:checked {
            & + .slider {
                background-color: light-dark(
                    var(--valid-color),
                    var(--third-color)
                );
            }
            & + .slider::before {
                transform: translateX(1.5em);
            }
        }
    }

    & .slider {
        background-color: #ccc;
        bottom: 0;
        cursor: pointer;
        left: 0;
        position: absolute;
        right: 0;
        top: 0;
        transition: 0.4s;

        &::before {
            background-color: #fff;
            bottom: 4px;
            content: "";
            height: 1em;
            left: 4px;
            position: absolute;
            transition: 0.4s;
            width: 1em;
        }

        &.round {
            border-radius: 1.5em;
            &::before {
                border-radius: 50%;
            }
        }
    }
}

/* Toast */
#toast {
    position: fixed;
    top: 5em;
    right: 1em;
    z-index: 3;
    padding: 1em;
    background-color: var(--third-color);
    color: var(--primary-color);
    border-radius: 0.25em;
    box-shadow: 0 2px 4px 0 var(--border-color),
        0 2px 10px 0 var(--border-secondary-color);
    transition: var(--transition-duration) ease;
    transition-behavior: allow-discrete;
    display: none;
    opacity: 0;

    &.active {
        display: block;
        opacity: 1;

        @starting-style {
            opacity: 0;
        }
    }

    &.default {
        background-color: var(--third-color);
        color: white;
    }

    &.success {
        background-color: var(--valid-color);
        color: white;
    }

    &.error {
        background-color: var(--invalid-color);
        color: white;
    }

    &.info {
        background-color: var(--info-color);
        color: white;
    }
}

#toast-message {
    margin: 0;
}

/* Custom Select */
.custom-select {
    position: relative;
    display: inline-block;
    width: 100%;
}
.select-button {
    font-size: 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1em;
    border: 1px solid var(--secondary-color);
    border-radius: 0 0.25em 0.25em 0;
    background-color: var(--input-color);
    color: light-dark(black, white);
    cursor: pointer;

    &:hover {
        background-color: var(--hover-color);
    }
}
.arrow {
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid light-dark(black, white);
    transition: transform ease-in-out var(--transition-duration);
}
.select-dropdown {
    position: absolute;
    z-index: 2;
    width: 100%;
    border: 1px solid var(--secondary-color);
    border-radius: 0.25em;
    background-color: var(--input-color);
    padding: 0;
    margin: 0;
    box-shadow: 0 2px 4px 0 var(--border-color),
        0 2px 10px 0 var(--border-secondary-color);
    max-height: 200px;
    overflow-y: auto;
}
.select-dropdown::-webkit-scrollbar {
    width: 7px;
}
.select-dropdown::-webkit-scrollbar-track {
    background: var(--input-color);
    border-radius: 25px;
}
.select-dropdown::-webkit-scrollbar-thumb {
    background: light-dark(#ccc, #545454);
    border-radius: 25px;
}
.select-dropdown li {
    padding: 10px;
    cursor: pointer;
}
/* Highlight the selected option */
.select-dropdown li.selected {
    background-color: var(--hover-color);
    border-radius: 4px;
    font-weight: bold;
}
.select-dropdown li:hover,
.select-dropdown li:focus {
    background-color: var(--hover-color);
    border-radius: 4px;
}
.select-dropdown.hidden {
    display: none;
}
