/* ==========================================================================
   zreso.css —— 首页 / 搜索页「泽索搜(zreso.cn)」风格主题
   仅 index.html / search.html 加载；复用站点已有搜索能力（#searchInput / #searchButton），
   不改变后端路由与分类页、内容页。
   ========================================================================== */

:root {
  --zr-bg: #fbfaf9;
  --zr-bg-card: #ffffff;
  --zr-text: #0f1115;
  --zr-text-soft: #18181b;
  --zr-muted: #71717a;
  --zr-muted-2: #52525b;
  --zr-muted-3: #a1a1aa;
  --zr-border: rgba(0, 0, 0, 0.08);
  --zr-border-strong: rgba(0, 0, 0, 0.12);
  --zr-hover: #f4f4f5;
  --zr-active: #e4e4e7;
  --zr-shadow-sm: 0 4px 20px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --zr-shadow-md: 0 6px 26px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --zr-radius-box: 22px;
  --zr-blue: #4176e6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --zr-bg: #121212;
    --zr-bg-card: #18181b;
    --zr-text: #f4f4f5;
    --zr-text-soft: #f4f4f5;
    --zr-muted: #a1a1aa;
    --zr-muted-2: #a1a1aa;
    --zr-muted-3: #71717a;
    --zr-border: rgba(255, 255, 255, 0.09);
    --zr-border-strong: rgba(255, 255, 255, 0.14);
    --zr-hover: #27272a;
    --zr-active: #3f3f46;
    --zr-shadow-sm: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
    --zr-shadow-md: 0 6px 26px -2px rgba(0, 0, 0, 0.55);
  }
  .dark {
    --zr-bg: #121212;
    --zr-bg-card: #18181b;
  }
}

/* 覆盖 public_layout 的暖色渐变背景与网格叠层、隐藏原滚动导航与默认页脚 */
body {
  background: var(--zr-bg) !important;
  color: var(--zr-text) !important;
}

body::before {
  display: none !important;
}

#mainNav {
  display: none !important;
}

.footer-container {
  display: none !important;
}

/* ---------------- 布局骨架 ---------------- */
.zr-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

.zr-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* 首页：垂直居中（仿 zreso 的 padding-top 计算） */
.zr-home-main {
  justify-content: center;
  padding-top: max(64px, calc((100dvh - 380px) / 2.6));
  padding-bottom: 48px;
}

/* ---------------- 首页 Logo 图片标（居中 + 响应式） ---------------- */
.zr-logo-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 32px;
  text-decoration: none;
  line-height: 0;
}

.zr-logo {
  display: block;
  margin: 0 auto;
  /* 响应式：手机更窄，桌面封顶，保证各端不溢出、不变形 */
  width: clamp(150px, 42vw, 240px);
  height: auto;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.2s ease;
}

.zr-logo-link:hover .zr-logo {
  opacity: 0.88;
}

@media (max-width: 480px) {
  .zr-logo {
    width: clamp(132px, 52vw, 180px);
  }
}

/* ---------------- 首页搜索框（chat 风格圆角容器） ---------------- */
.zr-search-form {
  width: 100%;
}

.zr-search-box {
  width: 100%;
  background: var(--zr-bg-card);
  border: 1px solid var(--zr-border);
  border-radius: var(--zr-radius-box);
  box-shadow: var(--zr-shadow-sm);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.zr-search-box:hover {
  border-color: var(--zr-border-strong);
  box-shadow: var(--zr-shadow-md);
}

.zr-search-box:focus-within {
  border-color: var(--zr-border-strong);
  box-shadow: var(--zr-shadow-md);
}

.zr-search-input-wrap {
  width: 100%;
  padding: 14px 16px 4px 18px;
}

.zr-search-input {
  width: 100%;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  font-size: 16px;
  line-height: 26px;
  color: var(--zr-text);
  padding: 4px 0;
  font-family: inherit;
  letter-spacing: inherit;
}

.zr-search-input::placeholder {
  color: #81858c;
  font-size: 15px;
  user-select: none;
}

.zr-search-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  margin-top: 6px;
  padding: 0 10px 10px 14px;
  gap: 8px;
}

.zr-left-area {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.zr-right-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.zr-icon-btn {
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--zr-muted-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
  transition: color 0.15s ease, background 0.15s ease;
}

.zr-icon-btn:hover {
  background: var(--zr-hover);
  color: var(--zr-text);
}

.zr-icon-btn.active {
  color: var(--zr-blue);
}

.zr-voice-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: transparent;
  border: none;
  color: var(--zr-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  flex-shrink: 0;
}

.zr-voice-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--zr-text);
}

.zr-voice-btn:active {
  transform: scale(0.96);
}

.zr-voice-btn.listening-active {
  background: #ef4444 !important;
  color: #fff !important;
  animation: zr-mic-pulse 1.4s infinite !important;
}

@keyframes zr-mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.zr-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.32);
  border: none;
  cursor: default;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.zr-send-btn.active {
  background: #000000;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.zr-send-btn.active:hover {
  background: #27272a;
  transform: scale(1.04);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.zr-send-btn.active:active {
  transform: scale(0.95);
}

@media (prefers-color-scheme: dark) {
  .zr-send-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.32);
  }
  .zr-send-btn.active {
    background: #ffffff;
    color: #000000;
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.2);
  }
  .zr-send-btn.active:hover {
    background: #f4f4f5;
  }
}

/* ------------------------------------------------------------------
   覆盖 index.css 的 #searchButton / #searchInput（暖色主题残留）。
   两页按钮都带 id="searchButton"，index.css 用 ID 选择器把它强设为
   58x58 金色渐变导致出框；此处用同级 ID + 后加载顺序压回 zreso 样式。
   ------------------------------------------------------------------ */
#searchButton {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 999px !important;
  background: rgba(0, 0, 0, 0.06) !important;
  color: rgba(0, 0, 0, 0.32) !important;
  font-weight: normal !important;
  box-shadow: none !important;
  transform: none !important;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease,
    transform 0.12s ease, box-shadow 0.15s ease !important;
  flex-shrink: 0 !important;
}

#searchButton:hover,
#searchButton:hover:not(.searching) {
  transform: none !important;
  box-shadow: none !important;
}

#searchButton.active {
  background: #000000 !important;
  color: #ffffff !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18) !important;
}

#searchButton.active:hover {
  background: #27272a !important;
  transform: scale(1.04) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25) !important;
}

#searchButton.active:active {
  transform: scale(0.95) !important;
}

#searchButton svg {
  width: 16px;
  height: 16px;
  color: inherit;
}

/* 首页输入框：抵消 index.css 的 58px 高与左内边距 */
#searchInput {
  height: auto !important;
  min-height: 0 !important;
  padding: 4px 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 16px !important;
  line-height: 26px !important;
  color: var(--zr-text) !important;
}

/* 搜索页紧凑输入框与按钮：用 ID+类组合压回紧凑尺寸 */
#searchInput.zr-results-input {
  padding: 6px 0 !important;
  font-size: 15px !important;
  line-height: 24px !important;
}

#searchButton.zr-results-send {
  width: 34px !important;
  height: 34px !important;
}

#searchButton.zr-results-send.active {
  background: #000000 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

#searchButton.zr-results-send.active:hover {
  background: #27272a !important;
  transform: none !important;
  box-shadow: none !important;
}

@media (prefers-color-scheme: dark) {
  #searchButton {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.32) !important;
  }
  #searchButton.active,
  #searchButton.zr-results-send.active {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.2) !important;
  }
  #searchButton.active:hover,
  #searchButton.zr-results-send.active:hover {
    background: #f4f4f5 !important;
  }
  #searchInput {
    color: var(--zr-text) !important;
  }
}

/* ---------------- 联想下拉 ---------------- */
.zr-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--zr-bg-card);
  border: 1px solid var(--zr-border);
  border-radius: 18px;
  box-shadow: var(--zr-shadow-md);
  z-index: 50;
  overflow-y: auto;
  max-height: 320px;
  padding: 6px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  scrollbar-width: none;
}

.zr-suggest::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.zr-suggest.hidden {
  display: none;
}

.zr-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s ease;
  text-decoration: none;
  user-select: none;
  color: var(--zr-text);
  font-size: 14px;
}

.zr-suggest-item:hover,
.zr-suggest-item.selected {
  background: rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  .zr-suggest-item:hover,
  .zr-suggest-item.selected {
    background: rgba(255, 255, 255, 0.08);
  }
}

.zr-suggest-icon {
  color: var(--zr-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zr-suggest-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

/* ---------------- 快捷入口 chips ---------------- */
.zr-chips-wrap {
  width: 100%;
  max-width: 768px;
  margin: 14px auto 0;
}

.zr-chips {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 4px 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  justify-content: center;
}

.zr-chips::-webkit-scrollbar {
  display: none;
}

.zr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px 0 13px;
  border-radius: 20px;
  border: 1px solid var(--zr-border);
  color: var(--zr-muted-2);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 20px;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
  background-color: transparent;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.zr-chip:hover {
  background-color: var(--zr-hover);
  color: var(--zr-text);
  transform: translateY(-1px);
}

.zr-chip:active {
  background-color: var(--zr-active);
  transform: translateY(0);
}

.zr-chip svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.zr-chip:hover svg {
  opacity: 0.95;
}

/* ---------------- 首页「最新更新」列表（卡片式） ---------------- */
.zr-latest {
  width: 100%;
  margin-top: 26px;
}

.zr-latest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0 4px;
}

.zr-latest-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--zr-text);
  letter-spacing: 0.01em;
}

.zr-latest-more {
  font-size: 12.5px;
  color: var(--zr-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.zr-latest-more:hover {
  color: var(--zr-text);
}

.zr-latest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zr-latest-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--zr-bg-card);
  border: 1px solid var(--zr-border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--zr-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.zr-latest-item a:hover {
  border-color: rgba(0, 0, 0, 0.16);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 彩色首字方块 */
.zr-latest-avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0;
  user-select: none;
}

.zr-av-1 { background: linear-gradient(135deg, #f7c873, #eeaf46); }
.zr-av-2 { background: linear-gradient(135deg, #7aa5f8, #4176e6); }
.zr-av-3 { background: linear-gradient(135deg, #5fd0a0, #23a06b); }
.zr-av-4 { background: linear-gradient(135deg, #a78bfa, #7c5ce0); }
.zr-av-5 { background: linear-gradient(135deg, #f8a978, #ef7d3a); }
.zr-av-6 { background: linear-gradient(135deg, #5bc8d0, #2a9aa8); }

.zr-latest-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.zr-latest-name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zr-latest-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--zr-muted);
}

.zr-latest-date i {
  font-size: 11px;
  margin-right: 2px;
}

.zr-latest-type {
  color: #d97706;
  font-weight: 600;
}

.zr-latest-tag {
  font-size: 11.5px;
  color: var(--zr-muted-2);
  padding: 2px 8px;
  border: 1px solid var(--zr-border);
  border-radius: 999px;
  background: var(--zr-hover);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .zr-latest {
    margin-top: 20px;
  }

  .zr-latest-name {
    font-size: 13.5px;
  }

  .zr-latest-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 16px;
  }
}

/* ---------------- 页脚 ---------------- */
.zr-footer {
  width: 100%;
  padding: 24px 0 28px;
  text-align: center;
  font-size: 12px;
  color: var(--zr-muted-3);
}

.zr-footer a {
  color: var(--zr-muted-2);
  text-decoration: none;
  transition: color 0.15s ease;
}

.zr-footer a:hover {
  color: var(--zr-text);
}

/* ==========================================================================
   搜索结果页
   ========================================================================== */

.zr-results-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: color-mix(in srgb, var(--zr-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--zr-border);
  padding: 10px 0;
}

.zr-results-header-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.zr-results-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 20px;
  color: var(--zr-text);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
  line-height: 0;
}

.zr-results-logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 160px;
  max-height: 56px;
  user-select: none;
  -webkit-user-drag: none;
}

.zr-results-logo:hover {
  opacity: 0.88;
}

.zr-results-search-form {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-width: 0;
}

.zr-results-search {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  background: var(--zr-bg-card);
  border: 1px solid var(--zr-border);
  border-radius: 16px;
  box-shadow: var(--zr-shadow-sm);
  padding: 6px 6px 6px 14px;
  min-width: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.zr-results-search:focus-within {
  border-color: var(--zr-border-strong);
}

.zr-results-input {
  flex: 1 1 auto;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  line-height: 24px;
  color: var(--zr-text);
  padding: 6px 0;
  min-width: 0;
  font-family: inherit;
}

.zr-results-input::placeholder {
  color: #81858c;
}

.zr-results-send {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.35);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.zr-results-send.active {
  background: #000;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .zr-results-send {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.35);
  }
  .zr-results-send.active {
    background: #fff;
    color: #000;
  }
}

/* 结果区容器：保持与原始 .container-fluid-custom 同宽（1240 / 20px），
   避免搜索结果区域被改窄、与原始样式不一致 */
.zr-results-main {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 20px;
  /* 覆盖 .zr-main 的 align-items:center，否则结果区会被收缩到内容宽度而变窄 */
  align-items: stretch;
}

/* 结果区（温馨提示 / 过滤胶囊 / 结果卡片 / 检测查看按钮）全部交还原
   index.css 的原始样式，此处不再覆盖 */

/* 响应式 */
@media (max-width: 768px) {
  .zr-home-main {
    justify-content: flex-start; /* 移动端不再垂直居中，避免顶部大片空白 */
    padding-top: 48px;
    padding-bottom: 36px;
  }

  .zr-main,
  .zr-results-main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .zr-results-header-inner {
    padding: 0 12px;
    gap: 10px;
  }

  .zr-results-logo {
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  .zr-logo-link {
    margin-bottom: 24px;
  }

  .zr-chips {
    justify-content: flex-start;
  }

  .zr-results-logo img {
    max-width: 110px;
    max-height: 40px;
  }
}
