@import '../../styles/mixins/index';

.nut-tabs {
  display: flex;
  background: $tabs-titles-background-color;
  border-radius: $tabs-titles-border-radius;
  padding: $tabs-padding;
  overflow: hidden;
  position: relative;
  &--menu {
    overflow: visible;
    z-index: 9;
  }
  &__scroll--screen {
    width: $tabs-scroll-screen-width;
    height: $tabs-scroll-screen-height;
    position: absolute;
    // top: 50%;
    top: 0;
    right: $tabs-scroll-screen-right;
    transform: scaleY(0.6);
    opacity: $tabs-scroll-screen-opacity;
    background: #FFFFFF;
    box-shadow: $tabs-scroll-screen-box-shadow;
    z-index: 2;
    &.scroll--screen_menu {
      width: 50px;
      right: 0;
    }
  }
  &__scroll--block {
    position: absolute;
    top: 0;
    right: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: $tabs-block-width;
    height: $tabs-scroll-block-height;
    background-color: $tabs-block-background;
    z-index: 3;
    &.scroll--block_menu {
      width: 50px;
    }
    &-icon {
      &-up {
        transition: all 0.2s linear;
        transform: rotate(180deg);
      }
      &-down {
        transition: all 0.2s linear;
      }
    }
  }
  &__extra-title {
    position: absolute;
    top: $tabs-horizontal-titles-height;
    left: 0;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 2;
    padding: 16px 0 0 0;
    background-color: #FFFFFF;
  }
}
.nut-radiogroup .nut-radio {
  &.nut-tabs__extra-title-radio {
    margin-bottom:  16px !important;
  }
}
.nut-tabs__divider--horizontal {
  top: $tabs-horizontal-titles-height;
  transform: translateY(-2px);
  z-index: 1;
}
.nut-tabs__divider--vertical {
  transform: translateX(-2px);
  left: $tabs-vertical-titles-width;
  z-index: 1;
}

.nut-tabs__titles {
  // position: relative;
  box-sizing: border-box;
  height: $tabs-horizontal-titles-height;
  // padding: 0 10px;
  // margin: $tabs-titles-margin;
  display: flex;
  user-select: none;
  flex-shrink: 0;
  overflow: hidden;
  background: $tabs-titles-item-background-color;
  // position: relative;
  z-index: 1;
  &--shadow-horizontal {
    box-shadow: 0px 2px 16px 0px rgba(0,0,0,0.04);
  }
  &--shadow-vertical {
    box-shadow: 2px 0px 16px 0px rgba(0,0,0,0.04);
  }
  &::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
  }
}

.nut-tabs__titles--left {
  justify-content: flex-start;
  padding: $tabs-scrollable-padding;
}

.nut-tabs__titles--right {
  justify-content: flex-end;
}

.nut-tabs__titles--scrollable {
  overflow-x: auto;
  overflow-y: hidden;

  .nut-tabs__titles-item {
    width: auto;
    padding: $tabs-horizontal-titles-item-pading;
    box-sizing: border-box;
  }
}

.nut-tabs__titles-item {
  position: relative;
  min-width: $tabs-horizontal-titles-item-min-width;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  margin: 0 $nut-tabs-title-gap;
  font-size: $tabs-titles-item-font-size;
  color: $tabs-titles-item-color;
  line-height: $tabs-titles-item-line-height;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nut-tabs__titles-item--left,
.nut-tabs__titles-item--right {
  flex: none;
}

.nut-tabs--horizontal.nut-tabs--normal .nut-tabs__titles-item__text {
  transform: translateY(-2px);
}
.nut-tabs__titles-item__text {
  text-align: center;
}

.nut-tabs__titles-item__smile,
.nut-tabs__titles-item__line {
  position: absolute;
  transition: width 0.3s ease;
  width: 0;
  height: 0;
  margin-top: 1px;
  content: ' ';
  bottom: $tabs-horizontal-tab-line-bottom;
  left: 50%;
  transform: translate(-50%, 0);
  border-radius: $tabs-horizontal-tab-line-border-radius;
  opacity: $tabs-horizontal-tab-line-opacity;
  overflow: hidden;
}

.nut-tabs__titles-item__smile {
  bottom: -20%;

  .nut-icon {
    position: absolute;
    font-size: 12px;
    width: 100%;
    height: 100%;
    color: $tabs-tab-smile-color;
  }
}

.nut-tabs__titles-item--active {
  color: $tabs-titles-item-active-color;
  font-weight: $tabs-titles-item-active-font-weight;

  .nut-tabs__titles-item__smile {
    overflow: unset;
    bottom: -2%;
    width: 40px;
    height: 20px;
  }

  .nut-tabs__titles-item__line {
    overflow: unset;
    content: ' ';
    width: $tabs-horizontal-titles-item-active-line-width;
    height: $tabs-horizontal-titles-item-active-line-height;
    background: $tabs-horizontal-tab-line-color;
    &.nut-tabs__titles-item__line-full {
      position: absolute;
      height: $tabs-horizontal-titles-item-active-line-full-height;
      bottom: 0;
    }
  }
}

.nut-tabs__titles-item--disabled {
  color: $disable-color;
}

.nut-tabs--horizontal {
  flex-direction: column;
}

.nut-tabs--vertical {
  flex-direction: row;
  width: 100%;

  .nut-tabs__titles {
    box-sizing: border-box;
    flex-direction: column;
    height: 100%;
    padding: 0;
    width: $tabs-vertical-titles-width;
    flex-shrink: 0;
  }

  .nut-tabs__titles--scrollable {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .nut-tabs__titles-item {
    height: $tabs-vertical-titles-item-height;
    flex: none;
    &--next {
      border-top-right-radius: $tabs-titles-item-next-border-top-right-radius;
    }
    &--last {
      border-bottom-right-radius: $tabs-titles-item-last-border-bottom-right-radius;
    }
  }

  .nut-tabs__titles-item__smile {
    width: 0;
    height: 0;
    overflow: hidden;
    transition: width 0.3s ease;
  }

  .nut-tabs__titles-item__line {
    width: 0;
    height: 0;
    transform: translate(0, -50%);
    transition: height 0.3s ease;
    bottom: 15%;
  }

  .nut-tabs__titles-item--active {
    background-color: $tabs-horizontal-titles-item-active-background-color;

    .nut-tabs__titles-item__line {
      left: 10px;
      width: $tabs-vertical-titles-item-active-line-width;
      height: $tabs-vertical-titles-item-active-line-height;
      background: $tabs-vertical-tab-line-color;
    }

    .nut-tabs__titles-item__smile {
      right: -5px;
      bottom: 2%;
      left: auto;
      width: 40px;
      height: 20px;
      transform: rotate(320deg);
    }
  }

  .nut-tabs--horizontal {
    .nut-tabs__titles {
      flex-direction: row;
      overflow-x: auto;
      overflow-y: hidden;
      height: $tabs-horizontal-titles-height;
    }
    .nut-tabs__content {
      flex-direction: row;
    }

    .nut-tabs__titles-item--active {
      background-color: initial;

      .nut-tabs__titles-item__line {
        left: 50%;
        transform: translate(-50%, 0);
      }

      .nut-tabs__titles-item__smile {
        left: 50%;
        right: auto;
        bottom: -3px;
        transform: translate(-50%, 0) rotate(0deg);
      }
    }
  }

  .nut-tabs__content {
    flex-direction: column;
    height: 100%;

    &__wrap {
      flex: 1;
    }

    .nut-tabpane {
      height: 100%;
    }
  }

  .nut-tabs--horizontal {
    .nut-tabs__titles {
      display: flex;
      flex-direction: row;
      padding: 0 !important;
      width: 100%;

      .nut-tabs__titles-item {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1 0 auto;

        &--active {
          color: $tabs-titles-item-active-color;
          font-weight: $tabs-titles-item-active-font-weight;

          .nut-tabs__titles-item__line {
            content: ' ';
            width: $tabs-horizontal-titles-item-active-line-width;
            height: $tabs-horizontal-titles-item-active-line-height;
            background: $tabs-horizontal-tab-line-color;
          }
        }
      }
    }
  }
}

.nut-tabs__content {
  &__wrap {
    overflow: hidden;
  }

  display: flex;
  box-sizing: border-box;
}



.nut-tabs--tag {
  display: inline-block;
  border-radius: $tabs-tag-border-radius;
  padding: $tabs-titles-tag-padding;
  .nut-tabs__titles {
    height: $tabs-titles-tag-height;
    // margin: $tabs-titles-tag-margin;
    position: relative;
    .nut-tabs__titles-tag-item {
      padding: $tabs__titles-tag-item-padding;
      flex: auto;
      z-index: 1;
      transition: color 0.3s ease;
      &.nut-tabs__titles-tag-item--active {
        color: $tabs__titles-tag-item--active-color;
      }
    }
    .nut-tabs__titles-item--active-line {
      // box-sizing: border-box;
      // padding: $tabs__titles-tag-item-padding;
      position: absolute;
      left: 0;
      transition: left 300ms ease, width 300ms ease;
      height: $tabs__titles-item--active-line-height;
      border-radius: $tabs__titles-item--active-line-border-radius;
      background: $tabs__titles-item--active-line-background;
      width: $tabs__titles-item--active-line-width;
    }
  }
}

.nut-tabs--slider {
  padding: $tabs-titles-slider-padding;
  .nut-tabs__titles {
    height: $tabs-titles-slider-height;
    // margin: $tabs-titles-slider-margin;
    background: $tabs-titles-slider-background;
    position: relative;
    .nut-tabs__titles-slider-item {
      color: $tabs__titles-slider-item-color;
      z-index: 1;
      transition: color 0.3s ease;
      &.nut-tabs__titles-slider-item--active {
        color: $tabs__titles-slider-item--active-color;
      }
    }
    .nut-tabs__titles-item--active-line {
      position: absolute;
      left: 0;
      transition: left 300ms ease, width 300ms ease;
      height: $tabs__titles-item--active-slider-line-height;
      border-radius: $tabs__titles-item--active-slider-line-border-radius;
      background: $tabs__titles-item--active-slider-line-background;
      transform: translate($tabs__titles-item--active-slider-line-transx, $tabs__titles-item--active-slider-line-transy);
      width: $tabs__titles-item--active-slider-line-width;
    }
  }
  &-middle {
    .nut-tabs__titles {
      width: $tabs--slider-middle-width;
      margin: 0 auto;
      .nut-tabs__titles-slider-item {
        flex: auto;
      }
    }
    
  }
}

.nut-tabs--card {
  padding: $tabs-titles-card-padding;
  .nut-tabs__titles {
    height: $tabs-titles-card-height;
    box-sizing: content-box;
    // margin: $tabs-titles-card-margin;
    border: $tabs-titles-card-border;
    .nut-tabs__titles-card-item {
      color: $tabs__titles-card-item-color;
      &+.nut-tabs__titles-card-item {
        border-left: $tabs-titles-card-border;
      }
      z-index: 1;
      &.nut-tabs__titles-card-item--active {
        background-color: $tabs__titles-card-item--active-background;
        color: $tabs__titles-card-item--active-color;
      }
    }
  }
}

.nut-tabs--radio {
  .nut-tabs__titles { 
    padding: $tabs-titles-radio-padding;
  }
}

.nut-tabs--radio-group {
  flex-wrap: nowrap !important;
}