/* Tool selector - pill variant.
   Opt-in modifier (.tool-selector-pills) on the base tool selector, used by the
   forms library. Lives in its own asset rather than styles.css so it loads only
   on pages that ask for it. */

/* The base component filters with an underline + a sliding indicator and assumes
   every tab carries an icon: under 768px it hides .tab span and shows the glyph
   instead. The forms categories are text-only, so on mobile that row rendered
   blank. Pills keep the label at every width and drop the indicator.

   Selectors carry both classes on purpose: base_tool_selector.css is a component
   asset and is emitted after the project stylesheets, so an equal-weight
   .tool-selector-pills .tab would lose the source-order tiebreak on every
   property the base component already sets. */

.base-tool-selector.tool-selector-pills .tab-list {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  border-bottom: none;
  padding: 0;
  margin: 0 auto 32px auto;
  overflow-x: visible;
}

.base-tool-selector.tool-selector-pills .tab {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--primary-blue) 7%, transparent);
  color: var(--muted-text);
  transition:
    background-color 200ms ease-in-out,
    color 200ms ease-in-out,
    border-color 200ms ease-in-out;
}

.base-tool-selector.tool-selector-pills .tab:hover:not(.active) {
  background: color-mix(in srgb, var(--primary-blue) 14%, transparent);
  color: var(--text-color);
}

.base-tool-selector.tool-selector-pills .tab.active {
  background: var(--primary-blue);
  border-color: transparent;
  color: #ffffff;
  font-weight: 600;
}

/* The sliding underline belongs to the default variant. The JS still measures
   and positions it; hiding it is enough and keeps the component untouched. */
.base-tool-selector.tool-selector-pills .tab-indicator {
  display: none;
}

@media (max-width: 768px) {
  .base-tool-selector.tool-selector-pills .tab-list {
    gap: 8px;
    margin: 12px auto 24px auto;
    padding-bottom: 0;
  }

  /* Restore the labels the base component hides for its icon-only mobile row,
     and drop the heading that stood in for them. */
  .base-tool-selector.tool-selector-pills .tab span {
    display: inline;
  }

  .base-tool-selector.tool-selector-pills .tab {
    font-size: 14px;
    padding: 8px 14px;
  }

  .base-tool-selector.tool-selector-pills .mobile-tab-label {
    display: none;
  }
}

/* ---------- Search orb in front of the pills ----------
   Same control as the landing tools grid (.pdf-search-orb): a collapsed
   magnifier that expands to the right over the tabs on hover or focus. The
   pills themselves are unchanged; this only puts the two on one row and gives
   the search its collapsed state back. */
.base-tool-selector.tool-selector-pills .forms-tool-controls {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 32px auto;
  flex-wrap: wrap;
}

/* The row owns the bottom margin now. */
.base-tool-selector.tool-selector-pills .forms-tool-controls .tab-list {
  margin: 0;
}

.base-tool-selector.tool-selector-pills .forms-search-orb {
  position: static; /* the panel measures against .forms-tool-controls */
  flex: none;
  width: 44px;
  align-self: stretch;
}

.base-tool-selector.tool-selector-pills .forms-search-orb__panel {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  height: 100%;
  width: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--primary-blue) 7%, var(--card-bg));
  box-shadow: none;
  overflow: hidden;
  cursor: pointer;
  transition:
    width 0.28s ease,
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.base-tool-selector.tool-selector-pills .forms-search-orb__icon {
  flex: none;
  font-size: 15px;
  line-height: 1;
  color: var(--muted-text);
  transition: color 0.2s ease;
}

.base-tool-selector.tool-selector-pills .forms-search-orb input,
.base-tool-selector.tool-selector-pills .forms-search-orb input:focus,
.base-tool-selector.tool-selector-pills .forms-search-orb input:focus-visible {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: var(--text-color);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: opacity 0.15s ease;
}

.base-tool-selector.tool-selector-pills
  .forms-search-orb
  input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.base-tool-selector.tool-selector-pills .forms-search-orb input::placeholder {
  color: var(--muted-text);
}

.base-tool-selector.tool-selector-pills
  .forms-search-orb:hover
  .forms-search-orb__panel,
.base-tool-selector.tool-selector-pills
  .forms-search-orb:focus-within
  .forms-search-orb__panel,
.base-tool-selector.tool-selector-pills
  .forms-search-orb:has(input:not(:placeholder-shown))
  .forms-search-orb__panel {
  width: 100%;
  cursor: text;
}

/* A typed query keeps it open, so the field stays visible while filtering. */
.base-tool-selector.tool-selector-pills
  .forms-search-orb:focus-within
  .forms-search-orb__panel,
.base-tool-selector.tool-selector-pills
  .forms-search-orb:has(input:not(:placeholder-shown))
  .forms-search-orb__panel {
  border-color: var(--primary-blue);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-blue) 18%, transparent);
}

.base-tool-selector.tool-selector-pills
  .forms-search-orb:focus-within
  .forms-search-orb__icon,
.base-tool-selector.tool-selector-pills
  .forms-search-orb:has(input:not(:placeholder-shown))
  .forms-search-orb__icon {
  color: var(--primary-blue);
}

.base-tool-selector.tool-selector-pills .forms-search-orb:hover input,
.base-tool-selector.tool-selector-pills .forms-search-orb:focus-within input,
.base-tool-selector.tool-selector-pills
  .forms-search-orb:has(input:not(:placeholder-shown))
  input {
  opacity: 1;
}

/* Below the pill row's wrap point an overlay would cover wrapped tabs, so the
   field goes back to being a normal full-width bar above them. */
@media (max-width: 768px) {
  .base-tool-selector.tool-selector-pills .forms-tool-controls {
    width: 100%;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
  }

  .base-tool-selector.tool-selector-pills .forms-search-orb {
    width: 100%;
    order: -1;
  }

  .base-tool-selector.tool-selector-pills .forms-search-orb__panel {
    position: static;
    width: 100%;
    height: 42px;
    border-radius: 999px;
  }

  .base-tool-selector.tool-selector-pills .forms-search-orb input {
    opacity: 1;
  }

  .base-tool-selector.tool-selector-pills .forms-tool-controls .tab-list {
    margin: 0;
  }
}
