﻿body {
    margin: 0;
    padding: 0;
}

.impersonationbar {
    background-color: #fff7d6;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    font-family: var(--body-font);
    & span {
        position: relative;
        align-self: center;
    }
    & .stopImpersonationBtn {
        position: relative;
        align-items: flex-end;
        background-color: red;
        padding: 5px;
        color: white;
        cursor: pointer;
        border-radius: 5px;
        align-self: center;
    }
}

#portal {
    --sidememu-width: 14rem;
    display: flex;
    flex-flow: column;
    height: 100dvh;
    width: 100vw;
    margin: 0;
    padding: 0;
    background: url('/content/bg.png');
    background-size: cover;
    background-position: center center;
    overflow: hidden;
    font-family: var(--body-font);
    & #portalContent {
        display: flex;
        flex-flow: row;
        height: 100%;
        width: 100%;
        & > .content {
            position: relative;
            height: 100%;
            flex: 1;
            margin: 0;
            padding: 0;
            & > * {
                border: none;
                position: absolute;
                width: 100%;
                height: 100%;
                margin: 0;
            }

        }
    }
}

#mainMenu {
    z-index: 100;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: var(--sidememu-width);
    padding: 0;
    margin: 0;
    background-color: color-mix(in srgb, var(--accent-base-color) 60%, transparent);
    backdrop-filter: blur(4px);
    overflow: visible;
    box-shadow: var(--elevation-shadow-tooltip);
    transition: width 100ms ease-in-out;
    & #navigationImage {
        display: block;
        width: 100%;
        & img {
            width: 100%;
            height: auto;
            position: relative;
        }
    }
    & #menuToggle {
        display: none;
    }
    & #applications {
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
    }
    & .spinner {
        display: flex;
        flex-direction: column;
        align-self: center;
        flex: 1;
        justify-content: center;
        align-items: center;
        color: var(--fill-color);
        font-family: var(--body-font);
    }
    & footer {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem 0;
        margin-top: auto;
        & > fluent-select {
            min-width: 100%;
        }
        & > label { 
            color: var(--fill-color);
            text-shadow: 1px 1px var(--neutral-foreground-rest);
            margin-bottom: -4px;
            font-size: 0.8em;
        }
    }
    & h2 {
        color: var(--foreground-on-accent-rest);
        font-family: var(--body-font);
        font-weight: 400;
        margin-bottom: 0.5rem;
    }
    & fluent-tree-view {
        width: calc(var(--sidememu-width) - 10px);
        min-width: 0;
        padding: 5px;
    }
    & fluent-tree-item {
        --tree-item-nested-width: 0.5em;
        overflow: hidden;
    }
    & fluent-tree-item span {
        -ms-text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
        text-overflow: ellipsis;
        overflow: hidden;
        width: calc(100% - 32px);
    }
    & fluent-tree-item.selected {
        font-weight: bold;
    }
    & fluent-tree-item.selected::before {
        background-color: var(--foreground-on-accent-rest);
    }
    & fluent-tree-item.selected:hover::before {
        background-color: var(--accent-fill-rest)
    }
    & footer {
        padding: .5rem;
        & fluent-anchor#signin {
            font-size: 17px;
            color: white;
            width: 100%;
        }
        & fluent-anchor#signin:hover {
            color: var(--accent-fill-rest);
            background-color: white;
        }
    }
    & .collapser {
        position: absolute;
        width: 20px;
        height: 150px;
        right: -20px;
        background-color: color-mix(in srgb, var(--accent-base-color) 60%, transparent);
        top: 50%;
        transform: translateY(-50%);
        border-top-right-radius: 5px;
        border-bottom-right-radius: 5px;
        text-align: center;
        & i {
            position: relative;
            top: 50%;
            transform: translateY(-50%);
            color: white;
        }
    }
    & .collapser:hover {
        background-color: color-mix(in srgb, var(--accent-base-color) 100%, transparent)
    }
}

#mainMenu.collapsed {
    width: 0;
    & footer {
        display: none;
    }
    & fluent-tree-view {
        display: none;
    }
}

#applications::-webkit-scrollbar {
    width: 6px;
}

#applications::-webkit-scrollbar-thumb {
    background-color: var(--neutral-layer-floating);
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--accent-base-color) 60%, transparent);
}

fluent-button {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* This piece of code takes care of the scrollbar in the Site dropdown */
.scrollable-select::part(listbox) {
    max-height: 50vh;
    overflow-y: auto;
}

#userAdminBtn {
    width: 100%;
    justify-content: center;
}

fluent-button#userAdminBtn::part(control) {
    width: 100%;
}

fluent-button#userAdminBtn::part(content) {
    width: 100%;
}

#userAdminBtnContent {
    display: flex;
    flex-flow: row;
    height: 100%;
    overflow: hidden; 
    justify-content: center;
                                      
    & i {
        height: 100%;
        display: flex;
        padding-right: 5px;
    }

    & #userNameContent {
        display: flex;
        flex-flow: column;
        text-align: left;
        overflow: hidden;
        padding-left: 5px;
        justify-content: center;

        & p {
            padding: 0;
            margin: 0;
            font-size: 13px;
            line-height: 13px;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
            width: 100%;
        }

        & .companyNameLabel {
            font-size: 10px;
            line-height: 10px;
            font-style: italic;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    } 
}

#userAdmin {
    background: var(--accent-stroke-control-rest);
    box-shadow: var(--elevation-shadow-card-focus);
    color: var(--neutral-fill-inverse-hover);
    width: calc(100%-var(--sidememu-width));
    border-radius: 0 calc(var(--layer-corner-radius) * 1px) calc(var(--layer-corner-radius) * 1px) 0;
    max-width: 24rem;
    transition: display 0s 0.9s, opacity 0.9s linear;
    display: block;
    padding: 0;
    box-sizing: border-box;
    & > .under {
        width: 100%;
        height: 100%;
        overflow: auto;
        background: var(--neutral-stroke-control-rest);
        border-radius:0;
        border: var(--neutral-stroke-control-rest);
        display: flex;
        flex-direction: column;
        transition: opacity 300ms ease-in;
        & > h1 {
            font-weight: 400;
            text-align: center;
        }
        & > .over {
            font-weight: 400;
            padding: 1rem;
            flex: 1;
            border-radius: 0;
            & > fluent-divider {
                margin-top: 1rem;
            }
            & h2 {
                font-weight: 300;
            }
        }
    }
    & .loader {
        opacity: 0;
        display: flex;
        place-items: center;
        justify-content: center;
        transition: opacity 300ms ease-in;
        height: 0;
    }
    & > .htmx-request .loader {
        opacity: 1;
        flex-direction: column;
        flex: 1;
    }
    & > .htmx-request .over {
        opacity: 0;
    }
    & form span {
        display: block;
        font-size: 14px;
        margin-bottom: .25rem;
    }
}

#applicationLoader {
    background: var(--neutral-fill-rest);
    box-shadow: var(--elevation-shadow-card-focus);
    max-width: 20rem;
    transition: display 0s 0.9s, opacity 0.9s linear;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-family: var(--body-font);
}

#applicationFrame > iframe {
    border: none;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

section.content {
    z-index: 50;
}

section.content > *[disabled] {
    display: none!important;
}

.form-group {
    padding: 0.5rem;
}

.noselect {
    -webkit-touch-callout: none;
    -webkit-user-select: none; 
    -moz-user-select: none; 
    -ms-user-select: none; 
    user-select: none;
}

.policyWrapper {
    width: 100dvw;
    height: 100dvh;
    background: rgba(0,0,0,.6);
    font-family: var(--body-font);
}

.policyModal {
    position: absolute;
    top: 50%;
    background-color: #ffffff;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 400px;
    min-height: auto;
    border-top: 5px solid color-mix(in srgb, var(--accent-base-color) 60%, transparent);
    padding: 20px;
}

.welcomeWrapper {
    height: 100dvh;
    width: 20dvw;
    background-color: #ffffff;
    padding: 20px;

    & .welcomeSuccess {
        padding: 5px;
        background-color: #dff6dd;
    }

    & .welcomeText {
        display: flex;
        flex-flow: column;
        gap: 15px;
    }
}

@media only screen and (max-width: 768px) {
    #portal {
        & #portalContent {
            flex-flow: column;

            & #mainMenu {
                width: 100%;
                height: auto;

                & #primaryInfo {
                    display: flex;
                    flex-direction: row;
                    justify-content: space-between;
                    overflow: hidden;
                    min-height: 50px;

                    & #menuToggle {
                        display: flex;
                        align-content: center;
                        padding: .5rem;
                        color: white;
                        font-size: 23px;
                        cursor: pointer;

                        & i {
                            align-self: center;
                        }
                    }

                    & #menuToggle:hover {
                        background-color: var(--accent-fill-rest);
                    }
                }

                & #navigationImage {
                    height: 50px;

                    & img {
                        width: auto;
                        height: 50px;
                    }
                }

                & #menuToggle {
                    display: block;
                }

                & .spinner {
                    display: none;
                }

                & .spinner.enabled {
                    display: block;
                }

                & #applications {
                    display: none;
                }

                & footer {
                    display: none;
                }

                & #collapser {
                    display: none;
                }

            }

            & #mainMenu.enabled {
                height: 100%;

                & .spinner {
                    display: block;
                }

                & #applications {
                    display: block;

                    & fluent-tree-view {
                        width: 100%;
                    }

                }

                & footer {
                    display: block;
                }

            }

            & section.content {
                width: 100%;
            }

        }
    }
}