@mixin common_sidebar() {
  background-color: $sidebar_bg_color;

  .view:not(:selected), iconview {
    border: none;
    color: $sidebar_fg_color;
    background-color: transparent;
  }

  frame > border, .frame { border: none; }

  row:not(:selected), view row:not(:selected), row.sidebar-row:not(:selected) {
    color: $sidebar_fg_color;

    &:backdrop { color: $unfocused_fg_color; }
  }

  .expander {
    color: $sidebar_fg_color;

    &:hover { color: $selected_bg_color; }
  }
}

@mixin sidebar() {
  filechooser, .nautilus-window, .nemo-window {
    placessidebar list { background-color: $sidebar_bg_color; }

    .sidebar { @include common_sidebar(); }
  }

  .caja-navigation-window .caja-side-pane { @include common_sidebar(); }

  stacksidebar {
    list {
      background-color: transparent;

      separator {
        background-color: $borders;

        &:backdrop { background-color: $unfocused_borders; }
      }
    }

    &.sidebar {
      &:dir(ltr) list,
      &.left list,
      &.left:dir(rtl) list {
        border-right: 1px solid $borders;
        border-left-style: none;
      }

      &:dir(rtl) list,
      &.right list {
        border-left: 1px solid $borders;
        border-right-style: none;
      }
    }

    row {
      padding: 10px 4px;

      > label {
        padding-left: 6px;
        padding-right: 6px;
      }

      &.needs-attention > label { background-size: 6px 6px, 0 0; }
    }
  }

  placessidebar {
    > viewport.frame { border-style: none; }

    row {
      min-height: 36px;
      padding: 0px;

      > revealer { padding: 0 14px; }

      image.sidebar-icon {
        opacity: 1;

        &:dir(ltr) { padding-right: 8px; }
        &:dir(rtl) { padding-left: 8px; }
      }

      label.sidebar-label {
        &:dir(ltr) {padding-right: 2px; }
        &:dir(rtl) { padding-left: 2px; }
      }

      &.sidebar-new-bookmark-row { color: $selected_bg_color; }

      &:drop(active):not(:disabled) {
        color: gtkshade($success_color, 0.8);
        box-shadow: inset 0 1px gtkshade($success_color, 0.8), inset 0 -1px gtkshade($success_color, 0.8);

        &:selected {
          color: $selected_fg_color;
          background-color: gtkshade($success_color, 0.8);
        }
      }
    }
  }

  button.sidebar-button {
    @include flat_buttons($bg_color, $fg_color, $borders);

    min-width: 22px;
    min-height: 22px;
    margin-top: 2px;
    margin-bottom: 2px;
    padding: 0;
    border-radius: 100%;
    color: $sidebar_fg_color;
    -gtk-outline-radius: 100%;

    &:hover, &:active { color: $fg_color; }
    &:not(:hover):not(:active) > image { opacity: 0.5; }
  }
}
