// -----------------------------------------------------------------------------
// This file contains all styles related to the tabs component.
// -----------------------------------------------------------------------------
// @import "./variables.scss";

.#{$namespace}tab {
  .#{$namespace}tab-header {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
    .#{$namespace}tab-header-bar {
      position: absolute;
      left: 0;
      bottom: 0;
      display: inline-block;
      width: 0;
      height: 2px;
      background: $tabs-header-bar-bg-color;
      transition: .3s cubic-bezier(.645, .045, .355,1);
      z-index: 3;
    }
    // 新增right-border类型的type
    &.#{$namespace}tab-right-border {
      background: $tabs-right-border-bg-color;
      &:after{
        border-bottom: $tabs-right-border-border-bottom;
      }
    }
    &.#{$namespace}tab-header-scroll {
      padding: $tabs-header-scroll-padding;
      overflow: hidden;
      .#{$namespace}tab-header-scroll-container {
        position: relative;
        overflow: hidden;
        white-space: nowrap;
      }
      .#{$namespace}icon-arrow-left, .#{$namespace}icon-arrow-right {
        position: absolute;
        top: 0;
        width: $tabs-arrow-width;
        height: 100%;
        background: inherit;
        color: $tabs-arrow-color;
        cursor: pointer;
      }
      .#{$namespace}icon-arrow-left {
        left: 0;
      }
      .#{$namespace}icon-arrow-right {
        right: 0;
      }
    }
    &.#{$namespace}tab-block {
      .#{$namespace}tab-header-scroll-container {
        display: flex;
        width: 100%;
        .#{$namespace}tab-item {
          flex: 1;
        }
      }
    }
    &.#{$namespace}tab-default {
      .#{$namespace}icon-arrow-left, .#{$namespace}icon-arrow-right {
        z-index: 4;
      }
    }
    &.#{$namespace}tab-border-card {
      color: $tabs-border-card-color;
      background: $tabs-border-card-bg-color;
      &.#{$namespace}tab-header-scroll {
        .#{$namespace}tab-item-border-card {
          &.#{$namespace}tab-item-active, &:not(.#{$namespace}tab-item-disabled):hover {
            &:first-child:after {
              border-left-color: $tabs-border-card-scroll-item-first-child-border-left-color;
            }
          }
        }
      }
    }
    &:after {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      border-bottom: $tabs-header-border-bottom;
    }
  }
  .#{$namespace}tab-content {
    width: 100%;
    .#{$namespace}tab-content-hide {
      display: none;
    }
  }
  &.#{$namespace}tab-box-shadow {
    box-shadow: $tabs-box-shadow;
  }
}
// 垂直
.#{$namespace}tab-column {
  display: flex;
  flex-direction: row;
  .#{$namespace}tab-header {
    overflow: visible;
    white-space: normal;
    flex-direction: column;
    .#{$namespace}tab-header-bar {
      bottom: 0;
      width: 2px;
      height: 0;
    }
    .#{$namespace}tab-item {
      width: 100%;
      padding: $tabs-column-item-padding;
      &.#{$namespace}tab-item-card:after, &.#{$namespace}tab-item-border:after {
        right: 0;
        bottom: $tabs-column-item-after-bottom;
      }
      .#{$namespace}item-content{
        .#{$namespace}item-label {
          min-width: $tabs-card-item-label-min-width;
          font-size: $tabs-column-font-size;
        }
      }
    }
    &:after {
      top: 0;
      left: auto;
      right: auto;
      border-bottom-color: transparent;
    }
  }
  .#{$namespace}tab-content {
    flex: 1;
    width: auto;
  }
}

.#{$namespace}tab-column.#{$namespace}tab-left .#{$namespace}tab-header {
  &:after {
    right: 0;
    border-right: $tabs-column-header-border-right;
  }
  .#{$namespace}tab-header-bar {
    left: auto;
    right: 0;
  }
  .#{$namespace}tab-item.#{$namespace}tab-item-card {
    &.#{$namespace}tab-item-active:after {
      border-bottom-color: $tabs-column-item-card-active-after-border-bottom-color;
      border-right-color: $tabs-column-item-card-active-after-border-left-right-color;
    }
    &:last-child:after {
      border-top-right-radius: 0;
      border-bottom-left-radius: $tabs-border-radius;
    }
  }
  .#{$namespace}tab-item.#{$namespace}tab-item-border {
    &:first-child:after {
      border-bottom-left-radius: 0;
      border-top-right-radius: $tabs-border-radius;
    }
    &:last-child:after {
      border-top-right-radius: 0;
      border-bottom-left-radius: $tabs-border-radius;
    }
  }
  .#{$namespace}tab-item-border-card {
    &.#{$namespace}tab-item-active:after, &:not(.#{$namespace}tab-item-disabled):hover:after {
      border-color: transparent;
    }
  }
}

.#{$namespace}tab-column.#{$namespace}tab-right .#{$namespace}tab-header {
  &:after {
    left: 0;
    border-left: $tabs-column-header-border-left;
  }
  .#{$namespace}tab-header-bar {
    left: 0;
  }
  .#{$namespace}tab-item.#{$namespace}tab-item-card {
    &.#{$namespace}tab-item-active:after {
      border-bottom-color: $tabs-column-item-card-active-after-border-bottom-color;
      border-left-color: $tabs-column-item-card-active-after-border-left-right-color;
    }
    &:first-child:after {
      border-top-left-radius: 0;
      border-top-right-radius: $tabs-border-radius;
    }
    &:last-child:after {
      border-top-right-radius: 0;
      border-bottom-right-radius: $tabs-border-radius;
    }
  }
  .#{$namespace}tab-item.#{$namespace}tab-item-border {
    &:first-child:after {
      border-bottom-left-radius: 0;
      border-top-right-radius: $tabs-border-radius;
    }
    &:last-child:after {
      border-top-right-radius: 0;
      border-bottom-left-radius: $tabs-border-radius;
    }
  }
  .#{$namespace}tab-item-border-card {
    &.#{$namespace}tab-item-active:after, &:not(.#{$namespace}tab-item-disabled):hover:after {
      border-color: transparent;
    }
  }
}

.#{$namespace}tab-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: $tabs-item-dafault-padding;
  vertical-align: middle;
  cursor: pointer;
  &.#{$namespace}tab-item-sm {
    padding: $tabs-item-sm-padding;
    .#{$namespace}item-content .#{$namespace}item-label {
      padding: $tabs-item-label-sm-padding;
      font-size: $tabs-item-sm-font-size;
    }
  }
  &.#{$namespace}tab-item-lg {
    padding: $tabs-item-lg-padding;
    .#{$namespace}item-content .#{$namespace}item-label {
      padding: $tabs-item-label-lg-padding;
      font-size: $tabs-item-lg-font-size;
    }
  }

  &.#{$namespace}tab-item-active {
    .#{$namespace}item-content .#{$namespace}item-label {
      color: $tabs-item-active-color;
    }
    .#{$namespace}btn-clear {
      color: $tabs-item-active-clear-color;
    }
  }

  &:not(.#{$namespace}tab-item-disabled):hover {
    .#{$namespace}item-content {
      color: $tabs-item-no-disabled-hover-color;
    }
    .#{$namespace}btn-clear {
      color: $tabs-item-no-disabled-hover-clear-color;
    }
  }
  
  &:not(.#{$namespace}tab-item-disabled) .#{$namespace}btn-clear:hover {
    color: $tabs-item-no-disabled-clear-hover-color;
    &:after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: -1;
      background: $tabs-item-no-disabled-clear-hover-after-bg-color;
      border-radius: 50%;
      transition: background-color .3s; // 渐变色
    }
  }
  &.#{$namespace}tab-item-disabled {
    opacity: .5;
    cursor: not-allowed;
    .#{$namespace}btn-clear {
      cursor: not-allowed;
    }
  }  
  
  .#{$namespace}item-content {
    display: inline-flex;
    align-items: center;
    .#{$namespace}item-icon {
      margin-right: 10px;
    }
    .#{$namespace}item-label {
      position: relative;
      display: inline-block;
      padding: $tabs-item-label-dafault-padding;
      font-size: $tabs-item-dafault-font-size;
      min-width: $tabs-item-label-min-width;
      text-align: center;
    }
  }
  
  i {
    font-style: normal;
  }

  .#{$namespace}btn-clear {
    position: relative;
    display: inline-block;
    width: $tabs-btn-clear-width;
    height: $tabs-btn-clear-height;
    line-height: 13px;
    margin-left: 10px;
    border: none;
    text-align: center;
    z-index: 3;
  }
}

.#{$namespace}tab-item-add {
  &.#{$namespace}tab-item.#{$namespace}tab-item-card:last-child:after {
    top: 0px;
    bottom: -1px;
  }
  &.#{$namespace}tab-item-sm {
    padding: $tabs-item-add-sm-padding;
    .#{$namespace}item-content .#{$namespace}item-label {
      font-size: $tabs-item-add-sm-font-size;
    }
  }
  &.#{$namespace}tab-item-md {
    padding: $tabs-item-add-md-padding;
    .#{$namespace}item-content .#{$namespace}item-label {
      font-size: $tabs-item-add-md-font-size;
    }
  }
  &.#{$namespace}tab-item-lg {
    padding: $tabs-item-add-lg-padding;
    .#{$namespace}item-content .#{$namespace}item-label {
      font-size: $tabs-item-add-lg-font-size;
    }
  }
}
//card的一些私有样式
.#{$namespace}tab-item-card {
  position: relative;
  &:first-child:after {
    border-top-left-radius: $tabs-card-item-border-top-radius;
    border-bottom-left-radius: $tabs-card-item-border-bottom-radius;
    border-left: $tabs-card-item-border-left;
  }
  &:last-child:after {
    right: 0;
    border-top-right-radius: $tabs-card-item-border-top-radius;
    border-bottom-right-radius: $tabs-card-item-border-bottom-radius;
    border-right: $tabs-card-item-border-right;
  }
  &:after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: $tabs-card-item-after-right;
    display: inline-block;
    border: $tabs-card-item-border;
    border-bottom: $tabs-card-item-border-bottom;
    border-top: $tabs-card-item-border-top;
    z-index: 1;
  }
  // &:not(.#{$namespace}tab-item-disabled) {
  //   border-color: $tabs-card-item-no-diabled-hover-border-color;
  // }
  &.#{$namespace}tab-item-active {
    background: $tabs-card-item-active-bg-color;
    border-radius: $tabs-card-item-active-border-radius;
    .#{$namespace}item-content,.#{$namespace}btn-clear{
      color: $tabs-card-item-active-color;
     }
     &:after {
      border-bottom-color: $tabs-card-item-active-border-bottom-color;
    }
  }
  &.#{$namespace}tab-item-active:hover {
    .#{$namespace}item-content {
      color: $tabs-card-item-active-color;
    }
    // .#{$namespace}btn-clear {
    //   color: $tabs-card-item-active-clear-hover-color;
    // }
  }
  .#{$namespace}item-label {
    transition: color .2s;
    min-width: $tabs-card-item-label-min-width;
  }
}

.#{$namespace}tab-item-wrapper {
  background: #fff;
  border: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  vertical-align: middle;
}

// type 类型为border时
.#{$namespace}tab-item-border {
  position: relative;
  color: $tabs-border-color;
  // &:first-child:after {
  //   border-top-left-radius: 4px;
  //   border-bottom-left-radius: 4px;
  // }
  // &:last-child:after {
  //   right: 0;
  //   border-top-right-radius: 4px;
  //   border-bottom-right-radius: 4px;
  // }
  &:not(:last-child) {
    &.#{$namespace}tab-item-active, &:not(.#{$namespace}tab-item-active):hover {
      &:after {
        border: $tabs-border-item-no-last-child-active-after-border;
        z-index: 2;
      }
    }
  }
  &:after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: $tabs-border-after-right;
    display: inline-block;
    border: $tabs-border-item-border;
    z-index: 1;
  }
  &.#{$namespace}tab-item-active {
    background: $tabs-border-item-active-bg-color;
    &:not(.#{$namespace}tab-item-disabled):after {
      border-color: $tabs-border-item-active-color;
    }
    &:after {
      border: $tabs-border-item-active-after-border;
      z-index: 2;
    }
    &:hover {
      background: $tabs-border-item-active-hover-bg-color;
      &:not(.#{$namespace}tab-item-disabled):after {
        border-color: $tabs-border-item-active-border-color;
      }
      &:after {
        border: $tabs-border-item-active-after-border;
        z-index: 2;
      }
    }
  }
  &:not(.#{$namespace}tab-item-active):hover {
    background-color: inherit;
    &:not(.#{$namespace}tab-item-disabled):after {
      border-color: $tabs-border-item-active-hover-color;
    }
    &:after {
      border: $tabs-border-item-no-active-hover-after-color;
      z-index: 2;
    }
  }
  &:not(.#{$namespace}tab-item-active) {
    &:after {
      border: $tabs-border-item-no-active-after-color;
    }
    color: $tabs-border-item-color;
  } 
  .#{$namespace}item-label {
    transition: color .2s;
  }
}

.#{$namespace}tab-item-border-card {
  position: relative;
  &:after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: $tabs-border-card-item-after-right;
    display: inline-block;
    border: $tabs-border-card-item-border;
    z-index: 1;
  }
  &.#{$namespace}tab-item-active, &:not(.#{$namespace}tab-item-disabled):hover {
    .#{$namespace}item-content .#{$namespace}item-label {
      color: $tabs-border-card-item-active-color;
    }
    .#{$namespace}btn-clear {
      color: $tabs-border-card-item-color;
    }
    background: $tabs-border-card-item-hover-bg-color;
  }
  &:not(.#{$namespace}item-disabled) .#{$namespace}btn-clear:hover {
    color: $tabs-border-card-item-no-disabled-hover-color;
    &:after {
      background: transparent;
    }
  }
  &.#{$namespace}tab-item-active, &:not(.#{$namespace}tab-item-disabled):hover {
    &:after {
      border-left-color: $tabs-border-card-item-active-after-border-left-color;
      border-right-color: $tabs-border-card-item-active-after-border-right-color;
      border-bottom-color: $tabs-border-card-item-active-after-border-bottom-color;
    }
    &:first-child:after {
      border-left-color: transparent;
      border-right-color: $tabs-border-card-item-active-first-child-after-border-right-color;
    }
  }
  &:not(.#{$namespace}tab-item-active.#{$namespace}tab-item-disabled):hover {
    &:after {
      border-bottom-color: transparent;
    }
  }
  .#{$namespace}item-label {
    transition: color .2s;
  }
}

// 新增right-border类型的type
.#{$namespace}tab-item-right-border {
  padding: $tabs-right-border-item-padding;
  position: relative;
  .#{$namespace}item-content{
    color: $tabs-right-border-item-color;
  }
  &:not(:first-child):before {
    content: '';
    width: 1px;
    height: 36%;
    background-color: $tabs-right-border-vertical-color;
    position: absolute;
    left: 0;
    top: 32%;
  }
  &.#{$namespace}tab-item-add {
    padding-left: $tabs-right-border-item-add-padding-left;
    &.#{$namespace}tab-item-md {
      .#{$namespace}item-content .#{$namespace}item-label {
        font-size: $tabs-right-border-item-add-md-content-font-size;
      }
    }
  }
  &.#{$namespace}tab-item-active {
    background: $tabs-right-border-active-bg-color;
    &:before{
      height: 0;
    }
    &:after{
      height: 0;
    }
  }
  &.#{$namespace}tab-item-active+ &.#{$namespace}tab-item-md:before{
    content: '';
    height: 0;
  }
  .#{$namespace}btn-clear{
    margin-left: $tabs-right-border-item-btn-clear-margin-left;
  }
}