/*
 * Component: Sidebar Mini
 */

// Add sidebar-mini class to the body tag to activate this feature
.sidebar-mini {
  // Sidebar mini should work only on large devices
  @include media-breakpoint-up(md) {
    // When the sidebar is collapsed...
    &.sidebar-collapse {
      // Apply the new margining to the main content and footer
      .content-wrapper,
      .main-footer {
        margin-left: $sidebar-mini-width !important;
      }

      // Modify the sidebar to shrink instead of disappearing
      .main-sidebar {
        // Don't go away! Just shrink
        @include translate(0, 0);
        width: $sidebar-mini-width !important;
      }

      .nav-sidebar {
        > .nav-item {
          position: relative;
          > .nav-link {
            margin-right: 0;
            > .nav-icon {
              width: 100%;
              text-align: center;
            }
          }

          > .nav-treeview {
            // Add some padding to the treeview menu
            padding-top: 5px;
            padding-bottom: 5px;
          }

          // Show menu items on hover
          &:hover {
            > .nav-link {
              overflow: visible;
            }
            > .nav-link > .text,
            > .nav-treeview {
              display: block !important;
              position: absolute;
              width: $sidebar-width - $sidebar-mini-width;
              left: $sidebar-mini-width;
            }

            // position the header & treeview menus
            > .nav-link > span {
              top: 0;
              margin-left: -3px;
              padding: $nav-link-padding;
              background-color: inherit;
            }
            > .nav-treeview {
              top: $nav-link-padding;
              margin-left: 0;
            }
          }
        }
      }

      // Make the sidebar links, menus, labels, badges
      // and angle icons disappear
      .main-sidebar .user-panel > .info,
      .sidebar-form,
      .nav-sidebar > .nav-item > .nav-link > span,
      .nav-sidebar > .nav-item > .nav-treeview,
      .nav-sidebar > .nav-item > .nav-link > .pull-right,
      .nav-sidebar .nav-header {
        display: none !important;
        -webkit-transform: translateZ(0);
      }
    }
  }
}

// A fix for text overflow while transitioning from sidebar mini to full sidebar
.nav-sidebar,
.main-sidebar .user-panel,
.nav-sidebar > .nav-header {
  white-space: nowrap;
  overflow: hidden;
}
.nav-sidebar {
  position: relative;
  &:hover {
    overflow: visible;
  }
}

.sidebar-form,
.nav-sidebar > .nav-header {
  overflow: hidden;
  text-overflow: clip;
}

.nav-sidebar .nav-item > .nav-link {
  position: relative;
  > .pull-right {
    position: absolute;
    right: 10px;
    top: 50%;
    margin-top: -7px;
  }
}
