@import '../../style/themes/index';
@import './variables.less';

@new-background-hovered: rgba(241, 242, 243, 1);
@new-background-pressed: rgba(237, 238, 239, 1);
@new-icon: rgba(92, 95, 98, 1);
@new-icon-hovered: rgba(26, 28, 29, 1);
@new-icon-pressed: rgba(68, 71, 74, 1);
@new-text-disabled: rgb(7, 8, 10);
@new-text-subdued: rgba(109, 113, 117, 1);

@navigation-prefix: ~'@{ant-prefix}-navigation';

.@{navigation-prefix} {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: calc(100vw - 64px);
  min-width: 240px;
  max-width: 360px;
  height: 100%;
  min-height: 100%;
  padding-bottom: 0;
  background-color: #f7f8fa;
  border-right: 1px solid @divider-color;
  -webkit-overflow-scrolling: touch;

  &:focus {
    outline: none;
  }

  @media (min-width: @screen-md-min) {
    max-width: 240px;
  }

  &-primary {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
    overflow: auto;

    &:focus {
      outline: none;
    }

    @media (min-width: @screen-md-min) {
      padding-top: 12px;
    }
  }

  &-item {
    .nav-item-attributes();
    position: relative;
  }

  &-item-selected {
    color: @primary-color;
    font-weight: 600;
    background-color: #fff;
    border-left: 3px solid @primary-color;

    &:hover {
      color: @primary-color;
      background-color: #fff;
    }

    &:active,
    &:active:hover {
      color: @primary-color;
      background-color: #fff;
    }
  }

  &-item-disabled {
    color: @new-text-disabled;
    opacity: 0.6;
    pointer-events: none;

    .@{navigation-prefix}-icon {
      opacity: 0.6;
    }
  }

  &-sub-navigation-active {
    color: @primary-color;
    background-color: #fff;
    border-left: 3px solid @primary-color;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  }

  &-badge {
    display: flex;
    align-items: center;
    margin-left: 8px;
  }

  &-icon {
    .nav-item-icon-attributes();
  }

  &-arrow {
    transition: all 0.3s ease-out;
    fill: @text-color;

    .@{navigation-prefix}-item:hover & {
      fill: @primary-color;
    }

    .@{navigation-prefix}-item-selected &,
    .@{navigation-prefix}-item-selected:hover &,
    .@{navigation-prefix}-sub-navigation-active &,
    .@{navigation-prefix}-sub-navigation-active:hover & {
      fill: @primary-color;
    }
  }

  &-list-item {
    .nav-list-item-attributes();

    &:not(:first-child) {
      .@{navigation-prefix}-item {
        margin-top: 5px;
      }
    }
  }

  &-list-item-has-action &-item {
    max-width: calc(100% - 56px);
  }

  &-item-wrapper {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
  }

  &-text {
    .nav-item-text-attributes();
  }

  &-secondary-action {
    display: flex;
    align-items: center;
    height: 40px;
    margin-right: 4px;
    padding: 4px 16px;
    border-radius: @border-radius-base;
    cursor: pointer;

    svg {
      fill: @new-icon;
    }

    @media (min-width: @screen-md-min) {
      height: 32px;
    }

    &:hover,
    &:focus,
    &:active {
      background: @new-background-hovered;

      svg {
        fill: @new-icon-hovered;
      }

      @media (-ms-high-contrast: active) {
        svg {
          fill: #fff;
        }
      }
    }
    &:active {
      background: @new-background-pressed;

      svg {
        color: @new-icon-pressed;
      }
    }

    &:focus,
    &:active {
      outline: none;
    }
  }

  &-secondary-navigation {
    flex-basis: 100%;
    margin-left: 0;
    overflow-x: visible;

    &.@{navigation-prefix}-is-expanded {
      margin-bottom: 8px;
    }

    .@{navigation-prefix}-list {
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .@{navigation-prefix}-item {
      height: 34px;
      padding-left: 48px;
      font-weight: 500;
      font-size: 15px;
    }

    .@{navigation-prefix}-text {
      margin-top: 6px;
      margin-bottom: 6px;
      line-height: 20px;
    }

    .@{navigation-prefix}-item-selected {
      color: @primary-color;
    }
    .@{navigation-prefix}-item-disabled {
      color: @new-text-disabled;
      font-weight: 500;
    }
  }

  &-secondary-navigation-no-icon {
    margin-left: 16px;
  }

  // Section styles
  &-section {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 0 16px 0;
    list-style: none;

    + .@{navigation-prefix}-section {
      padding-top: 4px;
    }
  }

  &-section-fill {
    flex: 1 0 auto;
  }

  &-section-with-separator {
    border-top: #e4e4e4;
  }

  &-section-heading {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding-left: 16px;
    font-weight: 600;
    font-size: 13px;
    line-height: 16px;
    text-transform: uppercase;

    @media (min-width: 640px) {
      font-size: 12px;
    }

    .@{navigation-prefix}-text {
      color: #b0afaf;
      font-size: 13px;

      @media (min-width: 640px) {
        font-size: 12px;
      }
    }

    .@{navigation-prefix}-action {
      display: flex;
      align-items: center;
      margin: 0;
      margin-right: 4px;
      padding: 0;
      padding: 4px 16px;
      color: inherit;
      font-size: inherit;
      line-height: inherit;
      background: none;
      border: none;
      border-radius: @border-radius-base;
      cursor: pointer;
      appearance: none;

      &:focus {
        outline: none;
      }

      svg {
        fill: @new-icon;
      }

      &:hover,
      &:focus {
        background: @new-background-hovered;
        svg {
          fill: @new-icon-hovered;
        }

        @media (-ms-high-contrast: active) {
          svg {
            fill: #fff;
          }
        }
      }

      &:focus:hover {
        svg {
          fill: @new-icon-hovered;
        }
      }

      &:active,
      &:active:hover {
        background: @new-background-pressed;

        svg {
          fill: @new-icon-pressed;
        }
      }

      &:focus,
      &:active {
        outline: none;
      }
    }
  }

  &-rollup-toggle {
    color: @new-text-subdued;
    font-weight: 400;

    &:hover {
      color: @primary-color;

      svg {
        fill: @primary-color;
      }
    }

    &:focus {
      outline: none;
    }
  }

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

  &-secondary-navigation-no-icon &-item {
    padding-left: 8px + 4px;
  }
}
