/* ==========================================================================
   Gridea Paper-Light Search System (Global Modal ⌘K + Archive Inline Filter)
   遵循博客白底极简设计规范：无暗黑背景、1px 细线层次、#F15406 焦点强调色
   ========================================================================== */

/* 1. 顶部导航栏搜索触发按钮 */
.site-header .menu-container .menu-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
  vertical-align: middle;
  align-self: center;
  line-height: 1.2;
}

.site-header .menu-container .menu-search-btn:hover {
  color: #f15406;
  background: #fff7ed;
  border-color: #fdba74;
}

.site-header .menu-container .menu-search-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.site-header .menu-container .menu-search-kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Consolas, monospace;
  color: #64748b;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  line-height: 1.3;
}

.site-header .menu-container .menu-search-btn:hover .menu-search-kbd {
  color: #ea580c;
  border-color: #fdba74;
}

/* 2. 全局极速搜索弹窗 (Paper-Light Command Palette) */
.gs-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.gs-modal-backdrop.is-open {
  display: flex;
}

.gs-modal-panel {
  width: 100%;
  max-width: 680px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  color: #0f172a;
}

.gs-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.gs-search-icon {
  width: 18px;
  height: 18px;
  color: #64748b;
  flex-shrink: 0;
}

.gs-modal-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: #0f172a;
  line-height: 1.4;
}

.gs-modal-input::placeholder {
  color: #94a3b8;
}

.gs-modal-input::-webkit-search-cancel-button,
.gs-modal-input::-webkit-search-decoration,
.archive-search-input::-webkit-search-cancel-button,
.archive-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.gs-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.gs-clear-btn.is-visible {
  display: inline-flex;
}

.gs-clear-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* 搜索范围切换胶囊 (全部 vs 仅标题) */
.gs-scope-switch {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 2px;
  flex-shrink: 0;
}

.gs-scope-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.gs-scope-btn:hover {
  color: #0f172a;
}

.gs-scope-btn.is-active {
  background: #ffffff;
  color: #f15406;
  font-weight: 600;
  border: 1px solid #e2e8f0;
}

.gs-esc-btn {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, Consolas, monospace;
  padding: 4px 7px;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
}

.gs-esc-btn:hover {
  color: #0f172a;
  border-color: #cbd5e1;
}

/* 状态栏 */
.gs-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 16px;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.gs-status-scanning {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0284c7;
}

.gs-spinner {
  width: 11px;
  height: 11px;
  border: 1.8px solid #bae6fd;
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: gs-spin 0.65s linear infinite;
}

@keyframes gs-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 搜索结果滚动容器 */
.gs-results-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  background: #ffffff;
}

.gs-result-item {
  display: block;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none !important;
  color: #0f172a;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.gs-result-item + .gs-result-item {
  margin-top: 2px;
}

.gs-result-item:hover,
.gs-result-item.is-selected {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.gs-result-item.is-selected {
  background: #fff7ed;
  border-color: #fed7aa;
}

.gs-result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.gs-result-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.gs-result-item:hover .gs-result-title,
.gs-result-item.is-selected .gs-result-title {
  color: #ea580c;
}

.gs-result-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  font-size: 12px;
  color: #64748b;
}

.gs-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  line-height: 1.4;
  flex-shrink: 0;
}

.gs-badge-title {
  color: #c2410c;
  background: #ffedd5;
}

.gs-badge-tag {
  color: #0369a1;
  background: #e0f2fe;
}

.gs-badge-heading {
  color: #047857;
  background: #d1fae5;
}

.gs-badge-body {
  color: #475569;
  background: #f1f5f9;
}

.gs-result-tag {
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
}

.gs-result-snippet {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
  word-break: break-word;
}

/* 关键词高亮标记 */
.gs-mark {
  background: #ffedd5;
  color: #c2410c;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 3px;
}

/* 弹窗默认快捷引导面板 (未输入关键词时) */
.gs-quick-panel {
  padding: 8px 8px 4px;
}

.gs-quick-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  padding: 4px 6px 8px;
}

.gs-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 6px 12px;
}

.gs-quick-tag-chip {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gs-quick-tag-chip:hover {
  color: #f15406;
  background: #fff7ed;
  border-color: #fdba74;
}

.gs-empty-state {
  padding: 36px 16px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

.gs-load-more-btn {
  display: block;
  width: calc(100% - 16px);
  margin: 8px auto;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
}

.gs-load-more-btn:hover {
  color: #f15406;
  border-color: #fdba74;
  background: #fff7ed;
}

.gs-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 11px;
  color: #64748b;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.gs-footer-shortcuts {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gs-footer-shortcuts kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  color: #475569;
  margin-right: 3px;
}

/* ==========================================================================
   3. 归档页专属原位实时过滤搜索框 (Archive Inline Search)
   ========================================================================== */
.archive-search-wrapper {
  margin: 0 24px 20px;
}

.archive-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.archive-search-bar:focus-within {
  background: #ffffff;
  border-color: #f15406;
}

.archive-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: #0f172a;
}

.archive-search-input::placeholder {
  color: #94a3b8;
}

.archive-search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 0 4px;
  font-size: 12px;
  color: #64748b;
}

.archive-live-results .year-count {
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 8px;
}

.archive-live-results .archive-hit-post {
  padding: 14px 24px;
  display: block;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.archive-live-results .archive-hit-post:hover {
  background: #f8fafc;
}

.archive-live-results .archive-hit-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: #94a3b8;
}

.archive-live-results .archive-hit-snippet {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
}

/* 响应式移动端适配 */
@media (max-width: 600px) {
  .site-header .menu-container .menu-search-kbd {
    display: none;
  }

  .gs-modal-backdrop {
    padding: 12px 10px;
  }

  .gs-modal-panel {
    max-height: 88vh;
  }

  .gs-modal-header {
    flex-wrap: wrap;
    padding: 12px;
    gap: 8px;
  }

  .gs-modal-input {
    font-size: 16px; /* 防止 iOS Safari 输入聚焦自动放大页面 */
  }

  .gs-scope-switch {
    width: 100%;
    justify-content: stretch;
  }

  .gs-scope-btn {
    flex: 1;
    text-align: center;
  }

  .gs-modal-footer {
    display: none;
  }

  .archive-search-wrapper {
    margin: 0 8px 16px;
  }

  .archive-search-bar {
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .archive-search-bar .gs-scope-switch {
    width: 100%;
  }

  .archive-live-results .archive-hit-post {
    padding: 12px 12px;
  }
}
