@import 'src/assets/styles/variables';
@import 'src/assets/styles/mixins';

.el-tabs__header {
  padding: 0;
  position: relative;
  margin: 0 0 1px;
}

.el-tabs__active-bar {
  display: none;
}
// TODO: do we use this? RI 2021-02-02
.el-tabs__new-tab {
  float: right;
  border: 1px solid $tf-light-gray;
  height: 18px;
  width: 18px;
  line-height: 18px;
  margin: 12px 0 9px 10px;
  border-radius: 3px;
  text-align: center;
  font-size: 12px;
  color: $tf-extra-light-gray-1;
  cursor: pointer;
  transition: all .15s;

  &:hover {
    color: $tf-green;
  }

  .el-icon-plus {
    -webkit-transform: scale(.8, .8);
    transform: scale(.8, .8);
  }
}

.el-tabs__nav-wrap {
  overflow: hidden;
  margin-bottom: -1px;
  position: relative;

  &::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background-color: $tf-light-gray;
    z-index: 1;

    .el-tabs--card > .el-tabs__header & {
      content: none;
    }
  }

  &.is-scrollable {
    padding: 0 26px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
}

.el-tabs__nav-scroll {
  overflow: hidden;
}

.el-tabs__nav-next,
.el-tabs__nav-prev {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: 10px 0;
  z-index: 11;
  cursor: pointer;
  color: $tf-dark-gray;
  font-size: 20px;
  line-height: 26px;

  &.is-disabled {
    color: $tf-light-gray;
  }

  &:hover {
    color: $tf-green;
    background: $tf-light-green;
  }

  i {
    position: absolute;
    width: 26px;
    height: 26px;
    line-height: 26px;

    &::before {
      display: inline-block;
      width: 26px;
      height: 26px;
      text-align: center;
    }
  }
}

.el-tabs__nav-next {
  right: 0;
}

.el-tabs__nav-prev {
  left: 0;
}

.el-tabs__nav {
  white-space: nowrap;
  position: relative;
  transition: transform .3s;
  float: left;
  z-index: 2;
}

.el-tabs__item {
  padding: 0 20px;
  height: 41px;
  box-sizing: border-box;
  line-height: 40px;
  display: inline-block;
  list-style: none;
  font-size: 14px;
  font-weight: 500;
  color: $tf-dark-gray;
  position: relative;

  &.is-active::after {
    display: block;
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 5px;
    background: $tf-green;
    content: '';
    border-radius: 2.5px;
  }

  .tf-badge {
    margin-left: 6px;
  }

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

  &:focus.is-active.is-focus:not(:active) {
    box-shadow: 0 0 2px 2px $tf-green inset;
  }

  &:hover {
    color: $tf-green;
    cursor: pointer;
  }

  .el-icon-close {
    border-radius: 50%;
    text-align: center;
    transition: all .3s cubic-bezier(.645, .045, .355, 1);
    margin-left: 5px;

    &:hover {
      background-color: $tf-extra-light-gray-1;
      color: $tf-white;
    }

    &.is-disabled {
      color: $tf-extra-light-gray-1;
      cursor: default;
    }

    &:before {
      -webkit-transform: scale(.9);
      transform: scale(.9);
      display: inline-block;
    }

    &.is-active {
      color: $tf-green;
    }
  }
}

.el-tabs__content {
  overflow: hidden;
  position: relative;
}

.el-tabs--top,
.el-tabs.small-tabs {
  .el-tabs__nav-wrap::after {
    bottom: 2px;
    height: 1px;
    border-color: $tf-extra-light-gray-1;
  }

  .el-tabs__item {
    padding: 0;
    margin: 0 40px 0 0;
    height: 46px;
    font-size: 20px;
    font-weight: 700;
    color: $tf-dark-gray;

    > span {
      display: inline-flex;
      align-items: center;
    }

    &.is-active {
      color: $tf-green;
    }

    &.is-disabled {
      color: $tf-light-gray;
      cursor: not-allowed;
    }
  }
}

.el-tabs.small-tabs {
  .el-tabs__item {
    padding: 0;
    margin: 0 30px 0 0;
    height: 36px;
    font-size: 16px;
    font-weight: 700;
    line-height: 22px;

    &.is-active {
      color: $tf-blue;

      &::after {
        background: $tf-blue;
      }
    }
  }

  .el-tabs__nav-next,
  .el-tabs__nav-prev {
    margin: 0;

    &:hover {
      color: $tf-blue;
      background: $tf-light-blue;
    }
  }
}

.el-tabs.text-tabs {
  .el-tabs__active-bar {
    display: none;
  }

  .el-tabs__nav-wrap::after {
    display: none;
  }

  .el-tabs__item.is-top:nth-child(2) {
    padding: 0;
  }

  .el-tabs__item {
    height: 26px;
    margin: 0 15px 0 0;
    padding: 0;
    font-size: 14px;
    line-height: 26px;

    &:first-of-type {
      margin-left: 15px;
    }

    &.is-active {
      color: $tf-blue;

      &::after {
        content: none;
      }
    }
  }

  .el-tabs__nav-next,
  .el-tabs__nav-prev {
    margin: 0;

    &:hover {
      color: $tf-blue;
      background: $tf-light-blue;
    }
  }
}

/* stylelint-disable selector-max-compound-selectors */
/* stylelint-disable max-nesting-depth */
.el-tabs.file-tabs {
  .label {
    display: block;
    overflow: hidden;
    padding: 0 6px 0 10px;
    margin-top: 2px;
    height: 41px;
    max-width: 166px;
    border-left: 1px $tf-light-gray solid;
    line-height: 40px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .tf-tooltip {
    text-transform: none;
  }

  .el-icon-close {
    display: none;
  }

  .label-wrapper {
    padding-right: 20px;
  }

  .el-tabs__nav-scroll {
    overflow: visible;
  }

  .el-tabs__nav-wrap {
    background: $tf-extra-light-gray-2;
    margin-left: 54px;
    margin-right: 21px;
    height: 46px;
    overflow: visible;

    &::after {
      content: none;
    }

    &.is-scrollable {
      padding: 0 21px;
    }

    .el-tabs__nav-next,
    .el-tabs__nav-prev {
      margin: 0;
      width: 19px;
      height: 44px;
      z-index: 11;
      background: $tf-white url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 512'><path d='M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z' fill='#{str-replace(inspect($tf-medium-gray),'#','%23')}'/></svg>") 50% 50%/11px no-repeat;
      border: 1px $tf-light-gray solid;
      border-top: 0;
      border-bottom: 1px $tf-light-gray solid;

      i:before {
        content: none;
      }
    }

    .el-tabs__nav-next {
      transform: rotate(180deg);
      border-top: 1px $tf-light-gray solid;
      border-bottom: 0;
    }
  }

  > .el-tabs__header {
    position: relative;
    margin: 0;
    border-top: 1px $tf-medium-gray solid;

    // overflow-hidden compatible way to extend the rule line at the bottom of the tabs
    // to an area
    &::after {
      content: '';
      display: block;
      position: absolute;
      right: -2000px;
      bottom: 1px;
      width: 10000px;
      height: 1px;
      background: $tf-light-gray;
    }

    .el-tabs__nav {
      border: 0;
    }

    .close {
      position: absolute;
      right: 0;
      top: 0;

      svg {
        width: 7px;
        padding: 14px 9px;
      }
    }

    .el-tabs__item {
      height: 45px;
      margin: 0;
      padding: 0;
      z-index: 8;
      background: $tf-light-blue;
      border-radius: 0;
      border-top: 0;
      border-bottom: 1px $tf-light-gray solid;
      border-left: 1px transparent solid;
      text-transform: uppercase;
      font-size: 10px;
      line-height: 1;
      font-weight: 600;
      color: $tf-blue;

      &.is-active {
        z-index: 10;
        border-left: 1px $tf-light-gray solid;
        border-right: 1px $tf-light-gray solid;
        border-bottom-color: $tf-white;
        background: $tf-white;
        color: $tf-medium-blue;
        font-weight: 700;

        .label-container {
          margin: 0;
          background: $tf-white;
        }

        .label {
          border-left-color: $tf-white;
        }
      }

      &.is-active + .el-tabs__item,
      &:first-of-type {
        .label {
          border-left-color: transparent;
        }

        &.is-active {
          border-left-color: $tf-white;
        }
      }

      &:last-of-type:not(.is-active) {
        .label-wrapper {
          border-right: 1px $tf-light-gray solid;
        }
      }

      &.is-closable,
      &.is-closable:hover,
      &.is-active.is-closable,
      &.is-active.is-closable:hover {
        padding-left: 0;
        padding-right: 0;
      }
    }

    .el-tabs__item.is-top:nth-child(2) {
      padding-left: 0;
    }
  }

  .el-tabs__item.is-active::after {
    content: none;
  }
}

.el-tabs.file-tabs.locked {
  > .el-tabs__header {
    .el-tabs__item {
      color: $tf-light-gray;
      background: $tf-extra-light-gray-1;

      &.is-active {
        color: $tf-blue;
        background: $tf-white;
      }

      &:not(.is-active) {
        cursor: not-allowed;
      }
    }
  }
}

.file-tabs {
  .el-tabs--card {
    .label {
      display: block;
      overflow: hidden;
      padding: 0 6px 0 10px;
      margin-top: 2px;
      height: 41px;
      max-width: 166px;
      border-left: 1px $tf-light-gray solid;
      line-height: 40px;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .tf-tooltip {
      text-transform: none;
    }

    .el-icon-close {
      display: none;
    }

    .label-wrapper {
      padding-right: 20px;
    }

    .el-tabs__nav-scroll {
      overflow: visible;
    }

    .el-tabs__nav-wrap {
      margin-left: 54px;
      margin-right: 21px;
      height: 46px;
      overflow: visible;

      &.is-scrollable {
        padding: 0 21px;
      }

      .el-tabs__nav-next,
      .el-tabs__nav-prev {
        margin: 0;
        width: 19px;
        height: 44px;
        z-index: 11;
        background: $tf-white url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 512'><path d='M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z' fill='#{str-replace(inspect($tf-medium-gray),'#','%23')}'/></svg>") 50% 50%/11px no-repeat;
        border: 1px $tf-light-gray solid;
        border-top: 0;
        border-bottom: 1px $tf-light-gray solid;

        i:before {
          content: '';
        }
      }

      .el-tabs__nav-next {
        transform: rotate(180deg);
        border-top: 1px $tf-light-gray solid;
        border-bottom: 0;
      }
    }

    > .el-tabs__header {
      position: relative;
      margin: 0;
      border-top: 1px $tf-medium-gray solid;

      .el-tabs__nav {
        border: 0;
      }

      .close {
        position: absolute;
        right: 0;
        top: 0;

        svg {
          width: 7px;
          padding: 14px 8.5px;
        }
      }

      .el-tabs__item {
        height: 45px;
        margin: 0;
        padding: 0;
        z-index: 8;
        background: $tf-light-blue;
        border-radius: 0;
        border-top: 0;
        border-bottom: 1px $tf-light-gray solid;
        border-left: 1px transparent solid;
        text-transform: uppercase;
        font-size: 10px;
        line-height: 1;
        font-weight: 600;
        color: $tf-blue;

        &.is-active {
          z-index: 10;
          border-left: 1px $tf-light-gray solid;
          border-right: 1px $tf-light-gray solid;
          border-bottom-color: $tf-white;
          background: $tf-white;
          color: $tf-medium-blue;
          font-weight: 700;

          .label-container {
            margin: 0;
            background: $tf-white;
          }

          .label {
            border-left-color: $tf-white;
          }
        }

        &.is-active + .el-tabs__item,
        &:first-of-type {
          .label {
            border-left-color: transparent;
          }

          &.is-active {
            border-left-color: $tf-white;
          }
        }

        &:last-of-type:not(.is-active) {
          .label-wrapper {
            border-right: 1px $tf-light-gray solid;
          }
        }

        &.is-closable,
        &.is-closable:hover,
        &.is-active.is-closable,
        &.is-active.is-closable:hover {
          padding-left: 0;
          padding-right: 0;
        }
      }

      .el-tabs__item.is-top:nth-child(2) {
        padding-left: 0;
      }
    }

    .el-tabs__item.is-active::after {
      content: none;
    }
  }
}

/* stylelint-enable selector-max-compound-selectors */
/* stylelint-enable max-nesting-depth */
