/* ---------------------------------------------------------------------------
   Top bar and side menu: Views\Shared\Menu.cshtml.

   This CSS used to live in a <style> at the bottom of Menu.cshtml. In the body it was parsed
   hundreds of lines after the markup it styles, so on a load without cache (CTRL + F5) the browser
   painted the bar unstyled for a frame: the Orbyta logo and the language flags are SVG with only a
   viewBox (no width/height), with no rule yet they take the whole width of the bar and flashed huge.
   In the <head> of Views\Shared\_Layout.cshtml it is render blocking, so nothing is painted before it.
   Keep it loaded before css\Themes\*: the theme rules all start with body.theme-modern and win anyway,
   but this way the classic look stays the base one.

   Classic colors (#222 bar, #9d9d9d text): the themes repaint them with the --chrome-* variables
   (css\Themes\theme-modern-components.css).
   --------------------------------------------------------------------------- */

:root {
    --top-bar-height: 50px;
    --side-menu-width: 220px;
}

body {
    padding-top: var(--top-bar-height);
}

/* Top bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-height);
    padding: 0px 15px;
    background-color: #222;
    border-bottom: 1px solid #080808;
    display: flex;
    align-items: flex-start;
    z-index: 1030;
}

.top-bar-logo {
    height: 30px;
    margin-top: 8px;
}

.top-bar-right {
    margin-left: auto;
}

.side-menu-toggle {
    background: none;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 9px 10px;
    margin: 8px 15px 0px 0px;
    cursor: pointer;
}

    .side-menu-toggle:hover {
        background-color: #333;
    }

    .side-menu-toggle .icon-bar {
        display: block;
        width: 22px;
        height: 2px;
        border-radius: 1px;
        background-color: #fff;
    }

        .side-menu-toggle .icon-bar + .icon-bar {
            margin-top: 4px;
        }

/* Side menu */
.side-menu {
    position: fixed;
    top: var(--top-bar-height);
    bottom: 0;
    left: 0;
    width: var(--side-menu-width);
    background-color: #222;
    overflow-y: auto;
    z-index: 1020;
    transition: transform .2s ease;
}

.side-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .side-menu-list a {
        display: block;
        padding: 10px 15px;
        color: #9d9d9d;
        text-decoration: none;
        border-left: 3px solid transparent;
    }

        .side-menu-list a:hover, .side-menu-list a:focus {
            color: #fff;
            background-color: #333;
        }

    .side-menu-list > li.active > a {
        color: #fff;
        background-color: #080808;
        border-left-color: #337ab7;
    }

/* Company selector, next to the logo; theme selector (admins), next to the language */
.top-bar-company {
    margin: 8px 0px 0px 15px;
    min-width: 0;
}

.top-bar-theme {
    margin: 8px 0px 0px 10px;
    min-width: 0;
}

    /* Same colors as the menu items */
    .top-bar-company select.form-control,
    .top-bar-theme select.form-control {
        width: auto;
        max-width: 220px;
        height: 34px;
        color: #9d9d9d;
        background-color: #222;
        border: 1px solid #333;
        box-shadow: none;
        cursor: pointer;
    }

        .top-bar-company select.form-control:hover,
        .top-bar-company select.form-control:focus,
        .top-bar-theme select.form-control:hover,
        .top-bar-theme select.form-control:focus {
            color: #fff;
            background-color: #333;
            border-color: #333;
            box-shadow: none;
        }

        .top-bar-company select.form-control option,
        .top-bar-theme select.form-control option {
            color: #fff;
            background-color: #222;
        }

@media (max-width: 767px) {
    .top-bar-company,
    .top-bar-theme {
        margin-left: 8px;
        flex: 0 1 auto;
    }

        .top-bar-company select.form-control,
        .top-bar-theme select.form-control {
            max-width: 130px;
            padding: 6px 4px;
        }
}

/* Language selector, same colors as the company selector */
.top-bar-language {
    margin: 8px 0px 0px 10px;
}

    .top-bar-language > .dropdown-toggle {
        height: 34px;
        padding: 6px 10px;
        color: #9d9d9d;
        background-color: #222;
        border: 1px solid #333;
        border-radius: 4px;
        white-space: nowrap;
    }

        .top-bar-language > .dropdown-toggle:hover,
        .top-bar-language > .dropdown-toggle:focus,
        .top-bar-language.open > .dropdown-toggle {
            color: #fff;
            background-color: #333;
            outline: none;
        }

    .top-bar-language .dropdown-menu {
        min-width: 100%;
        background-color: #222;
        border: 1px solid #333;
    }

        .top-bar-language .dropdown-menu > li > a {
            color: #9d9d9d;
        }

            .top-bar-language .dropdown-menu > li > a:hover,
            .top-bar-language .dropdown-menu > li > a:focus {
                color: #fff;
                background-color: #333;
                background-image: none;
            }

        .top-bar-language .dropdown-menu > li.active > a {
            color: #fff;
            background-color: #080808;
            background-image: none;
        }

/* Top bar selectors: they do not shrink, when there is no room they move to the side menu (FitTopBarTools) */
.top-bar-tools {
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
}

    .top-bar-tools > div {
        flex-shrink: 0;
    }

/* The same selectors at the bottom of the side menu, one per row and full width */
.side-menu-tools {
    padding: 10px 15px 2px 15px;
    border-top: 1px solid #333;
}

    .side-menu-tools:empty {
        display: none;
    }

    .side-menu-tools > div {
        margin: 0px 0px 8px 0px;
    }

    .side-menu-tools .top-bar-company select.form-control,
    .side-menu-tools .top-bar-theme select.form-control {
        width: 100%;
        max-width: none;
        padding: 6px 12px;
    }

    .side-menu-tools .top-bar-language > .dropdown-toggle {
        width: 100%;
        text-align: left;
    }

        .side-menu-tools .top-bar-language > .dropdown-toggle .caret {
            float: right;
            margin-top: 8px;
        }

    .side-menu-tools .top-bar-language .language-name {
        display: inline;
    }

.language-flag {
    width: 21px;
    height: 14px;
    margin-top: -2px;
    border: 1px solid #555;
    vertical-align: middle;
}

@media (max-width: 767px) {
    .top-bar-language {
        margin-left: 6px;
    }

        .top-bar-language .language-name {
            display: none;
        }
}

.side-menu-backdrop {
    display: none;
}

/* Desktop: the menu pushes the page, it can be collapsed */
@media (min-width: 768px) {
    body.has-side-menu .body-content {
        margin-left: var(--side-menu-width);
        transition: margin-left .2s ease;
    }

    body.side-menu-collapsed .side-menu {
        transform: translateX(-100%);
    }

    body.side-menu-collapsed .body-content {
        margin-left: 0;
    }
}

/* Mobile: the menu is a drawer over the page, closed by default */
@media (max-width: 767px) {
    .side-menu {
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0, 0, 0, .5);
    }

    body.side-menu-open .side-menu {
        transform: none;
    }

    body.side-menu-open .side-menu-backdrop {
        display: block;
        position: fixed;
        top: var(--top-bar-height);
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, .4);
        z-index: 1010;
    }
}

@media print {
    body.has-side-menu .body-content {
        margin-left: 0;
    }
}

/* User menu */
.userInfo {
    position: relative;
    display: inline-block;
}

.userMenu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 10px;
    display: none; /* Hidden by default */
    border-radius: .25em;
    white-space: nowrap;
}

    .userMenu a {
        display: block;
        color: #333;
        text-decoration: none;
        padding: 5px 10px;
    }

        .userMenu a:hover {
            background: #f0f0f0;
        }
