@import '../custom.less';
@import '../mixins/size.less';
@import '../mixins/clearfix.less';

@tabs-tag-name: r-tabs;
@tab-pane: r-tab-pane;
@tabs-prefix-cls: ~"@{css-prefix}tabs";

@{tabs-tag-name} {
  display: block;
  position: relative;
  overflow: hidden;
  color: @text-color;
  .clearfix();

}

.@{tabs-prefix-cls} {
    &-bar {
        outline: none;
        border-bottom: @border-width-base @border-style-base @border-color-base;
        margin-bottom: 16px;
    }

    &-nav-container {
        margin-bottom: -1px;
        line-height: @line-height-base;
        font-size: @font-size-base;
        white-space: nowrap;
        position: relative;
        .clearfix();
        
        // 设置溢出滚动条样式
        ::-webkit-scrollbar {
            height: 4px;
            background-color: #fff;
        }

        ::-webkit-scrollbar-thumb {
            border-radius: 20px;
            background-color: @border-color-base;
        }
    }

    &-nav-container:focus {
        outline: none;
        .@{tabs-prefix-cls}-tab-focused {
            border-color: @link-hover-color !important;
        }
    }

    &-nav-container-scrolling {
        padding-left: 32px;
        padding-right: 32px;
    }

    &-nav-wrap {
        position: relative;
        overflow-x: auto;
        overflow-y: hidden;
    }

    &-nav-right{
        float: right;
        margin-left: 5px;
    }

    &-nav-prev, &-nav-next{
        width: 32px;
        text-align: center;
        position: absolute;
        line-height: 32px;
        cursor: pointer;
        i{
            font-size: 16px;
        }
    }

    &-nav {
        padding-left: 0;
        margin: 0;
        float: left;
        list-style: none;
        position: relative;
        transition: transform 0.5s @ease-in-out;

        &:before,
        &:after {
            display: table;
            content: " ";
        }

        &:after {
            clear: both;
        }

        .@{tabs-prefix-cls}-tab-disabled {
            cursor: not-allowed !important;
            color: #ccc !important;
        }

        .@{tabs-prefix-cls}-tab {
            display: inline-block;
            height: 100%;
            padding: @padding-xs @padding-md;
            margin-right: 16px;

            cursor: pointer;
            text-decoration: none;
            position: relative;
            transition: color .3s @ease-in-out;

            &:hover {
                color: @link-hover-color;
            }

            &:active {
                color: @link-active-color;
            }
            .@{css-prefix-iconfont} {
                .size(14px,14px);
                margin-right: 8px;
            }
        }

        .@{tabs-prefix-cls}-tab-active {
            color: @primary-color;

            &::after {
                content: '';
                .size(100%,2px);
                background-color: @primary-color;
                position: absolute;
                left: 0;
                bottom: 0;
                z-index: 1;
            }
        }
    }
    &-mini &-nav-container {
        font-size: @font-size-base;
    }

    &-mini &-tab {
        margin-right: 0;
        padding: @padding-xs @padding-md;
        font-size: @font-size-small;
    }

    // card style
    &-card > &-bar &-nav-container {
        height: 32px;
    }

    &-card > &-bar &-tab {
        margin: 0;
        margin-right: 4px;
        height: 31px;
        padding: 5px @padding-md 4px;
        border: @border-width-base @border-style-base @border-color-base;
        border-bottom: 0;
        border-radius: @btn-border-radius @btn-border-radius 0 0;
        transition: all 0.3s @ease-in-out;
        background: @background-color-base;
    }
    &-card > &-bar &-tab-active {
        height: 32px;
        padding-bottom: 5px;
        background: @white;
        transform: translateZ(0);
        border-color: @border-color-base;
        color: @primary-color;

        &::after {
            display: none;
        }
    }
    &-card > &-bar &-nav-wrap {
        margin-bottom: 0;
    }
    &-card > &-bar &-tab &-close {
        .size(0,22px);
        font-size: 22px;
        margin-right: 0;
        color: @legend-color;
        text-align: right;
        vertical-align: middle;
        overflow: hidden;
        position: relative;
        top: 5px;
        transform-origin: 100% 50%;
        transition: all 0.3s @ease-in-out;
        &:hover {
            color: #444;
        }
    }

    &-card > &-bar &-tab-active &-close,
    &-card > &-bar &-tab:hover &-close {
        width: 22px;
        transform: translateZ(0);
        margin-right: -6px;
    }
}

.@{tabs-prefix-cls}-no-animation{
    > .@{tabs-prefix-cls}-content {
        transform: none!important;

        > .@{tabs-prefix-cls}-tabpane-inactive {
            display: none;
        }
    }
}

@{tabs-tag-name} {
  .@{tabs-prefix-cls}-content-animated {
      display: flex;
      flex-direction: row;
      will-change: transform;
      transition: transform .3s @ease-in-out;
  }

  @{tab-pane}{
      display: none;
      flex-shrink: 0;
      width: 100%;
      transition: opacity .3s;
      opacity: 1;
      outline: none;
  }

  .@{tabs-prefix-cls}-tabpane-inactive {
      opacity: 0;
      height: 0;
  }
}