@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;
    }
  }

  &__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;
      height: $van-tabs-card-height;
      border: 1px solid $gray-darker;

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

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

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

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

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

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

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

  &--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 {
    background-color: $active-color;
  }

  &--active {
    color: $red;
  }

  &--disabled {
    color: $gray;

    &:active {
      background-color: $white;
    }
  }

  &__pane {
    display: none;

    &--select {
      display: block;
    }
  }
}
