// In-cell editors: text, data-map dropdown, radio, and the shared dropdown list.

.apg-editor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  margin: 0;
  border: 2px solid var(--apg-active-border);
  border-radius: 2px;
  padding: var(--apg-cell-padding);
  font: inherit;
  color: var(--apg-cell-fg);
  background: var(--apg-cell-bg);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  will-change: transform;

  &.apg-align-right {
    text-align: right;
  }

  &.apg-align-center {
    text-align: center;
  }
}

.apg-editor-dropdown {
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
}

.apg-dd-input {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 2px solid var(--apg-active-border);
  border-radius: 2px;
  padding: var(--apg-cell-padding);
  padding-right: 22px;
  font: inherit;
  color: inherit;
  background: var(--apg-cell-bg);
  outline: none;
}

.apg-dd-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--apg-header-fg);
  cursor: pointer;
}

// Shared dropdown list used by the in-cell dropdown editor (and reusable for
// other editable dropdowns). Floats just below the input; flips up near the
// bottom.
.apg-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 4px 0;
  max-height: 200px;
  overflow-y: auto;
  list-style: none;
  background: var(--apg-cell-bg);
  border: var(--apg-border);
  border-radius: var(--apg-radius);
  box-shadow: var(--apg-shadow-md);

  &.apg-dropdown-up {
    top: auto;
    bottom: 100%;
  }
}

.apg-dropdown-option {
  padding: 5px 12px;
  white-space: nowrap;
  cursor: pointer;

  &:hover,
  &.apg-dropdown-active {
    background: var(--apg-selected-bg);
  }
}

// The radio editor floats below the cell as its own panel, so it overrides the
// fixed cell height and box styling the base .apg-editor sets.
.apg-editor-radio {
  height: auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-height: 180px;
  padding: 4px 6px;
  overflow-y: auto;
  border: 1px solid var(--apg-active-border);
  border-radius: var(--apg-radius);
  box-shadow: var(--apg-shadow-md);
  cursor: default;
}

.apg-radio-option {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;

  input {
    margin: 0;
  }
}
