/* Loot items for soft reserves: quality colors, icons and the item tooltip
   (public/assets/app/softres/loot.js), on the member reserve page and the dashboard. */
:root {
  --quality-0: #9d9d9d;
  --quality-1: #ffffff;
  --quality-2: #1eff00;
  --quality-3: #0070dd;
  --quality-4: #a335ee;
  --quality-5: #ff8000;
  --quality-6: #e6cc80;
  --quality-7: #00ccff;
}

.quality-0 {
  color: var(--quality-0);
}

.quality-1 {
  color: var(--quality-1);
}

.quality-2 {
  color: var(--quality-2);
}

.quality-3 {
  color: #3d9bff;
}

.quality-4 {
  color: #b878ff;
}

.quality-5 {
  color: var(--quality-5);
}

.quality-6 {
  color: var(--quality-6);
}

.quality-7 {
  color: var(--quality-7);
}

.loot-icon {
  display: block;
  border-radius: 6px;
  background: var(--bg-inset);
}

.loot-tip-button {
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: none;
  cursor: help;
  line-height: 0;
}

.loot-tip-button:hover {
  border-color: var(--border-hover);
}

.loot-tip-button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* A popover where the browser has them (so it shows above dialogs), placed by
   loot.js; inset, margin and overflow undo the popover's centring and
   clipping, which would hide the arrow. */
.loot-tip {
  position: fixed;
  inset: auto;
  z-index: 60;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #4a4a4a;
  border-radius: 7px;
  background: #0b0d12;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
  font-size: 13px;
  line-height: 1.4;
  color: #e6e6e6;
  overflow: visible;
}

/* The arrow, towards the item: at --tip-arrow from the left above or below
   it, from the top beside it. */
.loot-tip[data-side]::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border: solid #4a4a4a;
  background: #0b0d12;
  rotate: 45deg;
}

.loot-tip:is([data-side="top"], [data-side="bottom"])::before {
  left: var(--tip-arrow, 50%);
  translate: -50% 0;
}

.loot-tip:is([data-side="left"], [data-side="right"])::before {
  top: var(--tip-arrow, 50%);
  translate: 0 -50%;
}

.loot-tip[data-side="top"]::before {
  bottom: -5px;
  border-width: 0 1px 1px 0;
}

.loot-tip[data-side="bottom"]::before {
  top: -5px;
  border-width: 1px 0 0 1px;
}

.loot-tip[data-side="right"]::before {
  left: -5px;
  border-width: 0 0 1px 1px;
}

.loot-tip[data-side="left"]::before {
  right: -5px;
  border-width: 1px 1px 0 0;
}

.loot-tip-line {
  margin: 0 0 2px;
}

/* A two-column row (slot and type, damage and speed): the second part on the
   right, as in game. */
.loot-tip-line.is-split {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.loot-tip-right {
  flex: none;
}

.loot-tip-separator {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: pre;
}

/* A new block: a recipe's drop lines, crafted item or reagents. */
.loot-tip-line.has-gap {
  margin-top: 10px;
}

.loot-tip-line.is-name {
  font-weight: 700;
  font-size: 14px;
}

.loot-tip[data-quality="2"] .is-name {
  color: var(--quality-2);
}

.loot-tip[data-quality="3"] .is-name {
  color: #3d9bff;
}

.loot-tip[data-quality="4"] .is-name {
  color: #b878ff;
}

.loot-tip[data-quality="5"] .is-name {
  color: var(--quality-5);
}

.loot-tip-line.is-effect {
  color: var(--quality-2);
}

.loot-tip-line.is-flavor {
  color: #ffd100;
}

.loot-tip-line.is-muted {
  color: #a8a8a8;
}

/* An item as one tooltip button: icon and name in its quality color
   (itemLabel in loot.js), for reserved items. */
.loot-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 2px 8px 2px 2px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: help;
}

.loot-label .loot-icon {
  flex: none;
  border: 1px solid rgb(0 0 0 / 0.6);
}

.loot-label-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.loot-label-count {
  color: var(--text-secondary);
  font-weight: 500;
}

.loot-label:hover {
  background: var(--bg-hover);
}

.loot-label:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* The item picker (item-picker.js): a panel under its button, a sheet at the
   bottom of phones. */
.item-picker {
  position: fixed;
  z-index: 55;
  display: flex;
  flex-direction: column;
  max-height: min(460px, var(--picker-max, 460px));
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  background: var(--bg-secondary);
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.55);
  overflow: hidden;
}

.item-picker[hidden] {
  display: none;
}

.item-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 8px 4px 14px;
}

.item-picker-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.item-picker-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.item-picker-close:hover,
.item-picker-close:focus-visible {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.item-picker-search {
  display: flex;
  gap: 6px;
  padding: 4px 10px 10px;
  border-bottom: 1px solid var(--border);
}

.item-picker-search input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
}

.item-picker-search select {
  flex: 0 1 160px;
  min-width: 0;
}

.item-picker-list {
  /* Options measure their offsetTop from here when scrolled into view. */
  position: relative;
  flex: 1;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.item-picker-list [role="option"] {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.item-picker-list [role="option"] .loot-icon {
  flex: none;
  border: 1px solid rgb(0 0 0 / 0.6);
}

.item-picker-list [role="option"].is-active {
  background: var(--bg-hover);
  box-shadow: inset 0 0 0 1px var(--border-hover);
}

.item-picker-list [role="option"][aria-disabled="true"] {
  cursor: default;
  opacity: 0.55;
}

.item-picker-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.item-picker-name {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.item-picker-where {
  font-size: 11px;
  color: var(--text-muted);
}

.item-picker-note {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--accent);
  font-size: 11px;
}

.item-picker-note.is-muted {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.item-picker-empty {
  margin: 0;
  padding: 18px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.item-picker-empty[hidden] {
  display: none;
}

/* Where the loot data comes from; fixed under the list, which scrolls above it. */
.loot-picker-credit {
  flex: none;
  margin: 0;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.loot-picker-credit a {
  color: var(--text-secondary);
  text-decoration: underline;
}

.loot-picker-credit a:hover {
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .item-picker-search {
    flex-wrap: wrap;
  }

  .item-picker-search input,
  .item-picker-search select {
    flex: 1 1 100%;
  }

  .item-picker {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 80vh;
    border-radius: 14px 14px 0 0;
  }
}
