.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;

  &[data-entering] {
    animation: overlayFadeIn 200ms ease-out;
  }

  &[data-exiting] {
    animation: overlayFadeOut 150ms ease-in;
  }
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes overlayFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.modal {
  width: min(90vw, 500px);
  max-height: min(70vh, 400px);
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  outline: none;
  overflow: hidden;

  &[data-entering] {
    animation: modalScaleIn 200ms ease-out;
  }

  &[data-exiting] {
    animation: modalScaleOut 150ms ease-in;
  }
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalScaleOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
}

.dialog {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: min(70vh, 400px);
  outline: none;
  overflow: hidden;
}

.searchField {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--primary);
  font-family: inherit;

  &::placeholder {
    color: var(--secondary);
  }
}

.menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  outline: none;
  border: none;
}

.menuItem {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.875rem;
  outline: none;

  &[data-focused] {
    background-color: var(--action);
  }

  &[data-pressed] {
    background-color: var(--action);
  }
}

.empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--secondary);
  font-size: 0.875rem;
}
