/* Sidebar */

@import '../../../styles.scss';
.sidebar {
  min-height: calc(100vh - #{$navbar-height});
  background: $sidebar-dark-bg;
  font-family: $type1;
  padding: 0;
  width: $sidebar-width-lg;
  z-index: 11;
  transition: width $action-transition-duration $action-transition-timing-function, background $action-transition-duration $action-transition-timing-function;
  -webkit-transition: width $action-transition-duration $action-transition-timing-function, background $action-transition-duration $action-transition-timing-function;
  -moz-transition: width $action-transition-duration $action-transition-timing-function, background $action-transition-duration $action-transition-timing-function;
  -ms-transition: width $action-transition-duration $action-transition-timing-function, background $action-transition-duration $action-transition-timing-function;
  height: 100%;

  .nav {
    overflow: hidden;
    flex-wrap: nowrap;
    flex-direction: column;
    margin-bottom: 60px;

    :host-context(.rtl) & {
      padding-right: 0;
    }

    .nav-item {
      padding:0 $sidebar-menu-padding-x;
      @include transition-duration(0.25s);
      transition-property: background;
      -webkit-transition-property: background;
      .collapse {
        z-index: 999;
      }

      .nav-link {
        @include display-flex;
        @include align-items(center);
        white-space: nowrap;
        padding:$sidebar-menu-padding-y 0 $sidebar-menu-padding-y 0;
        color: $sidebar-dark-menu-color;
        @include transition-duration(0.45s);
        transition-property: color;
        -webkit-transition-property: color;
        cursor: pointer;
        border-top: 1px solid $sidebar-nav-link-border-color;

        i {
          color: inherit;

          &.menu-icon {
            font-size: $sidebar-icon-font-size;
            line-height: 1;
            margin-left: auto;
            :host-context(.rtl) & {
              margin-left: 0;
              margin-right: auto;
            }
            color: $sidebar-dark-menu-icon-color;
            &:before {
              vertical-align: middle;
            }
          }
        }

        .menu-title {
          color: inherit;
          display: inline-block;
          font-size: $sidebar-menu-font-size;
          line-height: 1;
          vertical-align: middle;
        }

        .badge {
          margin-right: auto;
          margin-left: 1rem;
        }

        &[aria-expanded="true"]{
          .menu-arrow{
            &:before{
              content: "\f140";
            }
          }
        }
      }

      &.active:not(.navbar-brand-mini-wrapper){
        background: $sidebar-dark-menu-active-bg;
        > .nav-link {
          border-top: none;
          .menu-title {
            color: $sidebar-dark-menu-active-color;
            font-family: $type1;       
            font-weight: $font-weight-medium;     
          }
          i {
            color: theme-color(success);
          }
        }

        & + .nav-item {
          .nav-link {
            border-top: none;
          }
        }
      }

      &:not(.nav-category):not(.nav-profile):hover{
        background: $sidebar-dark-menu-hover-bg;
      }
      &.nav-profile {
        max-width: 270px;
        margin-top: 10px;
        margin-bottom: 10px;

        .nav-link {
          display: flex;
          border-top: none;
          padding: 10px 0;

          .profile-image {
            margin-right: 15px;
            position: relative;

            :host-context(.rtl) & {
              margin-right: 0;
              margin-left: 15px;
            }
          }
          .dot-indicator {
            position: absolute;
            top: 50%;
            right: 0px;
            transform: translate(50%,-50%);
            width: 7px;
            height: 7px;
            border-radius: 50%;

            :host-context(.rtl) & {
              left: 0;
              right: auto;
              transform: translate(-50%,-50%); 
            }
          }

          .profile-name {
            margin-bottom: 5px;
            font-weight: 500;
            font-size: 15px;
          }

          .designation {
            margin-bottom: 0;
            font-weight: 400;
            color: $text-muted;
            font-size: 12px;
          }

          .icon-container{
            font-size: 16px;
            position: relative;
            color: $sidebar-dark-menu-icon-color;
            margin-left: auto;
            align-self: flex-start;

            :host-context(.rtl) & {
              margin-left: 0;
              margin-right: auto;
            }

            :host-context(.sidebar-mini) & {
              margin-right: auto;
            }

            .dot-indicator{
              top: 0;
              transform: none;
              color: $sidebar-dark-menu-icon-color;
            }
          }
        }
        :host-context(.sidebar-icon-only) & {
          display: none;
        }
      }
      &.nav-category {
        color: $sidebar-nav-category-color;
        font-size: 13px;
        font-weight: 700;
        text-transform: uppercase;

        .nav-link {
          border: none;
        }

        & ~ .nav-category {

          .nav-link{
            border-top: 1px solid $sidebar-nav-link-border-color;
          }
        }

        .nav-link{
          color: inherit;
          padding: $sidebar-nav-category-padding;

          :host-context(.sidebar-light) & {
            color: inherit;
          }
        }
        :host-context(.sidebar-icon-only) & {
          display: none;
        }
      }
      &.pro-upgrade {
        &:hover {
          background-color: transparent;

          :host-context(.sidebar-dark) & {
            background-color: transparent;
          }
        }
      }
      &.navbar-brand-mini-wrapper {
        display: none;

        .nav-link {
          width: 100%;

          :host-context(.sidebar-icon-only) & {
            margin: 0;
          }
        }

        :host-context(.sidebar-icon-only) & {
          @media (min-width: 992px) {
            display: block;
          }
        }
      }
    }

    &:not(.sub-menu) {
      > .nav-item {
        &:hover {
          &:not(.nav-category):not(.nav-profile) {
            > .nav-link {
              color: $sidebar-dark-menu-hover-color;
            }
          }
        }
      }
    }
    &.sub-menu {
      margin-bottom: 20px;
      margin-top:0;
      list-style: none;

      .nav-item {
        padding: 0;
        .nav-link {
          color: $sidebar-dark-submenu-color;
          padding: $sidebar-submenu-item-padding;
          position: relative;
          font-size: $sidebar-submenu-font-size;
          line-height: 1;
          height: auto;
          border-top: 0;
          &:before {
            content: "\e606";
            font-family: "simple-line-icons";
            display: block;
            position: absolute;
            left:0px;
            :host-context(.rtl) & {
              content: "\e605";
              left: auto;
              right: 0;
            }
            top:50%;
            @include transform(translateY(-50%));
            color: lighten($sidebar-light-submenu-color, 10%);
            font-size: .75rem;
          }
          &.active {
            color: $sidebar-light-menu-active-color;
            background: transparent;
          }
          &:hover {
            color: $sidebar-light-submenu-hover-color;
          }
        }
        &:hover {
          background: transparent;
        }
      }
    }
  }
}

// Sidebar mini layout start
:host-context(.sidebar-mini) {
  @media (min-width: 992px) {
    .sidebar {
      width: $sidebar-width-mini;
      .nav {
        .nav-item {
          padding: 0;
          .nav-link {
            @include display-flex;
            @include align-items(center);
            @include justify-content(center);
            @include flex-direction(column);
            text-align: center;
            position: relative;
            border-bottom: none;
            .menu-title {
              display: block;
              margin: auto;
            }
            .badge {
              margin-left: 5px;
              display: none;
            }
            i {
              &.menu-icon {
                display:block;
                margin-right: auto;
                margin-left: auto;
                margin-bottom: .625rem;
              }
              &.menu-arrow {
                display: inline-block;
                margin-left: 5px;
                position: absolute;
                top: 50%;
                right: 20px;
                @include transform(translateY(-50%));
              }
            }
          }
        }
        &.sub-menu {
          .nav-item {
            &::before {
              display: none;
            }
          }
        }
      }
    }
  }
}

:host-context(.sidebar-mini:not(.sidebar-icon-only)) {
  //Apply these styles only when sidebar-mini is not collapsed to icon-only mode
  .sidebar {
    .nav {
      &.sub-menu {
        padding: 0;
        border-top: none;
        .nav-item {
          .nav-link {
            padding: .75rem 0 .75rem 1.25rem;
            margin-left: auto;
            margin-right: auto;
            display: block;
            text-align: left;
            width: 66%;
          }
        }
      }
    }
  }
}

// Sidebar mini layout end


// Sidebar icon only layout start
:host-context(.sidebar-icon-only) {
  @media(min-width: 992px) {
    .sidebar {
      width: $sidebar-width-icon;
      .nav {
        overflow: visible;
        margin-left: 0;
        margin-right: 0;
        .nav-item {
          padding: 0 1rem;
          position: relative;
          .nav-link {
            display: block;
            padding-left: .5rem;
            padding-right: .5rem;            
            text-align: center;
            position: static;
            .menu-title,
            .badge,.menu-sub-title {
              display: none;
            }
            .menu-title {
              @include border-radius(0 5px 5px 0px);
              background: $sidebar-dark-menu-hover-bg;
            }
            i {
              &.menu-icon {
                margin-right: 0;
                margin-left: 0;
                margin-bottom: 0;
              }
              &.menu-arrow {
                display: none;
              }
            }
            &[aria-expanded] {
              .menu-title {
                @include border-radius(0 5px 0 0px);
              }
            }
          }
          .collapse {
            display: none;
          }
          &.hover-open {
            .nav-link {
              .menu-title {
                @include display-flex;
                @include align-items(center);
                background: $sidebar-dark-menu-hover-bg;
                padding: 0.5rem 1.4rem;
                left: $sidebar-width-icon;
                position: absolute;
                text-align: left;
                top: 0;
                bottom: 0;
                width: $icon-only-collapse-width;
                z-index: 1;
                line-height: 1.8;
                -webkit-box-shadow: 4px 0px 7px 0px rgba(182, 185, 189, 0.25);
                        box-shadow: 4px 0px 7px 0px rgba(182, 185, 189, 0.25);              
                &:after {
                  display: none;
                }
              }
            }
            .collapse,
            .collapsing {
              display: block;
              background: $sidebar-dark-bg;
              @include border-radius(0 0 5px 0);
              position: absolute;
              left: $sidebar-width-icon;
              width: $icon-only-collapse-width;
              -webkit-box-shadow: 4px 4px 7px 0px rgba(182, 185, 189, 0.25);
                      box-shadow: 4px 4px 7px 0px rgba(182, 185, 189, 0.25);
            }
          }
          &.nav-profile {
            padding: 0 .3rem;
            .nav-link {
              .nav-profile-text {
                display: none;
              }
              .nav-profile-badge {
                display: none;
              }
            }
          }
        }
        &:not(.sub-menu) {
          .nav-item {
            &.active {
              border-radius: 0;
            }
            &:hover {
              .nav-link {
                border-radius: 0;
              }
            }
          }
        }
        &.sub-menu {
          padding: $sidebar-icon-only-submenu-padding;
          .nav-item {
            .nav-link {
              text-align: left;
              padding-left: 20px;
            }
          }
        }
      }
    }
  }
}
// Sidebar icon only layout end

//sidebar light start
:host-context(.sidebar-light) {
  .sidebar {
    background: $sidebar-light-bg;
    .nav {
      .nav-item {
        .nav-link {
          color: $sidebar-light-menu-color;
          i {
            color: inherit;
            &.menu-icon {
              color: $sidebar-light-menu-icon-color;
            }
            &.menu-arrow {
              color: $sidebar-light-menu-arrow-color;
              &:before{
                color: inherit;
              }
            }
          }
        }
        &.hover-open {
          .nav-link {
            .menu-title {
              background: $icon-only-menu-bg-dark;
            }
          }
        }
        &.active {
          background: $sidebar-light-menu-active-bg;
          > .nav-link {
            .menu-title {
              color: $sidebar-light-menu-active-color;
            }
            i {
              color: theme-color(success);
            }
          }
        }
        &:hover {
          background: $sidebar-light-menu-hover-bg;
        }
        &.sidebar-actions {
          &:hover {
            background: initial;
            .nav-link {
              color: initial;
            }
          }
        }
      }
      &:not(.sub-menu) {
        > .nav-item {
          &:hover {
            &:not(.nav-category):not(.nav-profile) {
              > .nav-link {
                color: $sidebar-light-menu-hover-color;
              }
            }
          }
        }
      }
      &.sub-menu {
        .nav-item {
          .nav-link {
            color: $sidebar-light-submenu-color;
            &:before {
              color: lighten($sidebar-light-submenu-color, 10%);
            }
            &.active {
              color: $sidebar-light-menu-active-color;
              background: transparent;
            }
            &:hover {
              color: $sidebar-light-submenu-hover-color;
            }
          }
          &:hover {
            background: transparent;
          }
        }
      }
    }
  }
}

:host-context(.sidebar-icon-only.sidebar-light) {
  .sidebar {
    background: $icon-only-menu-bg-light;
    .nav {
      .nav-item {
        .nav-link {
          .menu-title {
            background: $sidebar-light-menu-hover-bg;
          }
        }
        &.hover-open {
          .collapse,
          .collapsing {
            background: $icon-only-menu-bg-light;
          }
        }
      }
      .sub-menu {
        background: $icon-only-menu-bg-light;
      }
    }
  }
}
//sidebar light end
:host-context(.sidebar-icon-only.rtl) {
  .sidebar {
    .nav {
      .nav-item {
        &.hover-open {
          .menu-title {
            left: auto;
            right: $sidebar-width-icon
          }
          .collapse,
          .collapsing {
            left: auto;
            right: $sidebar-width-icon
          }
        }
      }
      .sub-menu {
        padding-left: 0;
        padding-right: 1.5rem;
      }
    }
  }
}

:host-context(.sidebar-fixed) {
  @media(min-width: 992px) {
    .sidebar {
      position: fixed;
      max-height: auto;

      .nav {
        max-height: calc(100vh - #{$navbar-height});
        overflow: auto;
        position: relative;

        &.sub-menu {
          max-height: none;
        }
        &:not(.sub-menu) {
          padding-bottom: 3rem;
        }
      }
    }
  }
}

:host-context(.sidebar-hidden) {
  @media (min-width: 992px) {
    .sidebar {
      transition: width $action-transition-duration $action-transition-timing-function;
      -webkit-transition: width $action-transition-duration $action-transition-timing-function;
      -moz-transition: width $action-transition-duration $action-transition-timing-function;
      -ms-transition: width $action-transition-duration $action-transition-timing-function;
      width: 0;
    }
  }
}

:host-context(.sidebar-absolute) {
  @media (min-width: 992px) {
    .sidebar {
      -webkit-transition: none;
      transition: none;
    }
  }
}

:host-context(.sidebar-absolute:not(.sidebar-hidden)) {
  .sidebar {
    position: absolute;
    height: 100%;
    -webkit-box-shadow: 0 0 23px 0px #bcbcbc;
    box-shadow: 0 0 23px 0px #bcbcbc;
  }
}


/* style for off-canvas menu*/
@media screen and (max-width: 991px) {
  .sidebar-offcanvas {
    position: fixed;
    max-height: calc(100vh - #{$navbar-height});
    top: $navbar-height;
    bottom: 0;
    overflow: auto;
    right: -$sidebar-width-lg;
    -webkit-transition: all 0.25s ease-out;
    -o-transition: all 0.25s ease-out;
    transition: all 0.25s ease-out;
    &.active {
      right: 0;
    }
  }
}
