/*
 * Context menus (right click): a dark rounded panel on the grey texture with the gold accent of the theme (see theme.css).
 * Buttons with a data-icon attribute get that Material Icons glyph before the label, drawn with ::before so it
 * survives scripts that change the label (textContent)
 */
.contextmenu {
  position: fixed;
  width: auto;
  min-width: 120px;
  padding: 4px;
  z-index: 99999;
  box-sizing: border-box;
  border: 1px solid black;
  border-radius: 7px;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.3)), url("/png/bg.png?v=552de1a126ee");
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.4), 0 8px 20px rgba(0, 0, 0, 0.75);
  user-select: none;
  animation: contextmenu-open 0.08s ease-out;
}

/* Override modal's display:none when contextmenu is shown via JS */
.contextmenu.modal {
  /* display is set by JS, z-index should be highest */
  z-index: 99999;
}

@keyframes contextmenu-open {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
}

/* Header: the name of the clicked creature (or "Menu") in the soft accent color */
.contextmenu>.menu-header {
  margin-bottom: 4px;
  padding: 5px 10px 6px;
  cursor: auto;
  text-align: left;
  font-weight: bold;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--color-accent-text);
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contextmenu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0;
  padding: 5px 12px 5px 8px;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
  color: white;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  transition: background-color 0.08s, border-color 0.08s, box-shadow 0.08s;
}

.contextmenu button[data-icon]::before {
  content: attr(data-icon);
  flex: 0 0 16px;
  font-family: "Material Icons";
  font-weight: normal;
  font-size: 15px;
  line-height: 1;
  text-align: center;
  color: var(--color-icon-light);
  opacity: 0.75;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

/* Hovered option: the selected look of the theme (dark gold background with an accent border) */
.contextmenu button:hover {
  border-color: var(--color-accent);
  background-image: var(--gradient-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 4px var(--color-accent-glow);
}

.contextmenu button:hover::before {
  color: var(--color-accent);
  opacity: 1;
}

/* Options against another player (e.g., Report Player) use the blood red counterpart of the accent */
.contextmenu button.danger::before {
  color: var(--color-danger);
  opacity: 0.9;
}

.contextmenu button.danger:hover {
  border-color: var(--color-danger);
  background-image: var(--gradient-danger);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 4px var(--color-danger-glow);
}

.contextmenu button.danger:hover::before {
  color: var(--color-danger);
}

/* A checked option (e.g., Always Loot when the item is on that list): the icon is a gold check box */
.contextmenu button.checked::before {
  color: var(--color-accent);
  opacity: 1;
}

/* An option locked to premium accounts: a gold Premium tag after the label */
.contextmenu button.premium::after {
  content: "Premium";
  margin-left: auto;
  padding: 1px 5px;
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-accent-darker);
  border-radius: 6px;
  background-image: linear-gradient(to bottom, var(--color-accent-text), var(--color-accent));
}

/* The screen and battle menus grow to fit long creature names (header and party options) */
#screen-menu,
#battle-menu {
  min-width: 150px;
  max-width: 220px;
}

/* Card of an item (see Menu.openItemCard): the look of the item tooltip (tooltip.css, same background and border)
   with the actions below in the same box, opened where the tooltip of the item was */
.contextmenu.item-card {
  width: 200px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-panel-border);
  border-radius: 6px;
  background-image: none;
  background-color: var(--color-panel-background);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  font-family: 'Verdana', sans-serif;
  font-size: 11px;
  color: white;
}

/* An empty slot has no item: only the actions are shown */
.item-card-info:empty {
  display: none;
}

.item-card-actions {
  padding: 4px;
}

.item-card-info:not(:empty) + .item-card-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.contextmenu>.menu-separator,
.item-card-actions>.menu-separator {
  height: 1px;
  margin: 4px 6px;
  border: 0;
  background-image: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.22), transparent);
}
