@import './abstracts/variable';
@import './abstracts/mixin';
@import './icon.scss';
@import './sticky.scss';

@include b(tabs) {
  position: relative;
  background: $-tabs-nav-bg;

  @include e(nav) {
    position: relative;
    height: $-tabs-nav-height;
    overflow: hidden;
    background: $-tabs-nav-bg;
  }
  @include e(nav-container) {
    position: relative;
    display: flex;
    box-sizing: content-box;
    padding-bottom: 15px;
    overflow: hidden;
    user-select: none;
  }
  @include e(nav-item) {
    flex: 1;
    min-width: 0;
    text-align: center;
    height: $-tabs-nav-height;
    line-height: $-tabs-nav-height;
    font-size: $-tabs-nav-fs;
    color: $-tabs-nav-color;
    transition: color .3s;
    -webkit-tap-highlight-color: transparent;

    @include when(active) {
      font-weight: 500;
    }
    @include when(disabled) {
      color: $-tabs-nav-disabled-color;
    }
  }
  @include e(line) {
    position: absolute;
    bottom: 20px;
    left: 0;
    height: $-tabs-nav-line-height;
    background: $-tabs-nav-line-bg-color;
    z-index: 1;
    border-radius: $-tabs-nav-line-height / 2;
  }
  @include e(container) {
    position: relative;
    overflow: hidden;
  }
  @include e(body) {
    display: flex;
    width: 100%;
    height: 100%;
  }
  @include e(map) {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
  }
  @include e(map-btn) {
    position: absolute;
    right: 0;
    top: 0;
    width: $-tabs-nav-height;
    height: $-tabs-nav-height;
    line-height: $-tabs-nav-height;
    text-align: center;
    color: $-tabs-nav-map-arrow-color;
    z-index: 3;
    background: $-tabs-nav-bg;
    -webkit-tap-highlight-color: transparent;

    @include when(open) {
      @include halfPixelBorder;
    }

    &::before {
      position: absolute;
      content: '';
      top: 0;
      left: -24px;
      width: 24px;
      height: $-tabs-nav-height - 1;
      background: $-tabs-nav-map-btn-before-bg
    }
  }
  @include e(map-arrow) {
    font-size: $-tabs-nav-arrow-fs;
    display: block;
    transition: transform .3s;

    @include when(open) {
      font-size: $-tabs-nav-arrow-open-fs;
      transform: rotate(180deg);
    }
  }
  @include e(map-header) {
    position: relative;
    padding-left: 17px;
    height: $-tabs-nav-height;
    line-height: $-tabs-nav-height;
    font-size: $-tabs-nav-map-fs;
    color: $-tabs-nav-map-color;
    transition: opacity .3s;
    background: $-tabs-nav-bg;
    opacity: 0;

    @include halfPixelBorder;
  }
  @include e(map-body) {
    display: flex;
    flex-wrap: wrap;
    padding: 20px 15px 10px;
    background: $-tabs-nav-bg;
    transition: transform .3s;
    transform: scaleY(0);
    transform-origin: center top;

    @include when(open) {
      transform: scaleY(1);
    }
  }
  @include e(map-nav-item) {
    flex-basis: 33%;

    &:nth-child(3n + 2) {
      text-align: center;
    }
    &:nth-child(3n + 3) {
      text-align: right;
    }
  }

  @include e(map-nav-btn) {
    @include buttonClear;
    @include lineEllipsis;
    
    display: inline-block;
    width: 107px;
    height: 32px;
    line-height: 32px;
    background-color: $-tabs-nav-map-button-back-color;
    margin-bottom: 10px;
    border-color: transparent;
    border-radius: $-tabs-nav-map-button-radius;
    color: $-tabs-nav-map-color;
    font-size: $-tabs-nav-map-fs;
    text-align: center;
    transition: color .3s, border-color .3s;

    @include when(active) {
      color: $-tabs-nav-active-color;
      border: 1px solid $-tabs-nav-active-color;
      background-color: $-tabs-nav-bg
    }
    @include when(disabled) {
      color: $-tabs-nav-disabled-color;
      border-color: #f4f4f4;
    }
  }
  @include e(mask) {
    position: absolute;
    top: $-tabs-nav-height;
    left: 0;
    right: 0;
    bottom: 0;
    background: $-tabs-nav-map-modal-bg;
    opacity: 0;
    transition: opacity .3s;
  }

  @include when(slide) {
    .wd-tabs__nav-container {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    .wd-tabs__nav-item {
      color: $-tabs-nav-color;
      flex: 0 0 auto;
      padding: 0 17px;
    }
  }
  @include when(map) {
    .wd-tabs__nav {
      padding-right: 40px;
    }
  }
}
@media (max-width: 330px) {
  color: $-tabs-nav-color;
  .wd-tabs__map-nav-btn {
    width: 90px;
  }
}