@import '../../style/themes/index';
@import '../../style/mixins/index';
@import './size';
@import './rtl';
@import './position';
@import './dropdown';
@import './card';
@import './button';
@import './text';

@tab-prefix-cls: ~'@{wd-prefix}-tabs';

.@{tab-prefix-cls} {
  .reset-component();

  display: flex;
  overflow: hidden;

  // ========================== Navigation ==========================
  > .@{tab-prefix-cls}-nav,
  > div > .@{tab-prefix-cls}-nav {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;

    .@{tab-prefix-cls}-nav-wrap {
      position: relative;
      display: inline-block;
      display: flex;
      flex: auto;
      align-self: stretch;
      overflow: hidden;
      white-space: nowrap;
      transform: translate(0); // Fix chrome render bug

      // >>>>> Ping shadow
      &::before,
      &::after {
        position: absolute;
        z-index: 1;
        opacity: 0;
        transition: opacity @animation-duration-slow;
        content: '';
        pointer-events: none;
      }
    }

    .@{tab-prefix-cls}-nav-list {
      position: relative;
      display: flex;
      transition: transform @animation-duration-slow;

      // .@{tab-prefix-cls}-tab-last {
      //   margin-right: @tabs-tab-last-margin-right;
      // }

      .@{tab-prefix-cls}-nav-add-wrapper {
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

    // >>>>>>>> Operations
    .@{tab-prefix-cls}-nav-operations {
      display: flex;
      align-self: stretch;
      align-items: center;

      &-hidden {
        position: absolute;
        visibility: hidden;
        pointer-events: none;
      }

      .@{tab-prefix-cls}-nav-add {
        margin-left: @tabs-nav-operations-nav-add-margin-left;
      }
    }

    .@{tab-prefix-cls}-nav-more {
      margin-left: 0;
      position: relative;
      padding: 0 @padding-xs;
      border: none;
      width: @tabs-nav-operations-nav-more-width;
      height: @tabs-nav-operations-nav-more-height;
      font-size: @tabs-nav-operations-nav-more-font-size;
      cursor: pointer;
      border-radius: @tabs-nav-operations-nav-more-border-radius;

      span[role='img'] {
        margin-right: 0;
      }

      // &::after {
      //   position: absolute;
      //   right: 0;
      //   bottom: 0;
      //   left: 0;
      //   height: 5px;
      //   transform: translateY(100%);
      //   content: '';
      // }
    }

    .@{tab-prefix-cls}-nav-add {
      padding: 0 @padding-xs;
      outline: none;
      cursor: pointer;
      border: none;
      width: @tabs-nav-operations-nav-more-width;
      height: @tabs-nav-operations-nav-more-height;
      font-size: @tabs-nav-operations-nav-more-font-size;
      border-radius: @tabs-nav-operations-nav-more-border-radius;

      span[role='img'] {
        margin-right: 0;
      }
    }
  }

  &:not(.@{tab-prefix-cls}-button):not(.@{tab-prefix-cls}-card) {
    .@{tab-prefix-cls}-nav-wrap {
      &::before,
      &::after {
        top: @tabs-tab-nav-wrap-after-top;
        height: @tabs-tab-nav-wrap-after-height;
      }
    }
  }

  &-extra-content {
    flex: none;
  }

  &-centered {
    > .@{tab-prefix-cls}-nav,
    > div > .@{tab-prefix-cls}-nav {
      .@{tab-prefix-cls}-nav-wrap {
        &:not([class*='@{tab-prefix-cls}-nav-wrap-ping']) {
          justify-content: center;
        }
      }
    }
  }

  // ============================ InkBar ============================
  &-ink-bar {
    position: absolute;
    background: @tabs-ink-bar-color;
    pointer-events: none;
  }

  // ============================= Tabs =============================
  &-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: @tabs-tab2-padding;
    font-size: @font-size-sm;
    background: transparent;
    border: 0;
    outline: none;
    cursor: pointer;

    &-btn,
    &-remove {
      &:focus,
      &:active {
        color: @tabs-active-color;
      }
    }

    &-btn {
      position: relative;
      outline: none;
      // transition: all 0.3s;
      // font-size: @font-size-base;
      line-height: @tabs-tab2-btn-line-height;
      color: @text-secondary;

      &::before {
        display: none;
        position: absolute;
        top: 0;
        right: -8px;
        bottom: 0;
        left: -8px;
        z-index: -1;
        background-color: @tabs-btn-hover;
        border-radius: @border-radius-sm;
        opacity: 1;
        transition: background-color, opacity 0.2s cubic-bezier(0, 0, 1, 1);
        content: '';
      }

      &:hover {
        border-radius: @border-radius-sm;
        // padding:@base-num-zero  @padding-xs;
        // background: @tabs-btn-hover;
      }
    }

    &-remove {
      flex: none;
      margin-right: -@margin-xss;
      margin-left: @margin-xs;
      color: @text-color-secondary;
      font-size: @font-size-sm;
      background: transparent;
      border: none;
      outline: none;
      cursor: pointer;
      transition: all @animation-duration-slow;

      &:hover {
        color: @heading-color;
      }
    }

    &:not(.@{tab-prefix-cls}-tab-active):not(.@{tab-prefix-cls}-tab-disabled) {
      &:hover {
        .@{tab-prefix-cls}-tab-btn {
          color: @tabs-hover-color;

          svg {
            color: @brand-primary;
          }
        }
      }
    }

    &&-active &-btn {
      // color: @tabs-highlight-color;
      // text-shadow: 0 0 0.25px currentcolor;
      color: @text-primary;
      font-weight: @base-weight-font;

      svg {
        color: @brand-primary;
      }

      &::before {
        display: none;
      }
    }

    &&-disabled {
      cursor: not-allowed;
    }

    &&-disabled &-btn {
      color: @text-disable;
    }

    &&-disabled &-btn,
    &&-disabled &-remove {
      &:focus,
      &:active {
        color: @disabled-color;
      }
    }

    & &-remove .@{iconfont-css-prefix} {
      margin: 0;
    }

    .@{iconfont-css-prefix} {
      margin-right: @margin-sm;
    }
  }

  // &&-top &-tab {
  //   &:first-of-type {
  //     margin-left: (@tabs-horizontal-gutter / 2) * 1px;
  //   }
  // }

  &-tab + &-tab {
    margin: @tabs-horizontal-margin;
  }

  // =========================== TabPanes ===========================
  &-content {
    &-holder {
      flex: auto;
      min-width: 0;
      min-height: 0;
    }

    display: flex;
    width: 100%;

    &-animated {
      transition: margin @animation-duration-slow;
    }
  }

  &-tabpane {
    flex: none;
    width: 100%;
    outline: none;
  }
}
