// tab
.yc-tabs-tab {
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  outline: none;
  background-color: transparent;
  color: var(--color-text-2);
  line-height: 1.5715;
  display: flex;
  align-items: center;
  gap: 8px;

  .yc-tabs-tab-title {
    position: relative;
    padding: 1px 0;
  }
  &.yc-tabs-tab-active {
    color: rgb(var(--primary-6));
    font-weight: 500;
  }
}

// line text
.yc-tabs-tab-type-line,
.yc-tabs-tab-type-text {
  margin: 0 16px;
  transition: color 0.2s cubic-bezier(0, 0, 1, 1);
  .yc-tabs-tab-title {
    &::after {
      content: '';
      z-index: -1;
      position: absolute;
      top: 0;
      right: -8px;
      bottom: 0;
      left: -8px;
      background-color: transparent;
      border-radius: var(--border-radius-small);
      opacity: 1;
      transition:
        background-color 0.2s cubic-bezier(0, 0, 1, 1),
        opacity 0.2s cubic-bezier(0, 0, 1, 1);
    }
  }
  &:not(.yc-tabs-tab-active):not(.yc-tabs-tab-disabled):hover
    .yc-tabs-tab-title {
    &::after {
      background-color: var(--color-fill-2);
    }
  }
  &.yc-tabs-tab-type-text {
    margin: 0 9px;
    padding: 5px 0;
    &:not(:first-child)::before {
      content: '';
      position: absolute;
      top: 50%;
      left: -9px;
      width: 2px;
      height: 12px;
      background-color: var(--color-fill-3);
      transform: translateY(-50%);
    }
    .yc-tabs-tab-title {
      position: relative;
      padding-left: 9px;
      padding-right: 9px;
      &::after {
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
      }
    }
  }
  &.yc-tabs-tab-type-line {
    &.yc-tabs-tab-vertical {
      margin: 0;
      padding: 0 20px;
    }
  }
  &.yc-tabs-tab-no-padding {
    margin-left: 0;
    &.yc-tabs-tab-type-text {
      margin-left: 0;
    }
  }
}
// card card-gutter
.yc-tabs-tab-type-card,
.yc-tabs-tab-type-card-gutter {
  padding: 0 16px;
  border: 1px solid var(--color-neutral-3);
  transition:
    padding 0.2s cubic-bezier(0, 0, 1, 1),
    color 0.2s cubic-bezier(0, 0, 1, 1);
  &.yc-tabs-tab {
    &:not(.yc-tabs-tab-disabled):not(.yc-tabs-tab-active):hover {
      background-color: var(--color-fill-3);
    }
  }
  &.yc-tabs-tab-type-card-gutter {
    background-color: var(--color-fill-1);
    border-radius: var(--border-radius-small) var(--border-radius-small) 0 0;
  }
  &.yc-tabs-tab-horizontal {
    &.yc-tabs-tab-type-card {
      &:not(:first-child) {
        border-left: none;
      }
      &:first-child {
        border-top-left-radius: 2px;
      }
      &:last-child {
        border-top-right-radius: 2px;
      }
    }
    &.yc-tabs-tab-active {
      background-color: transparent;
      border-bottom-color: var(--color-bg-2);

      &.yc-tabs-tab-bottom {
        border-top-color: var(--color-bg-2);
        border-bottom-color: var(--color-neutral-3);
      }
    }
  }
  &.yc-tabs-tab-vertical {
    border-bottom: none;
    &:not(:last-child) {
      border-bottom: 1px solid var(--color-neutral-3);
    }
    &.yc-tabs-tab-type-card {
      &:not(:first-child) {
        border-top: none;
      }
    }
    &.yc-tabs-tab-active {
      background-color: transparent;
      border-right-color: var(--color-bg-2);
      &.yc-tabs-tab-right {
        border-right-color: var(--color-neutral-3);
        border-left-color: var(--color-bg-2);
      }
    }
  }
}
// rounded
.yc-tabs-tab-type-rounded {
  margin: 0 6px;
  padding: 0 16px;
  border-radius: 32px;
  &:not(.yc-tabs-tab-disabled):hover {
    background-color: var(--color-fill-2);
  }
  &.yc-tabs-tab-active {
    background-color: var(--color-fill-2);
  }
}
// capsule
.yc-tabs-tab-type-capsule {
  padding: 0 10px;
  &:not(.yc-tabs-tab-disabled):hover {
    background-color: var(--color-bg-2);
  }
  &.yc-tabs-tab-active {
    background-color: var(--color-bg-2);
  }
}

// size
@size: {
  @mini: {
    line-height: 18px;
    @padding: {
      line: 6px;
      rounded: 3px;
      card: 1px;
    };
  };
  @small: {
    line-height: 22px;
    @padding: {
      line: 6px;
      rounded: 3px;
      card: 1px;
    };
  };
  @medium: {
    line-height: 26px;
    @padding: {
      line: 8px;
      rounded: 5px;
      card: 4px;
    };
  };
  @large: {
    line-height: 30px;
    @padding: {
      line: 10px;
      rounded: 7px;
      card: 5px;
    };
  };
};
@type: line, card, card-gutter, capsule, rounded;
each(@size, .(@value, @name) {
  @key: replace(~'@{name}', '@', '');
  .yc-tabs-tab-size-@{key} {
    each(@type, .(@type-value,@type-key) {
      &.yc-tabs-tab-type-@{type-value} {
        font-size: if(@key = mini, 12px, 14px);
        & when (@type-value = capsule) {
          line-height: @value[line-height];
        }
        & when (@type-value = card), (@type-value = card-gutter) {
          @padding: @value[@padding][card];
          padding-top: @padding;
          padding-bottom: @padding;
        }
        & when (@type-value = line),(@type-value = rounded) {
          @padding:if(@type-value = line, @value[@padding][line], @value[@padding][rounded]);
          padding-top:@padding;
          padding-bottom:@padding;
        }
      }
    });
  }
});

.yc-tabs-tab-disabled {
  cursor: not-allowed;
  background-color: transparent;
  color: var(--color-text-4);
  &.yc-tabs-tab-active {
    color: var(--color-primary-light-3);
  }
}
