.root {
  position: relative;
  background: var(--alinea-fields);
  box-shadow: var(--alinea-fields-shadow);
  border-radius: var(--alinea-border-radius);

  &.is-open {
    z-index: 3;
  }

  &:focus-within {
    background: var(--alinea-fields-selected);
    outline: 2px solid var(--alinea-fields-focus);
  }

  &-input {
    cursor: pointer;
    appearance: none;
    background: transparent;
    display: flex;
    align-items: center;
    border: none;
    color: inherit;
    font: inherit;
    width: 100%;
    text-align: left;
    line-height: 1.5;
    outline: none;
    padding-right: 14px;
    gap: 8px;

    &-button {
      cursor: pointer;
      flex: 1;
      min-width: 0;
      gap: 8px;
      display: flex;
      align-items: center;
      text-align: left;
      padding: 9px 0 9px 14px;

      &:focus {
        outline: none;
      }
    }

    &-label {
      flex: 1 0 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;

      &.is-placeholder {
        color: hsla(var(--alinea-negative), 0.25);
      }
    }

    &-icon {
      flex-shrink: 0;
      color: hsla(var(--alinea-negative), 0.25);
      font-size: 18px;
    }

    &-delete {
      flex-shrink: 0;
      margin-right: -4px;
    }
  }

  &-dropdown {
    position: absolute;
    list-style: none;
    margin: 0;
    width: 100%;
    max-height: 240px;
    overflow-y: auto;
    z-index: 2;
    border-radius: var(--alinea-border-radius);
    background: var(--alinea-background);
    border: 1px solid var(--alinea-outline);
    box-shadow: 0 2px 10px var(--alinea-shadow);
    outline: none;

    &-inner {
      padding: 4px;
    }

    &-option {
      cursor: pointer;
      position: relative;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      height: 36px;
      padding: 8px;
      border-radius: var(--alinea-border-radius);

      &.is-active {
        background: var(--alinea-highlight);
      }

      &.is-selected {
        font-weight: 600;
      }

      &-icon {
        width: 24px;
        margin-left: auto;

        .is-selected & {
          color: var(--alinea-accent);
        }
      }
    }
  }
}
