.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 var(--sidebar-border-color);

      @media (prefers-contrast: more) {
        box-shadow: inset -1px 0 $border_color;
      }
    }
  }

  &:dir(rtl), &.end:dir(ltr) {
    &, banner > revealer > widget {
      box-shadow: inset 1px 0 var(--sidebar-border-color);

      @media (prefers-contrast: more) {
        box-shadow: inset 1px 0 $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 var(--secondary-sidebar-border-color);

      @media (prefers-contrast: more) {
        box-shadow: inset -1px 0 $border_color;
      }
    }
  }

  &:dir(rtl), &.end:dir(ltr) {
    &, banner > revealer > widget {
      box-shadow: inset 1px 0 var(--secondary-sidebar-border-color);

      @media (prefers-contrast: more) {
        box-shadow: inset 1px 0 $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,
  > .header > separator {
    margin: $menu_margin;
  }


  > .header > .heading {
    margin: $menu_margin + 6px;
  }

  /* No top margin on the first header */
  > .header.first > .heading {
    margin-top: 0;
  }

  @media (prefers-contrast: more) {
    > 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;
}

/**************
 * AdwSidebar *
 **************/

sidebar {
  .navigation-sidebar > row {
    // We have a context menu on these rows, remove padding and re-add it on
    // the child. Otherwise the edges would be unclickable, and the menu would
    // be positioned wrong
    padding: 0;

    > box {
      padding: 3px 14px;
      min-height: 36px;
      border-spacing: 12px;

      > .icon:disabled {
        opacity: var(--disabled-opacity);
      }
    }
  }

  .boxed-list {
    .icon:disabled,
    .arrow:disabled {
      opacity: var(--disabled-opacity);
    }
  }

  &:not(.page).empty statuspage {
    @extend .compact;
  }
}

/**************************
 * AdwViewSwitcherSidebar *
 **************************/

view-switcher-sidebar .indicator {
  background: color-mix(in srgb, currentColor 40%, transparent);
  border-radius: 999px;
  min-width: 1.6em;
  min-height: 1.6em;
  font-weight: bold;
  font-size: smaller;

  &.dot {
    min-width: 8px;
    min-height: 8px;
  }

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

  &.needs-attention {
    background: var(--accent-bg-color);

    > label {
      color: var(--accent-fg-color);
    }
  }
}
