// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

.dashboard-sidebar {
  background-color: $color-white;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: $size-2;

  .sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 0;

    hr {
      border-color: $color-gray-10;
      margin: 1rem 15px;
    }
  }

  .sidebar-team-switch {
    position: relative;
    display: flex;
    margin: 5px 15px;

    .teams-dropdown {
      left: 0;
      top: 50px;
      z-index: 12;
      max-height: 30rem;
      min-width: 234px;
      overflow-y: auto;
    }

    .options-dropdown {
      right: 2px;
      top: 50px;
      z-index: 12;
      max-height: 30rem;
      min-width: 162px;
    }

    .switch-content {
      height: 40px;
      display: flex;
      width: 100%;
      border: 1px solid $color-gray-10;
      border-radius: $br5;
      align-items: center;
    }

    .switch-options {
      display: flex;
      max-width: 22px;
      min-width: 28px;
      border-left: 1px solid $color-gray-10;
      justify-content: center;
      align-items: center;
      cursor: pointer;
      background-color: transparent;
      border: none;
      svg {
        width: 15px;
        height: 13px;
        fill: $color-gray-60;
      }
    }

    .current-team {
      cursor: pointer;
      display: flex;
      align-items: center;
      flex-grow: 1;
      font-size: $fs14;
      padding: 0px 10px;
      background-color: transparent;
      border: none;
    }

    .team-name {
      flex-grow: 1;
      display: flex;
      height: 40px;
      align-items: center;

      &.action {
        .team-icon {
          border-radius: 50%;
          background-color: $color-gray-10;
          height: 24px;
          margin-right: 10px;
          padding: 6px;
          width: 24px;

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

        &:hover {
          .team-icon {
            background-color: $color-primary;
          }
        }

        .team-text {
          width: 150px;
        }
      }

      .team-icon {
        display: flex;
        align-items: center;
        padding-right: 10px;

        svg {
          width: 23px;
          height: 23px;
          fill: $color-gray-60;
        }

        img {
          border-radius: 50%;
          flex-shrink: 0;
          height: 23px;
          width: 23px;
        }
      }

      .team-text {
        color: $color-gray-60;
        @include text-ellipsis;
        width: 130px;
        text-align: left;
      }

      .icon {
        margin-left: auto;
        svg {
          fill: $color-gray-60;
        }
      }
    }

    .switch-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      svg {
        width: 10px;
        height: 10px;
        fill: $color-gray-60;
      }
    }
  }

  .sidebar-empty-placeholder {
    padding: 10px 12px;
    color: $color-gray-30;
    display: flex;
    align-items: flex-start;

    .icon {
      padding: 0px 10px;
      svg {
        fill: $color-gray-30;
        width: 12px;
        height: 12px;
      }
    }
    .text {
      font-size: $fs12;
    }
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin: 0;
    user-select: none;

    // TODO: should be deprecated / unclear name
    &.dashboard-common {
      overflow: unset;
    }

    &.no-overflow {
      overflow: unset;
    }

    & > li {
      align-items: center;
      cursor: pointer;
      display: flex;
      flex-shrink: 0;
      padding: $size-2;
      a {
        font-weight: $fw400;
        width: 100%;
        &:hover {
          text-decoration: none;
        }
      }

      svg {
        fill: $color-black;
        margin-right: 8px;
        height: $size-3;
        width: $size-3;
      }

      span.element-title {
        color: $color-gray-60;
        font-size: $fs14;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      &::before {
        background-color: transparent;
        border-radius: $br3;
        content: "";
        height: 26px;
        margin-right: $size-2;
        width: 4px;
      }

      &.recent-projects {
        svg {
          fill: $color-white;
        }
      }

      & .edit-wrapper {
        border: 1px solid $color-gray-10;
        border-radius: $br3;
        display: flex;
        width: 100%;
      }

      input.element-title {
        border: 0;
        height: 30px;
        padding: 5px;
        margin: 0;
        width: 100%;
        background-color: $color-white;
      }

      .close {
        background-color: $color-white;
        cursor: pointer;
        padding-left: 5px;

        svg {
          fill: $color-gray-30;
          height: 15px;
          transform: rotate(45deg) translateY(7px);
          width: 15px;
          margin: 0;
        }
      }

      .element-subtitle {
        color: $color-gray-20;
        font-style: italic;
      }

      &:hover {
        &::before {
          background-color: $color-gray-10;
        }
      }

      &.current {
        a {
          font-weight: $fw700;
        }

        &::before {
          background-color: $color-primary;
        }
      }

      &.dragging {
        background-color: color.adjust($color-primary, $alpha: -0.69);
      }
    }
  }

  .sidebar-search {
    align-items: center;
    background-color: $color-white;
    border: 1px solid $color-gray-10;
    border-radius: $br5;
    display: flex;
    margin: 5px 15px;

    .input-text {
      background: transparent;
      border: 0;
      color: $color-gray-60;
      font-size: $fs14;
      padding: 6px;
      margin: 0;
      max-width: 195px;
      width: 100%;
      height: 40px;
    }

    &:focus,
    &:focus-within {
      border-color: $color-black;
    }

    .search,
    .clear-search {
      align-items: center;
      cursor: pointer;
      display: flex;
      height: 22px;
      margin-left: auto;
      padding: 0 $size-2;
      width: 32px;

      svg {
        fill: $color-gray-30;
        height: 15px;
        width: 15px;
      }
    }

    .clear-search svg {
      transform: rotate(45deg);

      &:hover {
        fill: $color-danger;
      }
    }
  }

  &.profile-bar {
    background-color: $color-gray-10;

    .dashboard-sidebar-inside {
      display: none;
    }
  }
}

.projects-row {
  align-items: center;
  display: flex;
  margin-top: 1rem;
  padding: $size-2;
  position: relative;

  span {
    color: $color-gray-30;
    font-size: $fs14;
  }

  .btn-icon-light {
    margin-left: auto;
  }

  &::before {
    background-color: $color-gray-10;
    content: "";
    height: 1px;
    left: 4%;
    position: absolute;
    right: 4%;
    top: -5px;
    width: 92%;
  }
}

.team-form-modal {
  h2 {
    font-weight: $fw400;
    color: $color-gray-40;
    font-size: 28px;
    margin-bottom: 30px;
  }

  .buttons-row {
    margin-top: 20px;
    display: flex;
    justify-content: center;
  }

  input[type="submit"] {
    margin-bottom: 0px;
  }
}

.profile-section {
  align-items: center;
  cursor: pointer;
  display: flex;
  padding: 10px 15px;
  position: relative;

  .profile {
    align-items: center;
    cursor: pointer;
    display: flex;
    flex-grow: 1;

    span {
      @include text-ellipsis;
      color: $color-black;
      margin: 10px;
      font-size: $fs14;
      max-width: 160px;
    }

    img {
      border-radius: 50%;
      flex-shrink: 0;
      height: 25px;
      width: 25px;
    }
    svg {
      height: 10px;
      margin-left: auto;
      margin-right: $size-2;
      width: 10px;
    }
  }

  .dropdown {
    left: 15px;
    bottom: 45px;
    min-width: 189px;

    @include animation(0, 0.2s, fadeInUp);

    li {
      font-size: $fs14;
      padding: $size-2 $size-4;

      svg {
        fill: $color-gray-20;
        margin-right: $size-2;

        height: 12px;
        width: 12px;
      }

      &.separator {
        border-top: 1px solid $color-gray-10;
      }
    }
  }
}

.primary-badge {
  border: 1px solid $color-primary;
  border-radius: $br2;
  font-size: $fs9 !important;
  font-weight: $fw500;
  color: $color-primary !important;
  padding: 2px 4px;
}
