@use '../tokens/components';
@use './../mixins/utilities';
@use './../functions/tokens';

@mixin input-btn() {
  z-index: 1;
  padding: 0;
  position: absolute;
  transform: translateY(-50%);
  background: none;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--post-device-border-radius-focus);
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    fill 0.2s ease;
  color: tokens.get('input-color-enabled-fg', components.$post-text-input);
  right: tokens.get('post-search-position-inline-end-icon', components.$post-search-input);
  top: calc(#{tokens.get('input-sizing-height', components.$post-text-input)} / 2);

  post-icon {
    width: tokens.get('select-sizing-icon', components.$post-select);
    height: tokens.get('select-sizing-icon', components.$post-select);
  }

  &:not([disabled]) {
    cursor: pointer;

    :where(:hover > *) post-icon {
      color: tokens.get('input-color-hover-fg', components.$post-text-input);

      @include utilities.high-contrast-mode() {
        color: Highlight;
      }
    }
  }
}
