.sidebar-folded {
  .sidebar {
    .sidebar-header {
        width: $sidebar-folded-width;
        .sidebar-brand {
            display: none;
        }
    }
  }
  .page-wrapper {
    width: calc(100% - #{$sidebar-folded-width});
    margin-left: $sidebar-folded-width;
    .navbar {
      width: calc(100% - #{$sidebar-folded-width});
      left: $sidebar-folded-width;
      right: 0;
    }
  }
  &:not(.open-sidebar-folded) {
    .sidebar {
      width: $sidebar-folded-width;
      .sidebar-header {
        width: $sidebar-folded-width;
        .sidebar-brand {
          opacity: 0;
          visibility: hidden;
          width: 0;
        }
      }
      .sidebar-body {
        .nav {
          .nav-item {
            .nav-link {
              .link-title,
              .link-arrow {
                  visibility: hidden;
                  opacity: 0;
              }
            }
            &.nav-category {
              visibility: hidden;
              &::before {
                content: '';
                width: 5px;
                height: 5px;
                border-radius: 50%;
                background: #9b9b9b;
                position: absolute;
                top: 5px;
                left: 6px;
                visibility: visible;
              }
            }
          }
          &.sub-menu {
            display: none;
          }
        }
      }
    }
  }
}

.sidebar-open, .settings-open {
  @media(max-width: 991px) {
    .main-wrapper {
      &::before {
        content: '';
        width: 100vw;
        background: rgba(0, 0, 0, .3);
        position: fixed;
        top: 0;
        bottom: 0;
        right: 0;
        z-index: 99;
        -webkit-transition: all 3s ease;
        transition: all 3s ease;
        z-index: 980;
      }
    }
  }    
}

//RTL layout
.rtl {
  direction: rtl;
  text-align: right;
  .main-wrapper {
    .sidebar {
      right: 0;
      left: auto;
      @media(max-width: 991px) {
        margin-right: -$sidebar-width-lg;
        @at-root #{selector-append(".sidebar-open", &)} {
          margin-right: 0;
        }
      }
      .sidebar-header {
        border-right: 0;
        border-left: 1px solid $sidebar-dark-border-color;
        @at-root #{selector-append(".sidebar-dark", &)} {
          border-left: 1px solid $sidebar-dark-border-color;
        }
      }
      .sidebar-body {
        direction: ltr;
        .nav {
          width: 100%;
          @media(min-width: 992px) {
            direction: rtl;
          }
          .nav-item {
            width: 100%;
            .nav-link {
              direction: rtl;
              .link-title {
                margin-left: 0;
                margin-right: 30px;
              }
              .link-arrow {
                margin-left: 0;
                margin-right: auto;
              }
            }
            &.active {
              .nav-link {
                &::before {
                  right: -25px;
                  left: auto;
                }
              }
            }
            &.nav-category {
              &::before {
                right: 6px;
              }
            }
          }
          &.sub-menu {
            padding: 0 33px 15px 0;
            .nav-item {
              .nav-link {
                &::before {
                  left: auto;
                  right: -29px;
                }
              }
            }
          }
        }
      }
    }
    .settings-sidebar {
      right: auto;
      left: -232px;
      border-radius: 0 0 4px 0;
      -webkit-box-shadow: 3px 0 10px 0 rgba(183, 192, 206, 0.2);
              box-shadow: 3px 0 10px 0 rgba(183, 192, 206, 0.2);
      @at-root #{selector-append(".settings-open", &)} {
        right: auto;
        left: 0;
      }
      .sidebar-body {
        .settings-sidebar-toggler {
          left: auto;
          right: -44px;
          -webkit-box-shadow: 3px 0 10px 0 rgba(183, 192, 206, 0.2);
                  box-shadow: 3px 0 10px 0 rgba(183, 192, 206, 0.2);
          border-radius: 0 4px 4px 0;          
        }
      }
    }
    .page-wrapper {
      @media(min-width: 992px) {
        margin-left: 0;
        margin-right: $sidebar-width-lg;
        @at-root #{selector-append(".sidebar-folded", &)} {
          margin-right: $sidebar-folded-width;
        }
      }
      @media(max-width: 991px) {
        margin-right: 0;
        width: 100%;
      }
      .navbar {
        -webkit-transition: width .1s ease, right .1s ease;
        transition: width .1s ease, right .1s ease;
        @media(min-width: 992px) {
          left: 0;
          right: $sidebar-width-lg;
          -webkit-transition: width .1s ease, right .1s ease;
          transition: width .1s ease, right .1s ease;
          @at-root #{selector-append(".sidebar-folded", &)} {
            right: $sidebar-folded-width;
            width: calc(100% - #{$sidebar-folded-width});
          }
        }
        @media(max-width: 991px) {
          right: 0;
        }
        .navbar-content {
          .search-form {
            margin-right: 0;
          }
          .navbar-nav {
            margin-left: 0;
            margin-right: auto;
            .nav-item {
              &.dropdown {
                .dropdown-menu {
                  right: auto;
                  left: -20px;
                  @media(max-width: 991px) {
                    left: 20px
                  }
                  &::before {
                    right: auto;
                    left: 28px;
                  }
                }
              }
              &.nav-profile {
                .dropdown-menu {
                  .dropdown-body {
                    .profile-nav {
                      .nav-item {
                        .nav-link {
                          svg {
                            margin-right: 0;
                            margin-left: 20px;
                          }
                        }
                      }
                    }
                  }
                }
              }
              &.nav-messages {
                .dropdown-menu {
                  .dropdown-body {
                    .dropdown-item {
                      .content {
                        margin-left: 0;
                        margin-right: 15px;
                        text-align: right;
                      }
                    }
                  }
                }
              }
              &.nav-notifications {
                .dropdown-menu {
                  .dropdown-body {
                    .dropdown-item {
                      .content {
                        margin-left: 0;
                        margin-right: 15px;
                        text-align: right;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      .page-content {
        .main-content {
          p {
            direction: ltr;
          }
        }
        .content-nav-wrapper {
          right: auto;
          left: 0;
        }
      }
    }
  }
}