/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

.search-container {
  position: absolute;
  top: var(--editor-header-height);
  left: 0;
  width: calc(100% - 1px);
  height: calc(100% - var(--editor-header-height));
  display: flex;
  flex-direction: column;
  z-index: 20;
  background-color: var(--theme-body-background);
  overflow-y: hidden;

  /* Using the same colors as the Netmonitor's --table-selection-background-hover */
  --search-result-background-hover: rgba(209, 232, 255, 0.8);
}

.theme-dark .search-container {
  --search-result-background-hover: rgba(53, 59, 72, 1);
}

.project-text-search {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
  height: 100%;
}

.project-text-search .result {
  display: contents;
  cursor: default;
  line-height: 16px;
  font-size: 11px;
  font-family: var(--monospace-font-family);
}

.project-text-search .result:hover > * {
  background-color: var(--search-result-background-hover);
}

.project-text-search .result .line-number {
  grid-column: 1;
  width: 100%;
  padding-block: 1px;
  padding-inline-start: 4px;
  padding-inline-end: 6px;
  text-align: end;
  color: var(--theme-text-color-alt);
}

.project-text-search .result .line-value {
  grid-column: 2;
  padding-block: 1px;
  padding-inline-end: 4px;
  text-overflow: ellipsis;
  overflow-x: hidden;
}

.project-text-search .result .query-match {
  border-bottom: 1px solid var(--theme-contrast-border);
  color: var(--theme-contrast-color);
  background-color: var(--theme-contrast-background);
}

.project-text-search .result.focused .query-match {
  border-bottom: none;
  color: var(--theme-selection-background);
  background-color: var(--theme-selection-color);
}

.project-text-search .tree-indent {
  display: none;
}

.project-text-search .no-result-msg {
  color: var(--theme-text-color-inactive);
  font-size: 24px;
  padding: 4px 15px;
  max-width: 100%;
  overflow-wrap: break-word;
  hyphens: auto;
}

.project-text-search .file-result {
  grid-column: 1/3;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 24px;
  padding: 2px 4px;
  font-weight: bold;
  font-size: 12px;
  line-height: 16px;
  cursor: default;
}

.project-text-search .file-result .img {
  margin-inline: 2px;
}

.project-text-search .file-result .img.file {
  margin-inline-end: 4px;
}

.project-text-search .file-path {
  flex: 0 1 auto;
  padding-inline-end: 4px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-text-search .file-path:empty {
  display: none;
}

.project-text-search .search-field {
  display: flex;
  align-self: stretch;
  flex-grow: 1;
  width: 100%;
  border-bottom: none;
}

.project-text-search .managed-tree {
  overflow-y: auto;
  height: 100%;
}

.project-text-search .managed-tree .tree {
  height: 100%;
  display: grid;
  /* Align the second column to the search input's text value */
  grid-template-columns: minmax(40px, auto) 1fr;
  overflow-x: hidden;
  padding-top: 4px;
}

/* Fake padding-bottom using a pseudo-element because Gecko doesn't render the
   padding-bottom in a scroll container */
.project-text-search .tree::after {
  content: "";
  display: block;
  height: 4px;
}

.project-text-search .managed-tree .tree .tree-node {
  display: contents;
}

/* Focus values */

.project-text-search .file-result.focused,
.project-text-search .result.focused .line-value,
.project-text-search .result.focused .line-number {
  color: var(--theme-selection-color);
  background-color: var(--theme-selection-background);
}

.project-text-search .file-result.focused .img {
  background-color: currentColor;
}
