/* ============================================================
   全域站内搜索样式
   1) 导航入口按钮 + 下拉检索面板（全站，base.html）
   2) /search 搜索结果页（tabs / 结果卡片 / 高亮 / 空状态 / 初始态）
   说明：仅新增自有类名（nav-search-btn / ss-* / sr-*），不改动既有组件样式；
        颜色一律走站点 CSS 变量并带 fallback，兼容首页与内页两套品牌色。
   ============================================================ */

/* ---------- 1. 导航入口按钮 ---------- */
.nav-search-btn {
  width: 38px; height: 38px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(8, 103, 99, .18);
  background: #fff; color: var(--ink-600, #4d5660);
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}
.nav-search-btn:hover {
  color: var(--brand-700, #086763);
  border-color: var(--brand-300, #82c5bf);
  background: var(--brand-50, #f1f8f6);
  transform: translateY(-1px);
}
.nav-search-btn[aria-expanded="true"] {
  background: var(--brand-700, #086763);
  border-color: var(--brand-700, #086763);
  color: #fff;
}
.nav-search-btn:focus-visible { outline: 2px solid var(--brand-500, #178d87); outline-offset: 2px; }

/* ---------- 2. 下拉检索面板 ---------- */
.site-search-panel {
  display: none;
  position: absolute; left: 0; right: 0; top: 100%;
  z-index: 60; padding: 18px 0 16px;
  background: rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-top: 1px solid rgba(8, 103, 99, .1);
  border-bottom-left-radius: 16px; border-bottom-right-radius: 16px;
  box-shadow: 0 24px 48px -28px rgba(6, 40, 38, .5);
}
.site-search-panel.is-open { display: block; animation: ssPanelIn .18s ease-out both; }
@keyframes ssPanelIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.ss-form {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 18px;
  background: #fff; border: 1px solid rgba(8, 103, 99, .16); border-radius: 999px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.ss-form:focus-within {
  border-color: var(--brand-500, #178d87);
  box-shadow: 0 0 0 4px rgba(8, 103, 99, .1);
}
.ss-ico { flex: none; color: var(--ink-400, #7a8890); }
.ss-input {
  flex: 1 1 auto; min-width: 0; height: 38px;
  border: 0; background: transparent; outline: none;
  font-size: 15px; color: var(--text-1, #263238);
  font-family: inherit;
}
.ss-input::placeholder { color: var(--ink-400, #9aa6ab); }
.ss-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.ss-submit { flex: none; }

.ss-hot, .sr-hots {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-top: 14px; font-size: 13px; color: var(--ink-500, #5c686d);
}
.ss-hot-label, .sr-hots-label { color: var(--ink-400, #7a8890); }
.ss-hot a, .sr-hots a {
  padding: 3px 11px; border-radius: 999px; text-decoration: none;
  color: var(--brand-700, #086763); background: var(--brand-50, #f1f8f6);
  border: 1px solid transparent;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.ss-hot a:hover, .sr-hots a:hover {
  background: #fff; border-color: var(--brand-300, #82c5bf); color: var(--brand-700, #086763);
}
.ss-hot .ss-all { margin-left: auto; background: transparent; color: var(--ink-600, #4d5660); }

/* ---------- 3. 搜索结果页 ---------- */
.sr-section { padding-bottom: 64px; }
.sr-container { max-width: 960px; margin: 0 auto; }

.sr-searchbar {
  display: flex; align-items: center; gap: 10px;
  margin-top: -28px; padding: 9px 9px 9px 20px;
  background: #fff; border: 1px solid rgba(8, 103, 99, .16); border-radius: 999px;
  box-shadow: 0 18px 34px -28px rgba(6, 40, 38, .55);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.sr-searchbar:focus-within {
  border-color: var(--brand-500, #178d87);
  box-shadow: 0 0 0 4px rgba(8, 103, 99, .1);
}
.sr-ico { flex: none; color: var(--ink-400, #7a8890); }
.sr-input {
  flex: 1 1 auto; min-width: 0; height: 42px;
  border: 0; background: transparent; outline: none;
  font-size: 15.5px; color: var(--text-1, #263238); font-family: inherit;
}
.sr-input::placeholder { color: var(--ink-400, #9aa6ab); }
.sr-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.sr-go { flex: none; padding: 10px 26px; border-radius: 999px; }

.sr-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  margin: 24px 0 14px; font-size: 13.5px; color: var(--ink-600, #4d5660);
}
.sr-count b { color: var(--brand-700, #086763); font-size: 15px; }
.sr-kws em {
  font-style: normal; margin-right: 6px; padding: 1px 8px; border-radius: 6px;
  font-size: 12.5px; color: var(--brand-700, #086763);
  background: var(--brand-50, #f1f8f6); border: 1px solid rgba(8, 103, 99, .12);
}
.sr-tip {
  padding: 3px 10px; border-radius: 6px; font-size: 12.5px;
  color: #8a6d1f; background: #fdf7e6; border: 1px solid #f3e3b5;
}

.sr-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-bottom: 14px; margin-bottom: 4px;
  border-bottom: 1px solid rgba(8, 103, 99, .1);
}
.sr-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; text-decoration: none;
  font-size: 13.5px; color: var(--ink-600, #4d5660); border: 1px solid transparent;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.sr-tab span {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 12px; color: var(--ink-400, #7a8890); background: rgba(8, 103, 99, .07);
}
.sr-tab:hover { background: var(--brand-50, #f1f8f6); color: var(--brand-700, #086763); }
.sr-tab.is-on { background: var(--brand-700, #086763); border-color: var(--brand-700, #086763); color: #fff; }
.sr-tab.is-on span { background: rgba(255, 255, 255, .24); color: #fff; }
.sr-tab.is-zero { opacity: .55; }

.sr-list { list-style: none; margin: 6px 0 0; padding: 0; }
.sr-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 17px 16px; border-radius: 12px;
  border: 1px solid transparent; text-decoration: none; color: inherit;
  transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.sr-item:hover {
  background: #fff; border-color: rgba(8, 103, 99, .14);
  transform: translateY(-2px); box-shadow: 0 18px 34px -26px rgba(6, 40, 38, .55);
}
.sr-badge {
  flex: none; margin-top: 2px; padding: 6px 9px; border-radius: 6px;
  font-size: 12px; line-height: 1; white-space: nowrap;
  color: var(--brand-700, #086763); background: var(--brand-50, #f1f8f6);
  border: 1px solid rgba(8, 103, 99, .12);
}
.sr-badge-parks { color: #8a6d1f; background: #fdf7e6; border-color: #f3e3b5; }
.sr-badge-faq { color: #2f5fa8; background: #eef4ff; border-color: #d8e4f8; }
.sr-badge-news { color: #5b4a9b; background: #f4f1fb; border-color: #e2dcf5; }

.sr-main { flex: 1 1 auto; min-width: 0; }
.sr-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.6; color: var(--text-1, #1a2b2a); }
.sr-item:hover .sr-title { color: var(--brand-700, #086763); }
.sr-snippet {
  margin: 6px 0 0; font-size: 13.5px; line-height: 1.78; color: var(--ink-600, #4d5660);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sr-meta { display: block; margin-top: 8px; font-size: 12px; color: var(--ink-400, #7a8890); }
.sr-arrow {
  flex: none; align-self: center; font-size: 15px; color: var(--ink-300, #a9b4b8);
  transition: color .18s ease, transform .18s ease;
}
.sr-item:hover .sr-arrow { color: var(--brand-700, #086763); transform: translateX(3px); }

/* 命中高亮：只作用于搜索结果，避免影响正文其它内容 */
.sr-title mark, .sr-snippet mark {
  color: inherit; padding: 0 1px; border-radius: 2px; font-weight: 600;
  background: linear-gradient(180deg, transparent 55%, rgba(255, 214, 102, .78) 55%);
}

.sr-empty { margin-top: 30px; }

/* 初始态（未输入关键词） */
.sr-start-tip { margin: 24px 0 16px; font-size: 14px; color: var(--ink-600, #4d5660); }
.sr-entries { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sr-entry {
  display: block; padding: 18px; border-radius: 12px; text-decoration: none;
  background: #fff; border: 1px solid rgba(8, 103, 99, .12);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.sr-entry b { display: block; font-size: 15px; color: var(--text-1, #1a2b2a); }
.sr-entry span { display: block; margin-top: 6px; font-size: 13px; line-height: 1.7; color: var(--ink-600, #4d5660); }
.sr-entry:hover {
  transform: translateY(-2px); border-color: rgba(8, 103, 99, .26);
  box-shadow: 0 18px 34px -26px rgba(6, 40, 38, .5);
}

/* ---------- 4. 窄屏兜底 ---------- */
@media (max-width: 1024px) {
  .sr-entries { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .site-search-panel { padding: 14px 0 12px; }
  .ss-form, .sr-searchbar { padding-left: 14px; border-radius: 14px; }
  .ss-hot .ss-all { margin-left: 0; }
  .sr-searchbar { margin-top: 0; }
  .sr-entries { grid-template-columns: 1fr; }
  .sr-item { padding: 14px 10px; }
  .sr-arrow { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .site-search-panel.is-open { animation: none; }
  .nav-search-btn, .sr-item, .sr-entry, .sr-arrow { transition: none; }
  .sr-item:hover, .sr-entry:hover, .nav-search-btn:hover { transform: none; }
}
