@import './common/var.css';

$van-tabs-line-height: 44px;
$van-tabs-card-height: 30px;

.van-tabs {
  position: relative;

  &__wrap {
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
    overflow: hidden;
    position: absolute;

    &--page-top {
      position: fixed;
    }

    &--content-bottom {
      top: auto;
      bottom: 0;
    }

    &--scrollable {
      .van-tab {
        flex: 0 0 22%;
      }

      .van-tabs__nav {
        overflow: hidden;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;

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

  &__nav {
    display: flex;
    user-select: none;
    position: relative;
    background-color: $white;

    &--line {
      height: 100%;
      padding-bottom: 15px; /* 15px padding to hide scrollbar in mobile safari */
      box-sizing: content-box;
    }

    &--card {
      margin: 0 15px;
      border-radius: 2px;
      box-sizing: border-box;
      border: 1px solid $red;
      height: $van-tabs-card-height;

      .van-tab {
        color: $red;
        border-right: 1px solid $red;
        line-height: calc($van-tabs-card-height - 2px);

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

        &.van-tab--active {
          color: $white;
          background-color: $red;
        }

        &--disabled {
          color: $gray;
        }
      }
    }
  }

  &__line {
    z-index: 1;
    left: 0;
    bottom: 15px;
    height: 2px;
    position: absolute;
    background-color: $red;
  }

  &--line {
    padding-top: $van-tabs-line-height;

    .van-tabs__wrap {
      height: $van-tabs-line-height;
    }
  }

  &--card {
    padding-top: $van-tabs-card-height;

    .van-tabs__wrap {
      height: $van-tabs-card-height;
    }
  }
}

.van-tab {
  flex: 1;
  cursor: pointer;
  padding: 0 5px;
  font-size: 14px;
  position: relative;
  color: $text-color;
  line-height: $van-tabs-line-height;
  text-align: center;
  box-sizing: border-box;
  background-color: $white;
  min-width: 0; /* hack for flex ellipsis */

  span {
    display: block;
  }

  &--active {
    color: $red;
  }

  &--disabled {
    color: $gray;
  }
}
