// The following styles are deprecated in GTK and should be removed for GTK 5.x

// .linked >                  element            child
$deprecated_linked_widgets: ("combobox",         "> box > button.combo"),
                            ("appchooserbutton", "> combobox > box > button.combo");

/****************
 * GtkAssistant *
 ****************/

window.assistant {
  .sidebar {
    padding: $menu-margin;
    background-clip: padding-box;

    > label {
      padding: 6px 12px;
      border-radius: $menu_radius;

      &.highlight {
        background-color: $selected_color;

        @if $contrast == 'high' {
          box-shadow: inset 0 0 0 1px $border_color;
        }
      }
    }
  }
}

/***************
 * GtkComboBox *
 ***************/

combobox {
  @extend dropdown;

  // Since cell view is taller than a plain label, make sure
  // the button doesn't get stretched with a larger font
  button {
    padding-top: 2px;
    padding-bottom: 2px;
    min-height: 30px;
  }
}

/***************
 * GtkIconView *
 ***************/

iconview {
  @extend %view;

  @if $contrast == 'high' {
    &:selected {
      box-shadow: inset 0 0 0 1px $border_color;
    }
  }

  @include focus-ring();

  &:drop(active) {
    box-shadow: none;
  }

  > dndtarget:drop(active) {
    border-style: solid;
    border-width: 1px;
    border-color: $drop_target_color;
  }
}

/**************
 * GtkInfoBar *
 **************/

infobar {
  > revealer > box {
    padding: 6px;
    padding-bottom: 7px;
    border-spacing: 6px;
    box-shadow: inset 0 -1px if($contrast == 'high', $border_color, $shade_color);

    > box {
      border-spacing: 6px;
    }
  }

  &.action:hover > revealer > box {
    background-image: image(gtkalpha(currentColor, .05));
  }

  &.action:active > revealer > box {
    background-image: image(gtkalpha(currentColor, .1));
  }

  @each $i_type, $i_color in (info, $accent_bg_color),
                             (question, $accent_bg_color),
                             (warning, $warning_bg_color),
                             (error, $error_bg_color) {
    &.#{$i_type} > revealer > box {
      background-color: gtkmix($i_color, $window_bg_color, 30%);
      color: $window_fg_color;
    }
  }

 .close {
    min-width: 18px;
    min-height: 18px;
    padding: 4px;
    border-radius: 50%;
    @extend %button_basic_flat;
  }
}

/****************
 * GtkStatusBar *
 ****************/

statusbar {
  padding: 6px 10px 6px 10px;
}

/***************
 * GtkTreeView *
 ***************/

// To be used for opaque elements overlaid atop the selected row
$treeview_selection_opaque: gtkmix(currentColor, $view_bg_color, 10%);
$treeview_borders_opaque: gtkmix(currentColor, $view_bg_color, if($contrast == 'high', 40%, 20%));

treeview.view {
  @extend columnview;

  border-left-color: $treeview_borders_opaque; // this is actually the tree lines color,
  border-top-color: $treeview_borders_opaque; // while this is the grid lines color, better then nothing

  &:selected {
    &:focus, & {
      border-radius: 0;
    }
  }

  &.separator {
    min-height: 2px;
    color: $border_color;
  }

  &.expander {
    // GtkTreeView uses the larger of the expander’s min-width and min-height
    min-width: 16px;
    min-height: 16px;
    -gtk-icon-source: -gtk-icontheme('pan-end-symbolic');

    &:dir(rtl) { -gtk-icon-source: -gtk-icontheme('pan-end-symbolic-rtl'); }

    color: gtkalpha(currentColor, .7);

    &:hover, &:active { color: currentColor; }

    &:checked { -gtk-icon-source: -gtk-icontheme('pan-down-symbolic'); }

    &:disabled { color: gtkalpha(currentColor, $disabled_opacity); }
  }

  > dndtarget:drop(active) {
    border-style: solid none;
    border-width: 1px;
    border-color: $drop_target_color;

    &.after { border-top-style: none; }

    &.before { border-bottom-style: none; }
  }

  > header > button {
    padding-left: 4px;
    padding-right: 4px;
    border-bottom: 1px solid $border_color;
  }

  &.progressbar { // progress bar in treeviews
    &, &:selected {
      background-color: $accent_bg_color;
      color: $accent_fg_color;
    }

    box-shadow: none;
  }

  &.trough { // progress bar trough in treeviews
    background-color: gtkalpha(currentColor, 0.1);
  }

  ~ undershoot.top {
    box-shadow: none;
  }

  acceleditor > label {
    // see tests/testaccel in GTK to test
    background-color: $treeview_selection_opaque;
  }
}

treeview.navigation-sidebar {
  padding: 0;

  &:selected {
    &:focus, & {
      background-color: $selected_color;
    }
  }
}

treeview entry {
  &:focus-within {
    &:dir(rtl), &:dir(ltr) { // specificity bump hack
      background-color: $view_bg_color;
      transition-property: color, background;
    }
  }

  &.flat, & {
    border-radius: 0;
    background-image: none;
    background-color: $view_bg_color;

    &:focus-within { border-color: $accent_color; }
  }
}

treeview spinbutton:not(.vertical) {
  min-height: 0;
  border-style: none;
  border-radius: 0;

  > text {
    min-height: 0;
    padding: 1px 2px;
  }
}

// The following styles are deprecated in libadwaita and should be removed in 2.x

// Deprecated: use .boxed-list instead
list.content {
  @extend .boxed-list;
}

// Deprecated: use .navigation-sidebar instead
.sidebar {
  &:not(separator) {
    &:dir(ltr),
    &.left,
    &.left:dir(rtl) {
      border-right: 1px solid $border_color;
      border-left-style: none;
    }

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

  listview.view,
  list {
    background-color: transparent;
    color: inherit;
  }

  paned & { &.left, &.right, &.left:dir(rtl), &:dir(rtl), &:dir(ltr), & { border-style: none; }}
}

// Deprecated: use .title-1
.large-title {
  font-weight: 300;
  font-size: 24pt;
}
