
%nautilus_dir_buttons {
  border-radius: 2px;
  border: none;
  min-height: 22px;
  min-width: 22px;
  padding: 0 6px;

  &:hover {
    color: $header_fg;
    background-color: rgba($header_fg, 0.1);
  }

  &:active {
    color: $header_fg;
    background-color: rgba($header_fg, 0.2);
  }

  &:checked {
    color: $header_fg;
    background-color: rgba($header_fg, 0.15);
  }
}

%dark_sidebar_scrollbar {
  border-color: darken($dark_sidebar_bg, 5%);

  &.overlay-indicator:not(.dragging):not(.hovering) > range > trough > slider {
    background-color: lighten($dark_sidebar_fg, 15%);
    border: 1px solid rgba(black, 0.3);
  }

  > range > trough {
    background-color: darken($dark_sidebar_bg, 5%);

    > slider {
      background-color: rgba(lighten($dark_sidebar_fg, 15%), 0.7);
  
      &:hover { background-color: lighten($dark_sidebar_fg, 20%); }
      &:hover:active { background-color: $selected_bg_color; }
  
      &:disabled { background-color: transparent; }
    }
  }
}

%dark_sidebar_list {
  > row {
    color: $dark_sidebar_fg;

    .sidebar-icon { color: rgba($dark_sidebar_fg, 0.75); }

    &:hover {
      background-color: $dark_sidebar_hover_color;
      box-shadow: inset 3px 0 lighten($selected_bg_color, 10%);
    }

    &:active {
      background-color: $dark_sidebar_active_color;
      box-shadow: inset 3px 0 lighten($selected_bg_color, 10%);
    }

    &:selected {
      background-color: $selected_bg_color;
      color: $selected_fg_color;
  
      &:hover {
        background-color: $alt_selected_bg_color;
        color: $selected_fg_color;
      }

      .sidebar-icon { color: rgba($selected_fg_color, 0.75); }
    }

    &:disabled {
      color: rgba($dark_sidebar_fg, 0.45);
    }

    &:not(:selected) button.sidebar-button {
      color: $dark_sidebar_fg;

      &:hover { @include button(header-hover); }
      &:active { @include button(header-active); }

      &:not(:hover):not(:active) > image { opacity: 0.5 };
    }

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

      .sidebar-icon { color: inherit; }
    }

    &:backdrop { opacity: 0.75; }

    &:drop(active):not(:disabled) {
      color: $drop_target_color;

      &:selected {
        color: $selected_fg_color;
        background-color: $drop_target_color;
      }
    }
  }

  separator { background-color: transparent; }
}

.nautilus-window {
  headerbar {
    splitbutton {
      border-radius: 2px;
      border: 1px solid transparent;
      padding: 2px;
      min-height: 22px;
      border-spacing: 2px;

      &, &:hover {
        background-clip: if($variant=='light', border-box, padding-box);
      }

      &:hover {
        @include button(header-hover);
      }

      > button,
      > menubutton > button {
        @extend %nautilus_dir_buttons;
      }
    }
  }

  flap .navigation-sidebar {
    background-color: $dark_sidebar_bg;
    color: $dark_sidebar_fg;
    padding: 0;
    @extend %dark_sidebar_list;

    > row.sidebar-row {
      margin: 0;
      border: none;
      border-radius: 0;
    }
  }

  .sidebar-pane .navigation-sidebar {
    padding: 0;
    @extend %dark_sidebar_list;

    > row.sidebar-row {
      margin: 0;
      border: none;
      border-radius: 0;
    }
  }

  @if $header == 'dark' and $variant == 'light' {
    flap {
      > separator {
        background-color: transparent;
        min-width: 0;
      }

      scrollbar { @extend %dark_sidebar_scrollbar }
    }
  }
}

.nautilus-grid-view {
  child.activatable {
    border-radius: 3px;
    border: 1px solid transparent;
    color: $fg_color;

    &:hover {
      background-color: rgba($fg_color, 0.08);
    }

    &:active {
      background-color: rgba($fg_color, 0.16);
    }

    &:selected {
      background-color: rgba($selected_bg_color, 0.45);
      border-color: $selected_bg_color;
      color: mix($fg_color, $selected_bg_color, 50%);
    }
  }
}

.nautilus-list-view {
  listview.view > row.activatable {
    border-radius: 2px;
    border: 1px solid transparent;
    color: $fg_color;

    &:hover {
      background-color: rgba($fg_color, 0.08);
    }

    &:active {
      background-color: rgba($fg_color, 0.16);
    }

    &:selected {
      background-color: rgba($selected_bg_color, 0.45);
      border-color: $selected_bg_color;
      color: mix($fg_color, $selected_bg_color, 50%);
    }
  }
}

.content-pane {
  .nautilus-grid-view,
  .nautilus-list-view {
    &, .view {
      background-color: transparent;
    }
  }
}

#NautilusViewCell {
  clamp box {
    margin: 0;
    border-spacing: 0;
  }
}

#NautilusQueryEditor { // search entry
  border-spacing: 0;

  > * { margin: 0; }

  #NautilusQueryEditorTag {
    > button {
      margin: 0;
    }
  }

  > menubutton > button {
    min-width: 16px;
    min-height: 16px;
    -gtk-icon-size: 16px;
    margin: 0;
    padding: 3px;
    border-radius: 999px;
    border: none;

    &:hover {
      color: $header_fg;
      background-color: rgba($header_fg, 0.1);
    }
  
    &:active {
      color: $header_fg;
      background-color: rgba($header_fg, 0.2);
    }
  
    &:checked {
      color: $header_fg;
      background-color: rgba($header_fg, 0.15);
    }
  }
}

#NautilusPathBar {
  min-height: 0;
  background-color: rgba($header_fg, 0.1);
  border-radius: 3px;
  border: 1px solid $header_border;
  background-clip: padding-box;
  border-spacing: 2px;

  #NautilusPathButton {
    @extend %nautilus_dir_buttons;

    label.dim-label {
      color: rgba($header_fg, 0.75);

      &:hover, &:active, &:checked {
        color: $header_fg;
      }
    }

    &.current-dir {
      color: $header_fg;

      &:hover, &:active {
        background: none;
        box-shadow: none;
      }
    }
  }

  > menubutton {
    padding: 2px;

    > button {
      border: none;
      @extend %nautilus_dir_buttons;
    }
  }
}

// reset
%content_pane_button {
  &:hover {
    color: $fg_color;
    background-color: rgba($fg_color, 0.1);
  }

  &:active {
    color: $fg_color;
    background-color: rgba($fg_color, 0.2);
  }

  &:checked {
    color: $fg_color;
    background-color: rgba($fg_color, 0.15);
  }
}

@if $variant == 'light' and $header == 'dark' {
  .content-pane {
    #NautilusQueryEditor { // search entry
      > menubutton > button {
        @extend %content_pane_button;
      }
    }
  
    #NautilusPathBar {
      background-color: rgba($fg_color, 0.1);
      border: 1px solid $borders_color;
  
      #NautilusPathButton {
        @extend %content_pane_button;
  
        label.dim-label {
          color: rgba($fg_color, 0.75);
  
          &:hover, &:active, &:checked {
            color: $fg_color;
          }
        }
  
        &.current-dir {
          color: $fg_color;
        }
      }
  
      > menubutton {
        > button {
          @extend %content_pane_button;
        }
      }
    }
  }
}

.nautilus-window .floating-bar {
  padding: 1px;
  background-color: $base_color;
  color: $fg_color;
  border-radius: 2px 2px 0 0;
  border: 1px solid $borders_color;
  box-shadow: none;

  &.bottom.left {
    border-top-left-radius: 0;
    border-width: 1px 1px 0 0;
  }

  &.bottom.right {
    border-top-right-radius: 0;
    border-width: 1px 0 0 1px;
  }

  button {
    border: none;
    border-radius: 100px;
    min-height: 0;
    min-width: 0;
    padding: 0;
    margin-right: 6px;
    -gtk-icon-shadow: none;
    @extend %selected-button;
  }
}

//
// Gnome Calendar
//

datechooser {
  .current-week {
    background-color: rgba($fg_color, 0.05);
  }

  label.weeknum {
    color: rgba($fg_color, 0.75);
  }

  label.weekday {
    color: $insensitive_fg_color;
  }

  button.day {
    border: none;

    &:selected {
      background-color: $selected_bg_color;
      color: $selected_fg_color;
    }
  }

  navigator > button.flat {
    padding: 0;
    min-height: 32px;
    min-width: 32px;
  }
}

agenda-view list.background {
  background-color: transparent;
}

menubutton.flat.popup.sources-button {
  margin: 0;

  > button {
    margin: 0;
    border-radius: 0;
    padding: 0 12px;

    .title {
      font-size: small;
      font-weight: normal;
    }

    .title, .subtitle {
      padding: 2px 0 2px 6px;
    }

    image.calendar-color-image {
      -gtk-icon-size: 8px;
    }
  }
}

.sidebar-pane {
  datechooser {
    .current-week {
      background-color: rgba($sidebar_pane_fg, 0.05);
    }

    label.weeknum {
      color: rgba($sidebar_pane_fg, 0.75);
    }

    label.weekday {
      color: rgba($sidebar_pane_fg, 0.45);
    }
  }
}
