/* Attribute-builder usability fixes: stable tooltips, searchable attributes, and inline row insertion. */

.info-tooltip {
  box-sizing: border-box !important;
  z-index: 10000 !important;
  width: min(340px, calc(100vw - 24px)) !important;
  min-width: min(280px, calc(100vw - 24px));
  max-width: 340px !important;
  max-height: calc(100vh - 24px);
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal !important;
  pointer-events: none;
  contain: layout paint;
}

.info-tooltip-title,
.info-tooltip-body {
  display: block;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal !important;
}

.stat-select-field {
  position: relative;
  overflow: visible;
}

.attribute-native-select {
  position: absolute !important;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  white-space: nowrap !important;
}

.attribute-combobox {
  position: relative;
  width: 100%;
  min-width: 0;
}

.attribute-combobox__input {
  width: 100%;
  min-width: 0;
  padding-right: 44px !important;
}

.attribute-combobox__toggle {
  position: absolute;
  z-index: 2;
  top: 1px;
  right: 1px;
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  place-items: center;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(197, 160, 89, 0.22);
  color: #d6bf8b;
  background: linear-gradient(90deg, rgba(21, 18, 15, 0.2), #15120f 55%);
  box-shadow: none;
  cursor: pointer;
}

.attribute-combobox__toggle:hover,
.attribute-combobox__toggle:focus-visible,
.attribute-combobox__toggle[aria-expanded="true"] {
  color: #f2dfb0;
  background: #211c17;
}

.attribute-combobox__list {
  position: absolute;
  z-index: 9000;
  top: calc(100% + 5px);
  left: 0;
  width: max(100%, min(360px, calc(100vw - 24px)));
  max-width: min(440px, calc(100vw - 24px));
  max-height: 286px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px;
  border: 1px solid rgba(197, 160, 89, 0.72);
  background: #15120f;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.78);
}

.attribute-combobox__list[hidden] {
  display: none !important;
}

.stat-filter-row.has-open-attribute-combobox {
  position: relative;
  z-index: 80;
}

/* Form stages share a stacking context. Lift the attribute stage while its
   menu is open so later stages cannot paint their headings through the list. */
.alert-form > .stats-section:has(.has-open-attribute-combobox) {
  z-index: 100;
}

.attribute-combobox__option {
  display: block;
  width: 100%;
  min-height: 39px;
  padding: 8px 11px;
  border: 1px solid transparent;
  color: #d8cdb8;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font-family: "EB Garamond", Baskerville, Georgia, serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  text-transform: none;
}

.attribute-combobox__option:hover,
.attribute-combobox__option.is-active,
.attribute-combobox__option[aria-selected="true"] {
  border-color: rgba(197, 160, 89, 0.34);
  color: #f0e4ce;
  background: rgba(197, 160, 89, 0.1);
}

.attribute-combobox__option mark {
  color: #ffe2a0;
  background: transparent;
  font-weight: 700;
}

.attribute-combobox__empty {
  padding: 11px;
  color: #9f947f;
  font-family: "EB Garamond", Baskerville, Georgia, serif;
  font-size: 0.95rem;
}

.inline-add-attribute {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: flex-start;
  min-height: 28px;
  margin-top: -2px;
}

.inline-add-attribute[hidden] {
  display: none !important;
}

.inline-add-attribute__button {
  display: grid;
  width: 31px;
  min-width: 31px;
  height: 28px;
  min-height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(197, 160, 89, 0.48);
  color: #d9c18c;
  background: linear-gradient(180deg, #332d27, #211d19);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 3px 7px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.inline-add-attribute__button:hover,
.inline-add-attribute__button:focus-visible {
  border-color: #efd497;
  color: #f3dfae;
  background: linear-gradient(180deg, #453c33, #2a241f);
}

@media (max-width: 480px) {
  .attribute-combobox__list {
    width: min(100%, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
  }

  .info-tooltip {
    min-width: 0;
  }
}
