/********
 * Nemo *
 ********/
// based css:
// https://github.com/linuxmint/nemo/blob/master/gresources/nemo-style-fallback-mandatory.css
// https://github.com/linuxmint/nemo/blob/master/gresources/nemo-style-fallback.css
// hard-coded css:
// https://github.com/linuxmint/nemo/blob/master/gresources/nemo-style-application.css

.nemo-window {
  @if $sidebar == 'styled' {
    background-color: $titlebar;
  }

  .primary-toolbar {
    border: none;

    @if $sidebar == 'styled' {
      background-color: transparent;
    } @else {
      background-color: $titlebar;
      box-shadow: inset 0 -1px $border;
    }

    // FIXME: workaround for wrong size allocation of Nemo
    entry {
      min-height: 0;
      margin: 0;
      @extend %titlebar-entry;
    }

    button:not(.text-button) { @extend %titlebar-button; }

    .path-bar > button {
      &.slider-button {
        padding-left: 4px;
        padding-right: 4px;
      }

      &.text-button {
        padding-left: 8px;
        padding-right: 8px;
        color: $titlebar-text-secondary;
        border-image: radial-gradient(circle closest-corner at center calc(100% - 1px),
                                      $applet-primary 0%,
                                      transparent 0%)
                                      0 0 0 / 0 0 0px;

        &:hover, &:active, &:checked { color: $titlebar-text; }

        &:disabled { color: $titlebar-text-disabled; }

        &:checked {
          border-image: radial-gradient(circle closest-corner at center calc(100% - 1px),
                                        $applet-primary 100%,
                                        transparent 0%)
                                        0 0 2 / 0 0 2px;
        }
      }
    }
  }

  // For Places Sidebar diskfull indicators
  .places-treeview {
    -NemoPlacesTreeView-disk-full-bg-color: mix($text, $background, percentage(0.3)); // Can't use translucent colors
    -NemoPlacesTreeView-disk-full-fg-color: $primary;
    -NemoPlacesTreeView-disk-full-bar-width: 2px;
    -NemoPlacesTreeView-disk-full-bar-radius: 0;
    -NemoPlacesTreeView-disk-full-bottom-padding: 1px; // There is already hard-coded 1px bottom-padding
    -NemoPlacesTreeView-disk-full-max-length: 80px;
    padding-top: $space-size / 2;
    padding-bottom: $space-size / 2;
  }

  .nemo-places-sidebar { border: none; }

  // Inactive F3 pane shading
  .nemo-inactive-pane .view:not(:selected) { background-color: $base-alt; }

  .nemo-window-pane {
    widget.entry { // Rename box styling in the icon view.
      border-radius: $corner-radius;
      background-color: $fill;

      &:selected { @extend %selected_items_primary; }
    }
  }

  .toolbar {
    button {
      @extend %button-flat;
    }
  }

  .view {
    selection,
    &:selected {
      @extend %selected_items_color;
    }
  }

  @if $sidebar == 'styled' {
    paned {
      > .sidebar {
        padding: 0;

        @if $topbar == 'dark' and $variant == 'light' {
          background-color: transparent;
          color: $titlebar-text;

          > scrolledwindow.frame treeview.view {
            &:not(:selected) {
              color: $titlebar-text;
            }

            &.expander {
              color: $titlebar-text-secondary;

              &:hover, &:active { color: $titlebar-text; }

              &:disabled { color: $titlebar-text-secondary-disabled; }
            }
          }

          .places-treeview {
            -NemoPlacesTreeView-disk-full-bg-color: mix($titlebar-text, $titlebar, 30%);
            -NemoPlacesTreeView-disk-full-fg-color: $applet-primary;
          }
        } @else {
          background-color: $primary;
          color: on($primary);
          border-radius: 0 $window-radius $window-radius 0;

          > scrolledwindow.frame treeview.view {
            &:not(:selected) {
              color: on($primary);
            }

            &.expander {
              color: on($primary, secondary);

              &:hover, &:active { color: on($primary); }

              &:disabled { color: on($primary, secondary-disabled); }
            }
          }

          .places-treeview {
            -NemoPlacesTreeView-disk-full-bg-color: mix(on($primary), $primary, 30%);
            -NemoPlacesTreeView-disk-full-fg-color: on($primary);
          }
        }

        > scrolledwindow.frame {
          border: none;
          border-radius: 0 $window-radius $window-radius 0;

          treeview.view {
            -gtk-icon-style: symbolic;

            &:not(:selected) {
              background-color: transparent;
            }
          }

          scrollbar {
            border: none;
            background-color: transparent;
          }
        }
      }

      > separator {
        background-color: transparent;
        background-image: none;
      }
    }

    @if $topbar == 'dark' and $variant == 'light' {
      .nemo-window-pane {
        notebook {
          margin-right: $space-size;
          border-radius: $window-radius;

          scrolledwindow.view {
            background-color: transparent;
          }
        }
      }
    }

    .toolbar {
      color: $titlebar-text;

      button {
        @extend %titlebar-button;
      }
    }

    > grid > separator {
      background-color: transparent;
    }
  }

  notebook > stack > box > overlay

  // Floating status bar
  .floating-bar {
    min-height: 32px;
    padding: $space-size / 2;
    margin: 0;
    border-style: none;
    border-radius: 0;
    background-color: $primary;
    color: on($primary);

    &.bottom.left {
      border-top-right-radius: $corner-radius;
      border-bottom-right-radius: $corner-radius;
    }

    &.bottom.right {
      border-top-left-radius: $corner-radius;
      border-bottom-left-radius: $corner-radius;
    }

    button {
      margin: (32px - $small-size) / 2;
      color: on($primary);

      @extend %small-button;
    }
  }
}

.nemo-desktop.nemo-canvas-item {
  @extend %desktop-canvas-item;
}
