@import '../common/style/var.less';
@import '../common/style/theme.less';

.van-tabs {
  position: relative;
  -webkit-tap-highlight-color: transparent;

  &__wrap {
    display: flex;
    overflow: hidden;

    &--scrollable {
      .van-tab {
        flex: 0 0 22%;
        &--complete {
          flex: 1 0 auto !important;
          padding: 0 @padding-sm;
        }
      }

      .van-tabs__nav {
        &--complete {
          padding-right: 8px;
          padding-left: 8px;
        }
      }
    }
  }

  &__scroll {
    .theme(background-color, '@tabs-nav-background-color');
    width: 100%;

    &--line {
      box-sizing: content-box;
      // 15px padding to hide scrollbar in mobile safari
      height: calc(100% + 15px);
    }

    &--card {
      .theme(margin, '0 @padding-md');
    }

    &::-webkit-scrollbar {
      display: none;
    }
  }

  &__nav {
    position: relative;
    display: flex;
    user-select: none;

    &--card {
      box-sizing: border-box;
      .theme(height, '@tabs-card-height');
      .theme(border, '@border-width-base solid @tabs-default-color');
      .theme(border-radius, '@border-radius-sm');

      .van-tab {
        .theme(color, '@tabs-default-color');
        .theme(line-height, 'calc(@tabs-card-height - 2 * @border-width-base)');
        .theme(border-right, '@border-width-base solid @tabs-default-color');

        &:last-child {
          border-right: none;
        }

        &.van-tab--active {
          .theme(color, '@white');
          .theme(background-color, '@tabs-default-color');
        }

        &--disabled {
          .theme(color, '@tab-disabled-text-color');
        }
      }
    }
  }

  &__line {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 1;
    .theme(height, '@tabs-bottom-bar-height');
    .theme(border-radius, '@tabs-bottom-bar-height');
    .theme(background-color, '@tabs-bottom-bar-color');
  }

  &__track {
    position: relative;
    width: 100%;
    height: 100%;

    &--animated {
      display: flex;
      transition-property: left;
    }

    // #ifdef MP-BAIDU
    > van-tab {
      flex-shrink: 0;
      box-sizing: border-box;
      width: 100%;
    }
    // #endif
  }

  &__content {
    overflow: hidden;
  }

  &--line {
    .van-tabs__wrap {
      .theme(height, '@tabs-line-height');
    }
  }

  &--card {
    .van-tabs__wrap {
      .theme(height, '@tabs-card-height');
    }
  }
}

.van-tab {
  position: relative;
  flex: 1;
  box-sizing: border-box;
  min-width: 0; /* hack for flex ellipsis */
  padding: 0 5px;
  text-align: center;
  cursor: pointer;
  .theme(color, '@tab-text-color');
  .theme(font-size, '@tab-font-size');
  .theme(line-height, '@tabs-line-height');

  &--active {
    .theme(font-weight, '@font-weight-bold');
    .theme(color, '@tab-active-text-color');
  }

  &--disabled {
    .theme(color, '@tab-disabled-text-color');
  }

  &__title {
    &__info {
      position: relative !important;
      top: -1px !important;
      display: inline-block;
      transform: translateX(0) !important;
    }
  }
}
