/*
 * Search suggestions and the phone search overlay (niguro-search.js; _header.search.tpl, __ng_shome.tpl,
 * search.tpl, ajax.search.tpl). Linked on every page (_head.tpl): the header search is everywhere.
 *
 * niguroapp's numbers (skins/search.css "Live-search dropdowns" and "Attached dropdowns", zz-search-focus.css,
 * skins/popups.css "Phone search overlay", app.css .na-search*), measured on niguro.com:
 *   - attached: no gap, the field's bottom corners square off, the list's top corners too, 22px bottom
 *     corners, a hairline 18px in from the sides where they meet, the list's shadow clipped off its top;
 *   - list: 8px 6px 6px padding; section heads 10px 10px 4px, 11px caps; rows 8px 10px, 12px corners,
 *     12px apart, the fill on hover / arrow keys; "See all" a soft brand pill;
 *   - overlay: a white sheet, a 70px bar (10px 12px 12px) with a hairline, a 48px fill pill (back · field
 *     · clear · round brand submit, 36px buttons), 48px rows, 13px section heads.
 * Plan (user, 2026-10-15): icons plain in the accent, no tile; entities with avatar + type label.
 * Colours are Niguro tokens; no borders or focus rings on fields (user, 2026-10-17).
 */

/* ------------------------------- */
/* Header field: Ctrl K and Ask Bhotu (na-topbar.php) */
/* ------------------------------- */

/* 42px as niguroapp's bar field (the global field scale is 40px; the id outranks it) */
.main-header .search-wrapper #search-input.form-control { height: 42px; padding-right: 96px; }
.ng-hsearch__end { position: absolute; top: 0; right: 6px; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 8px; }
.ng-hsearch__kbd {
  display: inline-flex; align-items: center; height: 22px; padding: 0 6px; border-radius: 6px;
  font: 600 11px/1 ui-sans-serif, system-ui, sans-serif; color: var(--ng-faint);
  background: var(--ng-card); box-shadow: inset 0 0 0 1px var(--ng-line);
}
.ng-hsearch__ai {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; flex: none;
  color: var(--ng-brand); background: hsl(var(--primary) / .1);
}
.ng-hsearch__ai:hover { color: var(--ng-brand); background: hsl(var(--primary) / .18); }
.ng-hsearch__ai .ng-ico { width: 16px; height: 16px; }
.main-header .search-wrapper form { position: relative; border-radius: 999px; box-shadow: var(--ng-search-shadow); }
.main-header .search-wrapper form:focus-within { box-shadow: var(--ng-search-shadow-focus); }
.main-header .search-input-icon .ng-ico { width: 18px; height: 18px; color: var(--ng-faint); }
[dir="RTL"] .main-header .search-wrapper #search-input.form-control { padding-right: 44px; padding-left: 96px; }
[dir="RTL"] .ng-hsearch__end { right: auto; left: 6px; }
/* the search button some fields add after Ask Bhotu (/watch's field): a filled brand circle like the search
   home's; the header field itself shows Ctrl K and the tinted Ask Bhotu circle (owner, 2026-10-18) */
.ng-hsearch__go {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 999px; flex: none;
  background: var(--ng-brand); color: hsl(var(--primary-foreground)); cursor: pointer; transition: transform .15s ease;
}
.ng-hsearch__go:hover { background: hsl(var(--primary) / .9); }
.ng-hsearch__go:active { transform: scale(.9); }
.ng-hsearch__go .ng-ico { width: 16px; height: 16px; }
.ng-hsearch__ai:focus-visible, .ng-hsearch__go:focus-visible { outline: 2px solid var(--ng-brand); outline-offset: 1px; }

/* open: the 42px pill squares off at the bottom and lifts (search.css "Top bar") */
.main-header .search-wrapper.is-open .form-control,
body.night-mode .main-header .search-wrapper.is-open .form-control { border-radius: 21px 21px 0 0; background: var(--ng-card); }
.main-header .search-wrapper.is-open form,
.main-header .search-wrapper.is-open form:focus-within { border-radius: 21px 21px 0 0; box-shadow: var(--ng-shadow-lg); }

/* ------------------------------- */
/* The list (header, search home, search page) */
/* ------------------------------- */

.ng-sdd {
  position: absolute; z-index: 60; top: 100%; left: 0; right: 0; width: auto; min-width: 0 !important;
  max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain;
  margin: 0 !important; padding: 8px 6px 6px; border: 0; border-radius: 0 0 22px 22px;
  background: linear-gradient(var(--ng-line), var(--ng-line)) no-repeat 18px 0 / calc(100% - 36px) 1px, var(--ng-card);
  box-shadow: var(--ng-shadow-lg); clip-path: inset(0 -64px -64px -64px);
  color: var(--ng-ink); text-align: left; font-size: 14px; line-height: 1.35;
}
.ng-sdd[hidden] { display: none; }
/* night: Sngine's night dropdown colours and shadow give way to the card, the hairline and the lift */
body.night-mode .ng-sdd {
  background: linear-gradient(var(--ng-line), var(--ng-line)) no-repeat 18px 0 / calc(100% - 36px) 1px, var(--ng-card);
  box-shadow: var(--ng-shadow-lg); color: var(--ng-ink);
}
.main-header .search-wrapper .ng-sdd.dropdown-menu { inset: 100% 0 auto 0; transform: none; border-radius: 0 0 22px 22px; }
/* the search home's list: niguroapp's 320px (index.php #autocomplete-results) and its lighter shadow there
   (zz-search-focus.css) */
.ng-shome .ng-sdd { z-index: 30; max-height: 320px; box-shadow: 0 8px 16px -6px hsl(var(--foreground) / .08); }
body.night-mode .ng-shome .ng-sdd { box-shadow: 0 8px 18px -6px hsl(0 0% 0% / .35); }

/* sections and their heads (Recent / Trending / Quick / On Niguro / Hashtags / Services) */
.ng-sdd__sec[hidden], .ng-sdd__slot:empty { display: none; }
.ng-sdd__head,
.ng-sdd .dropdown-widget-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 10px 10px 4px; border: 0;
}
.ng-sdd__t,
.ng-sdd .dropdown-widget-header .title {
  flex: 1; order: -1; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ng-faint); line-height: 1.4;
}
.ng-sdd__clear { flex: none; padding: 0; border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--ng-sub); cursor: pointer; }
.ng-sdd__clear:hover { color: var(--ng-ink); text-decoration: underline; text-underline-offset: 3px; }

/* rows */
.ng-sdd .dropdown-widget-body { padding: 0; }
.ng-sdd .js_scroller, .ng-sdd .slimScrollDiv { height: auto !important; overflow: visible !important; }
.ng-sdd__nodes { margin: 0; padding: 0; list-style: none; }
.ng-sdd__row,
.ng-sdd .ptb10.plr10 a {
  display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 8px 10px; border-radius: 12px;
  color: var(--ng-ink); font-size: 14px; text-decoration: none; transition: background-color .12s ease;
}
.ng-sdd .ptb10.plr10 { padding: 0 !important; }
.ng-sdd .ptb10.plr10 a .fa { width: 16px; color: var(--ng-brand); text-align: center; }
.ng-sdd__row[hidden] { display: none; }
.ng-sdd__row:hover, .ng-sdd__row.is-active,
.ng-sdd .ptb10.plr10 a:hover, .ng-sdd .ptb10.plr10 a.is-active { background: var(--ng-fill); color: var(--ng-ink); text-decoration: none; }
.ng-sdd__ic { display: grid; place-items: center; flex: none; width: 16px; color: var(--ng-brand); }
.ng-sdd__ic .ng-ico { width: 16px; height: 16px; }
.ng-sdd__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ng-sdd__main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ng-ink); }
.ng-sdd__main b { font-weight: 700; }
.ng-sdd__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ng-sub); }
.ng-sdd__body .ng-sdd__ok { display: none; }
.ng-sdd__x {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; margin: -4px -4px -4px 0; padding: 0;
  border: 0; border-radius: 999px; background: none; color: var(--ng-sub);
}
.ng-sdd__x:hover { background: var(--ng-fill-2); color: var(--ng-ink); }
/* niguro [dropdown hashtags] (2026-10-18): a hashtag row's post count, at the end of its one line */
.ng-sdd__n { flex: none; font-size: 12px; color: var(--ng-sub); white-space: nowrap; }
.ng-sdd__x .ng-ico { width: 14px; height: 14px; }
/* the search home and search page read at 16px, as niguroapp's home list (custom.css) */
:is(.ng-shome, .ng-xsearch) .ng-sdd__main { font-size: 16px; }

/* Sngine's people, pages, groups and events: the picture, a type label */
.ng-sdd__ava { flex: none; width: 32px; height: 32px; margin: -2px -4px -2px -4px; border-radius: 50%; object-fit: cover; background: var(--ng-fill); }
.ng-sdd__ava--sq { border-radius: 9px; }
.ng-sdd__type {
  display: inline-flex; align-items: center; flex: none; height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--ng-fill); color: var(--ng-sub); font-size: 11px; font-weight: 700; white-space: nowrap;
}
.ng-sdd__row:hover .ng-sdd__type, .ng-sdd__row.is-active .ng-sdd__type { background: var(--ng-card); }

/* typing: at most six of Sngine's live results (it sends up to min_results of each type) */
.ng-sdd:not(#search-history) .ng-sdd__nodes > li:nth-child(n+7) { display: none; }

/* See all results: a soft brand pill at the foot (search.css "View all results") */
.ng-sdd__all,
.main-header .ng-sdd .dropdown-widget-footer {
  display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 36px; margin: 6px 0 0; padding: 8px 10px;
  border: 0; border-radius: 12px; background: hsl(var(--primary) / .1); color: var(--ng-brand);
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.ng-sdd__all:hover, .ng-sdd__all.is-active,
.main-header .ng-sdd .dropdown-widget-footer:hover { background: hsl(var(--primary) / .16); color: var(--ng-brand); text-decoration: none; }
.ng-sdd__all .ng-ico { width: 14px; height: 14px; }
.ng-sdd__web[hidden] { display: none; }
.ng-sdd .loader { margin: 6px auto; }

/* the search home and search page: the field squares off while its list is open */
.ng-xsearch .ng-xsearch__field.is-open .form-control { border-bottom-left-radius: 0; border-bottom-right-radius: 0; background: var(--ng-card); }
.ng-xsearch .ng-xsearch__field .ng-sdd { z-index: 40; }
/* the page's hero clips its art: let the open list out of it, above what follows */
.ng-xsearch .ng-xsearch__hero:has(.ng-xsearch__field.is-open) { overflow: visible; z-index: 5; }

/* ------------------------------- */
/* Phones and tablets: the full-screen overlay */
/* ------------------------------- */

.ng-msearch {
  position: fixed; inset: 0; z-index: 1090; display: none; flex-direction: column; background: var(--ng-card);
}
.ng-msearch.is-open { display: flex; }
html.ng-msearch-on, html.ng-msearch-on body { overflow: hidden; }
.ng-msearch__bar { flex: none; padding: 10px 12px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: var(--ng-card); box-shadow: 0 1px 0 var(--ng-line); }
.ng-msearch__form {
  display: flex; align-items: center; gap: 6px; min-height: 48px; margin: 0; padding: 6px 8px 6px 6px;
  border-radius: 999px; background: var(--ng-fill);
}
.ng-msearch__input {
  flex: 1; min-width: 0; height: 36px; margin: 0; padding: 0; border: 0; outline: 0; background: transparent; box-shadow: none;
  color: var(--ng-ink); font-size: 16px; font-weight: 500; -webkit-appearance: none; appearance: none;
}
.ng-msearch__input::placeholder { color: var(--ng-faint); font-weight: 400; }
.ng-msearch__input::-webkit-search-cancel-button, .ng-msearch__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.ng-msearch__btn {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: var(--ng-ink); transition: background-color .15s ease;
}
.ng-msearch__btn[hidden] { display: none; }
.ng-msearch__btn:hover { background: var(--ng-fill-2); }
.ng-msearch__btn .ng-ico { width: 18px; height: 18px; }
.ng-msearch__go, .ng-msearch__go:hover { background: var(--ng-brand); color: hsl(var(--primary-foreground)); }
.ng-msearch__go:hover { filter: brightness(1.06); }
[dir="RTL"] .ng-msearch__btn[data-ng-msearch-back] .ng-ico { transform: scaleX(-1); }

/* the list: the same rows, a sheet's sizes (popups.css section 12) */
.ng-msearch .ng-sdd {
  position: static; flex: 1; max-height: none; padding: 4px 8px calc(28px + env(safe-area-inset-bottom, 0px));
  border-radius: 0; background: var(--ng-card); box-shadow: none; clip-path: none; font-size: 15px;
}
body.night-mode .ng-msearch .ng-sdd { background: var(--ng-card); box-shadow: none; }
.ng-msearch .ng-sdd[hidden] { display: block; }
.ng-msearch .ng-sdd__head, .ng-msearch .ng-sdd .dropdown-widget-header { padding: 16px 12px 6px; }
.ng-msearch .ng-sdd__t, .ng-msearch .ng-sdd .dropdown-widget-header .title {
  font-size: 13px; font-weight: 600; line-height: 16px; letter-spacing: 0; text-transform: none; color: var(--ng-sub);
}
.ng-msearch .ng-sdd__clear { font-size: 13px; line-height: 16px; }
.ng-msearch .ng-sdd__row, .ng-msearch .ng-sdd .ptb10.plr10 a { min-height: 48px; padding: 0 12px; gap: 14px; font-size: 15px; }
.ng-msearch .ng-sdd__main { font-size: 15px; }
.ng-msearch .ng-sdd__ic { width: 18px; }
.ng-msearch .ng-sdd__ic .ng-ico { width: 18px; height: 18px; }
.ng-msearch .ng-sdd__x { width: 32px; height: 32px; }
.ng-msearch .ng-sdd__ava { width: 36px; height: 36px; margin: 0 -2px; }
.ng-msearch .ng-sdd__chips { padding: 4px 12px 8px; }
.ng-msearch .ng-sdd__all { min-height: 44px; margin: 10px 4px 0; }
@media (min-width: 1024px) { .ng-msearch { display: none !important; } }
/* ---- [Search overlay lock] (owner, 2026-10-19, phones; iOS) ----
   The overlay is fixed and full screen (inset 0, 100dvh with a vh fallback) over the header (1001 while dimmed)
   and the bottom bar (995). The page behind is locked as under a sheet (html.ng-msearch-on: overflow hidden on the
   root, no bounce; [iOS pinned] in niguro.css), niguro-search.js puts the page's scroll back on close and stops
   touch drags that would reach the page (the bar, or a list with nothing left to scroll); only the list scrolls
   (contained). With the keyboard open niguro.js "[Sheet keyboard]" sets html.ng-kb, --ng-kb and --ng-vh: the
   overlay stands on the keyboard and takes the visible height, so the list ends above the keyboard, no gap. */
@media (max-width: 1023.98px) {
  .ng-msearch { top: 0; right: 0; bottom: 0; left: 0; height: 100vh; height: 100dvh; overscroll-behavior: contain; }
  html.ng-msearch-on, html.ng-msearch-on body { overscroll-behavior: none; }
  .ng-msearch__bar { touch-action: none; }
  .ng-msearch__bar :is(input, textarea, button, a) { touch-action: manipulation; } /* the field keeps its cursor long-press and taps */
  .ng-msearch .ng-sdd {
    flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  html.ng-kb .ng-msearch { top: auto; bottom: var(--ng-kb, 0px); height: var(--ng-vh, 100dvh); }
  html.ng-kb .ng-msearch .ng-sdd { padding-bottom: 12px; }
}
/* ---- [/Search overlay lock] ---- */
