// Interpolate accent color saturation: less saturated colors will receive higher opacity
$toggle-bg-color: transparentize($selected_bg_color, 0.75 - (1 - saturation($selected_bg_color) / 100%) * .15);

.quick-settings {
  padding: $base_padding*3;
  border-radius: $modal_radius*2.25;

  .icon-button, .button {
    padding: $base_padding*1.75;
  }
}

.quick-settings-grid {
  spacing-rows: $base_padding*2;
  spacing-columns: $base_padding*2;
}

.quick-toggle, .quick-menu-toggle {
  border-radius: 99px;
  min-width: 12em;
  max-width: 12em;
  min-height: 48px;
  border:none;
}

.quick-toggle {
  &:checked {
    // Yaru change: tone down accented checked buttons
    @include button(normal, $bg: $toggle-bg-color);
    &:hover {@include button(hover, $bg: $toggle-bg-color);}
    &:active {@include button(active, $bg: $toggle-bg-color);}
  }

  & > StBoxLayout { spacing: $base_padding*1.5; }

  /* Move padding into the box; this is to allow menu arrows
     to extend to the border */
  &.button { padding: 0; }
  & > StBoxLayout { padding: 0 $base_padding*2; }
  &:ltr > StBoxLayout { padding-left: $base_padding*2.5; }
  &:rtl > StBoxLayout { padding-right: $base_padding*2.5; }
  
  .quick-toggle-title { font-weight: bold; }

  & StBoxLayout > .quick-toggle-subtitle {
    font-weight: normal;
    font-size: 12px;
  }

  .quick-toggle-icon { icon-size: $base_icon_size; }
}

.quick-menu-toggle {
  & .quick-toggle {
    min-width: auto;
    max-width: auto;

    &:ltr { border-radius: 99px 0 0 99px; }
    &:ltr > StBoxLayout { padding-right: $base_padding*1.5; }
    &:rtl { border-radius: 0 99px 99px 0; }
    &:rtr > StBoxLayout { padding-left: $base_padding*1.5; }

    &:ltr:last-child { border-radius: 99px; }
    &:rtl:last-child { border-radius: 99px; }
  }

  & .quick-toggle-arrow {
    padding: $base_padding $base_padding*1.75;
    border-width: 0;
    // Yaru change: different toggle arrow bg
    $_bg: scale-color($color: $bg_color, $lightness: if($variant == 'light', -14%, 5%));
    @include button(normal, $bg: $_bg);
    &:hover {@include button(hover, $bg: $_bg);}
    &:active {@include button(active, $bg: $_bg);}

    &:checked {
      // Yaru change: different toggle arrow checked bg
      $_bg: adjust-color($color: $toggle-bg-color, $alpha: if($variant == 'light', 0.15, 0.1));
      @include button(normal, $bg: $_bg);
      &:hover {@include button(hover, $bg: $_bg);}
      &:active {@include button(active, $bg: $_bg);}
      // border-color: $selected_borders_color; // Yaru change: drop border
    }

    &:ltr {
      border-radius: 0 99px 99px 0;
      // border-left-width: 1px; // Yaru change: drop border
    }
    &:rtl {
      border-radius: 99px 0 0 99px;
      // border-right-width: 1px; // Yaru change: drop border
    }
  }
}

.quick-slider {
  & > StBoxLayout { spacing: $base_padding; }

  .icon-button { padding: $base_padding; }

  .slider-bin {
    &:focus {@include button(focus);}
    min-height: 20px; // slider size // Yaru change: larger slider cause to border in light theme
    padding: $base_padding;
    border-radius: 99px;
  }
}

.quick-toggle-menu {
  @include card;
  border-radius: $base_border_radius*3;
  padding: $base_padding*2;
  margin: $base_padding*2 $base_padding*3 0;
  
  .popup-menu-item > StIcon { -st-icon-style: symbolic; }

  & .header {
    spacing-rows: 0.5 * $base_padding;
    spacing-columns: $base_padding*2;
    padding-bottom: 2 * $base_padding;

    & .icon {
      icon-size: $base_icon_size*1.5; // a non-standard symbolic size but ok
      border-radius: 999px;
      padding: 1.5 * $base_padding;
      background-color: transparentize($fg_color, 0.9); // Yaru change: adjust background
      
      // Yaru change: remove active accent
      // &.active {
      //   background-color: $selected_bg_color;
      // }
    }

    & .title {
      @extend %title_3;
    }

    & .subtitle {
      @extend %caption_heading;
    }
  }
  
  // Yaru change: fix for light theme
  :active {
    color: $fg_color !important;
  }
}

.quick-toggle-menu-container {
  padding: 2 * $base_padding $base_padding 0;
}

.quick-settings-system-item {
  & > StBoxLayout { spacing: 2 * $base_padding; }

  & .power-item {
    min-height: 0;
    min-width: 0;

    &:insensitive {
      @include button(normal);
      background-color: transparent;
    }
  }
}

.nm-network-item {
  .wireless-secure-icon { icon-size: 0.5 * $base_icon_size; }
}

.bt-device-item {
  .popup-menu-icon { -st-icon-style: symbolic; }
}

.bt-menu-placeholder.popup-menu-item {
  @extend %title_4;
  text-align: center;

  padding: 2em 4em;
}

.device-subtitle { color: transparentize($fg_color, 0.5); }

// background apps

.background-apps-quick-toggle {
  min-height: 40px;
  background-color: transparent;

  & StIcon { icon-size: $base_icon_size !important; }
}

.background-app-item {
  & .title { @extend %heading; }
  & .subtitle { @extend %caption; }
  & .popup-menu-icon {
    icon-size: $large_icon_size !important;
    -st-icon-style: regular !important;
  }
  & .close-button {
    @extend .icon-button;
    padding: $base_padding;
  }

  &.popup-inactive-menu-item { color: $fg_color; }
}
