@import "globals";

.sidebar {
  position: fixed;
  width: $sidebar-width;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 4;
  background-color: $sidebar-background-color;
  color: $sidebar-text-color;
  transition: background-color $transitions-duration;
  padding-bottom: 32px;

  @include for-mobile {
    min-width: 280px;
    max-width: 360px;
    width: 80%;
    padding-bottom: 0;
    transform: translate3d(-100%, 0, 0);
    transition: transform $transitions-duration cubic-bezier(0, 0.5, 0.5, 1);
  }

  &.sidebar-opened {
    @include for-mobile {
      transform: none;
      box-shadow: 0 0 30px 10px rgba(0, 0, 0, 0.2);
    }
  }

  &-header {
    display: none;
    background-color: $sidebar-background-color;
    color: $sidebar-text-color;
    height: $sidebar-header-height;
    line-height: $sidebar-header-height;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 3;
    transition: background-color $transitions-duration, transform $transitions-duration;

    @include for-mobile {
      display: block;

      body.scroll-to-bottom & {
        transform: translate3d(0, -100%, 0);
      }
    }

    &-menu {
      &, &:visited, &:hover {
        display: inline-block;
        font-size: 14px;
        text-transform: uppercase;
        color: $sidebar-link-color;
        line-height: $sidebar-header-height;
        padding: 0 16px;
        border-right: 1px solid $sidebar-contrast-background-color;
      }

      &-icon {
        font-size: 16px;
        vertical-align: middle;
      }
    }
  }

  &-close {
    display: none;
    float: right;
    padding: 4px;
    margin: 12px 18px 0 12px;
    background: $sidebar-contrast-background-color;
    border-radius: 5px;
    z-index: 1;

    @include for-mobile {
      display: inline-block;
    }

    &.popup {
      background-color: $sidebar-popup-search-input-background-color;
    }

    &-icon {
      color: $sidebar-action-color;
      font-size: 28px;
      font-weight: bold;
      vertical-align: middle;
    }

    &.popup &-icon {
      color: $sidebar-popup-search-input-text-color;
    }
  }

  &-wrapper {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  &-section {
    padding: 20px 0;
    border-bottom: 1px solid $sidebar-contrast-background-color;
    transition: border-bottom-color 0.3s;

    @include for-mobile {
      padding: 10px 0;
    }

    &:last-child {
      border-bottom: 0;
    }
  }

  &-title {
    display: block;
    color: $sidebar-text-color;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 14px 0 24px;
    margin-bottom: 10px;
    transition: color $transitions-duration;

    @include for-mobile {
      padding: 12px 18px 12px 30px;
      margin-bottom: 0;

      html.touchevents & {
        padding-left: 20px;
      }
    }

    &-link {
      &, &:visited, &:hover {
        color: $sidebar-text-color;
        font-weight: bold;
        transition: color $transitions-duration;
      }

      &:hover {
        color: $sidebar-hover-title-action-item-color;
      }
    }
  }

  &-link {
    &, &:visited, &:hover {
      display: block;
      color: $sidebar-link-color;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding: 8px 12px 8px 24px;
      vertical-align: middle;
      transition: color $transitions-duration, background-color $transitions-duration;
      position: relative;

      @include for-mobile {
        padding: 12px 18px 12px 30px;

        html.touchevents & {
          padding-left: 20px;
        }
      }

      &.icon {
        font-size: 11px;
        text-transform: uppercase;
      }
    }

    &:hover, &.selected {
      color: $sidebar-hover-link-color;
      background-color: $sidebar-hover-background-color;
    }

    &-icon {
      font-size: 18px;
      vertical-align: middle;
      margin-right: 6px;
      color: $sidebar-icon-color;
      transition: color $transitions-duration;
    }

    &-label {
      vertical-align: middle;
      display: inline-block;
      transition: transform $transitions-duration;

      html.touchevents .editing & {
        display: inline-block;
        transform: translate3d(20px, 0, 0);
      }
    }
  }

  &-center-link {
    &, &:visited, &:hover {
      display: block;
      color: $sidebar-action-color;
      font-size: 11px;
      text-align: center;
      padding: 8px 0;
      text-transform: uppercase;
      transition: color $transitions-duration, background-color $transitions-duration;

      @include for-mobile {
        padding: 12px 20px;
      }
    }

    &:hover {
      color: $sidebar-hover-action-color;
      background-color: $sidebar-hover-background-color;
    }
  }

  &-left {
    position: absolute;
    left: 4px;

    html.touchevents & {
      top: 0;
      bottom: 0;
      transition: opacity $transitions-duration, transform $transitions-duration;
    }

    &.collapsible {
      display: none;

      html.touchevents & {
        display: inline-block;
        width: 0;
        opacity: 0;
        transform: scale(0);
        overflow: hidden;
      }
    }

    &-pin, &-unpin {
      &, &:visited, &:hover {
        display: inline-block;
        position: absolute;
        top: 1px;
        font-size: 14px;
        color: $sidebar-action-color;
        transition: color $transitions-duration;

        html.touchevents & {
          position: static;
          padding: 6px;
          margin-top: 6px;
          font-size: 18px;
        }
      }

      &:hover {
        color: $sidebar-hover-action-color;
      }
    }

    .apps-list-pinned &-pin {
      display: none;
    }

    .apps-list &-unpin {
      display: none;
    }
  }

  html.no-touchevents &-link:hover &-left.collapsible {
    display: inline-block;
  }

  html.touchevents .editing &-left.collapsible {
    opacity: 1;
    transform: scale(1);
    width: auto;
  }

  &-right {
    float: right;
    margin-left: 10px;

    &.collapsible {
      display: none;

      html.touchevents & {
        display: inline;
      }
    }

    &-edit {
      display: none;
      font-size: 18px;

      html.touchevents & {
        display: inline;
      }
    }

    &-plus {
      font-size: 14px;
      outline: 0;
    }

    &-arrow {
      color: $sidebar-arrow-color;
      font-size: 16px;
      font-weight: bold !important;
      transition: color $transitions-duration, opacity $transitions-duration;

      html.touchevents .editing & {
        opacity: 0;
      }
    }

    &-remove {
      &, &:visited, &:hover {
        position: relative;
        color: $sidebar-action-color;
        transition: color $transitions-duration;
      }

      &:hover {
        color: $sidebar-hover-action-color;
      }
    }
  }

  &-link:hover &-right.collapsible {
    display: inline-block;
  }

  &-link:hover &-right-arrow {
    color: $sidebar-hover-arrow-color;
  }

  .clone {
    display: none;
  }

  .apps-hide {
    &-label {
      display: none;
    }

    &.apps-visible .apps-hide-label.apps-visible {
      display: inline;
    }

    &.apps-hidden .apps-hide-label.apps-hidden {
      display: inline;
    }
  }

  &-copyright {
    background-color: $sidebar-contrast-background-color;
    color: $sidebar-contrast-text-color;
    height: 32px;
    line-height: 32px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    transition: background-color $transitions-duration, color $transitions-duration;

    @include for-mobile {
      display: none;
    }
  }

  &-popup {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: $sidebar-width;
    color: $sidebar-popup-text-color;
    background-color: $sidebar-popup-background-color;
    overflow-y: auto;

    @include for-mobile {
      min-width: 280px;
      max-width: 360px;
      width: 80%;
    }

    &-container {
      display: none;
      background-color: transparentize($sidebar-popup-overlay-color, 0.5);
      position: fixed;
      top: 0;
      left: $sidebar-width;
      bottom: 0;
      right: 0;
      z-index: 5;

      @include for-mobile {
        left: 0;
      }
    }

    &-section {
      display: none;
    }

    &-title {
      font-size: 12px;
      font-weight: bold;
      text-transform: uppercase;
      padding: 20px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;

      @include for-mobile {
        padding: 24px 20px;
        margin-bottom: 0;
        font-size: 14px;
      }
    }

    &-search {
      background-color: $sidebar-popup-search-input-background-color;
      color: $sidebar-popup-search-input-text-color;
      width: 100%;
      height: 32px;
      text-indent: 20px;
      border: 0;
      font-size: 13px;
      outline: 0;
      padding: 0;
      margin: 0 0 12px 0;
      border-radius: 0;

      //noinspection CssInvalidPseudoSelector
      &::placeholder {
        color: $sidebar-popup-search-input-placeholder-color;
      }

      @include for-mobile {
        font-size: 14px;
        height: 40px;
      }
    }

    &-list {
      margin: 0;
      padding: 0;
      list-style: none;

      &-item {
        a, a:visited, a:hover {
          color: $sidebar-popup-link-text-color;
          padding: 8px 20px;
          display: block;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;

          @include for-mobile {
            padding: 12px 20px;
          }
        }

        &.selected a {
          background-color: $sidebar-popup-hover-link-background-color;
          color: $sidebar-popup-hover-link-color;
        }
      }
    }
  }
}
