@mixin normal_buttons($bg, $fg, $br) {
  padding: 4px 4px;
  border-style: solid;
  border-width: 1px;
  border-radius: $button_radius;
  color: $fg;
  border-color: gtkshade($br, 0.5);
  background-color: $bg;
  background-image: linear-gradient(to bottom, $base_color, $bg_color);
  -gtk-outline-radius: $button_radius;

  outline-radius: 4px;
  outline-offset: 0;
  outline-style: solid;
  outline-color: gtkshade($br, 0.5);

  &:hover {
    outline-color: $selected_bg_color;
    color: $selected_bg_color;
    border-color: $selected_bg_color;
  }

  &:active, &:checked {
    color: $fg;
    border-color: gtkshade($br, 0.7);
    outline-color: gtkshade($br, 0.7);
    background-color: gtkmix($bg, $selected_bg_color, 0.3);
    background-image: none;

    &:backdrop {
      color: $unfocused_fg_color;
      border-color: gtkshade($unfocused_borders, 0.9);
      background-color: gtkmix($bg, $unfocused_selected_bg_color, 0.3);
    }
    
    &:disabled {
      color: gtkmix($fg, $unfocused_disabled_fg_color, 0.1);
      border-color: gtkmix($fg, $disabled_bg_color, 0.85);
      background-color: gtkshade($disabled_bg_color, 0.9);
      
      &:backdrop {
        color: $unfocused_disabled_fg_color;
        border-color: $unfocused_borders;
        background-color: gtkshade($unfocused_disabled_bg_color, 0.9);
      }
    }
  }

  &:disabled {
    color: gtkmix($fg, $unfocused_disabled_fg_color, 0.5);
    
    &:backdrop {
      color: $unfocused_disabled_fg_color;
    }
  }

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

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

  &:hover {
    color: $selected_fg_color;
    text-shadow: 1px 1px $dark_shadow;
    -gtk-icon-shadow: 1px 1px $dark_shadow;
  }

  &:active, &:checked {
    color: $fg;
    
    &:backdrop {
    }
  }

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

  &:backdrop {
    color: $unfocused_fg_color;
  }
}

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