/* ─── Search wrapper (input + AI toggle) ────────────────────────────────── */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  flex: 1;
  height: 40px;
  background: var(--kith-surface);
  border: 1px solid var(--kith-border);
  border-radius: var(--radius-lg);
  padding: 0 16px;
  font-size: 0.9rem;
  color: var(--kith-text);
  outline: none;
  transition: border-color 0.2s;
  /* Ensure input is never removed/replaced by JS targeting its parent */
  min-width: 0;
}

.search-input::placeholder { color: var(--kith-text-dim); }
.search-input:focus { border-color: var(--kith-text-muted); }

/* ─── AI toggle button ───────────────────────────────────────────────────── */
.ai-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--kith-surface);
  border: 1px solid var(--kith-border);
  color: var(--kith-text-dim);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.ai-toggle:hover {
  border-color: var(--kith-text-muted);
  color: var(--kith-text-muted);
}

.ai-toggle.ai-toggle-active {
  color: var(--kith-green);
  border-color: var(--kith-green);
  box-shadow: 0 0 6px rgba(29, 185, 84, 0.35);
}

/* ─── Search results container (sits inside .page-header, below search row) */
.search-results-container {
  /* Empty by default — JS populates this when results arrive */
}

/* ─── Results panel ──────────────────────────────────────────────────────── */
.search-results-panel {
  background: var(--kith-surface);
  border: 1px solid var(--kith-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 60vh;
  overflow-y: auto;
  margin-top: 4px;
}

/* ─── Individual result item ─────────────────────────────────────────────── */
.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--kith-border);
  transition: background 0.1s;
}

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

.search-result-item:hover,
.search-result-item:active {
  background: var(--kith-surface-2);
}

.search-result-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--kith-text);
}

.search-result-meta {
  font-size: 0.75rem;
  color: var(--kith-text-muted);
  margin-top: 2px;
}

/* ─── Results header (AI status) ─────────────────────────────────────────── */
.search-results-header {
  padding: 8px 16px 6px;
  border-bottom: 1px solid var(--kith-border);
}

.search-thinking {
  font-size: 0.75rem;
  color: var(--kith-text-muted);
  animation: pulse 1.2s ease-in-out infinite;
}

.search-ai-done {
  font-size: 0.75rem;
  color: var(--kith-green);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ─── Result row with AI badge ───────────────────────────────────────────── */
.search-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-ai-badge {
  font-size: 0.7rem;
  color: var(--kith-green);
  flex-shrink: 0;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.search-result-empty {
  padding: 20px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--kith-text-muted);
}

/* ─── Search-active: blur everything below the search header ─────────────── */
/* Applied to .page-content when the search input is focused.               */
/* The .page-header (which contains the input) stays crisp.                 */
.page-content.search-active > *:not(.page-header) {
  filter: blur(4px);
  opacity: 0.4;
  pointer-events: none;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.page-content > *:not(.page-header) {
  transition: filter 0.2s ease, opacity 0.2s ease;
}
