@import "mixins/mixins";
@import "common/var";

@include b(tabs) {
  @include e(header) {
    padding: 0;
    position: relative;
    margin: 0 0 15px;
  }
  @include e(active-bar) {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background-color: $--color-primary;
    z-index: 1;
    transition: transform .3s cubic-bezier(.645,.045,.355,1);
    list-style: none;
  }
  @include e(new-tab) {
    float: right;
    border: 1px solid #d3dce6;
    height: 18px;
    width: 18px;
    line-height: 18px;
    margin: 12px 0 9px 10px;
    border-radius: 3px;
    text-align: center;
    font-size: 12px;
    color: #d3dce6;
    cursor: pointer;
    transition: all .15s;

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

    &:hover {
      color: $--color-text-primary;
    }
  }
  @include e(nav-wrap) {
    overflow: hidden;
    margin-bottom: -1px;
    position: relative;

    &::after {
      content: "";
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;
      height: 1px;
      background-color: $--border-divider-color;
      z-index: $--index-normal;
    }

    @include when(scrollable) {
      padding: 0 20px;
      box-sizing: border-box;
    }
  }
  @include e(nav-scroll) {
    overflow: hidden;
  }
  @include e((nav-next, nav-prev)) {
    position: absolute;
    cursor: pointer;
    line-height: 32px;
    font-size: 14px;
    color: $--color-text-secondary;
    i:hover {
      cursor: pointer;
      background-color: $--color-grey-3;
      color: $--color-primary;
    }
    &.is-disabled {
      cursor: not-allowed;
      i:hover {
        cursor: not-allowed;
        background-color: inherit;
        color: inherit;
      }
    }
  }
  @include e(nav-next) {
    right: 0;
  }
  @include e(nav-prev) {
    left: 0;
  }
  @include e(nav) {
    white-space: nowrap;
    position: relative;
    transition: transform .3s;
    float: left;
    z-index: #{$--index-normal + 1};
  }
  @include e(item) {
    padding: 0 12px;
    height: 38px;
    box-sizing: border-box;
    line-height: 38px;
    display: inline-block;
    list-style: none;
    font-size: 14px;
    min-width: 56px;
    text-align: center;
    color: $--color-text-regular;
    position: relative;
    // margin-right: 32px;

    &:last-child {
      margin-right: 0px;
    }
    &:first-child {
      left: 0 !important;
    }

    &:focus, &:focus:active {
      outline: none;
    }
    .prefixIcon22{
      font-size: 22px;
      margin-right: 4px;
    }
    .prefixIcon16{
      font-size: 16px;
      margin-right: 4px;
    }

    &:hover {
      .close-btn-icon {
        opacity: 1;
      }
    }

    /* &:focus.is-active.is-focus:not(:active) {
      box-shadow: 0 0 2px 2px #409eff inset;
      border-radius: 3px;
    } */

    & .close-btn-icon {
      opacity: 0;
      // border-radius: 50%;
      // text-align: center;
      transition: all .3s cubic-bezier(.645,.045,.355,1);
      margin-left: 5px;
      color: $--color-text-primary;
      i {
        margin-top: -2px;
      }
      // &:before {
      //   transform: scale(.9);
      //   display: inline-block;
      // }
    }

    @include when(active) {
      color: $--color-text-primary;
      font-weight: $--font-weight-medium;
      // height: 38px;
      // line-height: 38px;
    }

    &:hover {
      color: $--color-text-primary;
      /* color: $--color-primary-light-2; */
      cursor: pointer;
    }

    @include when(disabled) {
      color: $--disabled-color-base;
      cursor: default;
    }
  }
  @include m(large) {
    .el-tabs__item {
      font-size: 16px;
      height: 40px;
      line-height: 40px;
    }
  }
  @include m(small) {
    .el-tabs__item {
      height: 32px;
      line-height: 32px;
      font-size: 12px;
      padding: 0 12px !important;
      [class^="el-ksd-icon-"], [class^="el-ksd-n-icon-"] {
        font-size: 16px;
      }
    }
    &.el-tabs--card {
      .el-tabs__item {
        height: 30px;
        line-height: 30px;
      }
    }
  }
  @include e(content) {
    overflow: hidden;
    position: relative;
  }
  @include m(card) {
    > .el-tabs__header {
      border-bottom: 1px solid $--border-divider-color;
      background-color: $--background-color-secondary;
    }
    > .el-tabs__header .el-tabs__nav-wrap::after {
      content: none;
    }
    > .el-tabs__header .el-tabs__nav {
      /* border: 1px solid $--border-color-light; */
      border-bottom: none;
      /* border-radius: 4px 4px 0 0; */
      padding: 8px 8px 0 8px;
    }
    > .el-tabs__header .el-tabs__active-bar {
      display: none;
    }
    > .el-tabs__header .el-tabs__item .close-btn-icon {
      position: relative;
      // font-size: 12px;
      // width: 14px;
      // height: 14px;
      // line-height: 14px;
      vertical-align: middle;
      // line-height: 15px;
      overflow: hidden;
      top: -1px;
      right: -2px;
      transform-origin: 100% 50%;
    }
    > .el-tabs__header .el-tabs__item {
      // padding: 0 20px;
      border-bottom: 1px solid transparent;
      // border-right: 1px solid $--border-secondary;
      margin-right: 0px;
      /* border-left: 1px solid $--border-color-light; */
      transition: color .3s cubic-bezier(.645,.045,.355,1), padding .3s cubic-bezier(.645,.045,.355,1);
      &:first-child {
        /* border-left: none; */
      }
      // &.is-closable {
      //   &:hover {
      //     padding-left: 13px;
      //     padding-right: 13px;

      //     & .el-icon-close {
      //       width: 14px;
      //     }
      //   }
      // }
      &.is-active {
        border: 1px solid $--border-divider-color;
        // height: 37px;
        // line-height: 37px;
        border-bottom-color: #fff;
        border-radius: 4px 4px 0 0;
        box-sizing: content-box;
        background-color: $--color-white;
        left: -1px;

        // &.is-closable {
          // padding-left: 20px;
          // padding-right: 20px;

          // .close-btn-icon {
            // width: 14px;
        //   }
        // }
      }
      &.is-top:not(.is-active) {
        &::after {
          content: '';
          position: absolute;
          right: 0;
          top: 8px;
          height: 60%;
          width: 0;
          border-right: 1px solid $--border-secondary;
        }
      }
    }
    .el-tabs__nav-next, .el-tabs__nav-prev {
      top: 8px;
    }
  }
  @include m(button) {
    .el-tabs__nav-wrap{
      margin-bottom:0;
    }
    .el-tabs__nav-wrap::after {
      height: 0px;
    }
    >.el-tabs__header {
      border: none;
      background-color: $--background-color-hover;
      border-radius: $--border-radius-base;
      // height: 28px;
      // font-size: 12px;
      display: inline-block;
      // .el-tabs__nav {
      //   margin: 3px 0;
      // }
    }
    >.el-tabs__header .el-tabs__item {
      // margin: 0 3px;
      // height: 22px;
      // line-height: 22px;
      min-width: 58px;
      text-align: center;
      &.is-active {
        background-color: $--color-white;
        // box-shadow: 0px 1px 4px rgba(63, 89, 128, 0.16);
        border-radius: $--border-radius-small;
        font-weight: 500;
      }
      &.is-disabled{
        cursor: not-allowed;
      }
      > * {
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }
    .is-full{
      display: block;
      .el-tabs__nav{
        display: flex;
        width: 100%;
        .el-tabs__item{
          flex:1;
          text-align: center;
        }
      }
    }
    &.el-tabs--small{
      & > .el-tabs__header .el-tabs__item{
        height: 24px;
        line-height: 24px;
        margin: 2px 4px;
        font-size: 12px;
      }
    }
    &.el-tabs--medium{
      & > .el-tabs__header .el-tabs__item{
        height: 24px;
        line-height: 24px;
        margin: 4px;
        font-size: 12px;
      }
    }
    &.el-tabs--large{
      & > .el-tabs__header .el-tabs__item{
        height: 26px;
        line-height: 26px;
        margin: 4px;
        font-size: 14px;
      }
      > * {
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }
    .is-full{
      display: block;
      .el-tabs__nav{
        display: flex;
        width: 100%;
        .el-tabs__item{
          flex:1;
          text-align: center;
        }
      }
    }
    &.el-tabs--small{
      & > .el-tabs__header .el-tabs__item{
        height: 24px;
        line-height: 24px;
        margin: 2px 4px;
        font-size: 12px;
      }
    }
    &.el-tabs--medium{
      & > .el-tabs__header .el-tabs__item{
        height: 24px;
        line-height: 24px;
        margin: 4px;
        font-size: 12px;
      }
    }
    &.el-tabs--large{
      & > .el-tabs__header .el-tabs__item{
        height: 26px;
        line-height: 26px;
        margin: 4px;
        font-size: 14px;
      }
    }
  }
  @include m(border-card) {
    background: $--color-white;
    border: 1px solid $--border-color-base;
    box-shadow: 0 2px 4px 0 rgba(0,0,0,0.12), 0 0 6px 0 rgba(0,0,0,0.04);
    >.el-tabs__content {
      padding: 15px;
    }
    >.el-tabs__header {
      background-color: $--background-color-base;
      border-bottom: 1px solid $--border-color-base;
      margin: 0;
    }
    > .el-tabs__header .el-tabs__nav-wrap::after {
      content: none;
    }
    >.el-tabs__header .el-tabs__item {
      padding: 0 12px;
      height: 39px;
      line-height: 39px;
      transition: all .3s cubic-bezier(.645,.045,.355,1);
      border: 1px solid transparent;
      margin: -1px -1px 0;
      color: $--color-text-secondary;

      &.is-active {
        color: $--color-primary;
        background-color: $--color-white;
        border-right-color: $--border-color-base;
        border-left-color: $--border-color-base;
      }
      &:hover {
        color: $--color-primary;
      }
    }
  }
  @include m((top, bottom)) {
    .el-tabs__item.is-top:nth-child(2),
    .el-tabs__item.is-bottom:nth-child(2) {
      /* padding-left: 0; */
    }
    .el-tabs__item.is-top:last-child,
    .el-tabs__item.is-bottom:last-child {
      /* padding-right: 0; */
    }

    &.el-tabs--border-card,
    .el-tabs--left, .el-tabs--right {
      .el-tabs__item:nth-child(2) {
        padding-left: 12px;
      }
      .el-tabs__item:last-child {
        padding-right: 12px;
      }
    }
  }
  @include m(bottom) {
    .el-tabs__header.is-bottom {
      margin-bottom: 0;
      margin-top: 10px;
    }
    &.el-tabs--border-card {
      .el-tabs__header.is-bottom {
        border-bottom: 0;
        border-top: 1px solid $--border-color-base;
      }
      .el-tabs__nav-wrap.is-bottom {
        margin-top: -1px;
        margin-bottom: 0;
      }
      .el-tabs__item.is-bottom:not(.is-active) {
        border: 1px solid transparent;
      }
      .el-tabs__item.is-bottom {
        margin: 0 -1px -1px -1px;
      }
    }
  }
  @include m((left, right)) {
    overflow: hidden;

    .el-tabs__header.is-left,
    .el-tabs__header.is-right,
    .el-tabs__nav-wrap.is-left,
    .el-tabs__nav-wrap.is-right,
    > .el-tabs__nav-scroll {
      height: 100%;
      background-color: $--background-color-secondary;
    }

    .el-tabs__active-bar.is-left,
    .el-tabs__active-bar.is-right {
      top: 0;
      bottom: auto;
      width: 0;
      height: auto;
    }

    .el-tabs__nav-wrap.is-left,
    .el-tabs__nav-wrap.is-right {
      margin-bottom: 0;

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

      &::after {
        height: 100%;
        width: 0;
        bottom: auto;
        top: 0;
      }
    }

    .el-tabs__nav {
      float: none;
    }
    .el-tabs__item.is-left,
    .el-tabs__item.is-right {
      display: block;
      height: 48px;
      line-height: 48px;
      &.is-active {
        background-color: $--background-color-active;
      }
    }

    .el-tabs__nav-prev,
    .el-tabs__nav-next {
      height: 30px;
      line-height: 30px;
      width: 100%;
      text-align: center;
      cursor: pointer;

      i {
        transform: rotateZ(90deg);
      }
    }
    .el-tabs__nav-prev {
      left: auto;
      top: 0;
    }
    .el-tabs__nav-next {
      right: auto;
      bottom: 0;
    }
  }
  @include m(left) {
    > .el-tabs__header.is-left {
      .el-tabs__item {
        margin-right: 0px;
      }
    }
    .el-tabs__header.is-left {
      float: left;
      margin-bottom: 0;
      margin-right: 10px;
    }
    .el-tabs__nav-wrap.is-left {
      margin-right: -1px;
      &::after {
        left: auto;
        right: 0;
      }
    }
    .el-tabs__active-bar.is-left {
      right: 0;
      left: auto;
    }
    .el-tabs__item.is-left {
      text-align: right;
    }

    &.el-tabs--card {
      .el-tabs__active-bar.is-left {
        display: none;
      }
      .el-tabs__item.is-left {
        border-left: none;
        border-right: 1px solid $--border-color-base;
        border-bottom: none;
        border-top: 1px solid $--border-color-base;
      }
      .el-tabs__item.is-left:first-child {
        border-right: 1px solid $--border-color-base;
        border-top: none;
      }
      .el-tabs__item.is-left.is-active {
        border: 1px solid $--border-color-base;
        border-right-color: #fff;
        border-left: none;
        border-bottom: none;

        &:first-child {
          border-top: none;
        }
        &:last-child {
          border-bottom: none;
        }
      }

      .el-tabs__nav {
        border-radius: 4px 0 0 4px;
        border-bottom: 1px solid $--border-color-base;
        border-right: none;
      }

      .el-tabs__new-tab {
        float: none;
      }
    }

    &.el-tabs--border-card {
      .el-tabs__header.is-left {
        border-right: 1px solid $--border-color-base;
      }
      .el-tabs__item.is-left {
        border: 1px solid transparent;
        margin: -1px 0 -1px -1px;

        &.is-active {
          border-color: transparent;
          border-top-color: rgb(209, 219, 229);
          border-bottom-color: rgb(209, 219, 229);
        }
      }
    }
  }
  @include m(right) {
    > .el-tabs__header.is-right {
      .el-tabs__item {
        margin-right: 0px;
      }
    }
    .el-tabs__header.is-right {
      float: right;
      margin-bottom: 0;
      margin-left: 10px;
    }

    .el-tabs__nav-wrap.is-right {
      margin-left: -1px;
      &::after {
        left: 0;
        right: auto;
      }
    }

    .el-tabs__active-bar.is-right {
      left: 0;
    }

    &.el-tabs--card {
      .el-tabs__active-bar.is-right {
        display: none;
      }
      .el-tabs__item.is-right {
        border-bottom: none;
        border-top: 1px solid $--border-color-light;
      }
      .el-tabs__item.is-right:first-child {
        border-left: 1px solid $--border-color-light;
        border-top: none;
      }
      .el-tabs__item.is-right.is-active {
        border: 1px solid $--border-color-light;
        border-left-color: #fff;
        border-right: none;
        border-bottom: none;

        &:first-child {
          border-top: none;
        }
        &:last-child {
          border-bottom: none;
        }
      }

      .el-tabs__nav {
        border-radius: 0 4px 4px 0;
        border-bottom: 1px solid $--border-color-light;
        border-left: none;
      }
    }
    &.el-tabs--border-card {
      .el-tabs__header.is-right {
        border-left: 1px solid #dfe4ed;
      }
      .el-tabs__item.is-right {
        border: 1px solid transparent;
        margin: -1px -1px -1px 0;

        &.is-active {
          border-color: transparent;
          border-top-color: rgb(209, 219, 229);
          border-bottom-color: rgb(209, 219, 229);
        }
      }
    }
  }
}

.slideInRight-transition,
.slideInLeft-transition {
  display: inline-block;
}
.slideInRight-enter {
  animation: slideInRight-enter .3s;
}
.slideInRight-leave {
  position: absolute;
  left: 0;
  right: 0;
  animation: slideInRight-leave .3s;
}
.slideInLeft-enter {
  animation: slideInLeft-enter .3s;
}
.slideInLeft-leave {
  position: absolute;
  left: 0;
  right: 0;
  animation: slideInLeft-leave .3s;
}

@keyframes slideInRight-enter {
  0% {
    opacity: 0;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: translateX(100%);
    transform: translateX(100%)
  }

  to {
    opacity: 1;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: translateX(0);
    transform: translateX(0)
  }
}
@keyframes slideInRight-leave {
  0% {
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: translateX(0);
    transform: translateX(0);
    opacity: 1
  }

  100% {
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: translateX(100%);
    transform: translateX(100%);
    opacity: 0
  }
}
@keyframes slideInLeft-enter {
  0% {
    opacity: 0;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%)
  }

  to {
    opacity: 1;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: translateX(0);
    transform: translateX(0)
  }
}
@keyframes slideInLeft-leave {
  0% {
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: translateX(0);
    transform: translateX(0);
    opacity: 1
  }

  100% {
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%);
    opacity: 0
  }
}
