/* Popovers/Menus */

//.the popover itself
.popup-menu-boxpointer {
  -arrow-border-radius: $menu_radius;
  -arrow-background-color: transparent;
  -arrow-border-width: 0;
  -arrow-border-color: transparent;
  -arrow-base: 30px - $menu_radius;
  -arrow-rise: 0;
  -arrow-box-shadow: none; //dreaming. bug #689995
  background: transparent; // needs to reset?
}

// container of the popover menu
.popup-menu {
  min-width: if($compact == 'true', 10em, 12em);
  color: $text-secondary !important;
  padding: 0;
  font-weight: normal;
  border-radius: $base_radius + $base_padding * 3;
  box-shadow: 0 3px 5px -2px rgba(black, if($variant == 'light', 0.1, 0.18));
  margin: $base_padding 6px 8px;
  @include fontsize($font_size - 1);

  .popup-menu-content {
    padding: $base_padding;
    background-color: $popover;
    border-radius: $menu_radius;
    margin: 0;
    font-weight: normal;

    @if $rimless == 'false' {
      border: 1px solid $window-border;
      box-shadow: inset 0 0 0 1px highlight($popover);
    } @else { border: none; }
  }

  .popup-menu-item {
    spacing: $base_spacing;
    color: $text-secondary !important;
    text-shadow: none;
    border-radius: $base_radius;
    margin: 0;
    transition-duration: 100ms;
    font-weight: normal;
    background-color: transparent;

    &:checked {
      font-weight: normal;
      border: none;
      box-shadow: none;
      color: $text !important;
      background-color: $divider !important;
      border-radius: $base_radius $base_radius 0 0 !important;

      &:focus, &:hover, &.selected {
        color: $text !important;
        background-color: $overlay-hover !important;
      }

      &:active {
        color: $text !important;
        background-color: $overlay-active !important;
      }

      &:insensitive { color: $text-secondary-disabled !important; }
    }

    &:focus, &:hover, &.selected {
      color: $text !important;
      background-color: $divider !important;
      transition-duration: 0;
    }

    &:active, &.selected:active {
      color: $text !important;
      background-color: $track !important;
    }

    &:insensitive { color: $text-secondary-disabled !important; }
  }

  .popup-sub-menu {
    background-color: $divider !important;
    color: $text-secondary !important;
    border: none;
    box-shadow: none;
    margin: 0;
    border-radius: 0 0 $base_radius $base_radius !important;

    .popup-menu-item {
      margin: 0;

      &:focus, &:hover, &.selected {
        color: $text !important;
        background-color: $divider !important;
      }

      &:active, &.selected:active {
        color: $text !important;
        background-color: $track !important;
      }

      &:insensitive { color: $text-secondary-disabled !important; }
    }
  }

  .popup-inactive-menu-item { //all icons and other graphical elements
    color: $text-secondary !important;

    &:insensitive { color: $text-secondary-disabled !important; }
  }

  //.popup-status-menu-item { font-weight: normal;  color: pink; } //dunno what that is
  &.panel-menu {
    -boxpointer-gap: $base_margin; // distance from the panel
    margin-bottom: 1.75em;
  }
}

// symbolic icons in popover
.popup-menu-arrow,
.popup-menu-icon { icon-size: $base_icon_size; }

// container for radio and check boxes
.popup-menu-ornament {
  width: 1.2em;

  &:ltr { text-align: right; }
  &:rtl { text-align: left; }
}

// desktop background menu
.background-menu {
  -boxpointer-gap: $base_margin;
  -arrow-rise: 0px; // hide the beak on the menu
}

// system status popover menu
.aggregate-menu {
  min-width: if($compact == 'true', 19em, 20em);

  // lock screen, shutdown, etc. buttons
  .popup-menu-icon {
    padding: 0;
    margin: 0 $base_padding / 2;
    -st-icon-style: symbolic;
  }
}

// right-click (and panel) app menu
.app-menu {
  max-width: 27.25em;

  // this is unneeded at the top-level in this menu, hide it
  .popup-menu-ornament { width: 0 !important; }

  .popup-inactive-menu-item:first-child {
    // "Open Windows" label
    > StLabel {
      @extend %caption_heading;
      &:ltr {margin-right: $base_margin * 2;}
      &:rtl {margin-left: $base_margin * 2;}
    }
  }
}
