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

  &:hover {
    color: $fg;
    background-color: gtkshade($bg, 1.1);
    background-image: linear-gradient(to bottom, gtkshade($bg_color, 1.2), gtkshade($bg, 0.999));
  }

  &:active, &:checked {
    color: $fg_color;
    border-color: gtkshade($br, 0.9);
    background-color: gtkmix($bg, $fg, 0.1);
    background-image: linear-gradient(to bottom, gtkshade($bg, 0.9), gtkshade($bg, 0.8));

    &:backdrop {
    }
    
    &: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);
      background-image: linear-gradient(to bottom, gtkshade($bg, 0.95), gtkshade($bg, 0.9));
      
      &:backdrop {
      }
    }
  }

  &:disabled {
    color: gtkmix($fg, $unfocused_disabled_fg_color, 0.5);
    border-color: gtkshade($br, 1.15);
    background-image: linear-gradient(to bottom, gtkshade($unfocused_disabled_bg_color, 1.05), $unfocused_disabled_bg_color);
    
    &:backdrop {
    }
  }

  &:backdrop {
  }
}

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

  &:hover {
    color: $fg;
    border-color: $br;
    background-color: $bg;
    background-image: linear-gradient(to bottom, gtkshade($bg, 1.2), gtkshade($bg, 0.98));
    -gtk-outline-radius: $button_radius;
  }

  &:active, &:checked {
    color: $fg_color;
    border-color: gtkshade($br, 0.9);
    background-color: gtkmix($bg, $fg, 0.1);
    background-image: linear-gradient(to bottom, gtkshade($bg, 0.9), gtkshade($bg, 0.8));
    
    &:backdrop {
    }
  }

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

  &:backdrop {
  }
}

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