:host {
  /* layout */
  --ld-select-popper-min-width: 12.8125rem;
  --ld-select-popper-max-height: min(23.75rem, 75vh - 1.25rem);

  /* colors */
  --ld-select-popper-border-col: var(--ld-col-neutral-100);
  min-width: var(--ld-select-popper-min-width);
}

.ld-select-popper {
  min-width: 100%;

  &:not(.ld-select-popper--expanded) {
    display: none;
  }

  ::slotted(.ld-select__shadow) {
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    box-shadow: var(--ld-shadow-sticky);
    border-radius: var(--ld-br-m);
    pointer-events: none;
    z-index: -1;
  }
}

.ld-select-popper__scroll-container {
  max-height: var(--ld-select-popper-max-height);
  overflow-y: auto;
  border-bottom-left-radius: var(--ld-br-m);
  border-bottom-right-radius: var(--ld-br-m);
  border-top: solid var(--ld-select-popper-border-col) var(--ld-sp-1);
  overscroll-behavior: contain;

  .ld-select-popper--detached:not(.ld-select-popper--filter) &,
  .ld-select-popper--pinned:not(.ld-select-popper--filter) & {
    border-top: 0;
    border-radius: var(--ld-br-m);
  }

  .ld-select-popper--all-filtered & {
    border-top: 0;
  }
}

.ld-select-popper__shadow {
  position: absolute;
  width: 100%;
  height: calc(100% + var(--ld-select-min-height-md));
  box-shadow: var(--ld-shadow-sticky);
  border-radius: var(--ld-br-m);
  pointer-events: none;
  z-index: -1;
  bottom: 0;

  .ld-select-popper--detached & {
    height: 100% !important;
  }
}

.ld-select-popper__filter-container {
  align-items: center;
  background-color: var(--ld-col-wht);
  border-top: solid var(--ld-col-neutral-100) var(--ld-sp-1);
  color: var(--ld-col-neutral-900);
  display: grid;
  font: var(--ld-typo-label-m);
  grid-template-columns: 1fr auto;

  .ld-select-popper--detached &,
  .ld-select-popper--pinned & {
    border-top: 0;
    border-top-left-radius: var(--ld-br-m);
    border-top-right-radius: var(--ld-br-m);
  }

  .ld-select-popper--all-filtered & {
    border-bottom-left-radius: var(--ld-br-m);
    border-bottom-right-radius: var(--ld-br-m);
  }
}

.ld-select-popper__create-button {
  font: var(--ld-typo-label-s);
  line-height: var(--ld-select-trigger-line-height);
  margin-right: var(--ld-sp-8);

  &::part(button) {
    --ld-button-padding-x-sm: var(--ld-sp-6);
    --ld-button-padding-y-sm: var(--ld-sp-4);
    min-height: 0;
    min-width: 0;
  }
}

.ld-select-popper__filter-input {
  appearance: none;
  background-color: transparent;
  border: 0;
  box-sizing: border-box;
  color: inherit;
  font: inherit;
  height: 2.5rem;
  line-height: var(--ld-select-trigger-line-height);
  outline: none;
  padding: var(--ld-sp-8) var(--ld-sp-12);
  width: 100%;

  &::placeholder {
    color: var(--ld-col-neutral-600);
  }

  .ld-select-popper--detached &,
  .ld-select-popper--pinned & {
    border-top: 0;
    border-top-left-radius: var(--ld-br-m);
    border-top-right-radius: var(--ld-br-m);
  }
}
