/* Find a file, in the look of the Go to file picker: the repository name and the shared search field, then a box
   of paths with a file icon, the path muted and the characters that match the query in bold. Forgejo's find-file
   script fills the table and marks matches with "ui text red". */
.theme-find-file-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 16px;
  line-height: 24px;
  & > .theme-search-field {
    flex: 1;
    min-width: 0;
  }
}

/* The shared field styles its search input; Forgejo's find-file input is a text input, given the same look. */
:is(.ui.form, body) .theme-find-file-bar .theme-search-field input[type="text"] {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 30px;
  margin: 0;
  padding: 5px 12px 5px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-text);
  font: 14px/20px var(--fonts-proportional);
  outline: none;
  &:is(:focus, :focus-visible) {
    background: transparent;
    box-shadow: none;
  }
  &::placeholder {
    color: var(--color-text-light-1);
    opacity: 1;
  }
}

.theme-find-file-repo {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-find-file-divider {
  color: var(--color-text-light-1);
}

.ui.table.theme-find-file-results {
  margin: 0;
  border: 1px solid var(--color-light-border);
  border-radius: var(--border-radius);
  background: var(--color-body);
  overflow: hidden;
  &:has(> tbody:empty) {
    display: none;
  }
  & > tbody > tr > td {
    padding: 0;
    border-top: 1px solid var(--color-light-border);
  }
  & > tbody > tr:first-child > td {
    border-top: 0;
  }
  /* The script puts the icon and each part of the path side by side, so the link stays inline text. */
  & > tbody > tr > td > a {
    display: block;
    padding: 8px 16px;
    color: var(--color-text-light-1);
    font-size: 14px;
    line-height: 20px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  & > tbody > tr > td > a:hover {
    background: var(--color-hover);
    text-decoration: none;
  }
  & > tbody > tr > td > a:focus-visible {
    outline: 2px solid var(--github-fgColor-accent);
    outline-offset: -2px;
  }
  & > tbody > tr > td > a > .svg {
    margin: 0 8px 0 0 !important;
    vertical-align: text-bottom;
  }
  /* Forgejo's .text.red colour is !important. */
  & > tbody > tr > td > a > .ui.text.red {
    color: var(--color-text) !important;
    font-weight: 600;
  }
}

.theme-find-file-empty {
  min-height: 0;
}

@media (max-width: 767.98px) {
  .theme-find-file-bar {
    font-size: 14px;
    line-height: 20px;
  }
}
