/*
 * Copyright (c) 2019-present Sonatype, Inc.
 * This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License 2.0 which accompanies this
 * distribution and is available at https://www.eclipse.org/legal/epl-2.0/.
 */
@use '../../scss-shared/nx-container-helpers';

.nx-combobox {
  display: inline-block;
  position: relative;

  &__menu {
    position: absolute;
    width: 100%;
  }

  &__input {
    margin-bottom: 0;
  }

  &__alert {
    position: absolute;
    width: 100%;
    border-radius: var(--nx-border-radius);
    margin: var(--nx-spacing-base) 0 0 0;
    padding: var(--nx-spacing-base) 0;
    background: var(--nx-color-dropdown-menu-background);
    box-shadow: var(--nx-box-shadow-dropdown);
    box-sizing: border-box;
    max-height: 328px;
    overflow-y: auto;
    z-index: 1;

    &--error {
      padding: 0;
    }

    @include nx-container-helpers.container-vertical;
  }

  &__empty-message {
    padding: var(--nx-spacing-base) var(--nx-spacing-4x);
    text-align: center;
  }

  &--long{
    .nx-combobox__input{
      width: var(--nx-width-form-element-wide);
    }
  }

  &--short{
    .nx-combobox__input{
      width: var(--nx-width-form-element-short);

      .nx-text-input__input {
        min-width: 0;
      }
    }
  }

  .nx-dropdown-button.selected {
    background-color: var(--nx-color-interactive-background-selected);
    color: var(--nx-color-text-stark);
  }

  .nx-loading-spinner {
    padding-top: var(--nx-spacing-6x);
    padding-bottom: var(--nx-spacing-6x);
    text-align: center;
  }
}
