/* ═══════════════════════════════════════════════════════════════
   Shared Layout — Header, search, results, concept chips
   Import after tokens.css on every page
   ═══════════════════════════════════════════════════════════════ */

/* ── HEADER BAR (44px) ── */
.header {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
  gap: 8px;
  position: relative;
  z-index: 1000;
}

.header-logo {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.2px;
  white-space: nowrap;
  margin-right: 4px;
  text-decoration: none;
  cursor: pointer;
}

.header-logo:hover { opacity: 0.8; }

.header-logo a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.header-logo a:hover { opacity: 0.8; }

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding-right: 6px;
}

.header-btn {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-2);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: color 0.15s;
}

.header-btn:hover { color: var(--text); }

/* ── HEADER TITLE & STATS (used on roadmap, stats, wiki) ── */
.header-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.header-stats {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ── SEARCH INPUT ── */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.search-wrap.search-short {
  flex: 0 1 280px;
  max-width: 280px;
}

.search-wrap input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 400;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: none;
}

.search-wrap input::placeholder {
  color: var(--text-3);
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  z-index: 10;
  width: 16px;
  height: 16px;
}

/* Override browser autofill background */
.search-wrap input:-webkit-autofill,
.search-wrap input:-webkit-autofill:hover,
.search-wrap input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
}

/* Disable native browser search affordances (clear X, decorations, results buttons). */
.search-wrap input[type="search"]::-webkit-search-decoration,
.search-wrap input[type="search"]::-webkit-search-cancel-button,
.search-wrap input[type="search"]::-webkit-search-results-button,
.search-wrap input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.search-wrap input[type="search"]::-ms-clear,
.search-wrap input[type="search"]::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

/* ── SEARCH DROPDOWN ── */
.search-results,
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-results.visible,
.search-results.active,
.search-dropdown.show,
.search-dropdown.active {
  display: block;
}

/* ── SEARCH RESULT ITEMS ── */
.search-result-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-subtle, var(--border));
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover,
.search-result-item.highlighted {
  background: var(--accent-bg, #f0f6ff);
}

.search-result-item:hover .sr-t { color: var(--accent); }

/* Paper result sub-elements */
.sr-id {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.sr-body { flex: 1; min-width: 0; }

.sr-t {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  transition: color 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-a {
  font-size: 10px;
  color: var(--text-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-cit {
  font-size: 9px;
  color: var(--text-3);
  flex-shrink: 0;
  white-space: nowrap;
}

/* Paper concept tags in search results */
.sr-tags {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.sr-tag {
  font-size: 9px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  color: #fff;
  background: #999;
}

.sr-tag.sg-structure-of-qft { background: #5B8DBE; }
.sr-tag.sg-observables-scattering { background: #C45B7C; }
.sr-tag.sg-quantum-gravity-holography { background: #E07850; }
.sr-tag.sg-cosmology { background: #C4A835; }
.sr-tag.sg-strings-math { background: #8BB048; }


.search-loading,
.search-empty {
  padding: 12px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
}

/* ── CONCEPT CHIP ROW ── */
.search-concept-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
}

/* Chip base styles, weight classes, and supergroup colors
   are in shared/concepts.css. Search-specific overrides below. */

.search-concept-row .fp-chip {
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  color: #fff;
  background: #999;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── RESPONSIVE (shared across pages) ── */
@media (max-width: 600px) {
  .header {
    height: 48px;
    padding: 0 8px;
    gap: 6px;
  }

  .header-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0 8px;
  }

  .header-title,
  .header-stats {
    display: none;
  }

  .search-wrap {
    flex: 1 1 auto;
    max-width: none;
  }

  .search-wrap.search-short {
    flex: 1 1 auto;
    max-width: none;
  }

  .search-wrap input {
    height: 36px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .search-result-item {
    padding: 10px 12px;
    min-height: 44px;
  }

  .search-concept-row .fp-chip {
    padding: 4px 10px;
    font-size: 12px;
    min-height: 32px;
  }
}
