@mixin default-focus-style(
  $border-color: $focus-color,
  $box-shadow: 0 0 0 2px $focus-color,
  $border-radius: $default-border-radius) {
  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: $button-bg-color,
  $hover-color: $button-hover-bg-color,
  $hover-border-color: $button-hover-border-color,
  $border-radius: $button-border-radius,
  $border: $button-border-width solid $button-border-color,
  $box-shadow: $button-box-shadow,
  $padding: $button-padding,
  $margin: $button-margin,
  $color: $button-text-color,
  $line-height: $form-field-line-height,
  $focus-border-color: $button-focus-border-color,
  $focus-box-shadow: $button-focus-box-shadow) {
  display: inline-block;
  font-family: $default-font-family;
  font-size: $default-font-size;
  font-weight: $button-font-weight;
  line-height: $line-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 $transition-duration;
  @include antialiased-font-smoothing;

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

  &:active, &:active:focus {
    border-color: $hover-border-color;
    box-shadow: none;
  }

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

  &.disabled, &[disabled],
  &.disabled:active, &[disabled]:active,
  &.disabled:hover, &[disabled]:hover {
    background-color: transparentize($button-bg-color, 0.5);
    cursor: not-allowed;
    box-shadow: none;
  }

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

@mixin form-label {
  width: $form-left-width;
  padding-right: 2 * $default-padding;
  padding-top: 0.6em;
  margin-top: $default-margin;
  vertical-align: top;
  word-break: normal;
  float: left;
  text-align: right;
  font-size: $default-font-size;
}

@mixin form-value-display {
  float: right;
  width: $form-right-width;
  margin: $form-field-margin;
  padding: $default-padding 2*$default-padding;
  line-height: 21px;
  min-height: $form-field-height;
  background: white;
  border-radius: $default-border-radius;
}

@mixin form-hint($background-color: $light_yellow, $border-color: $medium-gray) {
  font-size: $small-font-size;
  line-height: 1.5em;
  padding: $default-padding;
  background-color: $background-color;
  border: 1px solid $border-color;
  display: block;
  clear: both;
  border-radius: $default-border-radius;
}

@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 $dark-gray;
  -webkit-box-shadow: $shadow;
  -moz-box-shadow: $shadow;
  -ms-box-shadow: $shadow;
  -o-box-shadow: $shadow;
  box-shadow: $shadow;
}

@mixin tag-base($margin: 2*$default-margin 0, $padding: $default-padding 3*$default-padding) {
  padding: $padding;
  margin: $margin;
  background-color: $medium-gray;
  overflow: hidden;
  position: relative;
  border-radius: $default-border-radius;

  &:before {
    content: fa-content($fa-var-tag);
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.8em;
    padding-right: 2*$default-padding;
  }

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

@mixin linked-button(
  $border-radius: $default-border-radius,
  $line-height: $form-field-line-height,
  $padding: 3px) {
  @include button-defaults(
    $line-height: $line-height,
    $background-color: $linked-button-color,
    $hover-color: darken($linked-button-color, 10%),
    $border: 1px solid $linked-border-color,
    $hover-border-color: darken($linked-border-color, 10%),
    $border-radius: $border-radius,
    $box-shadow: none,
    $padding: $padding,
    $margin: 0
  );
}

@mixin zoom-in {
  cursor: pointer;
  cursor: image-url('alchemy/lupe.cur');
  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 hint-hover-style {
  visibility: visible;
  top: 26px;
  opacity: 1;
  transition-delay: .2s;
}

@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;
}
