@import "variables";
@import "mixins";

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  background: $white;
  box-shadow: 0 2px 8px rgba($primary, .1);
  height: auto;
  left: 0;
  padding: 0;
  position: relative;
  top: 0;
  width: 100%;
  z-index: 1000;

  @media (min-width: $screen-md-min) {
    height: 100vh;
    position: fixed;
    width: $sidebar-width;
  }
}

/* Sidebar-offset
   ========================================================================== */

.sidebar-offset {
  .container,
  .container-hybrid {
    width: calc(100% - 40px);
  }

  .container-hybrid .flex-row {
    align-content: center;
    align-items: center;
    display: flex;
    flex-flow: row wrap;
    justify-content: flex-start;

    > * {
      float: none;
    }
  }
}

/* Sidebar > list
   ========================================================================== */

.sidebar-list {
  height: 100%;
  list-style: none;
  margin: 0;
  overflow-y: auto;
  padding: 0;
}

/* Sidebar > list > header
   ========================================================================== */

.sidebar-list-header {
  margin: 24px 12px;

  img {
    height: 32px;
  }

  .sidebar-list-header-title {
    color: rgba($primary, .8);
    font-family: $font-primary;
    font-size: 17px;
    font-weight: 700;
    line-height: 24px;
    margin: 0;
    padding: 0;
  }

  .sidebar-list-header-subtitle {
    color: rgba($primary, .8);
    display: block;
    font-family: $font-secondary;
    font-size: 13px;
    line-height: 24px;
    margin: 0;
    padding: 0;
    position: relative;

    @include anim(color);

    &:hover {
      color: $accent;
    }
  }
}

/* Sidebar > list > item
   ========================================================================== */

.sidebar-item {
  display: block;

  &:last-child {
    margin-bottom: 24px;
  }
}

/* Sidebar > Header
   ========================================================================== */

.sidebar-header {
  align-content: center;
  align-items: center;
  background: rgba($primary, .05);
  color: rgba($primary, .8);
  cursor: pointer;
  display: block;
  display: flex;
  flex-flow: row nowrap;
  font-size: 14px;
  font-weight: 600;
  justify-content: flex-start;
  line-height: 24px;
  padding: 18px 12px;
  user-select: none;
  width: 100%;

  @include anim(background);
}

.sidebar-header:hover,
.sidebar-header:focus {
  background: rgba($primary, .1);
}

.sidebar-header span {
  flex: 1 1 auto;
  margin-right: 12px;
}

.sidebar-header .sidebar-icon {
  display: inline-block;
  flex: 0 1 auto;
}

.sidebar-header .sidebar-icon-right {
  flex: 0 1 auto;
  margin-right: 0;

  > * {
    margin-right: 0;
  }
}

/* Sidebar > Toggle Header
   ========================================================================== */

.toggler-header-collapsed .icon-12-arrow-up-short {
  display: none;
}

.toggler-header-collapsed .icon-12-arrow-down-short {
  display: inline;
}

.toggler-header-expanded .icon-12-arrow-up-short {
  display: inline;
}

.toggler-header-expanded .icon-12-arrow-down-short {
  display: none;
}

.toggler-collapsed {
  display: none;
}

/* Sidebar > Search
   ========================================================================== */

.sidebar-search .form-group {
  margin: 12px 0;
}

.sidebar-search .form-control {
  background: rgba($primary, .05);
  border-color: $white;
  color: rgba($primary, .4);
  font-family: $font-primary;
  font-weight: 600;

  @include anim(all);
}

.sidebar-search .input-inner-icon-helper {
  color: rgba($primary, .6);
  line-height: 24px;
  top: 20px;

  @include anim(color);
}

.sidebar-search .form-control:focus {
  background: $white;
  border-color: $accent;
  color: rgba($primary, .8);
}

.sidebar-search .form-control:focus + .input-inner-icon-helper {
  color: $accent;
}

/* Sidebar > list
   ========================================================================== */

.sidebar-link:focus {
  outline: none;
}

.sidebar-list .sidebar-link {
  border-radius: 0;
  color: rgba($primary, .8);
  display: block;
  font-family: $font-primary;
  font-size: 13px;
  font-weight: 700;
  line-height: 24px;
  padding: 12px;
  text-decoration: none;

  @include anim(all);
}

.sidebar-list .sidebar-settings-item .sidebar-link {
  img {
    height: 24px;
    margin-right: 8px;
    width: 24px;
  }

  span:not(.sidebar-icon) {
    display: inline-block;
    line-height: 24px;
    position: relative;
    top: 1px;
  }
}

.sidebar-list .sidebar-link:hover,
.sidebar-list .sidebar-link:focus {
  background: rgba($accent, .1);
  color: rgba($primary, .8);
}

.sidebar-list .sidebar-link-selected,
.sidebar-list .sidebar-link-selected:hover,
.sidebar-list .sidebar-link-selected:focus {
  background: rgba($accent, .1);
  color: $accent;
}

/* Medium Screens
   ========================================================================== */

@media (min-width: $screen-md-min) {
  .sidebar-offset {
    margin-left: $sidebar-width;
    padding-top: 0;
    width: calc(100% - #{$sidebar-width});

    .container {
      max-width: $screen-md-min - $sidebar-width;
    }
  }

  .sidebar-header {
    display: none;
  }

  .toggler-collapsed {
    display: block;
  }

  .sidebar-search .form-group {
    margin: 0 0 24px;
  }
}

/* Sidebar Offset => Large screens
   ========================================================================== */

@media (min-width: $screen-lg-min) {
  .sidebar-offset {
    .container,
    .container-hybrid {
      max-width: $screen-lg-min - $sidebar-width;
      padding-left: 0;
      padding-right: 0;
    }
  }
}

@media (min-width: 1440px) {
  .sidebar-offset {
    .container,
    .container-hybrid {
      max-width: 948px;
      padding-left: 0;
      padding-right: 0;
    }
  }
}

@media (min-width: 1600px) {
  .sidebar-offset {
    .container,
    .container-hybrid {
      max-width: calc(1440px - #{$sidebar-width});
      padding-left: 0;
      padding-right: 0;
    }
  }
}

@media (min-width: 1920px) {
  .sidebar-offset {
    .container,
    .container-hybrid {
      max-width: $screen-lg-min;
      padding-left: 0;
      padding-right: 0;
    }
  }
}

/* Sidebar Navigation Menu
   ========================================================================== */

.sidebar-navigation {
  display: none;
  height: 100vh;
  left: 0;
  position: fixed;
  top: 0;
  width: 100vw;
  z-index: 9999;

  @media (min-width: 960px) {
    display: inline-block;
    width: 252px;
  }

  .sidebar {
    height: 100vh;
    width: 252px;
  }

  .sidebar-navigation-fade {
    animation: fadeIn .3s cubic-bezier(.3, 0, .3, 1) .1s 1 forwards;
    background: rgba($primary, .3);
    cursor: pointer;
    display: inline-block;
    height: 100%;
    opacity: 0;
    width: 100%;

    @media (min-width: 960px) {
      display: none;
    }
  }
}

.sidebar-navigation.open {
  display: inline-block;
  width: 100vw;

  @media (min-width: 960px) {
    display: inline-block;
    width: 252px;
  }
}

.sidebar-navigation.open .sidebar {
  animation: fadeInToRight .3s cubic-bezier(.3, 0, .3, 1) .1s 1 forwards;
  opacity: 0;
  position: absolute;
}

/* Sidebar Link
   ========================================================================== */
.sidebar .sidebar-link {
  display: flex;
  padding: 12px 0;
  justify-content: flex-start;

  .sidebar-item-icon {
    fill: $primary;
    height: 18px;
    margin: 0 18px 0 6px;
    width: 18px;
    transition: fill 0.33s;
  }

  .sidebar-item-container {
    border-left: 4px solid transparent;
    height: 30px;
    display: flex;
    align-items: center;
    font-weight: $fwp-normal;
    padding: 0 12px 0 8px;

    .sidebar-item-text {
      color: #0e141a;
      padding-bottom: 1px;
      font-size: 14px;
      transition: 0.33s
    }
  }

  &:hover {
    .sidebar-item-icon {
      fill: rgba($primary, .8);
    }
    .sidebar-item-text {
      color: rgba($primary, .8);
    }
  }

  &.sidebar-link-selected, .sidebar-link-selected:focus {
    .sidebar-item-icon {
      fill: $accent;
    }
    .sidebar-item-text {
      color: $primary;
    }
  }
}

