/* Popovers/Menus */

$popop_menuitem_radius: $wm_radius - 4px;

//.the popover itself
.popup-menu-boxpointer {
  -arrow-border-radius: 2px;
  -arrow-background-color: transparent;
  -arrow-border-width: 0;
  -arrow-border-color: transparent;
  -arrow-base: 64px;
  -arrow-rise: 0;
  -arrow-box-shadow: none; //dreaming. bug #689995
}

@if $scale != 'default' {
  #lockDialogGroup .popup-menu,
  .login-screen .popup-menu { // FIXME: not use? how to set the popovers on login-screen?
    min-width: 24em;
    @include fontsize($base_font_size * 2 - 2);

    .popup-menu-content {
      padding: 12px 0;
      box-shadow: 0 10px 20px 0 rgba(black, 0.18);
      border: 2px solid if($variant=='light', rgba(black, 0), rgba(black, 0.75));
      margin: 8px 24px 34px 24px;
      @include fontsize($base_font_size * 2 - 2);
    }

    .popup-menu-item {
      spacing: $base_spacing * 4;
      padding-top: 12px;
      padding-bottom: 12px;
      border-radius: $popop_menuitem_radius * 2;
      margin: 0 12px;

      &:ltr { padding-right: 4em; padding-left: 0; }
      &:rtl { padding-right: 0; padding-left: 4em; }

      &:checked {
        border-radius: $popop_menuitem_radius * 2 $popop_menuitem_radius * 2 0 0;
      }
    }

    .popup-sub-menu {
      border-radius: 0 0 $popop_menuitem_radius * 2 $popop_menuitem_radius * 2;
      margin: 0 6px;

      .popup-menu-item {
        border-radius: $popop_menuitem_radius * 2;
      }
    }

    &.panel-menu {
      -boxpointer-gap: $base_margin * 2; // distance from the panel
      margin-bottom: 3.5em;
    }
  }
  // symbolic icons in popover
  .popup-menu-arrow,
  .popup-menu-icon { icon-size: $base_icon_size * 2; }
}

// container of the popover menu
.popup-menu {
  min-width: 12em;
  color: $alt_fg_color;
  @include font(body-1);

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

  StEntry {
    selection-background-color: $light_alt_fg_color;
    selected-background-color: $light_alt_fg_color;
    selected-color: $primary_color;
    caret-color: $fg_color;

    StLabel.hint-text {
      margin-left: 2px;
      color: transparentize($fg_color, 0.3);
    }
  }
}

.popup-menu-content {
  padding: $base_padding;
  @extend %theme_dialogs;
  box-shadow: 0 5px 10px 0 rgba(black, 0.18);
  border: 1px solid if($variant=='light', rgba(black, 0), rgba(black, 0.75));
  margin: 4px 12px 17px 12px;
  @include font(body-1);
}

.popup-menu-item {
  spacing: $base_spacing;
  padding: $base_padding * 1.5 $base_padding * 2;
  color: $alt_fg_color;
  text-shadow: none;
  border-radius: $popop_menuitem_radius;
  font-weight: normal;
  transition: none;

  &:checked {
    font-weight: normal;
    border-radius: $popop_menuitem_radius $popop_menuitem_radius 0 0;
    border: none;
    box-shadow: none;
    color: $alt_fg_color !important;
    background-color: $submenu_bg_color !important;
    background-gradient-direction: none !important;

    &:focus, &:hover, &:selected {
      color: $selected_fg_color !important;
      background-color: $selected_bg_color !important;
      background-gradient-direction: none !important;
    }

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

    &:insensitive { color: $disabled_fg_color !important; }
  }

  &:focus, &:hover, &:selected {
    color: $selected_fg_color !important;
    background-color: $selected_bg_color !important;
    transition-duration: 0ms !important;
  }

  &:active, &.selected:active {
    color: $selected_fg_color !important;
    background-color: mix($fg_color, $selected_bg_color, 5%) !important;
  }

  &:insensitive { color: $disabled_fg_color !important; }
}

.popup-sub-menu {
  background-color: $submenu_bg_color !important;
  border-radius: 0 0 $popop_menuitem_radius $popop_menuitem_radius;
  border: none;
  box-shadow: none;

  .popup-menu-item {
    margin: 0;
    border-radius: $popop_menuitem_radius;

    &:focus, &:hover, &:selected {
      color: $selected_fg_color !important;
      background-color: $selected_bg_color !important;
    }

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

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

  &:insensitive { color: $disabled_fg_color !important; }
}

// 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;
  text-align: center !important;

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

// separator
.popup-separator-menu-item {
  background: none;
  border: none;
  padding-top: 0 !important;
  padding-bottom: 0 !important;

  .popup-separator-menu-item-separator {
    height: 1px; //not really the whole box
    margin: 0;
    background-color: $borders_color;

    .popup-sub-menu & { //submenu separators
      margin: 0 32px 0 0;
      height: 1px;
    }
  }
}

// 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: 21em;

  // lock screen, shutdown, etc. buttons
  .popup-menu-icon {
    padding: 0 !important;
    -st-icon-style: symbolic;

    &:ltr { margin-right: $base_margin * 2 !important; }
    &:rtl { margin-left: $base_margin * 2 !important; }
  }
}

// right-click app menu
.app-menu,
.app-well-menu {
  max-width: 27.25em;
}

// Rename popup for app folders
.rename-folder-popup {
  .rename-folder-popup-item {
    spacing: $base_spacing;
    &:ltr, &:rtl { padding: 0 $base_padding * 2; }
  }
}
