/* Mobile Search — Figma Nav bar / search (321:1197) */

html:has(#searchPageRoot),
body:has(#searchPageRoot) {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

body:has(#searchPageRoot) {
  padding-bottom: 0;
}

body:has(#searchPageRoot) #app,
body:has(#searchPageRoot) #shellMain {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body:has(#searchPageRoot) #shellMain {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.search-page-root {
  --search-brand: #0b2346;
  --search-text-secondary: #273942;
  --search-border: #e2e8f0;
  --search-bg: #fbfcfd;
  --search-placeholder: #bfc2c7;
  --search-chrome-height: 166px;
  --search-page-inline-pad: 21px;
  --search-chip-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  background: var(--search-bg);
  color: var(--search-brand);
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.search-chrome {
  position: relative;
  z-index: 40;
  flex: none;
  height: var(--search-chrome-height);
  min-height: var(--search-chrome-height);
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  /* Figma: searchbar top 44; filters top 108; chrome h 166 → bottom pad 16 */
  padding: 44px var(--search-page-inline-pad) 16px;
  overflow: visible;
}

.search-chrome__bar {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  width: 100%;
  max-width: 370px;
  margin-inline: auto 0;
  border: 1.5px solid var(--search-border);
  border-radius: 28px;
  background: transparent;
  padding: 0 14px 0 40px;
  box-sizing: border-box;
}

.search-chrome__bar-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-chrome__bar-icon img {
  width: 15px;
  height: 15px;
  display: block;
}

.search-chrome__input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: var(--search-brand);
}

.search-chrome__input::placeholder {
  color: var(--search-placeholder);
  font-weight: 700;
}

/* Hide native search clear so Figma chrome stays clean */
.search-chrome__input::-webkit-search-decoration,
.search-chrome__input::-webkit-search-cancel-button,
.search-chrome__input::-webkit-search-results-button,
.search-chrome__input::-webkit-search-results-decoration {
  display: none;
}

.search-filters {
  position: relative;
  margin-top: 16px;
  min-height: 42px;
  overflow: visible;
}

.search-filters__row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: visible;
}

/* Sticky L1: pinned chip left; L2 scrolls behind/under (lower z) */
.search-filters--has-l1 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  overflow: visible;
}

.search-filters__pinned {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
}

.search-filters__row--l2 {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Unclip 0 0 8px chip glow; negative margin keeps chrome at 166px */
  padding: 8px 8px 8px 0;
  margin: -8px -8px -8px 0;
  touch-action: pan-x;
  overscroll-behavior-x: none;
  scroll-snap-type: x proximity;
}

.search-filters__row--l2::-webkit-scrollbar {
  display: none;
}

.search-filters__row--l2 .search-chip {
  scroll-snap-align: start;
}

.search-filters__row--l2 .search-chip:last-child {
  scroll-snap-align: end;
}

.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 11px;
  border-radius: 24px;
  border: 1px solid var(--search-border);
  background: #fff;
  box-shadow: var(--search-chip-shadow);
  color: var(--search-brand);
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  box-sizing: border-box;
}

.search-chip:focus-visible {
  outline: 2px solid var(--search-brand);
  outline-offset: 2px;
}

.search-chip__icon {
  width: 15px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.search-chip__icon--objects {
  width: 13px;
  height: 17px;
}

.search-chip__icon--clients {
  width: 15px;
  height: 19px;
}

.search-chip__icon--articles {
  width: 15px;
  height: 17px;
}

.search-chip__icon svg,
.search-chip__glyph {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.search-chip__clear {
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 2px;
}

.search-chip__clear img {
  width: 17px;
  height: 17px;
  display: block;
}

.search-chip--active {
  background: var(--search-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: none;
  padding: 0 6px 0 11px;
}

.search-chip--l2 {
  box-shadow: var(--search-chip-shadow);
  padding: 0 11px;
}

.search-chip--l2.search-chip--active {
  background: var(--search-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: none;
}

.search-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 15px var(--search-page-inline-pad) 0;
}

.search-body:has(.search-results) {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: calc(var(--fsm-bottom-nav-reserve, 80px) + 24px);
}

.search-empty,
.search-no-results {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 50px;
  text-align: center;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 24px 8px;
  cursor: text;
  user-select: none;
}

.search-empty__title,
.search-no-results__title {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.0003;
  color: var(--search-text-secondary);
  max-width: 355px;
}

.search-no-results__query {
  display: inline;
}

.search-empty__helper,
.search-no-results__helper {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--search-text-secondary);
  max-width: 295px;
  white-space: pre-line;
}

.search-empty__icon,
.search-no-results__icon {
  width: 147px;
  height: 147px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.search-empty__icon img,
.search-no-results__icon > img {
  width: 147px;
  height: 147px;
  display: block;
  object-fit: contain;
}

.search-no-results__icon-x {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  pointer-events: none;
}

.search-no-results__icon-x img {
  width: 44px;
  height: 44px;
  display: block;
}

.search-section {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.search-section__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  margin: 0 0 12px;
}

/* Figma Linebreak: full 351px rule under label; label bg masks the middle */
.search-section__header-line {
  position: absolute;
  left: 50%;
  top: 29px;
  transform: translateX(-50%);
  width: min(351px, 100%);
  height: 1px;
  background: var(--search-border);
  pointer-events: none;
}

.search-section__header-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: var(--search-bg);
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: var(--search-brand);
  white-space: nowrap;
}

.search-section__header-label .search-section__header-icon {
  width: 13px;
  height: 17px;
  display: inline-flex;
  color: var(--search-brand);
}

.search-section__header-label .search-section__header-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.search-section__cards {
  display: grid;
  gap: 8px;
}

.search-see-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  max-width: 361px;
  height: 34px;
  margin: 4px auto 0;
  border-radius: 31px;
  border: 1px solid var(--search-border);
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
  color: var(--search-brand);
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
}

.search-see-all__label {
  display: inline;
  white-space: nowrap;
}

.search-see-all__prefix {
  font-weight: 500;
}

.search-see-all__count {
  font-weight: 700;
}

.search-see-all__suffix {
  font-weight: 800;
}

.search-see-all .lucide,
.search-see-all svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Figma cards: white + bottom border only + radius 20 */
.search-result-card {
  width: 100%;
  max-width: 371px;
  margin-inline: auto;
  background: #fff;
  border-radius: 20px;
  border: 0;
  border-bottom: 1px solid var(--search-border);
  box-shadow: none;
  box-sizing: border-box;
}

.search-result-card--tall {
  min-height: 72px;
  height: 72px;
}

.search-result-card--compact {
  min-height: 56px;
  height: 56px;
}

.search-result-card__body {
  height: 100%;
  /* Figma insets ~18px left, ~7px top, ~6px bottom */
  padding: 7px 18px 6px;
  display: grid;
  align-content: start;
  gap: 0;
  box-sizing: border-box;
}

.search-result-card__body--compact {
  padding: 10px 18px;
  align-content: center;
}

.search-result-card__title {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--search-brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-card__subtitle,
.search-result-card__meta {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--search-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-match-hl {
  font-weight: 900;
}

.search-end-of-list {
  margin: 16px 0 8px;
  text-align: center;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: var(--search-text-secondary);
  position: relative;
  padding-top: 16px;
}

.search-end-of-list::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: min(351px, 100%);
  height: 1px;
  background: var(--search-border);
}

.search-end-of-list strong {
  font-weight: 700;
}

.search-infinite-sentinel {
  height: 1px;
  width: 100%;
}

.dark .search-page-root {
  --search-bg: #0b1628;
  --search-text-secondary: #d7dee7;
  --search-border: rgba(255, 255, 255, 0.14);
  --search-placeholder: #8b95a5;
}

.dark .search-chrome {
  background: rgba(18, 35, 58, 0.92);
}

.dark .search-chrome__bar,
.dark .search-chip,
.dark .search-result-card,
.dark .search-see-all {
  background: #12233a;
}

.dark .search-chip--active,
.dark .search-chip--l2.search-chip--active {
  background: #f5c518;
  border-color: transparent;
  color: #0b2346;
}

.dark .search-section__header-label {
  background: var(--search-bg);
}
