/* HMS-312 command palette */
/* HMS-1706 — roomier palette: titled header with close button, taller search
   field with a leading icon, a real empty state in the results area, and the
   keyboard hints moved into a footer. QA retest: sub-1rem text bumped up a
   notch (footer hints and kbd chips were the smallest). */

.command-palette {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(94vw, 48rem);
  height: min(80vh, 34rem);
  padding: 0;
  overflow: hidden;
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-surface-border);
  border-radius: 0.75rem;
  box-shadow: 0 1rem 2rem rgb(0 0 0 / 0.25);
}

.command-palette::backdrop {
  background: rgb(0 0 0 / 0.45);
}

.command-palette__panel {
  display: flex;
  flex-direction: column;
  /* Web Awesome's native.css makes open dialogs `display: flex` with
     `align-items: start`; without an explicit width the panel shrink-wraps
     to its content and the right third of the dialog is dead space. */
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.command-palette__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0.75rem 1rem;
  border-bottom: 1px solid var(--wa-color-surface-border);
}

.command-palette__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.command-palette__title > .fa-magnifying-glass {
  color: var(--wa-color-text-quiet);
}

.command-palette__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--wa-color-text-quiet);
  font-size: 1rem;
  cursor: pointer;
}

.command-palette__close:hover {
  background: var(--wa-color-surface-lowered);
  color: var(--wa-color-text-normal);
}

.command-palette__search {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--wa-color-surface-border);
}

.command-palette__search-icon {
  position: absolute;
  left: 1rem;
  color: var(--wa-color-text-quiet);
  font-size: 1rem;
  pointer-events: none;
}

.command-palette__input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 0;
  background: transparent;
  color: var(--wa-color-text-normal);
  font-size: 1rem;
  outline: none;
}

.command-palette__input::placeholder {
  color: var(--wa-color-text-quiet);
}

.command-palette__input:focus {
  box-shadow: inset 0 0 0 2px var(--wa-color-brand-fill-normal);
}

.command-palette__results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
}

/* An empty list has no children, so it drops out of the flex column and the
   visible empty state below can take the whole results region. */
.command-palette__results:empty {
  display: none;
}

/* native.css gives every li `margin-inline-start: 1.125em`, which would
   indent options past the input's text alignment. */
.command-palette__option {
  margin-inline-start: 0;
}

.command-palette__option-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  padding: 0.625rem 1rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  color: inherit;
}

.command-palette__option-label {
  font-weight: 600;
}

.command-palette__option--active .command-palette__option-button,
.command-palette__option-button:hover {
  background: var(--wa-color-brand-fill-normal);
  color: var(--wa-color-brand-on-normal);
}

/* Both empty states (idle prompt and no-results) claim the results region so
   the message sits centered in the space between the search field and the
   footer. display:flex here would otherwise beat the UA [hidden] rule. */
.command-palette__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin: 0;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--wa-color-text-quiet);
  font-size: 0.9375rem;
}

.command-palette__empty[hidden] {
  display: none;
}

.command-palette__empty-art {
  display: block;
  width: 5.5rem;
  height: 5.5rem;
  margin-bottom: 0.75rem;
}

.command-palette__empty-art-lens {
  fill: var(--wa-color-brand-95);
  stroke: var(--wa-color-brand-70);
  stroke-width: 7;
}

.command-palette__empty-art-handle {
  stroke: var(--wa-color-brand-60);
  stroke-width: 9;
  stroke-linecap: round;
}

.command-palette__empty-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.command-palette__empty-sub {
  margin: 0;
  font-size: 0.875rem;
}

.command-palette__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  border-top: 1px solid var(--wa-color-surface-border);
  padding: 0.75rem 1rem;
  color: var(--wa-color-text-quiet);
  font-size: 0.875rem;
}

.command-palette__footer kbd {
  padding: 0.1875rem 0.5rem;
  border: 1px solid var(--wa-color-surface-border);
  border-radius: 0.25rem;
  background: var(--wa-color-surface-lowered);
  font-size: 0.8125rem;
  font-family: inherit;
}
