@mixin default-focus-style(
  $border-color: var(--focus-color),
  $box-shadow: 0 0 0 2px var(--focus-color),
  $border-radius: var(--border-radius_medium)
) {
  border-color: $border-color;
  border-radius: $border-radius;
  box-shadow: $box-shadow;
  outline: none;

  &::-moz-focus-inner {
    border: none !important;
    padding: 1px !important;
  }
}

@mixin button-defaults(
  $background-color: var(--button-bg-color),
  $hover-color: var(--button-hover-bg-color),
  $hover-border-color: var(--button-hover-border-color),
  $border-radius: var(--button-border-radius),
  $border: var(--button-border),
  $box-shadow: var(--button-box-shadow),
  $height: var(--button-height),
  $padding: var(--button-padding),
  $margin: var(--button-margin),
  $color: var(--button-text-color),
  $line-height: var(--button-line-height),
  $focus-border-color: var(--button-focus-border-color),
  $focus-box-shadow: var(--button-focus-box-shadow)
) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: var(--button-font-size);
  font-weight: var(--button-font-weight);
  height: $height;
  padding: $padding;
  cursor: pointer;
  border-radius: $border-radius;
  background-color: $background-color;
  box-shadow: $box-shadow;
  border: $border;
  color: $color;
  margin: $margin;
  -webkit-appearance: none;
  transition: all var(--transition-duration);
  @include antialiased-font-smoothing;

  &:hover {
    text-decoration: none;
    background-color: $hover-color;
    border-color: $hover-border-color;
  }

  &:active,
  &.active {
    box-shadow: inset var(--button-box-shadow);
  }

  &:focus {
    @include default-focus-style(
      $border-color: $focus-border-color,
      $box-shadow: $focus-box-shadow
    );
  }

  &.disabled,
  &[disabled] {
    background-color: var(--button-disabled-bg-color);
    border-color: var(--button-border-color);
    cursor: not-allowed;
    box-shadow: none;
    outline: none;
  }

  &::-moz-focus-inner {
    padding: 0 !important;
    margin: -1px !important;
  }
}

@mixin form-label {
  width: var(--form-left-column-width);
  padding-right: var(--spacing-2);
  padding-top: 0.6em;
  margin-top: var(--spacing-1);
  vertical-align: top;
  word-break: normal;
  float: left;
  text-align: right;
  font-size: var(--font-size_medium);
  color: var(--form-field-label-color);
}

@mixin form-hint(
  $background-color: var(--hint-background-color),
  $border-color: var(--hint-border-color),
  $color: var(--hint-text-color)
) {
  font-size: var(--font-size_small);
  line-height: 1.5em;
  padding: var(--spacing-1);
  background-color: $background-color;
  border: 1px solid $border-color;
  color: $color;
  display: block;
  clear: both;
  border-radius: var(--border-radius_medium);
}

@mixin animate-left {
  -webkit-transition: left 0.15s ease-in-out;
  -moz-transition: left 0.15s ease-in-out;
  -ms-transition: left 0.15s ease-in-out;
  -o-transition: left 0.15s ease-in-out;
  transition: left 0.15s ease-in-out;
}

@mixin bottom-right-rounded-border {
  $side: bottom-right;
  $radius: 3px;
  -webkit-border-#{$side}-radius: $radius;
  -moz-border-radius-#{$side}: $radius;
  -ms-border-#{$side}-radius: $radius;
  -o-border-#{$side}-radius: $radius;
  border-#{$side}-radius: $radius;
}

@mixin drop-shadow {
  $shadow: 0px 0px 4px var(--color-grey_dark);
  -webkit-box-shadow: $shadow;
  -moz-box-shadow: $shadow;
  -ms-box-shadow: $shadow;
  -o-box-shadow: $shadow;
  box-shadow: $shadow;
}

@mixin label-base(
  $margin: var(--spacing-2) 0,
  $padding: var(--spacing-1) var(--spacing-3)
) {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  vertical-align: middle;
  padding: $padding;
  margin: $margin;
  background-color: var(--tag-background-color);
  overflow: hidden;
  position: relative;
  border-radius: var(--border-radius_medium);
  color: var(--text-color);
}

@mixin tag-base($margin: var(--spacing-2) 0, $padding: var(--spacing-2)) {
  @include label-base($margin: $margin, $padding: $padding);
  line-height: 1.3;

  &:before {
    display: inline-flex;
    align-self: start;
    flex-shrink: 0;
    content: "";
    background-image: var(--tag-background-image);
    width: 12px;
    height: 12px;
    margin-top: var(--spacing-0);
  }

  &:focus {
    @include default-focus-style(
      $box-shadow: inset 0 0 0 2px var(--focus-color)
    );
  }
}

@mixin zoom-in {
  cursor: pointer;
  cursor: -webkit-zoom-in;
  cursor: -moz-zoom-in;
  cursor: zoom-in;
}

@mixin truncate($max-width, $display: inline-block, $wrap: normal) {
  display: $display;
  max-width: $max-width;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: $wrap;
}

@mixin clearfix {
  &::after {
    clear: both;
    content: "";
    display: table;
  }
}

@mixin border-top-radius($radius) {
  border-top-left-radius: $radius;
  border-top-right-radius: $radius;
}

@mixin border-bottom-radius($radius) {
  border-bottom-left-radius: $radius;
  border-bottom-right-radius: $radius;
}

@mixin border-left-radius($radius) {
  border-bottom-left-radius: $radius;
  border-top-left-radius: $radius;
}

@mixin border-right-radius($radius) {
  border-bottom-right-radius: $radius;
  border-top-right-radius: $radius;
}

@mixin antialiased-font-smoothing {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
