/* ─────────────────────────────────────────────────────────────────────────
   STRIP SEARCH — the drop-down under the place strip's search box
   (METIS-pub#814; shell/_strip_search.html, crm/js/strip_search.js).

   The box itself is place-strip.css's (.place-strip__search); this file draws
   only what the drop-down adds: a light panel under the dark row, the group
   labels, the rows (face and name, then one muted line of where they are),
   the last "Search everything" row and the keys hint. On a phone the strip
   folds the box to its icon; .strip-search--open unfolds it full width over
   the row, and the list fills the screen below it.

   Lifted from the round r1j prototype (METIS-specs future/final-ux/source/
   pages/50_search.css). Tokens only.
   ───────────────────────────────────────────────────────────────────────── */

@layer components {
  .strip-search { position: relative; }

  .strip-search__panel {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    width: max(100%, 420px);
    max-width: calc(100vw - 2 * var(--space-4));
    padding: var(--space-1) 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--elev-3);
    font-size: var(--text-md);
  }

  .strip-search__panel[hidden] { display: none; }

  .strip-search__label {
    padding: var(--space-2) var(--space-3) var(--space-1);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .strip-search__option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    color: inherit;
    text-decoration: none;
  }

  .strip-search__option[aria-selected="true"] { background: var(--color-accent-soft); }

  .strip-search__who {
    flex: 1;
    min-width: 0;
  }

  .strip-search__who mark {
    background: none;
    color: inherit;
    font-weight: 700;
  }

  .strip-search__context {
    max-width: 45%;
    overflow: hidden;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .strip-search__all {
    margin-top: var(--space-1);
    border-top: 1px solid var(--color-border-light);
    color: var(--color-accent);
  }

  .strip-search__empty {
    padding: var(--space-3);
    color: var(--color-text-muted);
  }

  .strip-search__keys {
    padding: var(--space-1) var(--space-3) var(--space-2);
    color: var(--color-text-faint);
    font-size: var(--text-xs);
  }

  /* ── Phone: the folded box, opened by its icon (strip_search.js) ───── */
  .place-strip__search.strip-search--open {
    /* Over the strip's other controls (the user menu sat on Cancel). */
    z-index: 2;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    min-height: 48px;
    padding: 0 var(--space-3);
    justify-content: flex-start;
    background: var(--color-text);
    color: var(--color-text-invert);
  }

  .strip-search--open .place-strip__search-text {
    display: block;
    flex: 1;
    min-width: 0;
  }

  /* Cancel: only on the phone's unfolded box (strip_search.js folds it). */
  .strip-search__cancel { display: none; }

  .strip-search--open .strip-search__cancel {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-2);
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: var(--text-md);
    cursor: pointer;
  }

  .strip-search--open .strip-search__panel {
    position: fixed;
    top: 48px;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-width: none;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
  }

  @media (max-width: 640px) {
    .strip-search__keys { display: none; }

    .strip-search__panel {
      position: fixed;
      top: 48px;
      right: 0;
      left: 0;
      width: auto;
      max-width: none;
      border-radius: 0;
    }
  }
}
