/* ============================================================================
   fp-search.css - the Digital Products search palette (Phase 24).

   Premium dark glass, matching dpx-night. This overlay only ever appears on DP
   pages, which are all dark, so unlike fp-upload.css there is no light variant
   to keep in step - if the palette is ever mounted on a light page it will need
   one, and that is a deliberate, stated limit rather than an oversight.
   ============================================================================ */

@keyframes fpsIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes fpsPop { from { opacity: 0; transform: translateY(-10px) scale(.985) } to { opacity: 1; transform: none } }

.fps-ov {
  position: fixed; inset: 0; z-index: 2147482500;
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(16px, 9vh, 96px) 20px 24px;
  background: rgba(6, 9, 18, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  animation: fpsIn var(--dpx-dur-2) ease both;
}

.fps-panel {
  width: 100%; max-width: 660px;
  display: flex; flex-direction: column;
  max-height: min(72vh, 680px);
  border-radius: var(--dpx-r7);
  border: 1px solid rgba(150, 180, 235, 0.2);
  /* solid, not translucent: a result list read through the page behind it is a
     list you misread */
  background: #10162a;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .03) inset;
  overflow: hidden;
  animation: fpsPop var(--dpx-dur-3) cubic-bezier(.2, .75, .25, 1) both;
  font-family: Inter, Inter, system-ui, -apple-system, sans-serif;
  color: #eef3ff;
}

/* ── search bar ── */
.fps-bar { display: flex; align-items: center; gap: 10px; padding: 14px 14px 13px; border-bottom: 1px solid rgba(150, 180, 235, .14); flex: none; }
.fps-bar-ic { width: 20px; height: 20px; flex: none; color: #9fb0d0; display: inline-flex }
.fps-bar-ic svg { width: 20px; height: 20px }
.fps-input {
  flex: 1; min-width: 0; appearance: none; -webkit-appearance: none;
  background: transparent; border: 0; outline: none;
  font: inherit; font-size: 17px; font-weight: 600; color: #eef3ff; padding: 4px 0;
}
.fps-input::placeholder { color: #7d8caa; font-weight: 500 }
.fps-input::-webkit-search-cancel-button { display: none }
/* The palette autofocuses this input on open, so its missing focus state was easy to miss - but
   Shift-Tab back to it from a result row left nothing on screen at all. Same outline the mic and
   close buttons already use at :61, so the overlay keeps one focus idiom. */
.fps-input:focus-visible { outline: 2px solid #7ea8ff; outline-offset: 2px; border-radius: var(--dpx-r2) }

.fps-mic, .fps-close {
  flex: none; width: 34px; height: 34px; border-radius: var(--dpx-r3); border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .06); color: #9fb0d0; transition: background var(--dpx-dur-2), color var(--dpx-dur-2);
}
.fps-mic svg, .fps-close svg { width: 17px; height: 17px }
.fps-close:hover { background: rgba(255, 255, 255, .12); color: #fff }
/* disabled on purpose - there is no speech backend, and a button that opens
   nothing is worse than a button that says it is not ready */
.fps-mic[disabled] { opacity: .38; cursor: not-allowed }
.fps-mic:focus-visible, .fps-close:focus-visible { outline: 2px solid #7ea8ff; outline-offset: 2px }

/* ── result list ── */
.fps-list { overflow-y: auto; overscroll-behavior: contain; padding: 8px; flex: 1 1 auto; min-height: 96px }
.fps-sec + .fps-sec { margin-top: 4px }
.fps-sec-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 10px 6px; font-size: 11px; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase; color: #8b9bbb;
}
.fps-clear { border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; color: #9dc0ff; letter-spacing: 0; text-transform: none; padding: 2px 4px; border-radius: var(--dpx-r1) }
.fps-clear:hover { color: #cfe0ff; background: rgba(126, 168, 255, .12) }

.fps-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--dpx-r4);
  text-decoration: none; color: inherit; cursor: pointer;
  transition: background var(--dpx-dur-1) ease;
}
.fps-row.is-active { background: rgba(126, 168, 255, .16) }
.fps-row-thumb {
  flex: none; width: 40px; height: 40px; border-radius: var(--dpx-r3); overflow: hidden;
  background: rgba(255, 255, 255, .06);
  display: inline-flex; align-items: center; justify-content: center; color: #9dc0ff;
}
.fps-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block }
.fps-row-thumb--ic svg { width: 18px; height: 18px }
.fps-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 }
.fps-row-label { font-size: 14px; font-weight: 700; color: #eef3ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.fps-row-sub { font-size: 12px; color: #9fb0d0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
/* why this row is here, straight from the server's matchedField */
.fps-row-why {
  flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #9dc0ff; background: rgba(126, 168, 255, .13); border: 1px solid rgba(126, 168, 255, .24);
  border-radius: var(--dpx-pill); padding: 3px 8px;
}
.fps-row-x {
  flex: none; width: 26px; height: 26px; border-radius: var(--dpx-r2); border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: #7d8caa; transition: background var(--dpx-dur-1), color var(--dpx-dur-1);
}
.fps-row-x svg { width: 13px; height: 13px }
.fps-row-x:hover { background: rgba(255, 122, 112, .18); color: #ff9a92 }

/* skeleton rows reuse .dpx-skel from digital-products.css */
.fps-row--sk { cursor: default }
.fps-sk-line { display: block; height: 11px; border-radius: var(--dpx-r1); width: 62% }
.fps-sk-line--sm { width: 34%; height: 9px; margin-top: 6px }

.fps-note { margin: 0; padding: 18px 12px; font-size: 13px; line-height: 1.6; color: #9fb0d0; text-align: center }
.fps-note b { color: #eef3ff }
.fps-empty { padding: 6px 4px 14px; text-align: center }
.fps-cta, .fps-all {
  display: inline-flex; align-items: center; justify-content: center;
  margin: 4px auto 0; padding: 10px 16px; border-radius: var(--dpx-r4);
  font-size: 13px; font-weight: 700; text-decoration: none;
  color: #0b1120; background: linear-gradient(135deg, #9dc0ff, #6ea0ff);
}
.fps-all { display: flex; margin: 6px 6px 2px }
.fps-cta:hover, .fps-all:hover { filter: brightness(1.05) }

.fps-foot {
  display: flex; gap: 16px; align-items: center; flex: none;
  padding: 9px 14px; border-top: 1px solid rgba(150, 180, 235, .14);
  font-size: 11px; color: #7d8caa;
}
.fps-foot kbd {
  display: inline-block; min-width: 18px; text-align: center;
  padding: 2px 5px; margin-right: 3px; border-radius: 5px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(150, 180, 235, .2);
  font: inherit; font-size: 10.5px; color: #cfdcf2;
}

/* ── mobile: a full sheet, because a centred card on a phone wastes the screen ── */
@media (max-width: 640px) {
  .fps-ov { padding: 0; align-items: stretch }
  .fps-panel { max-width: none; max-height: none; height: 100%; border-radius: 0; border: 0 }
  .fps-bar { padding: 12px; position: sticky; top: 0; background: #10162a; z-index: 1 }
  .fps-input { font-size: 16px }            /* 16px stops iOS zooming the page on focus */
  .fps-mic, .fps-close { width: 40px; height: 40px }   /* 44px-ish touch target */
  .fps-row { padding: 11px 10px }
  .fps-foot { display: none }               /* no physical keyboard to hint at */
}

@media (prefers-reduced-motion: reduce) {
  .fps-ov, .fps-panel { animation: none }
  .fps-row { transition: none }
}
@media (prefers-contrast: more) {
  .fps-panel { border-color: rgba(190, 214, 255, .7) }
  .fps-row-sub, .fps-note, .fps-foot { color: #cfdcf2 }
  .fps-row.is-active { outline: 2px solid #9dc0ff; outline-offset: -2px }
}
@media (forced-colors: active) {
  .fps-panel { background: Canvas; color: CanvasText; border-color: ButtonBorder }
  .fps-row.is-active { background: Highlight; color: HighlightText }
}
