﻿.MainNavigation {
    display: grid;
    grid-template-rows: auto 1fr 1fr;
    grid-template-columns: 1fr;
    grid-row-gap: clamp(6px, 1%, 80px);
    width: var(--sidebar-sm-width);
    height: calc(100vh - (var(--sidebar-padding-vertical) * 2));
    min-height: -webkit-fill-available;
    padding: var(--sidebar-padding-vertical) var(--sidebar-padding-horizontal);
    border: 0;
    border-radius: 0;
    overflow: initial;
    background-color: var(--sidebar-bg-color);
    z-index: 999;
    -webkit-transition: width 0.2s ease-out;
    -moz-transition: width 0.2s ease-out;
    -o-transition: width 0.2s ease-out;
    transition: width 0.2s ease-out;
    box-shadow: var(--shadow-2);
}

    .MainNavigation.expanded {
        width: var(--sidebar-lg-width);
        padding: 24px;
    }

    .MainNavigation:not(.expanded) {
    }

        .MainNavigation .MainNavigationLogoContainer {
            height: 80px;
            display: flex;
        }

        .MainNavigation:not(.expanded) .MainNavigationLogoContainer {
            flex-direction: column;
            gap: 20px;
        }

        .MainNavigation.expanded .MainNavigationLogoContainer {
            flex-direction: row;
            justify-content: space-around;
            width: 100%;
        }

    .MainNavigation .MainNavigationBMWLogo,
    .MainNavigation .MainNavigationMINILogo {
        -webkit-transition: width 0.5s ease-out 0.1s;
        -moz-transition: width 0.5s ease-out 0.1s;
        -o-transition: width 0.5s ease-out 0.1s;
        transition: width 0.5s ease-out 0.1s;
    }

    .MainNavigation:not(.expanded) .MainNavigationBMWLogo,
    .MainNavigation:not(.expanded) .MainNavigationMINILogo {
        width: 40px;
    }

    .MainNavigation.expanded .MainNavigationBMWLogo {
        width: 80px;
    }

    .MainNavigation.expanded .MainNavigationMINILogo {
        width: 100px;
    }

    .MainNavigation .MainNavigationItems {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: clamp(16px, 5%, 24px);
    }

        .MainNavigation .MainNavigationItems .navigation-link {
            width: 100%;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            cursor: pointer;
            color: var(--sidebar-fg-color);
            transition-duration: .2s;
            margin-inline: 0 !important;
            margin-block: 0 !important;
            padding-block: 0 !important;
            padding-inline: 0 !important;
        }

        .MainNavigation.expanded .MainNavigationItems .navigation-link {
            justify-content: flex-start;
            gap: 16px;
            padding-left: 12px;
        }
        
        .MainNavigation:not(.expanded) .MainNavigationItems .navigation-link:hover {
            position: relative;
        }

    .MainNavigation .MainNavigationItems .navigation-link.aspNetDisabled {
        background: transparent !important;
    }

    .MainNavigation.expanded .MainNavigationItems .navigation-link.aspNetDisabled,
    .MainNavigation:not(expanded) .MainNavigationItems .navigation-link.aspNetDisabled .navigation-link-icon {
        opacity: 0.5;
        cursor: default !important;
    }

        .MainNavigation .MainNavigationItems .navigation-link[data-selected="true"],
        .MainNavigation .MainNavigationItems .navigation-link:hover {
            background-color: var(--sidebar-highlight-bg-color);
            color: var(--sidebar-highlight-fg-color);
        }

        .MainNavigation .MainNavigationItems .navigation-link[data-selected="true"] {
            border-left: 2px solid var(--sidebar-highlight-border-color);
        }

        .MainNavigation .MainNavigationItems .navigation-link:not(.desktop) {
            display: none !important;
        }

        .MainNavigation .MainNavigationItems .navigation-link .navigation-link-icon {
            height: 40px;
            width: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
        }

            .MainNavigation .MainNavigationItems .navigation-link .navigation-link-icon:before {
                line-height: 100%;
            }

        .MainNavigation .MainNavigationItems .navigation-link .navigation-link-text {
            height: 40px;
            line-height: 42px; /* weird, but better visual alignment */
            font-size: 1rem;
        }

        .MainNavigation:not(.expanded) .MainNavigationItems .navigation-link .navigation-link-text {
            display: none;
        }

        .MainNavigation:not(.expanded) .MainNavigationItems .navigation-link:hover .navigation-link-text {
            display: block;
            position: absolute;
            width: max-content;
            height: 32px;
            line-height: 32px;
            top: 3px;
            left: 60px;
            padding: 0;
            font-size: 0.8rem;
            color: var(--sidebar-fg-color);
            background-color: var(--sidebar-bg-color);
            padding: 0 16px;
            border-radius: var(--sidebar-border-radius);
            box-shadow: var(--sidebar-highlight-box-shadow);
        }

.MainNavigation .MainNavigationUserProfile {
    width: 100%;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    align-self: flex-end;
    transition-duration: 0.2s;
}

    .MainNavigation:not(.expanded) .MainNavigationUserProfile {
        cursor: pointer;
    }

    .MainNavigation:not(.expanded) .MainNavigationUserProfile:hover {
        transform: scale(1.1);
    }

    .MainNavigation .MainNavigationUserPhoto {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        outline: var(--sidebar-user-photo-border);
        box-shadow: var(--sidebar-user-photo-box-shadow);
    }

.MainNavigation .MainNavigationUserInfo {
    -webkit-transition: display 0.05s ease-out 1s;
    -moz-transition: display 0.05s ease-out 1s;
    -o-transition: display 0.05s ease-out 1s;
    transition: display 0.05s ease-out 1s;
}

.MainNavigation:not(.expanded) .MainNavigationUserInfo {
    display: none;
    opacity: 0;
}

.MainNavigation.expanded .MainNavigationUserInfo {
    opacity: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

    .MainNavigation.expanded .MainNavigationUserInfo span {
        max-width: 175px;
        height: 0.9rem;
        line-height: 0.9rem;
        min-height: 0.9rem;
        font-size: .9rem;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        color: var(--sidebar-fg-color);
        padding: 4px 8px;
        padding-bottom: 2px;
    }

        .MainNavigation.expanded .MainNavigationUserInfo span:first-child {
            font-weight: bold;
        }

    .MainNavigation:not(.expanded) .MainNavigationUserProfile {
        position: relative;
    }
    
    .MainNavigation:not(.expanded) .MainNavigationUserProfile::after {
        content: '';
        height: calc(40px + 4px);
        width: calc(40px + 4px);
        position: absolute;
        border-radius: 50%;
        left: -2px;
        top: -2px;
        animation: user-profile-outline 0.5s linear 1s forwards,
            user-profile-badge-inactive 1.5s linear 10s forwards;
    }

    .MainNavigation:not(.expanded) .MainNavigationUserProfile[data-dealer-selected='True'][data-salesman-selected='False']::after,
    .MainNavigation:not(.expanded) .MainNavigationUserProfile[data-dealer-selected='False'][data-salesman-selected='True']::after {
        animation: user-profile-outline 0.5s linear 1s forwards, 
            user-profile-badge-active-outline 1.5s linear 10s forwards;
    }
    
    .MainNavigation:not(.expanded) .MainNavigationUserProfile[data-dealer-selected='True'][data-salesman-selected='True']::after {
        animation: user-profile-outline 0.5s linear 1s forwards, 
            user-profile-badge-active 1.5s linear 10s forwards;
    }

    @keyframes user-profile-outline {
        from {
            outline: 2px solid transparent;
        }
        to {
            outline: 2px solid var(--brand);
        }
    }
    

    @keyframes user-profile-badge-active {

        from {
            outline: 2px solid var(--brand);
        }

        40% {
            height: calc(44px + 4px);
            width: calc(44px + 4px);
            left: -4px;
            top: -4px;
            background-color: transparent;
            outline: 2px solid var(--brand);
        }

        to { 
            height: 12px;
            width: 12px;
            outline: 0px solid transparent;
            background-color: var(--brand);
            left: calc(100% - 12px);
        }
    }

    @keyframes user-profile-badge-inactive {
        from {
            outline: 2px solid var(--brand);
        }

        40% {
            height: calc(44px + 4px);
            width: calc(44px + 4px);
            left: -4px;
            top: -4px;
            background-color: transparent;
            outline: 2px solid var(--brand);
        }

        to { 
            height: 12px;
            width: 12px;
            outline: 0;
            outline: 2px solid var(--surface-3);
            background-color: var(--surface-1);
            left: calc(100% - 12px);
        }
    }

    @keyframes user-profile-badge-active-outline {
        from {
            outline: 2px solid var(--brand);
        }

        40% {
            height: calc(44px + 4px);
            width: calc(44px + 4px);
            left: -4px;
            top: -4px;
            background-color: transparent;
            outline: 2px solid var(--brand);
        }

        to { 
            height: 12px;
            width: 12px;
            outline: 0;
            outline: 2px solid var(--brand);
            background-color: var(--surface-1);
            left: calc(100% - 12px);
        }
    }

    .MainNavigation.expanded .MainNavigationUserProfile {
        /*margin-left: 12px;*/
    }

    .MainNavigation .MainNavigationUserName {
        color: var(--sidebar-fg-color);
        font-size: 0.9rem;
        height: 40px;
        line-height: 40px;
    }

    .MainNavigation.expanded .MainNavigationUserName {
        display: block;
    }

.MainNavigation:not(.expanded) .MainNavigationUserSettings{
    display: none;
}

.MainNavigation.expanded .MainNavigationUserSettings {
    display: flex;
    cursor: pointer;
}

    .MainNavigation.expanded .MainNavigationUserSettings:before {
        color: var(--sidebar-fg-color);
        font-size: 20px;
    }

    .MainNavigation .expander {
        /* use !important to prevent issues with browser extensions that change fonts */
        font-family: 'Glyphicons Basic' !important;
        speak: none;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        /* Better Font Rendering =========== */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 30px;
        width: 30px;
        border-radius: 50%;
        position: absolute;
        top: 130px;
        right: -15px;
        background-color: var(--sidebar-bg-color);
        color: var(--sidebar-highlight-fg-color);
        box-shadow: none;
        cursor: pointer;
        transition-duration: 0.2s;
        opacity: 0;
    }

    div[id$='UPMainNavigation']:hover .expander {
        opacity: 1;
    }

    .MainNavigation:not(.expanded) .expander:before {
        content: "\e9df";
    }

    .MainNavigation.expanded .expander:before {
        content: "\e9de";
    }

.MainNavigation .user-metrics {
    display: none !important;
    position: fixed;
    left: 56px;
    bottom: 0;
}

.MainNavigation.expanded .user-metrics {
    left: 290px;
}

.MainNavigation .user-metrics[active] {
    display: flex !important;
}

#user-menu.inanimate {
    opacity: 1;
    animation: none;
}

@media (max-width: 768px),
       (max-width: 900px) and (orientation: portrait) {
    .MainNavigation {
        display: flex;
        /*position: fixed;*/
        /*bottom: 0;*/
        flex-direction: row;
        top: auto;
        left: 0;
        height: 60px;
        width: 100%;
        min-height: 20px;
        padding: 0px;
        padding-bottom: 2px;
        gap: 0;
    }

        .MainNavigation .MainNavigationLogoContainer {
            display: none !important;
        }

        .MainNavigation .MainNavigationItems {
            flex-direction: row;
            justify-content: space-evenly;
            grid-gap: 0;
        }

            .MainNavigation .MainNavigationItems .navigation-link {
                color: var(--sidebar-fg-color) !important;
            }
            
            .MainNavigation .MainNavigationItems .navigation-link[data-selected="true"],
            .MainNavigation .MainNavigationItems .navigation-link:hover,
            .MainNavigation .MainNavigationItems .navigation-link:hover .navigation-link-text {
                color: var(--sidebar-highlight-fg-color) !important;
            }

            .MainNavigation .MainNavigationItems .navigation-link {
                border-bottom: 4px solid var(--sidebar-bg-color);
            }

                .MainNavigation .MainNavigationItems .navigation-link:hover {
                    border-bottom-color: var(--sidebar-highlight-bg-color);
                }

            .MainNavigation .MainNavigationItems .navigation-link[data-selected="true"] {
                background-color: var(--sidebar-highlight-bg-color) !important;
                border-bottom-color: var(--sidebar-highlight-border-color);
                border-left: 0;
            }

            .MainNavigation .MainNavigationItems .navigation-link:not(.mobile) {
                display: none !important;
            }

                .MainNavigation .MainNavigationItems .navigation-link.mobile {
                    height: 60px;
                    display: flex !important;
                    flex-direction: column;
                    margin-block: 0;
                    margin-inline: 0;
                    padding-block: 0;
                    padding-inline: 0;
                }

            .MainNavigation .MainNavigationItems .navigation-link .navigation-link-icon {
                height: 30px;
                width: 30px;
                margin-top: 4px;
            }

            .MainNavigation .MainNavigationItems .navigation-link .navigation-link-text {
                height: 30px !important;
                line-height: 30px !important;
                display: flex !important;
                position: initial !important;
                font-size: 0.7rem !important;
                background-color: transparent !important;
                box-shadow: none !important;
            }

                .MainNavigation .expander {
                    display: none !important;
                }

        .MainNavigation .MainNavigationUserProfile {
            width: auto !important;
            margin-right: 24px;
            display: none !important;
        }

            .MainNavigation .MainNavigationUserProfile .MainNavigationUserPhoto {
                box-shadow: none !important;
            }

        #user-menu {
            animation: var(--animation-fade-in) forwards, var(--animation-slide-in-up) !important;
        }

        .user-metrics {
            width: 94% !important;
            left: 50% !important;
            bottom: 64px !important;
            margin: 0 !important;
            padding: 0 !important;
            transform: translateX(-50%);
        }

            .user-metrics .user-metrics .navigation .change-password .navigation-item, 
            .user-metrics .navigation .sign-out .navigation-item
            {
                padding-left: 40%;
            }
}
