@mixin selection_mode_button() {
  button, button.flat, button.suggested-action {
    border-width: 1px;
    border-style: solid;
    border-radius: $button_radius;
    border-color: gtkshade($selected_bg_color, 0.5);
    color: gtkmix($selected_fg_color, $selected_bg_color, 0.1);
    background-color: $selected_bg_color;
    background-image: linear-gradient(to bottom, $selected_bg_color 40%, gtkshade($selected_bg_color, 0.85));
    box-shadow: inset 0 1px gtkalpha($light_shadow, 0.5), inset 0 -1px gtkalpha($dark_shadow, 0.025);
    text-shadow: 0 1px $dark_shadow;
    -gtk-icon-shadow: 0 1px $dark_shadow;
    outline-color: gtkalpha($selected_fg_color, 0.5);

    &:hover { background-image: linear-gradient(to bottom, gtkshade($selected_bg_color, 1.1) 40%, gtkshade($selected_bg_color, 0.95)); }

    &:active, &:checked {
      border-color: gtkshade($selected_bg_color, 0.5);
      background-color: gtkshade($selected_bg_color, 0.95);
      background-image: none;

      &:backdrop {
        border-color: gtkshade($unfocused_selected_bg_color, 0.5);
        background-color: gtkshade($unfocused_selected_bg_color, 0.975);
        background-image: none;
        text-shadow: none;
        -gtk-icon-shadow: none;
      }
    }

    &:disabled {
      border-color: gtkshade($selected_bg_color, 0.85);
      color: gtkalpha($selected_fg_color, 0.75);
      background-color: gtkmix($selected_bg_color, $disabled_bg_color, 0.2);
      background-image: none;
      text-shadow: none;
      -gtk-icon-shadow: none;

      &:backdrop {
        border-color: gtkshade($unfocused_selected_bg_color, 0.85);
        color: gtkalpha($unfocused_selected_fg_color, 0.6);;
        background-color: gtkmix($unfocused_selected_bg_color, $unfocused_disabled_bg_color, 0.2);
        background-image: none;
        text-shadow: none;
        -gtk-icon-shadow: none;
      }
    }

    &:backdrop {
      border-color: gtkshade($unfocused_selected_bg_color, 0.5);
      color: $unfocused_selected_fg_color;
      background-color: $unfocused_selected_bg_color;
      background-image: none;
      text-shadow: none;
      -gtk-icon-shadow: none;
    }
  }
}

@mixin selection_mode() {
  toolbar.selection-mode { padding: 4px; }

  headerbar.selection-mode, toolbar.selection-mode {
    border-color: gtkshade($selected_bg_color, 0.5);
    color: $selected_fg_color;
    background-color: $selected_bg_color;
    box-shadow: inset 0 1px gtkalpha($light_shadow, 0.5), inset 0 -1px gtkalpha($dark_shadow, 0.025), inset 0 -2px gtkalpha($dark_shadow, 0.1);

    &:backdrop {
      border-color: gtkshade($unfocused_selected_bg_color, 0.5);
      color: $unfocused_selected_fg_color;
      background-color: $unfocused_selected_bg_color;
      box-shadow: inset 0 1px gtkalpha($light_shadow, 0.25), inset 0 -1px gtkalpha($dark_shadow, 0.01);
    }

    @include selection_mode_button();

    .selection-menu button {
      border-style: none;
      background-color: transparent;
      color: gtkshade($selected_bg_color, 0.8);

      .dim-label {
        color: gtkshade($selected_bg_color, 0.7);
      }
    }
  }
}
