/* SPDX-License-Identifier: Apache-2.0 */
#search-filter-root {
  --active-color: #2563eb;
  --chip-text-color: #102e91;
  --chip-bg-color: #dbeafe;
  --chip-width: 7rem;

  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: max-content;
  max-width: 100%;
  color: var(--text-color);
}

#search-filter-button {
  height: 2.25rem;
  min-width: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--bkg-color);
  cursor: pointer;
}

#search-filter-button.active {
  border-color: var(--active-color);
  background: var(--bkg-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) inset;
}

#search-filter-button.active .filter-icon {
  filter: invert(35%) sepia(100%) saturate(400%) hue-rotate(190deg);
}

.filter-icon {
  width: 20px;
  height: 20px;
}

.badge {
  position: absolute;
  top: -0.25rem;
  right: -0.5rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.15rem;
  border-radius: 5rem;
  background: var(--active-color);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1rem;
  text-align: center;
}

#search-filter-chips {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 5rem;
  background: var(--chip-bg-color);
  color: var(--chip-text-color);
  border: 1px solid var(--chip-text-color);
  padding: 0.1rem 0.5rem;
  font-size: 0.8rem;
  max-width: var(--chip-width);
  height: 1.1rem;
  flex: 0 0 auto;
  cursor: pointer;
}

.chip-label {
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0;
  width: 100%;
  min-width: 0;
}

.chip-remove {
  border: none;
  background: transparent;
  color: var(--chip-text-color);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  font-size: 1rem;
  width: 1rem;
  height: 1rem;
}

#search-filter-menu {
  position: absolute;
  display: flex;
  flex-direction: column;
  /* bring menu to the same top position as search results */
  top: 3.15rem;
  left: 0;
  width: 100%;
  min-width: 28rem;
  max-width: min(36rem, 50vw);
  color: var(--text-color);
  background: var(--bkg-color);
  border: var(--app-standard-border);
  border-radius: 4px;
  /* 1 above search results */
  z-index: 1001;
  min-height: 0;
  max-height: min(31rem, 60vh);
  overflow: hidden;
}

.menu-header {
  position: sticky;
  top: 0;
  background: var(--bkg-color);
  border-bottom: var(--app-standard-border);
  z-index: 1002;
  padding: 1rem 1rem 0.5rem 1rem;
}

.category-title {
  font-weight: bold;
  font-size: 1rem;
  padding-bottom: 0.75rem;
}

.menu-actions {
  display: flex;
  gap: 0.35rem;
}

.menu-action {
  border: var(--app-standard-border);
  border-radius: 4px;
  background: var(--bkg-color);
  cursor: pointer;
  padding: 0.15rem 0.5rem;
}

.shortcut-title {
  font-size: 0.85rem;
  margin: 0 0.5rem 0 auto;
  align-self: center;
}

.menu-list {
  padding: 0.5rem;
  overflow: auto;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem;
  border-radius: 4px;
  cursor: pointer;
}

.category-row:hover {
  background-color: var(--bkg-color-grad1);
}

.category-label {
  min-width: 0;
  margin-right: auto;
}

.category-example {
  font-size: 0.8em;
}

.shortcut {
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--text-color-grad1);
}

/* Shortcut dropdown */

.shortcut-header {
  font-style: italic;
  padding: 0.5rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  border: 0 solid transparent;
  border-radius: 4px;
  background: var(--bkg-color);
  color: var(--text-color);
  padding: 0.5rem;
  cursor: pointer;
  text-align: left;
}

.shortcut-row:hover,
.shortcut-row:focus,
.shortcut-row.active {
  background-color: var(--bkg-color-grad1);
  outline: none;
}

.shortcut-row > .shortcut {
  min-width: 4rem;
}

.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
