/* ═══════════════════════════════════════════
   SEARCH MODULE — THE ZODIVERSE
   ═══════════════════════════════════════════ */

/* ── Search Button (injected into nav) ── */
.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(42, 42, 48, 0.5);
  color: var(--parchment);
  cursor: pointer;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-right: 0.5rem;
  transition: all 0.3s;
  flex-shrink: 0;
}

.search-btn:hover {
  border-color: var(--ember-dim);
  color: var(--flame);
}

.search-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Overlay ── */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: min(20vh, 160px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ── Modal ── */
.search-modal {
  width: 90%;
  max-width: 560px;
  background: var(--obsidian);
  border: 1px solid rgba(212, 98, 43, 0.15);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(-10px);
  transition: transform 0.25s;
}

.search-overlay.open .search-modal {
  transform: translateY(0);
}

/* ── Input Area ── */
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(42, 42, 48, 0.5);
}

.search-input-wrap svg {
  width: 18px;
  height: 18px;
  stroke: var(--smoke);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--celestial);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 300;
  caret-color: var(--ember);
}

.search-input::placeholder {
  color: var(--smoke);
  font-style: italic;
}

/* ── Results ── */
.search-results {
  max-height: 50vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ash) transparent;
}

.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb { background: var(--ash); }

.search-result {
  display: block;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(42, 42, 48, 0.3);
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
}

.search-result:hover,
.search-result.active {
  background: rgba(212, 98, 43, 0.08);
}

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

.search-result-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 0.15rem;
}

.search-result-title mark {
  background: none;
  color: var(--flame);
  font-weight: 600;
}

.search-result-sub {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ember-dim);
  margin-bottom: 0.3rem;
}

.search-result-desc {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--smoke);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Empty State ── */
.search-empty {
  padding: 2rem 1.25rem;
  text-align: center;
}

.search-empty-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--smoke);
}

/* ── Footer / Keyboard Hints ── */
.search-footer {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem 1.25rem;
  border-top: 1px solid rgba(42, 42, 48, 0.5);
}

.search-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  color: var(--smoke);
}

.search-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 4px;
  background: var(--ash);
  border: 1px solid rgba(107, 107, 120, 0.3);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--parchment);
  line-height: 1;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .search-overlay {
    padding-top: 0;
    align-items: flex-start;
  }

  .search-modal {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    border: none;
  }

  .search-results {
    max-height: calc(100vh - 120px);
  }

  .search-footer {
    display: none;
  }

  .search-btn {
    margin-right: 0.75rem;
  }
}
