// Input_control module's mixin definitions are here. For the module itself
// check `_input_control.scss`.
// Mixin for alternate buttons (button color variants).
// Variables:
// - $button-alt-name : The name of the class used for the alternate button.
// - $button-alt-back-color : The background color of the alternate button.
// - $button-alt-back-opacity : Opacity of the background color of the alternate button.
// - $button-alt-hover-back-opacity : Opacity of the background color of the alternate button on hover.
// - $button-alt-fore-color : (Optional) The text color of the alternate button. Defaults to the text color of the button.
// Notes:
// Due to something like `.button.secondary` being a higher specificity than `a.button` or `a`, no extra rules are
// required for such elements. However rules for the normal button elements are applied in order to not require the
// base class for the button styles.
@mixin make-button-alt-color ($button-alt-name, $button-alt-back-color, $button-alt-back-opacity,
  $button-alt-hover-back-opacity, $button-alt-fore-color: $button-fore-color) {
  button.#{$button-alt-name}, [type="button"].#{$button-alt-name}, [type="submit"].#{$button-alt-name},
  [type="reset"].#{$button-alt-name}, .#{$button-class-name}.#{$button-alt-name}, [role="button"].#{$button-alt-name} {
    background: rgba($button-alt-back-color, $button-alt-back-opacity);
    @if $button-alt-fore-color != $button-fore-color {
      color: $button-alt-fore-color;
    }
    &:hover, &:focus {
      background: rgba($button-alt-back-color, $button-alt-hover-back-opacity);
    }
  }
  @if $style-link-active-state {
    a.#{$button-class-name}.#{$button-alt-name}:active, a[role="button"].#{$button-alt-name}:active {
      background: rgba($button-alt-back-color, $button-alt-hover-back-opacity);
    }
  }
}
// Mixin for alternate button styles (button style variants).
// Variables:
// - $button-alt-name : The name of the class used for the alternate button style.
// - $button-alt-border-style : The border style of the alternate button style.
// - $button-alt-border-radius : Border radius of the alternate button style.
// - $button-alt-padding : Padding of the alternate button style.
// - $button-alt-margin : Margin of the alternate button style.
// Notes:
// Due to something like `.button.small` being a higher specificity than `a.small` or `a`, no extra rules are
// required for such elements. However rules for the normal button elements are applied in order to not require the
// base class for the button styles.
@mixin make-button-alt-style ($button-alt-name, $button-alt-border-style, $button-alt-border-radius,
  $button-alt-padding, $button-alt-margin) {
  button.#{$button-alt-name}, [type="button"].#{$button-alt-name}, [type="submit"].#{$button-alt-name},
  [type="reset"].#{$button-alt-name}, .#{$button-class-name}.#{$button-alt-name}, [role="button"].#{$button-alt-name} {
    @if $button-alt-border-style != $button-border-style {
      border: $button-alt-border-style;
    }
    @if $button-alt-border-radius != $button-border-radius {
      border-radius: $button-alt-border-radius;
    }
    @if $button-alt-padding != $button-padding {
      padding: $button-alt-padding;
    }
    @if $button-alt-margin != $button-margin {
      margin: $button-alt-margin;
    }
  }
}
// Mixin for alternate switch (switch color variants).
// Variables:
// - $switch-alt-name : The name of the class used for the alternate switch.
// - $switch-alt-on-knob-back-color : The background color of the alternate switch's knob when the switch is turned on.
// - $switch-alt-on-bar-back-color : (Optional) The background color of the alternate switch's bar when the switch is turned on. Defaults to the background color of the switch's bar when the switch is turned on.
// - $switch-alt-knob-back-color : (Optional) The background color of the alternate switch's knob. Defaults to the background color of the switch's knob.
// - $switch-alt-bar-back-color : (Optional) The background color of the alternate switch's bar. Defaults to the background color of the switch's bar.
@mixin make-switch-alt-color ($switch-alt-name, $switch-alt-on-knob-back-color,
  $switch-alt-on-bar-back-color: $switch-on-bar-back-color, $switch-alt-knob-back-color: $switch-knob-back-color,
  $switch-alt-bar-back-color: $switch-bar-back-color) {
  @if not ($include-switch) {
    @error "Input_control module's switch mixins are only available if switchws are enabled. Set '$include-switch' to 'true' and try again!";
  }
  [type="checkbox"] + label.#{$switch-name}.#{$switch-alt-name},
  [type="radio"] + label.#{$switch-name}.#{$switch-alt-name} {
    &:before {
      @if $switch-alt-bar-back-color != $switch--bar-back-color {
        background: $switch-alt-bar-back-color;
      }
    }
    &:after {
      @if $switch-alt-knob-back-color != $switch-knob-back-color {
        background: $switch-alt-knob-back-color;
      }
    }
  }
  [type="checkbox"]:checked + label.#{$switch-name}.#{$switch-alt-name},
  [type="radio"]:checked + label.#{$switch-name}.#{$switch-alt-name} {
    &:before {
      @if $switch-alt-on-bar-back-color != $switch-on-bar-back-color {
        background: $switch-alt-on-bar-back-color;
      }
    }
    &:after {
      @if $switch-alt-on-knob-back-color != $switch-on-knob-back-color {
        background: $switch-alt-on-knob-back-color;
      }
    }
  }

}
