/* Shared AdminLTE header/sidebar layout. Loaded separately to keep it in sync with navbar markup. */
:root {
    --app-header-height: 50px;
    --app-sidebar-width: 300px;
}

.main-header.sticky {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: none;
}

.main-header .logo {
    width: var(--app-sidebar-width);
}

.navbar.navbar-static-top.custom-navbar {
    display: flex;
    align-items: flex-start;
    min-height: 50px;
    height: auto;
    margin-left: var(--app-sidebar-width);
}

.custom-navbar .sidebar-toggle {
    flex: 0 0 50px;
    text-align: center;
}

.main-header .navbar-custom-menu.custom_menu {
    display: flex;
    flex: 1 1 auto;
    float: none;
    min-width: 0;
    align-items: flex-start;
    justify-content: flex-end;
}

.custom_menu > .navbar-nav {
    display: flex;
    float: none;
    flex-wrap: nowrap;
    justify-content: flex-end;
    margin: 0;
}

.custom_menu > .navbar-primary-actions {
    flex: 0 0 auto;
}

.custom_menu > .navbar-secondary-actions {
    flex: 0 0 auto;
}

.custom_menu > .navbar-nav > li {
    float: none;
}

.custom_menu > .navbar-nav > li > a {
    min-height: 50px;
    padding-right: 9px;
    padding-left: 9px;
    white-space: nowrap;
}

.navbar-user-name {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    vertical-align: middle;
    text-overflow: ellipsis;
}

.navbar-compact-label,
.navbar-actions-toggle,
.mobile-sidebar-backdrop,
.navbar-actions-backdrop {
    display: none;
}

.main-sidebar.custom-sidebar {
    position: fixed;
    top: 50px !important;
    width: var(--app-sidebar-width);
    height: calc(100vh - 50px) !important;
    height: calc(100dvh - 50px) !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.content-wrapper.custom-main-content {
    margin-top: var(--app-header-height) !important;
    margin-left: var(--app-sidebar-width);
}

.search-menu-box {
    width: 100%;
    color: white !important;
    border-right: unset;
    border-left: unset;
}

.search-menu-box:focus {
    border-color: #dfe0e1 !important;
    box-shadow: unset !important;
}

@media (min-width: 768px) {
    .sidebar-mini.sidebar-collapse .navbar.navbar-static-top.custom-navbar,
    .sidebar-expanded-on-hover .navbar.navbar-static-top.custom-navbar {
        margin-left: 50px;
    }

    .sidebar-expanded-on-hover .content-wrapper.custom-main-content {
        margin-left: 50px;
    }

    /* Keep the header still while the scrollable mini sidebar expands on hover. */
    .sidebar-expanded-on-hover .main-header .logo {
        width: 50px;
    }

    .sidebar-expanded-on-hover .main-header .logo > .logo-mini {
        display: block;
        margin-right: -15px;
        margin-left: -15px;
    }

    .sidebar-expanded-on-hover .main-header .logo > .logo-lg {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 1500px) {
    .custom_menu > .navbar-nav > li > a {
        padding-right: 7px;
        padding-left: 7px;
        font-size: 13px;
    }
}

@media (max-width: 1279px) {
    .navbar-compact-label {
        display: inline;
        margin-left: 8px;
    }

    .navbar-user-name {
        max-width: calc(100% - 40px);
    }

    .main-header .navbar-custom-menu.custom_menu {
        position: static;
        align-items: stretch;
    }

    .custom_menu > .navbar-primary-actions {
        display: flex;
        flex: 1 1 auto;
    }

    .custom_menu > .navbar-primary-actions > li {
        flex: 1 1 50%;
        text-align: center;
    }

    .custom_menu > .navbar-primary-actions > li > a {
        padding-right: 8px;
        padding-left: 8px;
    }

    .navbar-actions-toggle {
        display: flex;
        flex: 0 0 62px;
        min-height: 50px;
        padding: 4px 8px;
        border: 0;
        border-left: 1px solid rgba(0, 0, 0, .1);
        background: transparent;
        color: inherit;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        font-size: 11px;
        line-height: 1.1;
    }

    .navbar-actions-toggle .fa {
        margin-bottom: 2px;
        font-size: 18px;
    }

    .custom_menu > .navbar-secondary-actions {
        position: fixed;
        z-index: 1033;
        top: var(--app-header-height);
        right: 0;
        display: none;
        width: min(420px, 100vw);
        max-height: calc(100vh - var(--app-header-height));
        max-height: calc(100dvh - var(--app-header-height));
        margin: 0;
        padding: 6px 0;
        overflow-y: auto;
        background: #fff;
        box-shadow: 0 8px 18px rgba(0, 0, 0, .22);
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .custom-navbar.navbar-actions-open .navbar-secondary-actions {
        display: flex;
    }

    .custom_menu > .navbar-secondary-actions > li {
        width: 100%;
    }

    .custom_menu > .navbar-secondary-actions > li > a {
        min-height: 44px;
        padding: 12px 18px;
        border-bottom: 1px solid #eee;
        color: #333 !important;
        text-align: left;
    }

    .custom_menu > .navbar-secondary-actions > li > a > .label {
        top: 7px;
        right: 12px;
    }

    /* Touch devices must use the dropdown toggle rather than a sticky hover. */
    .custom_menu > .navbar-secondary-actions > li:not(.open) > .dropdown-menu {
        display: none;
    }

    .custom_menu > .navbar-secondary-actions > li.open > .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
        margin: 0;
        border: 0;
        border-bottom: 1px solid #ddd;
        box-shadow: none;
    }

    .custom_menu > .navbar-secondary-actions .dropdown-menu .menu {
        max-height: none;
    }

    .custom_menu > .navbar-secondary-actions .dropdown-menu .menu > li > a {
        min-height: 42px;
        height: auto;
        padding: 11px 18px 11px 32px;
        white-space: normal;
    }

    .main-header .navbar-nav > .user-menu > .dropdown-menu {
        width: 100%;
    }

    .navbar-actions-backdrop {
        position: fixed;
        z-index: 1029;
        top: var(--app-header-height);
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        border: 0;
        background: rgba(0, 0, 0, .28);
    }

    body.navbar-actions-menu-open .navbar-actions-backdrop {
        display: block;
    }

}

@media (max-width: 767px) {
    :root {
        --app-header-height: 100px;
    }

    .main-header .logo {
        width: 100%;
    }

    .navbar.navbar-static-top.custom-navbar {
        width: 100%;
        margin-left: 0;
        align-items: stretch;
    }

    .main-sidebar.custom-sidebar {
        z-index: 1021;
        top: var(--app-header-height) !important;
        width: min(var(--app-sidebar-width), 85vw);
        height: calc(100vh - var(--app-header-height)) !important;
        height: calc(100dvh - var(--app-header-height)) !important;
        transform: translateX(-100%);
    }

    .sidebar-open .main-sidebar.custom-sidebar {
        width: min(var(--app-sidebar-width), 85vw);
        transform: translateX(0);
    }

    .content-wrapper.custom-main-content {
        margin-left: 0;
        transform: none !important;
    }

    .mobile-sidebar-backdrop {
        position: fixed;
        z-index: 1020;
        top: var(--app-header-height);
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        border: 0;
        background: rgba(0, 0, 0, .28);
    }

    .sidebar-open .mobile-sidebar-backdrop {
        display: block;
    }
}

