
//
// avatar
//

avatar {
  border-radius: $circular_radius;
  font-weight: bold;

  // The list of colors to generate avatars.
  // Each avatar color is represented by a font color, a gradient start color and a gradient stop color.
  // There are 8 different colors for avtars in the list if you change the number of them you
  // need to update the NUMBER_OF_COLORS in src/adw-avatar.c.
  // The 2D list has this form: ((font-color, gradient-top-color, gradient-bottom-color)).
  $avatarcolorlist: (
   (#cfe1f5, #83b6ec, #337fdc), // blue
   (#caeaf2, #7ad9f1, #0f9ac8), // cyan
   (#cef8d8, #8de6b1, #29ae74), // green
   (#e6f9d7, #b5e98a, #6ab85b), // lime
   (#f9f4e1, #f8e359, #d29d09), // yellow
   (#ffead1, #ffcb62, #d68400), // gold
   (#ffe5c5, #ffa95a, #ed5b00), // orange
   (#f8d2ce, #f78773, #e62d42), // raspberry
   (#fac7de, #e973ab, #e33b6a), // magenta
   (#e7c2e8, #cb78d4, #9945b5), // purple
   (#d5d2f5, #9e91e8, #7a59ca), // violet
   (#f2eade, #e3cf9c, #b08952), // beige
   (#e5d6ca, #be916d, #785336), // brown
   (#d8d7d3, #c0bfbc, #6e6d71), // gray
  );

  @for $i from 1 through length($avatarcolorlist) {
    &.color#{$i} {
      $avatarcolor: nth($avatarcolorlist, $i);
      background-image: linear-gradient(nth($avatarcolor, 2), nth($avatarcolor, 3));
      color: nth($avatarcolor, 1);
    }
  }

  &.contrasted { color: white; }

  &.image { background: none; }
}

//
// preferencespage
//

preferencespage > scrolledwindow > viewport > clamp > box {
  margin: 24px 12px;
  border-spacing: 24px;
}

preferencesgroup > box {
  &, .labels {
    border-spacing: $container_padding;
  }

  > box.header:not(.single-line) {
    margin-bottom: $container_padding;
  }

  > box.single-line {
    min-height: 34px;
  }
}

//
// AdwStatusPage
//

statuspage {
  > scrolledwindow > viewport > box {
    margin: 36px $container_padding * 2;
    border-spacing: 36px;

    > clamp > box {
      border-spacing: $container_padding * 2;

      > .icon {
        -gtk-icon-size: 128px;

        color: gtkalpha(currentColor, 0.55);

        &:disabled {
          opacity: $disabled_opacity;
        }

        &:not(:last-child) {
          margin-bottom: 24px;
        }
      }
    }
  }

  &.compact > scrolledwindow > viewport > box {
    margin: 24px 12px;
    border-spacing: 24px;

    > clamp > box {
      > .icon {
        -gtk-icon-size: 96px;

        &:not(:last-child) {
          margin-bottom: $container_padding * 2;
        }
      }

      > .title {
        font-size: 18pt;
      }
    }
  }
}


//
// Cards
//

.card {
  @at-root %card, & {
    @extend %circular_list;

    .osd &, &.osd {
      background-color: gtkalpha(currentColor, .1);
      color: inherit;
      box-shadow: none;
    }
  }

  .osd &, &.osd {
    &:focus:focus-visible {
      outline-color: $fill_color;
    }
  }

  &.activatable {
    transition: $button_transition;

    &:hover {
      background-image: image(gtkalpha(currentColor, .03));
    }

    &:active {
      background-image: image(gtkalpha(currentColor, .08));
    }
  }
}

//
// Toasts
//

toast {
  @extend %osd;
  margin: $container_padding * 2;
  margin-bottom: $container_padding * 3;
  border-radius: $mn_radius;
  border-spacing: $container_padding;
  padding: $container_padding;
  box-shadow: 0 3px 8px rgba(black, 0.35);

  &:dir(ltr) { padding-left: $container_padding * 2; }
  &:dir(rtl) { padding-right: $container_padding * 2; }

  button { @extend %osd_button; }

  > widget {
    margin: 0 $container_padding;
  }
}

//
// viewswitcher
//

viewswitcher {
  margin: 0;

  &.wide {
    border-spacing: 0;

    > button.toggle {
      margin: 8px 0;
    }
  }

  &.narrow > button.toggle {
    border-radius: 0;
    margin: 0;
  }

  > button.toggle {
    font-weight: normal;
    padding: 0;

    > stack > box {
      &.narrow {
        font-size: 0.75rem;
        padding-top: $container_padding;
        padding-bottom: $container_padding;
        border-spacing: 0;

        > stack > label {
          padding-left: $container_padding + 2px;
          padding-right: $container_padding + 2px;
        }
      }

      &.wide {
        padding: 0 $container_padding * 2;
        border-spacing: 0;

        > label, > indicatorbin > image {
          padding-left: $container_padding / 2;
          padding-right: $container_padding / 2;
        }
      }
    }
  }
}

// AdwViewSwitcherBar

viewswitcherbar actionbar > revealer > box {
  padding: 0;
}

// AdwViewSwitcherTitle

viewswitchertitle viewswitcher {
  margin-left: $container_padding * 2;
  margin-right: $container_padding * 2;
}

// AdwIndicatorBin

indicatorbin {
  > indicator, > mask {
    min-width: $container_padding * 2;
    min-height: $container_padding * 2;
    border-radius: $circular_radius;
  }

  > indicator {
    margin: 1px;
    background: gtkalpha(currentColor, .4);

    > label {
      font-size: 0.6rem;
      font-weight: normal;
      padding: 1px 4px;
      color: white;
    }
  }

  > mask {
    padding: 0;
    background: black;
  }

  &.needs-attention > indicator {
    background: $selected_bg_color;

    > label { color: $selected_fg_color; }
  }
}


//
// Tab View
//

tabbar {
  .box {
    min-height: $menuitem_size;
  }

  tabbox {
    > separator {
      &.hidden {
        opacity: 0;
      }
    }

    > revealer > indicator {
      min-width: 2px;
      border-radius: 2px;
      background: gtkalpha($selected_bg_color, 0.5);
    }
  }

  .start-action,
  .end-action {
    padding: $container_padding;
  }

  .start-action:dir(ltr),
  .end-action:dir(rtl) {
    padding-right: 0;
  }

  .start-action:dir(rtl),
  .end-action:dir(ltr) {
    padding-left: 0;
  }

  &:not(.inline) {
    .box {
      background-color: $bg_color;
      color: $text_color;
      margin-top: -1px;

      @if $monterey == 'false' {
        padding: 0;
        box-shadow: inset 0 -1px $borders_color;
        border-bottom: none;
      } @else {
        border-bottom: 1px solid $borders_color;
        padding: 0 $container_padding / 2 $container_padding / 2;
      }
    }

    &:backdrop .box {
      > scrolledwindow,
      > .start-action,
      > .end-action {
        filter: opacity(0.5);
      }
    }
  }
}

dnd tab {
  background-color: $base_color;
  color: $text_color;
  box-shadow: none;
  margin: $container_padding * 4;
}

tabbar,
dnd {
  tab {
    padding-right: $container_padding / 2;
    margin: 0;

    @if $monterey == 'false' {
      @extend %tabs_tab;
    } @else {
      @extend %monterey_tab;

      + tab {
        margin-left: $container_padding / 2;
      }
    }

    button.tab-close-button {
      border-radius: 3px;
      min-height: $small_size;
      min-width: $small_size;
      padding: 0;
    }

    indicator {
      min-height: 2px;
      border-radius: 2px;
      background: gtkalpha($selected_bg_color, 0.5);
    }
  }
}

tabview:drop(active),
tabbox:drop(active) {
  box-shadow: none;
}

// Sidebar

.unfolded stacksidebar.sidebar {
  border: none;
}
