/* Smart search, chips, market badge/block, mobile filter drawer. Uses the design tokens from app.css (light + dark). */

/* --- smart search field --- */
.ss { display: flex; gap: 8px; align-items: stretch; position: relative; }
.ss-field { position: relative; flex: 1; min-width: 0; }
.ss-ico { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.ss-input.input { padding: 13px 14px 13px 44px; font-size: 1.05rem; border-radius: 14px; background: var(--surface); }
.ss-input::-webkit-search-cancel-button { cursor: pointer; }
.ss-btn { border-radius: 14px; padding: 0 22px; font-size: 1rem; }
.ss-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 55; margin: 0; padding: 6px; list-style: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); max-height: min(60vh, 420px); overflow-y: auto; }
.ss-list[hidden] { display: none; }
.ss-opt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.ss-opt:hover, .ss-opt.on { background: var(--surface-2); }
.ss-opt.on { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: -2px; }
.ss-type { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 2px 7px; border-radius: 999px; }
.ss-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.ss-count { font-size: .8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* hero variant (home) */
.hero-smart { margin-top: 28px; max-width: 760px; }
.ss-hero { background: var(--surface); padding: 8px; border-radius: 20px; box-shadow: var(--shadow-lg); }
.ss-hero .ss-input.input { border-color: transparent; background: var(--surface-2); font-size: 1.08rem; padding-top: 15px; padding-bottom: 15px; }
.ss-examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; font-size: .88rem; color: color-mix(in srgb, var(--hero-ink) 75%, transparent); }
.ss-ex { border: 1px solid color-mix(in srgb, var(--hero-ink) 25%, transparent); background: color-mix(in srgb, var(--hero-ink) 8%, transparent); color: var(--hero-ink);
  border-radius: 999px; padding: 6px 12px; font-size: .85rem; cursor: pointer; font-weight: 550; }
.ss-ex:hover { background: color-mix(in srgb, var(--hero-ink) 16%, transparent); }
.ss-herometa { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: .85rem; color: color-mix(in srgb, var(--hero-ink) 70%, transparent); }
.ss-herometa a { color: #9ff0d6; }

/* --- search page top --- */
.ss-page { padding-top: 22px; }
.ss-top { display: grid; gap: 10px; }
.ss-top .ss { max-width: 860px; }
.ss-last { justify-self: start; }
.ss-chipsbox:empty { display: none; }
.ss-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ss-interp { font-size: .85rem; font-weight: 650; color: var(--ink-2); margin-right: 2px; }
.fchip { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  border-radius: 999px; padding: 4px 4px 4px 12px; font-size: .86rem; font-weight: 600; line-height: 1.3; }
.fchip button { border: 0; background: transparent; color: var(--ink-2); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 1.05rem; line-height: 1; display: grid; place-items: center; }
.fchip button:hover { background: color-mix(in srgb, var(--brand) 22%, transparent); color: var(--ink); }
.ss-note { margin: 2px 0 0; display: flex; align-items: center; gap: 8px; }
.ss-hint { margin: 2px 0 0; background: var(--accent-soft); color: var(--ink); border-radius: 10px; padding: 8px 12px; }
.ss-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brand); animation: ss-spin .8s linear infinite; flex: none; }
@keyframes ss-spin { to { transform: rotate(360deg); } }
.ss-page .search-layout { padding-top: 16px; }
.ss-sort { width: auto; }

/* zero results */
.ss-zero p { color: var(--ink-2); }
.ss-relax { display: grid; gap: 8px; justify-items: center; margin-top: 10px; }
.ss-relax .btn { white-space: normal; text-align: center; max-width: 100%; }

/* --- cards: market badge + distance --- */
.lcard-dist { color: var(--muted); }
.mbadge { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; line-height: 1.35; }
.mb-great { background: var(--good-soft); color: var(--good); }
.mb-good { background: var(--brand-soft); color: var(--brand); }
.mb-fair { background: var(--surface-2); color: var(--ink-2); }
.mb-high { background: var(--warn-soft); color: var(--warn); }

/* --- listing page market block --- */
.mblock-est b { font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mbar { position: relative; height: 34px; margin: 4px 4px 0; }
.mbar::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 8px; border-radius: 999px; background: var(--surface-2); }
.mbar-band { position: absolute; top: 8px; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 35%, var(--surface-2)); }
.mbar-est { position: absolute; top: 4px; width: 2px; height: 16px; background: var(--ink-2); transform: translateX(-1px); border-radius: 1px; }
.mbar-dot { position: absolute; top: 4px; width: 16px; height: 16px; border-radius: 50%; transform: translateX(-8px); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.mbar-dot.mb-great { background: var(--good); } .mbar-dot.mb-good { background: var(--brand); } .mbar-dot.mb-fair { background: var(--ink-2); } .mbar-dot.mb-high { background: var(--warn); }
.mbar-lab { position: absolute; top: 21px; transform: translateX(-50%); font-size: .7rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.mblock details summary { cursor: pointer; }
.peers .table td, .peers .table th { white-space: nowrap; }
.peers .table td:first-child { white-space: normal; min-width: 160px; }
.peer-self td { background: var(--surface-2); }

/* --- filters: head/foot, mobile drawer --- */
.filters-head { display: flex; align-items: center; gap: 8px; }
.filters-head strong { margin-right: auto; }
.filters-body { margin-top: 12px; }
.filters-body > * + * { margin-top: 14px; }
.filters-foot.mobile-only { display: none; }
@media (max-width: 960px) {
  body.ss-lock { overflow: hidden; }
  .filters.open { display: flex; flex-direction: column; padding: 0; background: var(--surface); max-height: none; height: 100%; height: 100dvh; top: 0; z-index: 70; }
  .filters.open .filters-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .filters.open .filters-body { padding: 4px 16px 24px; flex: 1; }
  .filters.open .filters-foot.mobile-only { display: block; position: sticky; bottom: 0; z-index: 2; background: var(--surface); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
  .filters.open .toggle { padding: 8px 12px; }
}
@media (max-width: 560px) {
  .ss { flex-wrap: wrap; }
  .ss-btn { flex: 1 0 100%; padding: 12px; }
  .ss-hero .ss-btn { flex-basis: 100%; }
  .results-head { align-items: flex-start; }
  .results-head .row { width: 100%; }
  .results-head .row .btn, .results-head .row select { flex: 1 1 auto; }
  .ss-opt { grid-template-columns: 1fr auto; }
  .ss-type { display: none; }
}
