/* ═══════════════════════════════════════════════════════════
   NAV-EMBEDDED SEARCH  (futuristic / VS Code + Geek)
   ═══════════════════════════════════════════════════════════ */

/* ── Container ─────────────────────────────────────────────── */
.nav-search-container {
  flex-shrink: 0;
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  position: relative;
}

/* ── Scan-line pulse on the bottom edge while focused ───────── */
.nav-search-container::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #3fb950 50%, transparent 100%);
  opacity: 0;
  transform: scaleX(0.2);
  transform-origin: center;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.nav-search-container:focus-within::after {
  opacity: 0.55;
  transform: scaleX(1);
  animation: nav-scan-pulse 2.4s ease-in-out infinite;
}

@keyframes nav-scan-pulse {
  0%, 100% { opacity: 0.3; transform: scaleX(0.6); }
  50%       { opacity: 0.7; transform: scaleX(1);   }
}

/* ── Input wrapper ─────────────────────────────────────────── */
.nav-search-wrap {
  display: flex;
  align-items: center;
  position: relative;
}

/* ── Search icon ───────────────────────────────────────────── */
.nav-search-icon {
  position: absolute;
  left: 8px;
  font-size: 0.85rem;
  color: var(--text-muted, #8b949e);
  pointer-events: none;
  user-select: none;
  line-height: 1;
  z-index: 1;
  transition: color 0.2s, text-shadow 0.2s;
}

.nav-search-container:focus-within .nav-search-icon {
  color: #3fb950;
  text-shadow: 0 0 8px rgba(63,185,80,0.7);
}

/* ── The input ─────────────────────────────────────────────── */
.nav-search-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 4px;
  padding: 5px 26px 5px 26px;
  font-family: var(--code-font, "JetBrains Mono", "Courier New", monospace);
  font-size: 0.73rem;
  color: var(--text, #0f172a);
  caret-color: #3fb950;
  outline: none;
  letter-spacing: 0.02em;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.nav-search-input::placeholder {
  color: var(--text-muted, #94a3b8);
  opacity: 0.55;
  font-style: italic;
}

.nav-search-input:focus {
  border-color: #3fb950;
  background: rgba(63,185,80,0.04);
  box-shadow:
    0 0 0 1px rgba(63,185,80,0.35),
    0 0 14px rgba(63,185,80,0.15);
}

/* Glow the typed text in dark/grey */
[data-theme="dark"] .nav-search-input:focus:not(:placeholder-shown),
[data-theme="grey"] .nav-search-input:focus:not(:placeholder-shown) {
  text-shadow: 0 0 10px rgba(63,185,80,0.45);
  color: #e6edf3;
}

/* Loading shimmer */
.nav-search-input.nav-search-loading {
  border-color: #3fb950;
  animation: nav-search-shimmer 0.8s linear infinite;
}

@keyframes nav-search-shimmer {
  0%   { box-shadow: 0 0 0 1px rgba(63,185,80,0.1), 0 0 6px  rgba(63,185,80,0.1); }
  50%  { box-shadow: 0 0 0 1px rgba(63,185,80,0.5), 0 0 18px rgba(63,185,80,0.3); }
  100% { box-shadow: 0 0 0 1px rgba(63,185,80,0.1), 0 0 6px  rgba(63,185,80,0.1); }
}

/* ── Clear button ──────────────────────────────────────────── */
.nav-search-clear {
  position: absolute;
  right: 6px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
  user-select: none;
  line-height: 1;
}

.nav-search-clear:hover { color: #f85149; background: rgba(248,81,73,0.1); }

/* ── Results list — flex sibling of nav-sections ────────────── */
.nav-search-results {
  list-style: none;
  margin: 0;
  padding: 4px 0 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border, #cbd5e1) transparent;
}

.nav-search-results::-webkit-scrollbar       { width: 3px; }
.nav-search-results::-webkit-scrollbar-thumb { background: var(--border, #cbd5e1); border-radius: 3px; }

/* ── Result item ───────────────────────────────────────────── */
.nav-search-item {
  display: flex;
  flex-direction: column;
  padding: 5px 14px 5px 18px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.1s, border-color 0.1s;
  outline: none;
}

.nav-search-item:hover,
.nav-search-item.active {
  background: rgba(63,185,80,0.07);
  border-left-color: #3fb950;
}

.nav-search-item:hover .nav-search-item-label,
.nav-search-item.active .nav-search-item-label {
  color: #16a34a;
}

[data-theme="dark"] .nav-search-item:hover .nav-search-item-label,
[data-theme="dark"] .nav-search-item.active .nav-search-item-label,
[data-theme="grey"] .nav-search-item:hover .nav-search-item-label,
[data-theme="grey"] .nav-search-item.active .nav-search-item-label {
  color: #56d364;
  text-shadow: 0 0 8px rgba(63,185,80,0.4);
}

.nav-search-item-label {
  font-size: 0.8rem;
  color: var(--text, #334155);
  line-height: 1.4;
  transition: color 0.1s, text-shadow 0.1s;
}

.nav-search-item-module {
  font-size: 0.62rem;
  font-family: var(--code-font, "JetBrains Mono", monospace);
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.04em;
  margin-top: 1px;
}

/* ── Highlighted match ─────────────────────────────────────── */
.nav-search-mark {
  background: none;
  color: #16a34a;
  font-weight: 700;
}

[data-theme="dark"] .nav-search-mark,
[data-theme="grey"] .nav-search-mark {
  color: #56d364;
  text-shadow: 0 0 6px rgba(63,185,80,0.5);
}

/* ── Empty state ───────────────────────────────────────────── */
.nav-search-empty {
  padding: 8px 18px;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-muted, #94a3b8);
  list-style: none;
}

/* ─── Dark theme ───────────────────────────────────────────── */
[data-theme="dark"] .nav-search-container     { border-bottom-color: #30363d; }
[data-theme="dark"] .nav-search-input         { background: rgba(255,255,255,0.025); border-color: #30363d; color: #8b949e; }
[data-theme="dark"] .nav-search-input::placeholder { color: #3d444d; opacity: 1; }
[data-theme="dark"] .nav-search-input:focus   { border-color: #3fb950; background: rgba(63,185,80,0.04); }
[data-theme="dark"] .nav-search-item-label    { color: #8b949e; }
[data-theme="dark"] .nav-search-item-module   { color: #3d444d; }

/* ─── Grey theme ───────────────────────────────────────────── */
[data-theme="grey"] .nav-search-container     { border-bottom-color: #444c56; }
[data-theme="grey"] .nav-search-input         { background: rgba(255,255,255,0.025); border-color: #444c56; color: #768390; }
[data-theme="grey"] .nav-search-input::placeholder { color: #545d68; opacity: 1; }
[data-theme="grey"] .nav-search-input:focus   { border-color: #57ab5a; background: rgba(87,171,90,0.04); box-shadow: 0 0 0 1px rgba(87,171,90,0.35), 0 0 14px rgba(87,171,90,0.15); }
[data-theme="grey"] .nav-search-container::after,
[data-theme="grey"] .nav-search-container:focus-within::after {
  background: linear-gradient(90deg, transparent 0%, #57ab5a 50%, transparent 100%);
}
[data-theme="grey"] .nav-search-container:focus-within .nav-search-icon { color: #57ab5a; text-shadow: 0 0 8px rgba(87,171,90,0.7); }
[data-theme="grey"] .nav-search-mark          { color: #73c977; text-shadow: 0 0 6px rgba(87,171,90,0.5); }
[data-theme="grey"] .nav-search-item:hover,
[data-theme="grey"] .nav-search-item.active   { border-left-color: #57ab5a; }
[data-theme="grey"] .nav-search-item-label    { color: #768390; }
[data-theme="grey"] .nav-search-item-module   { color: #545d68; }

/* ─── Contrast theme ───────────────────────────────────────── */
[data-theme="aurora"] .nav-search-container             { border-bottom: 1px solid rgba(192,132,252,0.2); }
/* aurora: keep ::after glow but use purple */
[data-theme="aurora"] .nav-search-icon                  { color: rgba(192,132,252,0.55); }
[data-theme="aurora"] .nav-search-container:focus-within .nav-search-icon { color: #c084fc; text-shadow: 0 0 8px rgba(192,132,252,0.6); }
[data-theme="aurora"] .nav-search-input                 { background: rgba(7,7,26,0.8); border: 1px solid rgba(192,132,252,0.25); color: #d8d8f8; caret-color: #c084fc; }
[data-theme="aurora"] .nav-search-input::placeholder    { color: #3a3a60; opacity: 1; }
[data-theme="aurora"] .nav-search-input:focus           { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.25), 0 0 12px rgba(192,132,252,0.15); background: rgba(7,7,26,0.95); }
[data-theme="aurora"] .nav-search-clear                 { color: rgba(112,112,160,0.5); }
[data-theme="aurora"] .nav-search-clear:hover           { color: #c084fc; background: rgba(192,132,252,0.12); }
[data-theme="aurora"] .nav-search-results               { background: rgba(7,7,26,0.98); border: 1px solid rgba(192,132,252,0.2); }
[data-theme="aurora"] .nav-search-item                  { background: transparent; border-bottom: 1px solid rgba(192,132,252,0.08); }
[data-theme="aurora"] .nav-search-item-label            { color: #d8d8f8; }
[data-theme="aurora"] .nav-search-item-module           { color: #5a5a80; }
[data-theme="aurora"] .nav-search-mark                  { color: #f472b6; background: none; text-shadow: 0 0 8px rgba(244,114,182,0.5); font-weight: 700; }
[data-theme="aurora"] .nav-search-item:hover,
[data-theme="aurora"] .nav-search-item.active           { background: rgba(192,132,252,0.12); border-left-color: #c084fc; border-bottom-color: rgba(192,132,252,0.08); }
[data-theme="aurora"] .nav-search-item:hover .nav-search-item-label,
[data-theme="aurora"] .nav-search-item.active .nav-search-item-label { color: #e0e0ff; text-shadow: none; }
[data-theme="aurora"] .nav-search-item:hover .nav-search-mark,
[data-theme="aurora"] .nav-search-item.active .nav-search-mark { color: #f472b6; }
[data-theme="aurora"] .nav-search-item:hover .nav-search-item-module,
[data-theme="aurora"] .nav-search-item.active .nav-search-item-module { color: #7070a0; }
[data-theme="aurora"] .nav-search-empty                 { color: #3a3a60; }
