//
// _sidebar.scss 
//

@use "../variables" as *;
@use "../utils/mixins" as *;

.sidebar {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    background: $menu-bg;
    border-right: 1px solid $menu-item-border;
    margin-top: 0;
    z-index: 99;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transition: all 0.25s ease-in-out;
    width: $sidenav-width;
    @include respond-below(lg) {
        margin-left: -575px;
        transition: all 0.4s ease;
        z-index: 9999;
        top: 0;
    }
    .sidebar-logo {
        position: fixed;
        line-height: $topbar-height;
        width: $sidenav-width;
        padding: 0 16px;
        border-bottom: 1px solid $menu-item-border;
        .logo {
            display: block;
        }
        .logo-small, .dark-logo {
            display: none;
        }
        #toggle_btn {
            @include respond-above(lg) {
                position: absolute;
                top: 50%;
                transform: translateY(-50%);
                right: 16px;
                width: 22px;
                height: 22px;
                border-radius: $border-radius-pill;
                color: $menu-item-heading;
                font-size: 16px;
            }
        }
    }
    [data-simplebar] {
        top: $topbar-height;
        height: calc(100% - $topbar-height);
        @include respond-below(sm) {
            width: 100% !important;
        }
        @include respond-below(lg) {
            height: 100%;
        }
        .sidebar-menu {
            margin-top: 0;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            height: 100%;
        }
    }
    .sidebar-inner {
        width: 100%;
    }
    .sidebar-menu {
        margin-top: $topbar-height;
        padding: 16px;
        ul {
            margin: 0;
            padding-left: 0;
            list-style: none;
            display: flex;
            flex-direction: column;
        }
        > ul {
            > li {
                margin-bottom: 10px;
                &:last-child {
                    margin-bottom: 0;
                }
                &:first-child {
                    &.menu-title {
                        margin-top: 0;
                    }
                }
                > ul {
                    > li {
                        > a {
                            .count {
                                width: 14px;
                                height: 14px;
                                border-radius: 50%;
                                background: $danger;
                                font-size: 10px;
                                display: flex;
                                align-items: center;
                                justify-content: center;
                                color: $white;
                                flex-shrink: 0;
                                margin-left: auto;
                                font-weight: $font-weight-normal;
                            }
                            &:hover {
                                background: $menu-item-active-bg;
                                color: $primary;
                                 i{
                                        color: $darkmode-white;
                                        background-color: $primary;
                                    }
                                .menu-arrow {
                                    &::before{
                                        border-color: $white;
                                    }
                                }
                            }
                        }
                    }
                }
                &:last-child {
                    ul {
                        margin-bottom: 0;
                    }
                }
                &.active{
                    a{
                        color: $white;
                    }
                }
                > a{
                    display: -webkit-box;
                    display: -ms-flexbox;
                    display: flex;
                    align-items: center;
                    -webkit-box-align: center;
                    -ms-flex-align: center;
                    padding: 10px 15px ;
                    position: relative;
                    color: $gray-900;
                    border-bottom: none;                    
                    &.active{
                        background: $light;
                        border-radius: 6px;
                        border-left: 2px solid $menu-item-active-color;
                    }
                    span{
                        font-size: 15px;
                        font-weight: $font-weight-medium;
                        color: $gray-600;
                    }
                }
                &.submenu {
                    ul {
                        display: none;
                       li {
                            a{
                               font-weight: $font-weight-medium;
                               font-size: $font-size-base;
                               position: relative;
                               display: block;
                               padding:8px 8px 8px 40px;
                               padding-left: 30px;
                           }
                       }
                    }
                }
                ul {
                    display: flex;
                    flex-direction: column;
                    li {
                        overflow: hidden;
                        margin-bottom: 5px;
                        a {
                            display: -webkit-box;
                            border-radius: 6px;
                            display: -ms-flexbox;
                            display: flex;
                            align-items: center;
                            -webkit-box-align: center;
                            -ms-flex-align: center;
                            font-size: 14px;
                            color: $menu-item-heading;
                            font-weight: $font-weight-medium;
                            position: relative;
                            width: 100%;
                            padding: 4px 4px;
                            i {
                                font-size: 16px;
                                width: 28px;
                                height: 28px;
                                background-color: $menu-icon-bg;
                                display: flex;
                                align-items: center;
                                justify-content: center;
                                border-radius: $border-radius-sm;
                                flex-shrink: 0;
                            }
                            span {
                                white-space: nowrap;
                                margin-left: 8px;
                            }
                            &.active{
                                color: $menu-item-hover-color;
                                .menu-arrow {
                                    &::before {
                                        border-color: $white;
                                    }
                                }
                                &::before {
                                    opacity: 1;
                                }
                            }
                        }  
                    }
                    & > li {
                        &.active a{
                            background: $menu-item-active-bg;
                            border-radius: 6px;
                            color: $primary;
                             i{
                                color: $darkmode-white;
                                background-color: $primary;
                            }
                            .menu-arrow {
                                &::before {
                                    border-right: 2px solid $primary;
                                    border-bottom: 2px solid $primary;
                                }
                            }
                            &.subdrop {
                                background: $primary-transparent;
                                border-radius: 6px;
                                color: $primary;
                                i {
                                    color:$white;
                                    background:$white;
                                }
                                span {
                                    color: $primary;
                                    
                                }
                            }
                        }
                    }
                }
                .submenu {
                    ul {
                        display: none;
                        border: 0;
                        padding-top: 0;
                        padding-bottom: 0;
                        position: relative;
                        li {
                            margin: 0;
                        }
                    }
                }
            }
            li {            
                &.menu-title {
                    font-weight: $font-weight-medium;
                    letter-spacing: 0;
                    font-size: 13px;
                    margin: 8px 0 12px;
                    text-transform: uppercase;
                    position: relative;
                    display: flex;
                    align-items: center;
                    border: 0;
                    color: $menu-title-color;
                    span {
                        flex-shrink: 0;
                    }
                }
                .submenu > {
                    ul {
                        margin: 4px 0 0;
                        position: relative;
                        li {

                            a {
                                padding: 8px 4px 8px 36px;
                                font-size: 13px;
                                position: relative;
                                color: $menu-item-color;
                                font-weight: $font-weight-normal;
                                &.active {
                                    color: $submenu-active-color;                                    
                                    &::before {
                                        opacity: 1;
                                    }
                                    &::after{
                                        background-color: $submenu-active-color;
                                    }
                                }
                                &:hover {            
                                    color: $submenu-active-color; 
                                    &::after{
                                        background-color: $submenu-active-color;
                                    }
                                    .menu-arrow {
                                        &::before {
                                            border-color: $menu-item-hover-color;
                                        }
                                    }
                                } 
                                &::after{
                                    position: absolute;
                                    content: "";
                                    background-color: $menu-item-color;
                                    width: 8px;
                                    height: 8px;
                                    left: 20px;
                                    top: 50%;
                                    border-radius: 50%;
                                    transform: translateY(-50%);
                                    -webkit-transform: translateY(-50%);
                                    -ms-transform: translateY(-50%);
                                }                               
                                &::before {
                                    position: absolute;
                                    content: "";
                                    background-color: $menu-item-border;
                                    width: 0.5px;
                                    height: 8px;
                                    left: 22.5px;
                                    top: -2px;
                                }
                            }
                        }
                    }
                    
                    a {
                        &.subdrop {
                            background: $menu-item-active-bg;
                            border-radius: 6px;
                            color: $primary;
                            i{
                                color: $darkmode-white;
                                background-color: $primary;
                            }
                            .menu-arrow{
                                &::before{
                                   border-color: $primary; 
                                }
                            }
                        }
                        &.active {
                            background: $menu-item-active-bg;
                            border-radius: 6px;
                            color: $primary;
                            i{
                                color: $darkmode-white;
                                background-color: $primary;
                            }
                        }
                    }
                }
                .submenu.submenu-two {
                    a {
                        &.subdrop {
                            background: transparent;
                            color: $menu-item-active-color;   
                            border: 0;                         
                            .menu-arrow {
                                &::before {
                                    border-color: $menu-item-active-color;
                                }
                            }
                        }
                        &.active { 
                            background: transparent;
                            color: $menu-active-color;   
                            border: 0;                         
                            .menu-arrow {
                                &::before {
                                    border-color: $menu-active-color;
                                }
                            }
                        }
                    }
                    ul {
                        margin-top: 0;
                        li {
                            margin-left: 20px;
                        }
                    }
                }
                .submenu.submenu-two.submenu-three {
                    ul {
                        li {
                            margin-left: 20px;
                        }
                    }
                }
            }

        }            
        .menu-arrow {
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            align-items: center;
            -webkit-box-align: center;
            -ms-flex-align: center;
            justify-content: center;
            -webkit-justify-content: center;
            -ms-flex-pack: center;
            text-rendering: auto;
            line-height: 40px;
            font-size: 18px;
            line-height: 16px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            position: absolute;
            top: 50%;
            right: 6px;
            transform: translatey(-50%);
            transition: all 0.2s ease;
            &::before {
                position: absolute;
                right: 0;
                top: 50%;
                content: "\ea5f";
                font-family: 'tabler-icons';
                margin-right: 0;
                font-size: 14px;
                display: inline-block;
                transform: translateY(-50%);
            }
            &.inside-submenu {
                right: 10px;
            }
        }
        &.subdrop {
            .menu-arrow {
                transform: translateY(-50%) rotate(90deg);                          
                background: #FFEDDC;
            }
        }
    }
   li {
        a.subdrop {
            .menu-arrow {
                &::before {
                    content: "\ea62";
                }  
            }
        }
    }
}

@include respond-above(lg) {
    .mini-sidebar {
        .page-wrapper {
            margin-left: $sidenav-width-sm;
        }
        .header-left {
            #toggle_btn{
                opacity: 1;
                transform: rotate(180deg);
                &:after {
                   border:0;
                }
            }
        }
        .sidebar {
            .sidebar-menu {
                .clinicdropdown > a {
                    padding: 5px;
                }
            }
        }
        &.expand-menu {
            .header-left {
                #toggle_btn{
                    opacity: 1;
                    transform: rotate(180deg);
                }
            }  
            .sidebar {
                .sidebar-menu {
                    .clinicdropdown > a {
                        padding: 10px 15px;
                    }
                }
            }
        }
        .sidebar-right {
            display: none;
        }
        .sidebar {
            width: $sidenav-width-sm;
            overflow: hidden;
            .sidebar-menu {
                  ul {
                    li {
                        a {
                            span, .count{
                                display:none;
                            }
                        }
                        .menu-title {
                            font-size: 0;
                            &::after {
                                margin-left: 0;
                            }
                        }                                                       
                        svg {
                            margin-right:0;
                        }
                    }
                }
            } 
        }
    }
    .expand-menu {
        &.mini-sidebar {
            .navbar-header {
                margin-left: $sidenav-width;
                #toggle_btn {
                    @include respond-above(lg) {
                        left: -32px;
                        background: transparent;
                        color: $gray-900;
                    }
                }
            }
            #toggle_btn{
                opacity: 1;
                i{
                    transform: rotate(180deg);
                }
            }
            .sidebar {    
                width: $sidenav-width;    
                .sidebar-logo {   
                    width: $sidenav-width;     
                    .logo {
                        display: block;
                    }
                    .logo-small {
                        display: none;
                        text-align: center;
                    } 
                }     
                .sidebar-menu {
                    ul {
                        li {
                            a {
                                 .count{
                                    display: flex;
                                }
                            }
                        }
                    }
                    .menu-title {
                        display:flex;
                        &::after {
                            margin-left: 8px;
                        }
                    }
                }
                .user-names{
                    display: none;
                }
            } 
        }
        .sidebar-right {
            display: block;
            transition: all 0.2s ease;
        }
        .sidebar {
            width: $sidenav-width;
            .sidebar-menu {
               ul {
                   > li {
                        > a {
                            span{
                                display:inline-block;
                            }
                        }      
                    }
                }
                .menu-title {
                    display:flex;
                }
            }
        }
    }
    #toggle_btn {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        align-items: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        justify-content: center;
        -webkit-justify-content: center;
        -ms-flex-pack: center;
        color: $topbar-item-color;
        &.active {
            border: 0;
            background: transparent;
        }
        &:hover {
            color: $topbar-item-hover-color;
        }
    }
}
.mini-sidebar {
    .navbar-header {
        margin-left: $sidenav-width-sm;
        @include respond-below(lg) {
            left: 0;
            margin-left: 0;
        }
    }
     #toggle_btn{
        opacity: 0;
    }
    .sidebar {
        .sidebar-logo {
            width: $sidenav-width-sm;
            .logo {
                display: none;
            }
            .logo-small {
                display: block;
                text-align: center;
            }
            @include respond-below(lg) {                
                width: 240px;
                .logo-small{
                    display: none;
                }
                .logo {
                    display: block;
                }
            }
        }
        .sidebar-menu {
            > ul {
                li {
                    position: relative;
                    &.menu-title {
                        display: none;
                        span {
                            @include respond-above(lg) {
                                display: none;
                            }
                        }
                    }
                    &:first-child {
                        &.menu-title {
                            &::before {
                                content: none;
                            }
                        }
                    }
                    a {
                        justify-content: center;
                        height: 38px;
                    }
                }
            }
        }
    }
     
    &.expand-menu {
        .sidebar {
            .sidebar-menu > ul > li.submenu-open ul li a {
                justify-content: left;
                -webkit-justify-content: left;
                -ms-flex-pack: left;
                padding-left:  18px;
            }
            .sidebar-menu > ul > li ul > li.active a{
                justify-content: start;
            }
            .user-names {
                display: block !important;
            }
            .sidebar-menu {
                > ul {
                    li { 
                        &.menu-title {
                            &::before {
                                content: none;
                            }
                            span {
                                display: block;
                            }
                        }
                        a {
                            justify-content: start;
                        }
                    }
                }
            }
        }
        
    }
}
.slide-nav{
    .sidebar {
        margin-left: 0;
    }
}
.mini-sidebar {
    .slide-nav {
        .sidebar {
            .sidebar-menu {
                > ul {
                    li {
                        a {
                            justify-content: start;
                        }
                    }
                }
            }
        }
        .active.subdrop ~ ul {
            display: block !important;
        }
    }
}
.sidebar-overlay {
    display: none;
    height: 100%;
    width: 100%;
    z-index: 1050;
    background-color: rgba(0, 0, 0, 0.6);
    position: fixed;
    top: 0;
    left: 0;
    &.opened {
        display: block;
    }
}
.mini-sidebar {
    .active.subdrop ~ ul {
        display: none !important;
    }
}
.mini-sidebar.expand-menu {
    .active.subdrop ~ ul {
        display: block !important;
    }
}
.active.subdrop ~ ul {
    display: block !important;
}
.mini-sidebar.expand-menu .navbar-header #toggle_btn {
    opacity: 1;
}
.sidebar-close {
    display: none;
    z-index: 1;
    position: absolute;
    background: transparent;
    border: none;
    top: 0;
    right: 10px;
    cursor: pointer;
    color: $menu-item-color;
    line-height: $topbar-height;
    font-size: 20px;
    &:hover,
    &:focus,
    &:active {
        color: $menu-item-hover-color;
    }
    @include respond-below(lg) {
        display: block;
    }
}

[data-layout="full-width"]{
    .mobile-btn{
        display: block;
    }
    .slide-nav {
        .sidebar {
            margin-left: 0;
            transition: all 0.4s ease;
            z-index: 9999;
            top: 0;
            opacity: 1;
        }
    }
    .sidenav-toggle-btn {
        display: none !important;
    }
    .sidebar-close {
        display: block;
    }
}