/* ── Search modal overlay ─────────────────────────────────────────── */
#search-modal {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px; padding-bottom: 40px;
}
#search-modal[hidden] { display: none; }

#search-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

#search-panel {
  position: relative; z-index: 1;
  width: 620px; max-width: calc(100vw - 32px);
  background: var(--c-bg-card);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 60px rgba(0,0,0,0.25), 0 0 0 1px var(--c-border);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 160px);
  animation: searchPanelIn 160ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes searchPanelIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ── Input row ────────────────────────────────────────────────────── */
#search-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.search-icon { font-size: 18px; color: var(--c-text-muted); flex-shrink: 0; }

#search-input {
  flex: 1; border: none; outline: none;
  font-size: 15px; font-family: var(--font-base);
  color: var(--c-text-primary); background: transparent;
}
#search-input::placeholder { color: var(--c-text-muted); }
#search-input::-webkit-search-cancel-button { display: none; }

.search-esc-hint {
  font-size: 10px; padding: 2px 6px;
  background: var(--c-bg-hover); border: 1px solid var(--c-border);
  border-radius: 4px; color: var(--c-text-muted);
  flex-shrink: 0; user-select: none;
}

/* ── Results area ─────────────────────────────────────────────────── */
#search-results {
  flex: 1; overflow-y: auto; min-height: 0;
}

/* ── States ───────────────────────────────────────────────────────── */
.search-state[hidden] { display: none; }

/* Initial: quick actions */
.search-hint-label {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .05em; color: var(--c-text-muted);
  padding: 14px 18px 8px;
  margin: 0;
}
.search-qa-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px; padding: 0 18px 16px;
}
.search-qa-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-bg-hover); color: var(--c-text-primary);
  font-size: 12.5px; text-decoration: none;
  transition: background 120ms, border-color 120ms;
}
.search-qa-btn:hover, .search-qa-btn.keyboard-focused {
  background: var(--c-navy-light); border-color: var(--c-navy-border);
  color: var(--c-navy); text-decoration: none;
}
.search-qa-btn i { font-size: 15px; flex-shrink: 0; }

/* Loading */
.search-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 18px; color: var(--c-text-muted); font-size: 13px;
}
.search-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-navy);
  animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty */
.search-empty {
  text-align: center; padding: 32px 24px;
  color: var(--c-text-muted); font-size: 14px;
}
.search-empty i   { font-size: 32px; margin-bottom: 10px; opacity: .4; }
.search-empty p   { margin: 4px 0; }
.search-empty-hint{ font-size: 12px; }

/* ── Section ──────────────────────────────────────────────────────── */
.search-section { padding: 0 0 8px; }
.search-section + .search-section {
  border-top: 1px solid var(--c-border);
}
.search-section-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px 4px;
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .05em; color: var(--c-text-muted);
}
.search-section-header i { font-size: 13px; }

.search-section-list { list-style: none; padding: 0; margin: 0; }

/* ── Individual result (modal + page) ─────────────────────────────── */
.search-result-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 18px; text-decoration: none;
  color: var(--c-text-primary);
  transition: background 80ms;
}
.search-result-link:hover,
.search-result-link.keyboard-focused {
  background: var(--c-navy-light);
  text-decoration: none;
}
.search-result-link:hover .sr-title,
.search-result-link.keyboard-focused .sr-title,
.search-result-link:hover .search-result-title,
.search-result-link.keyboard-focused .search-result-title {
  color: var(--c-navy);
}
.sr-icon, .search-result-icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--c-bg-hover); display: flex;
  align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px; color: var(--c-text-secondary);
}
.sr-text, .search-result-content  { flex: 1; min-width: 0; }
.sr-title, .search-result-title {
  display: block; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-sub, .search-result-subtitle {
  display: block; font-size: 11.5px; color: var(--c-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.sr-arrow {
  font-size: 12px; color: var(--c-text-muted);
  flex-shrink: 0; opacity: 0;
  transition: opacity 100ms;
}
.search-result-link:hover .sr-arrow,
.search-result-link.keyboard-focused .sr-arrow { opacity: 1; }

/* Match highlight */
#search-modal mark,
.search-page mark {
  background: transparent;
  color: var(--c-navy);
  font-weight: 600;
  padding: 0;
}

.search-view-more {
  display: block; padding: 7px 18px;
  font-size: 12px; color: var(--c-blue);
  text-decoration: none;
}
.search-view-more:hover { text-decoration: underline; }

/* ── Footer ───────────────────────────────────────────────────────── */
#search-footer {
  border-top: 1px solid var(--c-border);
  padding: 10px 18px;
  display: flex; align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
.search-view-all-link {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--c-navy); text-decoration: none;
  font-weight: 500;
  min-width: 0;
}
.search-view-all-link:hover { text-decoration: underline; }
.search-view-all-link i { flex-shrink: 0; }
.search-key-hints {
  display: flex; gap: 12px; font-size: 11px; color: var(--c-text-muted);
  flex-shrink: 0;
}
.search-key-hints kbd {
  background: var(--c-bg-hover); border: 1px solid var(--c-border);
  border-radius: 3px; padding: 1px 5px; font-size: 10px;
  font-family: var(--font-mono);
}

/* ── Full-page search results ─────────────────────────────────────── */
.search-page { max-width: 760px; }
.search-page-query { font-weight: 400; color: var(--c-text-secondary); }

.search-page-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 24px; border-bottom: 1px solid var(--c-border);
  padding-bottom: 0;
}
.search-tab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 6px 6px 0 0;
  font-size: 13px; text-decoration: none;
  color: var(--c-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms;
}
.search-tab:hover { color: var(--c-text-primary); text-decoration: none; }
.search-tab.active {
  color: var(--c-navy); font-weight: 500;
  border-bottom-color: var(--c-navy);
  background: var(--c-navy-light);
}
.search-tab-count {
  background: var(--c-bg-hover); border-radius: 999px;
  padding: 1px 7px; font-size: 11px; font-weight: 500;
}
.search-tab.active .search-tab-count {
  background: var(--c-navy); color: #fff;
}

.search-results-section { margin-bottom: 28px; }
.search-section-heading {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .05em; color: var(--c-text-muted);
  margin-bottom: 10px;
}
.search-section-count {
  background: var(--c-bg-hover); padding: 1px 7px;
  border-radius: 999px; font-size: 11px;
}

.search-results-list { list-style: none; padding: 0; margin: 0; }
.search-result-item:not(:last-child) {
  border-bottom: 1px solid var(--c-border);
}

.search-more-link {
  display: block; padding: 8px 0;
  font-size: 12px; color: var(--c-blue); text-decoration: none;
}
.search-more-link:hover { text-decoration: underline; }

.search-page-empty {
  text-align: center; padding: 60px 24px;
  color: var(--c-text-muted);
}
.search-page-empty i { font-size: 40px; margin-bottom: 14px; opacity: .3; }
