@mixin normal_buttons($bg, $fg, $br) {
  padding: 4px 8px;
  border: none;
  border-radius: $button_radius;
  color: $fg;
  background-color: gtkmix($bg, $fg, 0.2);
  outline-color: gtkalpha($dark_shadow, 0.15);
  outline-offset: -2px;
  outline-width: 2px;
  outline-style: solid;

  &:hover {
    color: $fg;
    background-color: gtkmix($bg, $fg, 0.25);
  }

  &:active, &:checked {
    color: $fg;
    background-color: gtkmix($bg, $fg, 0.35);

    &:backdrop {
      color: $unfocused_fg_color;
      background-color: gtkshade($unfocused_bg_color, 0.85);
    }
  }

  &:disabled {
    color: gtkmix($fg, $unfocused_disabled_fg_color, 0.1);
    background-color: gtkmix($bg, $disabled_bg_color, 0.3);
    
    &:backdrop {
      color: $unfocused_disabled_fg_color;
      background-color: gtkmix($bg, $unfocused_disabled_bg_color, 0.3);
    }
  }

  &:backdrop {
    color: gtkmix($fg, $unfocused_bg_color, 0.3);
    background-color: gtkmix($bg, $fg, 0.2);
  }
}

@mixin flat_buttons($bg, $fg, $br)
{
  border-color: transparent;
  border-radius: $button_radius;
  color: $fg;
  background-color: transparent;

  &:hover {
    color: $fg;
    background-color: $bg;
  }

  &:active, &:checked {
    color: $selected_fg_color;
    background-color: $selected_bg_color;
    
    &:backdrop {
      color: $unfocused_selected_fg_color;
      background-color: $unfocused_selected_bg_color;
    }
  }

  &:disabled {
    color: gtkalpha($fg, 0.8);
    background-color: transparent;
    
    &:backdrop {
      color: gtkalpha($fg, 0.7);
      background-color: transparent;
    }
  }

  &:backdrop {
    background-color: transparent;
    color: $unfocused_fg_color;
  }
}

@mixin button() {
  button {
    @include normal_buttons($bg_color, $fg_color, $borders);
    
    &.flat {
      @include flat_buttons($bg_color, $fg_color, $borders);
    }
  }
}
