/* Dark Market Watch custom item combobox. Replaces the browser-native datalist UI. */

.alert-form,
.form-stage,
.primary-fields,
.item-field {
  overflow: visible;
}

.alert-form,
.form-stage,
.primary-fields {
  position: relative;
}

.item-field {
  position: relative;
  z-index: 20;
}

.item-field:focus-within {
  z-index: 1000;
}

.item-field .input-with-icon.dmw-item-picker-anchor {
  position: relative;
  z-index: 1001;
  overflow: visible;
}

.dmw-v3-item-input-wrap {
  position: relative;
  z-index: 1001;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.dmw-v3-item-input-wrap > #v3-item.dmw-item-picker-input {
  width: 100%;
  box-sizing: border-box;
}

.alert-form[data-builder-version="3"] > .form-stage:first-of-type {
  overflow: visible;
}

#alert-item.dmw-item-picker-input {
  padding-right: 46px;
}

.dmw-item-picker-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #d4c39b;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.dmw-item-picker-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 7px solid currentColor;
  transition: transform 140ms ease, color 140ms ease;
}

.dmw-item-picker-toggle[aria-expanded="true"]::before {
  transform: rotate(180deg);
}

.dmw-item-picker-toggle:hover,
.dmw-item-picker-toggle:focus-visible {
  color: #f0d88e;
}

.dmw-item-picker-toggle:focus-visible {
  outline: 1px solid #d5aa47;
  outline-offset: 1px;
}

.dmw-item-picker-panel {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  z-index: 1002;
  overflow: hidden;
  isolation: isolate;
  color: #eadfc8;
  border: 1px solid rgba(205, 164, 77, 0.72);
  border-radius: 3px;
  background: #100e0c;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 18px 40px rgba(0, 0, 0, 0.82),
    0 0 0 1px rgba(0, 0, 0, 0.8);
}

.dmw-item-picker-panel[hidden] {
  display: none !important;
}

.dmw-item-picker-status {
  min-height: 38px;
  padding: 10px 13px;
  color: #a99b80;
  border-bottom: 1px solid rgba(201, 164, 92, 0.18);
  background: #15120f;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.25;
}

.dmw-item-picker-list {
  max-height: 344px;
  margin: 0;
  padding: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #100e0c;
  scrollbar-color: #80652c #17130f;
  scrollbar-width: thin;
}

.dmw-item-picker-option {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 52px;
  padding: 6px 9px;
  color: #e8ddc5;
  border: 1px solid transparent;
  border-radius: 2px;
  background: #100e0c;
  cursor: pointer;
  user-select: none;
}

.dmw-item-picker-option + .dmw-item-picker-option {
  margin-top: 2px;
}

.dmw-item-picker-option:hover,
.dmw-item-picker-option[aria-selected="true"] {
  color: #fff3d6;
  border-color: rgba(202, 159, 68, 0.42);
  background:
    linear-gradient(90deg, rgba(136, 99, 31, 0.23), rgba(74, 57, 31, 0.1)),
    #15120f;
  box-shadow: inset 3px 0 0 #c89b3d;
}

.dmw-item-picker-art {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  color: #cfb56f;
  border: 1px solid rgba(201, 164, 92, 0.34);
  border-radius: 3px;
  background:
    radial-gradient(circle at 36% 26%, rgba(201, 164, 92, 0.17), transparent 43%),
    #0c0b09;
  box-shadow: inset 0 0 9px rgba(0, 0, 0, 0.65);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.85rem;
}

.dmw-item-picker-art img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 3px;
  box-sizing: border-box;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}

.dmw-item-picker-copy {
  min-width: 0;
}

.dmw-item-picker-name {
  overflow: hidden;
  color: inherit;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.91rem;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dmw-item-picker-meta {
  margin-top: 3px;
  overflow: hidden;
  color: #9f927b;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dmw-item-picker-empty {
  padding: 22px 15px;
  color: #a99c83;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  text-align: center;
}

.dmw-item-picker-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  color: #887c68;
  border-top: 1px solid rgba(201, 164, 92, 0.16);
  background: #0c0b09;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
}

@media (max-width: 700px) {
  .item-field:focus-within {
    z-index: 2000;
  }

  .dmw-item-picker-panel {
    z-index: 2002;
    max-height: calc(100dvh - 190px);
  }

  .dmw-item-picker-list {
    max-height: calc(100dvh - 285px);
    min-height: 0;
  }

  .dmw-item-picker-option {
    min-height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dmw-item-picker-toggle::before {
    transition: none;
  }
}
