.quick-settings {
  padding: $base_padding * 2 !important;
  border-radius: $modal_radius !important;
  margin-top: $base_padding !important;

  .icon-button, .button {
    min-height: 20px;
    min-width: 20px;
    padding: $base_padding * 1.75;

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

  .icon-button {
    border-radius: $circular_radius;
    border: none;
  }
}

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

.quick-toggle, .quick-toggle-has-menu {
  border-radius: $base_border_radius;
  min-width: 12em;
  max-width: 12em;
  min-height: $scalable_icon_size * 3; // use icon size so the button scales
  border: none;
}

.quick-toggle {
  background-color: rgba($fg_color, if($variant == 'light', 0.08, 0.06)) !important;
  color: $alt_fg_color;
  text-shadow: none !important;

  &:hover {
    background-color: rgba($fg_color, if($variant == 'light', 0.16, 0.12)) !important;
    color: $fg_color;
  }

  &:active {
    background-color: rgba($fg_color, if($variant == 'light', 0.24, 0.18)) !important;
    color: $fg_color;
  }

  &:checked {
    background-color: $selected_bg_color !important;
    color: $selected_fg_color !important;
    text-shadow: none !important;

    &:hover {
      background-color: lighten($selected_bg_color, 5%) !important;
      color: $selected_fg_color !important;
      text-shadow: none !important;
    }

    &:active {
      background-color: darken($selected_bg_color, 5%) !important;
      color: $selected_fg_color !important;
    }
  }

  > StBoxLayout { spacing: $base_padding; }

  /* Move padding into the box; this is to allow menu arrows
     to extend to the border */
  &.button {
    padding: 0;
    min-height: 40px;
  }

  & > 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 {
    @extend %heading;
  }

  .quick-toggle-subtitle {
    @extend %caption;
    font-weight: normal;
  }

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

// toggle with a menu button
.quick-toggle-has-menu {
  .quick-toggle {
    min-width: auto;
    max-width: auto;

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

    &:ltr:last-child { border-radius: $base_border_radius; }
    &:rtl:last-child { border-radius: $base_border_radius; }
  }

  .quick-toggle-menu-button {
    background-color: rgba($fg_color, if($variant == 'light', 0.12, 0.10)) !important;
    color: $alt_fg_color;
    text-shadow: none !important;

    &:hover {
      background-color: rgba($fg_color, if($variant == 'light', 0.20, 0.18)) !important;
      color: $fg_color;
    }

    &:active {
      background-color: rgba($fg_color, if($variant == 'light', 0.28, 0.26)) !important;
      color: $fg_color;
    }

    &:checked {
      background-color: lighten($selected_bg_color, 3%) !important;
      color: $selected_fg_color;
      text-shadow: none !important;

      &:hover {
        background-color: lighten($selected_bg_color, 8%) !important;
        color: $selected_fg_color;
        text-shadow: none !important;
      }

      &:active {
        background-color: darken($selected_bg_color, 3%) !important;
        color: $selected_fg_color;
      }
    }

    &:ltr {
      border-radius: 0 $base_border_radius $base_border_radius 0;
    }

    &:rtl {
      border-radius: $base_border_radius 0 0 $base_border_radius;
    }
  }

  .quick-toggle-separator {
    width: 0;
  }
}

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

  .slider-bin {
    &:focus { @include button(focus); }
    min-height: 16px; // slider size
    padding: $base_padding;
    border-radius: 99px;
  }

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

  .icon-button {
    background-color: transparent;
    color: $fg_color !important;
    padding: $base_padding;

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

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

.quick-toggle-menu {
  background-color: $base_color !important;
  color: $fg_color !important;
  border-radius: $modal_radius !important;
  padding: $base_padding * 2 0 !important;
  margin: $base_padding * 2 $base_padding * 3 0 $base_padding * 3.5 !important;

  .popup-menu-item {
    border-radius: 0 !important;

    > StIcon {
      -st-icon-style: symbolic;
      icon-size: $base_icon_size;
    }
  }

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

    & .icon {
      icon-size: 16px * 1.5; // a non-standard symbolic size but ok
      border-radius: $circular_radius;
      padding: 1.5 * $base_padding;
      background-color: rgba($fg_color, 0.12) !important;

      &.active {
        background-color: $selected_bg_color !important;
        color: $selected_fg_color;
      }
    }

    & .title {
      @extend %title_3;
    }

    & .subtitle {
      @extend %caption_heading;
    }
  }
}

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

  .icon-button {
    @extend %icon_button;

    > StIcon {
      -st-icon-style: symbolic;
      icon-size: $base_icon_size !important;
    }
  }

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

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

.nm-network-item {
  .wireless-secure-icon { icon-size: 8px; }
}

.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); }

.keyboard-brightness-level {
  spacing: $base_padding;

  .button:checked { @extend %default_button; }
}

// background apps

.background-apps-quick-toggle {
  min-height: to_em(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;
  }
  & .icon-button {
    padding: $base_padding;
  }
  & .spinner {
    padding: $base_padding;
  }
  &.popup-inactive-menu-item { color: $fg_color; }
}
