@use '../variables' as *;
@use './ItemTable.m.scss' as table;

.noWrap {
  white-space: nowrap;
}

.name {
  composes: noWrap;
  font-weight: bold;
}

.new {
  composes: flexColumn from '../dim-ui/common.m.scss';
  align-items: center;
  > div {
    position: static !important;
  }
}

.stats {
  text-align: right;
  > div {
    justify-content: center;
  }
  // Recoil background semi-circle
  svg {
    circle {
      fill: black;
    }
  }
}

.statsHeader {
  text-align: center;
  > div {
    display: flex;
    flex-direction: row;
    align-items: center;
    > div {
      display: flex;
      flex-direction: column;
      align-items: center;
    }
  }
}

.centered {
  text-align: center;
  justify-content: center;
}

.dmg {
  composes: centered;
  padding-top: calc(var(--item-size) * 0.75 * 0.5 - 2px);
}
.dmgHeader {
  composes: centered;
  padding-top: 4px;
}

.icon {
  --icon-item-size: calc(var(--item-size) * 0.75);
  composes: centered;
  padding-top: 4px;
  min-width: calc(var(--item-size) * 0.75);
  left: calc(30px + env(safe-area-inset-left));
  position: sticky;
  top: calc(var(--header-height) + var(--table-header-height) + var(--item-table-toolbar-height));
  z-index: table.$header-cells;
  background: var(--org-row-bg);
  > :global(.item) {
    --item-size: var(--icon-item-size) !important;
    height: var(--item-size);

    @include interactive($hover: true) {
      outline: 1px solid var(--theme-item-polaroid-hover-border);
      cursor: pointer;
    }
  }
}

.iconHeader {
  composes: centered;
  left: calc(30px + env(safe-area-inset-left));
  position: sticky;
  top: calc(var(--header-height) + var(--item-table-toolbar-height));
}

.inlineIcon {
  height: 14px;
  width: 14px;
  margin-right: 0;
}

.positive {
  color: $xp;
}

.negative {
  color: #d14334;
}

.modPerks {
  composes: flexColumn from '../dim-ui/common.m.scss';
  break-inside: avoid;
  gap: 4px;
  padding-left: 3px;
}

.perkLike {
  padding-top: calc(var(--item-size) * 0.5 * 0.5 - 5px);
  > *:nth-last-child(n + 2) {
    margin-bottom: 4px;
  }
  .modPerks {
    flex: 0;
    min-width: 160px;
    flex-basis: 160px;
    padding-left: 3px;
  }
}

.perks {
  composes: perkLike;
  columns: 2;
  height: 100%;
  box-sizing: border-box;
  column-gap: 8px;
}
.isPerk {
  margin-left: 0;
  padding-left: 1px;
  box-shadow:
    -5px 0 0 -3px var(--org-row-bg),
    -5px 0 0 -1px #888;
}

// Perks in the perk/mod columns
.modPerk {
  composes: flexRow from '../dim-ui/common.m.scss';
  composes: noWrap;
  align-items: flex-start;
  gap: 2px;
}
.miniPerkContainer {
  --item-size: 18px;
  position: relative;
  contain: layout paint style;
  box-sizing: border-box;
  height: 18px;
  width: 18px;
  margin-left: -1px;
  flex-shrink: 0;
  > img {
    height: var(--item-size);
    width: var(--item-size);
  }
}
.perkSelected {
  font-weight: bold;
}
.perkSelectable {
  cursor: pointer;
}
// copy pasted from src/app/item-popup/PlugTooltip.m.scss with spacing tweaks
.enhancedArrow {
  width: 25px;
  display: flex;
  &::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 11px;
    vertical-align: text-bottom;
    mask-image: url('images/enhancedArrow.svg');
    background-color: $enhancedYellow;
    margin-left: 1px;
    margin-top: 3px;
  }
}

.perksGrid {
  --mod-size: calc(#{dim-item-px(28)});
  --perk-size: calc(#{dim-item-px(28)});
  padding-top: 4px;
  padding-bottom: 4px;

  @include phone-portrait {
    --mod-size: 26px;
  }
}

// D1 talent grids are like sockets
.talentGrid {
  padding: 4px 2px 0 2px;
  max-width: 150px;
  height: auto;
}

.locationCell {
  composes: flexRow from '../dim-ui/common.m.scss';
  composes: noWrap;
  align-items: flex-start;
  img {
    margin-right: 4px;
    height: 16px;
    width: 16px;
  }
}

$modslotSize: 24px;
.modslotIcon {
  height: $modslotSize;
  width: $modslotSize;
}

.modslot {
  composes: centered;
  padding-top: calc(4px + (var(--item-size) * 0.75 - #{$modslotSize}) / 2);
}

.loadouts {
  flex-direction: column;
  gap: 4px;
}

.loadout {
  composes: noWrap;
  img {
    height: 16px;
    width: 16px;
    margin-right: 4px;
    vertical-align: middle;
  }
}

.shapedIconOverlay {
  position: absolute;
  bottom: 1px;
  left: 1px;
  width: calc(var(--item-size) - ($item-border-width * 2));
}
