/* Chrona search component.
   One authoritative single-row control on computer, tablet, and phone:
   [magnifying glass][input][current/total][close]. */
.search-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  height: 40px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  transition: width 180ms ease, background 140ms ease, border-color 140ms ease;
}

.search-shell.is-open {
  width: clamp(260px, 36vw, 500px);
  border-color: var(--border);
  background: var(--surface-solid);
  box-shadow: var(--control-shadow);
}

.search-shell > .search-toggle {
  position: relative;
  z-index: 2;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  margin: 0;
  border: 0;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
}

.search-shell > .search-control {
  position: static;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 5px;
  width: 0;
  min-width: 0;
  height: 40px;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.search-shell.is-open > .search-control {
  width: auto;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.search-control .search-box {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.search-control .search-box input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  -webkit-text-fill-color: currentColor;
}

.search-control .search-results {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 30px;
  margin: 0;
  padding: 0 4px;
  white-space: nowrap;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.search-control .search-results[hidden] { display: none; }

.search-control #searchResultCount {
  display: inline-block;
  min-width: 32px;
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  -webkit-text-fill-color: currentColor;
}

.search-control .search-results button { display: none; }

.search-control .search-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  margin-right: 3px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  -webkit-text-fill-color: currentColor;
  font-size: 20px;
  line-height: 1;
  box-shadow: none;
}
.search-control .search-close:hover { background: var(--surface-hover); }

/* The same component is used on every screen size. On narrow screens it
   consumes the available header row; adjacent utility buttons hide only while
   search is open. The search group itself never wraps or creates another row. */
@media (max-width: 699px) {
  .app-header.search-is-open .viewport-debug-controls,
  .app-header.search-is-open .settings-toggle {
    display: none;
  }
  .app-header.search-is-open .header-icon-row {
    width: 100%;
    min-width: 0;
    justify-content: stretch;
  }
  .app-header.search-is-open .search-shell {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
  }
  .search-control .search-box input { padding-inline: 4px; }
}

html[data-preview-size="phone"] .app-header.search-is-open .viewport-debug-controls,
html[data-preview-size="phone"] .app-header.search-is-open .settings-toggle {
  display: none;
}
html[data-preview-size="phone"] .app-header.search-is-open .header-icon-row {
  width: 100%;
  min-width: 0;
  justify-content: stretch;
}
html[data-preview-size="phone"] .app-header.search-is-open .search-shell {
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
}
