@import "framework/variables";
@import 'framework/tw_bootstrap_variables';
@import "bootstrap/variables";

$active-background: rgba(0, 0, 0, .04);
$active-border: $indigo-500;
$active-color: $indigo-700;
$active-hover-background: $active-background;
$active-hover-color: $gl-text-color;
$inactive-badge-background: rgba(0, 0, 0, .08);
$hover-background: $indigo-700;
$hover-color: $white-light;
$inactive-color: $gl-text-color-secondary;
$new-sidebar-width: 220px;

.page-with-new-sidebar {
  @media (min-width: $screen-sm-min) {
    padding-left: $new-sidebar-width;
  }

  // Override position: absolute
  .right-sidebar {
    position: fixed;
    height: 100%;
  }

  .issues-bulk-update.right-sidebar.right-sidebar-expanded .issuable-sidebar-header {
    padding: 10px 0 15px;
  }
}

.context-header {
  position: relative;

  a {
    border-bottom: 1px solid $border-color;
    font-weight: 600;
    display: flex;
    align-items: center;
    padding: 10px 16px 10px 10px;
    color: $gl-text-color;

    @media (max-width: $screen-xs-max) {
      padding-right: 30px;
    }

    &:hover {
      background-color: $hover-background;
      color: $hover-color;
      border-color: $hover-background;

      .avatar-container {
        border-color: transparent;
      }

      .settings-avatar {
        background-color: $indigo-500;

        i {
          color: $hover-color;
        }
      }
    }
  }

  .avatar-container {
    flex: 0 0 40px;
    background-color: $white-light;
  }

  .project-title,
  .group-title {
    overflow: hidden;
    text-overflow: ellipsis;
  }


  &:hover {
    .close-nav-button {
      color: $white-light;
    }
  }

  .close-nav-button {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    background-color: transparent;
    border: 0;
    padding: 0 10px;

    @media (max-width: $screen-xs-max) {
      display: block;
    }

    &:hover {
      color: $gl-text-color;
    }
  }
}

.settings-avatar {
  background-color: $white-light;

  i {
    font-size: 20px;
    width: 100%;
    color: $gl-text-color-secondary;
    text-align: center;
    align-self: center;
  }
}

.nav-sidebar {
  position: fixed;
  z-index: 400;
  width: $new-sidebar-width;
  transition: left $sidebar-transition-duration;
  top: $header-height;
  bottom: 0;
  left: 0;
  overflow: auto;
  background-color: $gray-normal;
  box-shadow: inset -2px 0 0 $border-color;

  &.nav-sidebar-expanded {
    left: 0;
  }

  a {
    transition: none;
    text-decoration: none;
  }

  ul {
    padding-left: 0;
    list-style: none;
  }

  li {
    white-space: nowrap;

    a {
      display: flex;
      align-items: center;
      padding: 12px 16px;
      color: $inactive-color;
    }

    svg {
      fill: $inactive-color;
    }
  }

  .nav-item-name {
    flex: 1;
  }

  li.active {
    box-shadow: inset 4px 0 0 $active-border;

    > a {
      color: $active-color;
      font-weight: 700;
    }

    svg {
      fill: $active-color;
    }
  }

  @media (max-width: $screen-xs-max) {
    left: (-$new-sidebar-width);
  }

  .nav-icon-container {
    display: flex;
    margin-right: 8px;

    svg {
      height: 16px;
      width: 16px;
    }
  }
}

.with-performance-bar .nav-sidebar {
  top: $header-height + $performance-bar-height;
}

.sidebar-sub-level-items {
  display: none;
  padding-bottom: 8px;

  > li {
    a {
      padding: 8px 16px 8px 50px;

      &:hover,
      &:focus {
        background: $active-hover-background;
        color: $active-hover-color;
      }
    }

    &.active {
      a {
        &,
        &:hover,
        &:focus {
          background: $active-background;
          color: $active-color;
        }
      }
    }
  }
}

.sidebar-top-level-items {
  > li {
    > a {
      @media (min-width: $screen-sm-min) {
        margin-right: 2px;
      }

      &:hover {
        color: $gl-text-color;
      }
    }

    &:not(.active) {
      > a {
        margin-left: 1px;
        margin-right: 3px;
      }

      .sidebar-sub-level-items {
        @media (min-width: $screen-sm-min) {
          position: fixed;
          top: 0;
          left: 220px;
          width: 150px;
          margin-top: -1px;
          padding: 8px 1px;
          background-color: $white-light;
          box-shadow: 2px 1px 3px $dropdown-shadow-color;
          border: 1px solid $gray-darker;
          border-left: 0;
          border-radius: 0 3px 3px 0;

          &::before {
            content: "";
            position: absolute;
            top: -30px;
            bottom: -30px;
            left: 0;
            right: -30px;
            z-index: -1;
          }

          &::after {
            content: "";
            position: absolute;
            top: 44px;
            left: -30px;
            right: 35px;
            bottom: 0;
            height: 100%;
            max-height: 150px;
            z-index: -1;
            transform: skew(33deg);
          }

          &.is-above {
            margin-top: 1px;

            &::after {
              top: auto;
              bottom: 44px;
              transform: skew(-30deg);
            }
          }

          a {
            padding: 8px 16px;
            color: $gl-text-color;

            &:hover,
            &:focus {
              background-color: $gray-darker;
            }
          }
        }
      }
    }

    .badge {
      background-color: $inactive-badge-background;
      color: $inactive-color;
    }

    &.active {
      background: $active-background;

      > a {
        margin-left: 4px;
      }

      .badge {
        color: $active-color;
        font-weight: 600;
      }

      .sidebar-sub-level-items {
        display: block;
      }
    }

    &:not(.active):hover > a,
    > a:hover,
    &.is-over > a {
      background-color: $white-light;
    }
  }
}

.toggle-mobile-nav {
  display: none;
  background-color: transparent;
  border: 0;
  padding: 6px 16px;
  margin: 0 16px 0 -15px;
  height: 46px;
  border-right: 1px solid $gl-text-color-quaternary;

  i {
    font-size: 20px;
    color: $gl-text-color-secondary;
  }

  @media (max-width: $screen-xs-max) {
    display: inline-block;
  }
}

.mobile-overlay {
  display: none;

  &.mobile-nav-open {
    display: block;
    position: fixed;
    background-color: $black-transparent;
    height: 100%;
    width: 100%;
    z-index: 300;
  }
}


// Make issue boards full-height now that sub-nav is gone

.boards-list {
  height: calc(100vh - #{$header-height});

  @media (min-width: $screen-sm-min) {
    height: 475px; // Needed for PhantomJS
    // scss-lint:disable DuplicateProperty
    height: calc(100vh - 180px);
    // scss-lint:enable DuplicateProperty
  }
}

.with-performance-bar .boards-list {
  height: calc(100vh - #{$header-height} - #{$performance-bar-height});
}


// Change color of all horizontal tabs to match the new indigo color
.nav-links li.active a {
  border-bottom-color: $active-border;

  .badge {
    font-weight: 600;
  }
}
