@import '../../style/common';

.@{prefix}tab {
  position: relative;
  flex: 1;
  box-sizing: border-box;
  min-width: 0;
  padding: 0 5px;
  color: @tab-text-color;
  font-size: @tab-font-size;
  line-height: @tabs-line-height;
  text-align: center;

  span {
    display: inline-block;
  }

  &--active {
    color: @tab-active-text-color;
    font-weight: 500;
  }

  &--disabled {
    color: @tab-disabled-text-color;
  }

  &__badge {
    line-height: @tab-font-size;
  }
}

.@{prefix}tabs {
  position: relative;

  &__wrap {
    overflow: hidden;

    &::after {
      border-color: @tabs-border-color;
    }

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

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

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

        &--complete {
          flex: 1 0 auto;
        }
      }

      .@{prefix}tabs__nav {
        overflow: hidden;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;

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

  &__nav {
    position: relative;
    display: flex;
    background-color: @tabs-nav-background-color;
    user-select: none;

    &--line {
      box-sizing: content-box;
      height: 100%;

      /* 15px padding to hide scrollbar in mobile safari */
      padding-bottom: 15px;
    }

    @tabs-card-height-half: calc(@tabs-card-height / 2);

    &--card {
      box-sizing: border-box;
      height: @tabs-card-height;
      overflow: hidden;
      border-right: 1px solid @primary-color;
      border-radius: @tabs-card-height-half;

      .@{prefix}tab {
        color: @primary-color;
        line-height: @tabs-card-height - 2px;
        border: 1px solid @primary-color;
        border-right: 0;

        &:first-child {
          border-radius: @tabs-card-height-half 0 0 @tabs-card-height-half;
        }

        &:last-child {
          border-right: 0;
          border-radius: 0 @tabs-card-height-half @tabs-card-height-half 0;
        }

        &.@{prefix}tab--active {
          color: @white;
          background-color: @primary-color;
        }

        &--disabled {
          color: @tab-disabled-text-color;
        }

        &--disabled + .@{prefix}tab {
          border-left: 0;
        }
      }
    }
  }

  &__line {
    position: absolute;
    bottom: @tabs-line-bottom;
    left: 0;
    z-index: 1;
    height: @tabs-bottom-bar-height;
    background-color: @tabs-bottom-bar-color;
    border-radius: @border-radius-1;
  }

  &__track {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    will-change: left;
  }

  &__content {
    &--animated,
    &--touchable {
      overflow: hidden;
    }
  }

  &--line {
    .@{prefix}tabs__wrap {
      height: @tabs-line-height;
    }
  }

  &--card {
    > .@{prefix}tabs__wrap {
      height: @tabs-card-height;
    }
  }

  &--static {
    > .@{prefix}tabs__nav {
      padding-right: 4px;
      padding-left: 4px;
    }

    .@{prefix}tab {
      flex: none;
      padding: 0 12px;
    }
  }

  &--large {
    .@{prefix}tabs {
      &__line {
        bottom: @tabs-large-line-bottom;
      }
    }

    .@{prefix}tab {
      font-size: @tab-large-font-size;
    }

    .@{prefix}tab__badge {
      line-height: @tab-large-font-size;
    }
  }
}
