@import '../../../assets/scss/variables.scss';
@import '../../../assets/scss/mixins.scss';

.g-sidebar {
  position: absolute;
  top: 0;
  z-index: 999;
  display: none;
  width: $sidebar-desktop-width;
  min-height: 100%;
  padding: 50px 0 35px;
  color: #fff;
  background: #2a3f54;

  @media (min-width: 768px) {
    display: block;
  }

  &__profile {
    padding: 10px;

    &-photo {
      width: 56px;
      margin-right: 10px;
    }

    &-message {
      display: block;
      color: #bab8b8;
    }

    &-name {
      color: #ecf0f1;
      font-weight: 300;
      font-size: 14px;
    }
  }

  &__footer {
    position: fixed;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    width: $sidebar-desktop-width;
    height: 50px;
    margin: 0;
    padding: 0;
    list-style: none;
    background: #2a3f54;

    &-list {
      float: left;
      width: 25%;
      text-align: center;
      background: #172d44;
    }

    &-link {
      display: block;
      padding: 5px 0;
      color: #5a738e;
      font-size: $sidebar-icon-size;

      &:hover {
        color: #fff;
        background: #425567;
      }
    }
  }

  &__menu {
    &-title {
      display: block;
      padding: 7px 10px 7px;
      font-weight: 700;
      font-size: 11px;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      text-shadow: 1px 1px #000;
    }

    &-item {
      position: relative;
      margin-top: 1px;

      &--arrow::after {
        position: absolute;
        top: 16px;
        right: 15px;
        color: #c4cfda;
        font-size: 10px;
        @include font-awesome('\f078');
      }

      &--active.g-sidebar__menu-item--arrow::after {
        content: '\f077';
      }
    }

    &-link {
      display: block;
      margin-bottom: 1px;
      padding: 12px 15px;
      color: #e7e7e7;
      cursor: pointer;

      &:hover {
        color: #f2f5f7;
      }
    }

    // First Level Menu
    &-list {
      margin-bottom: 10px;
      padding: 0;
      color: #e7e7e7;
      font-weight: 500;
      list-style: none;

      .g-sidebar__menu-list {
        display: none;
        margin: 0;

        .g-sidebar__menu {
          &-item {
            margin: 0;

            &--arrow::after {
              top: 8px;
            }
          }

          &-link {
            margin-bottom: 0;
            padding: 6px 15px 6px 45px;
            color: #cacfd4;
            font-size: 12px;

            &:hover {
              color: #f2f5f7;
            }
          }

          // Second Level Menu
          &-list {
            .g-sidebar__menu-link {
              padding-left: 60px;
            }
          }
        }
      }
    }

    &-icon {
      width: 26px;
      font-size: $sidebar-icon-size;
      font-style: normal;
      text-align: center;
    }

    // Active and Selected state
    > .g-sidebar__menu-list > .g-sidebar__menu-item {
      &--active,
      &--selected {
        color: #f2f5f7;
        background-color: #324558;

        > .g-sidebar__menu-link {
          color: #f2f5f7;
          text-shadow: rgba(0, 0, 0, 0.25) 0 -1px 0;
          background: linear-gradient(#334556, #2c4257), #2a3f54;
          box-shadow: rgba(0, 0, 0, 0.25) 0 1px 0, inset rgba(255, 255, 255, 0.16) 0 1px 0;
        }

        .g-sidebar__menu-link:hover {
          background-color: #3d4f62;
        }

        .g-sidebar__menu-list > .g-sidebar__menu-item--active > .g-sidebar__menu-link {
          color: #f2f5f7;
          background-color: #3d4f62;
        }
      }

      &--selected {
        border-left: 5px solid #1abb9c;

        .g-sidebar__menu-link {
          padding-left: 40px;
        }

        > .g-sidebar__menu-link {
          padding-left: 10px;
        }

        > .g-sidebar__menu-list {
          display: block;

          > .g-sidebar__menu-item--selected {
            > .g-sidebar__menu-list {
              display: block;
            }
          }
        }

        .g-sidebar__menu-list .g-sidebar__menu-list .g-sidebar__menu-link {
          padding-left: 65px;
        }
      }
    }
  }

  // Collapse
  &--collapse {
    display: block;
    width: $sidebar-mobile-width;

    .g-sidebar {
      &__site-name,
      &__details,
      &__menu-title,
      &__menu-description {
        display: none;
      }

      &__title {
        text-align: center;
      }

      &__footer {
        display: none;
        width: 50px;
      }

      &__menu {
        &-list {
          margin-bottom: 0;
        }
      }
    }

    .g-sidebar__menu > .g-sidebar__menu-list > .g-sidebar__menu-item {
      &.g-sidebar__menu-item--arrow::after {
        display: none;
      }

      > .g-sidebar__menu-list {
        display: none !important;

        .g-sidebar__menu-link {
          padding-left: 15px;
        }

        .g-sidebar__menu-list {
          .g-sidebar__menu-link {
            padding-left: 30px;
          }
        }
      }

      &--toggle {
        background: linear-gradient(#334556, #2c4257), #2a3f54;
        box-shadow: rgba(0, 0, 0, 0.25) 0 1px 0, inset rgba(255, 255, 255, 0.16) 0 1px 0;

        .g-sidebar__menu-description {
          position: absolute;
          top: 0;
          left: 50px;
          z-index: 1000;
          display: block;
          width: 180px;
          padding: 13px 15px;
          background: #2a3f54;
          background: linear-gradient(#334556, #2c4257), #2a3f54;
          border-top-right-radius: 0.25em;
          border-bottom-right-radius: 0.25em;
          box-shadow: rgba(0, 0, 0, 0.25) 0 1px 0, inset rgba(255, 255, 255, 0.16) 0 1px 0;
        }

        > .g-sidebar__menu-list {
          position: absolute;
          top: 43px;
          left: 50px;
          display: block !important;
          width: 180px;
          padding-top: 3px;
          background: #324558;
          border-bottom-right-radius: 0.25em;
        }
      }

      &--selected.g-sidebar__menu-item--toggle {
        .g-sidebar__menu-description,
        > .g-sidebar__menu-list {
          left: 45px;
        }
      }
    }
  }
}
