.sidebar-pane {
  background-color: var(--sidebar-bg-color);
  color: var(--sidebar-fg-color);

  &:backdrop {
    background-color: var(--sidebar-backdrop-color);
    transition: background-color $backdrop_transition;
  }

  --shade-color: var(--sidebar-shade-color);

  banner > revealer > widget {
    background-color: color-mix(in srgb, var(--banner-color) 30%, var(--sidebar-bg-color));
    color: var(--sidebar-fg-color);

    &:backdrop {
      background-color: color-mix(in srgb, var(--banner-color) 15%, var(--sidebar-bg-color));
    }
  }

  &:dir(ltr), &.end:dir(rtl) {
    &, banner > revealer > widget {
      box-shadow: inset -1px 0 if($contrast == 'high', $border_color, var(--sidebar-border-color));
    }
  }

  &:dir(rtl), &.end:dir(ltr) {
    &, banner > revealer > widget {
      box-shadow: inset 1px 0 if($contrast == 'high', $border_color, var(--sidebar-border-color));
    }
  }
}

/* Middle pane in three-pane setups */
:not(.isolated) > .content-pane :not(.isolated) > .sidebar-pane,
:not(.isolated) > .sidebar-pane :not(.isolated) > .content-pane {
  background-color: var(--secondary-sidebar-bg-color);
  color: var(--secondary-sidebar-fg-color);

  &:backdrop {
    background-color: var(--secondary-sidebar-backdrop-color);
    transition: background-color $backdrop_transition;
  }

  --shade-color: var(--secondary-sidebar-shade-color);

  banner > revealer > widget {
    background-color: color-mix(in srgb, var(--banner-color) 30%, var(--secondary-sidebar-bg-color));
    color: var(--secondary-sidebar-fg-color);

    &:backdrop {
      background-color: color-mix(in srgb, var(--banner-color) 15%, var(--secondary-sidebar-bg-color));
    }
  }

  &:dir(ltr), &.end:dir(rtl) {
    &, banner > revealer > widget {
      box-shadow: inset -1px 0 if($contrast == 'high', $border_color, var(--secondary-sidebar-border-color));
    }
  }

  &:dir(rtl), &.end:dir(ltr) {
    &, banner > revealer > widget {
      box-shadow: inset 1px 0 if($contrast == 'high', $border_color, var(--secondary-sidebar-border-color));
    }
  }
}

.sidebar-pane .sidebar-pane {
  background-color: transparent;
  color: inherit;
}

stacksidebar row {
  padding: 10px 4px;

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

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

/**********************
 * Navigation Sidebar *
 **********************/

.navigation-sidebar {
  &, &.view, &.view:disabled {
    background-color: transparent;
    color: inherit;
  }

  &.background {
    &, &:disabled {
      background-color: var(--window-bg-color);
      color: var(--window-fg-color);
    }
  }

  row.activatable, child.activatable, flowboxchild {
    &:hover { background-color: $hover_color; }

    &:active { background-color: $active_color; }

    // this is for indicating which row generated a popover see https://bugzilla.gnome.org/show_bug.cgi?id=754411
    &.has-open-popup { background-color: $hover_color; }

    &:selected {
      &:hover { background-color: $selected_hover_color; }

      &:active { background-color: $selected_active_color; }

      &.has-open-popup { background-color: $selected_hover_color; }
    }
  }

  row, child, flowboxchild {
    &:selected {
      background-color: $selected_color;
    }
  }

  padding: $menu-margin 0; //only vertical padding. horizontal row size would clip

  > separator {
    margin: $menu-margin;
  }

  @if $contrast == 'high' {
    > row, > child, > flowboxchild {
      &:selected {
        box-shadow: inset 0 0 0 1px $border_color;
      }
    }
    > row.activatable, > child.activatable, > flowboxchild {
      &:hover,
      &:active {
        box-shadow: inset 0 0 0 1px $border_color;
      }
    }
    > row.activatable.has-open-popup {
      box-shadow: inset 0 0 0 1px $border_color;
    }
  }

  > row {
    border-radius: $menu_radius;
    min-height: 36px;
    padding: 0 8px;
    margin: 0 $menu_margin 2px;
  }

  > child, > flowboxchild {
    border-radius: $menu_radius;
    margin: 3px;
    padding: 8px;
  }
}

gridview.navigation-sidebar, flowbox.navigation-sidebar {
  padding: 3px;
}
