@forward "./base-btn";

@mixin mask-var($bg) {
  -webkit-mask-image: $bg;
  mask-image: $bg;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: var(--mask-size);
  width: var(--mask-size);
  height: var(--mask-size);
}

@mixin vendor-prefix($name, $value) {
  @each $vendor in ("-webkit-", "-moz-", "-ms-", "-o-", "") {
    #{$vendor}#{$name}: #{$value};
  }
}

@mixin size($w: 24px, $h: null) {
  width: $w;

  @if $h ==null {
    height: $w;
  } @else {
    height: $h;
  }
}

@mixin icon($bg, $w: 24px, $h: null) {
  background: $bg no-repeat center;
  width: $w;

  @if $h ==null {
    height: $w;
  } @else {
    height: $h;
  }
}

@mixin theme-icon($bg-light, $bg-dark, $w: 24px, $h: null) {
  background: $bg-light no-repeat center;

  width: $w;

  @if $h ==null {
    height: $w;
  } @else {
    height: $h;
  }
}

@mixin mask($url, $w: 24px, $h: null) {
  mask-image: $url;
  -webkit-mask-image: $url;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: $w;
  -webkit-mask-size: $w;
  width: $w;

  @if $h ==null {
    height: $w;
  } @else {
    height: $h;
  }
}

@mixin flex($direction: row, $justify: center, $align: center) {
  display: flex;
  flex-direction: $direction;
  justify-content: $justify;
  align-items: $align;
}

@mixin scrollbar($y: true, $x: false, $over: auto) {
  --thumb-color: var(--ic-02);

  @if $y {
    overflow-y: $over;
  }

  @if $x {
    overflow-x: $over;
  }

  &::-webkit-scrollbar {
    width: var(--scrollbar-width, 6px);
    height: 5px;
    background-color: transparent;
    display: block;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--thumb-color);
    border-radius: 5px;

    &:hover {
      --thumb-color: var(--border-color-focus);
    }
  }
}

@mixin border-fix($offset: 0) {
  position: relative;

  &::after {
    content: "";
    position: absolute;
    top: $offset;
    left: $offset;
    right: $offset;
    bottom: $offset;
    pointer-events: none;
    @content;
  }
}

@mixin abs-center-y {
  top: 50%;
  transform: translateY(-50%);
}

// label for "outlined" form controls
@mixin outlined-control-label {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: -8px;
  left: var(--label-offset-left-x);
  padding: 0 4px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  white-space: pre;
  text-overflow: ellipsis;
  cursor: inherit;
  color: var(--label-color);
  font-size: 12px;
  font-weight: 500;

  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 4px;
  background: var(--bg-elevated-01);

  > span {
    overflow: hidden;
    white-space: pre;
    text-overflow: ellipsis;
  }
}

@mixin field-helper {
  font-size: 12px;
  color: var(--txt-03);
  padding: 2px 0 0;
  white-space: pre-wrap;
  text-overflow: ellipsis;
  font-weight: 500;
  line-height: 16px;
  margin-top: 6px;
}

@mixin field-error {
  font-size: 12px;
  color: var(--txt-error);
  padding: 2px 0 0;
  white-space: pre-wrap;
  text-overflow: ellipsis;
  font-weight: 500;
  line-height: 16px;
  margin-top: 6px;
}

@mixin scrollbarTable($y: true, $x: false) {
  @if $y {
    overflow-y: auto;
  }

  @if $x {
    overflow-x: auto;
  }

  &::-webkit-scrollbar {
    width: 7px;
    height: 8px;
    background-color: #e1e3eb;
    display: block;
  }

  &::-webkit-scrollbar-thumb {
    background: #fff;
    border-radius: 9999px;
    background-clip: padding-box;
    border: 2px solid transparent;
    border-right: 1px solid transparent;
  }
}
