/* =========================================================
   Z-Library 搜索块：标签页 + 宽搜索框 + 搜索设置 + 分享
   ========================================================= */

.zl-search {
  width: 100%;
  margin: 18px auto 0;
  text-align: left;
}

/* ---------- 标签页 ---------- */
.search-tabs {
  display: flex;
  gap: 4px;
  padding-left: 24px;
}
.search-tab {
  padding: 8px 16px;
  background: #26282C;
  border: 1px solid #3A3D42;
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  color: #8C8C8C;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.search-tab:hover { color: #FAFAFA; }
.search-tab.active {
  color: #FAFAFA;
  font-weight: 500;
  background: #1E1F22;
  border-color: #3A3D42;
  border-bottom: 1px solid #1E1F22;
  margin-bottom: -1px;
}

/* ---------- 输入框 ---------- */
.search-field {
  display: flex;
  height: 62px;
  background: #1E1F22;
  border: 1px solid #3A3D42;
}
.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 24px;
  background: transparent;
  border: none;
  outline: none;
  color: #FAFAFA;
  font-size: 17px;
}
.search-field input::placeholder { color: #8C8C8C; }
.search-field button {
  width: 150px;
  flex-shrink: 0;
  background: #2B2D31;
  border: none;
  border-left: 1px solid #3A3D42;
  color: #FAFAFA;
  font-size: 17px;
  cursor: pointer;
  transition: background-color .15s ease;
}
.search-field button:hover { background: #3A3D42; }

/* ---------- 动态交互：悬停 / 聚焦 / 提交 ---------- */
.search-field {
  position: relative;
  transition: border-color .22s ease, box-shadow .3s ease,
              transform .22s ease, background-color .22s ease;
}
.search-field:hover { border-color: rgba(73, 175, 208, .45); }
.search-field:focus-within {
  border-color: var(--link);
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(73, 175, 208, .15),
              0 24px 50px -18px rgba(0, 0, 0, .55);
}

/* 聚焦时沿输入区底部扫过一道光 */
.search-field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 150px;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--link), transparent) no-repeat;
  background-size: 34% 100%;
  background-position: -60% 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.search-field:focus-within::after {
  opacity: .85;
  animation: zl-search-scan 2.6s linear infinite;
}
@keyframes zl-search-scan {
  from { background-position: -60% 0; }
  to   { background-position: 160% 0; }
}
/* 焦点落在搜索按钮上（刚点完）时收起扫光，避免常驻闪动 */
.search-field:has(button:focus)::after { opacity: 0; animation-play-state: paused; }

/* 提交后的扩散光环 */
.search-field::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
}
.search-field.is-searching::before {
  animation: zl-search-pulse .7s ease-out;
}
@keyframes zl-search-pulse {
  0%   { opacity: 1; box-shadow: 0 0 0 0 rgba(73, 175, 208, .38); }
  100% { opacity: 0; box-shadow: 0 0 0 14px rgba(73, 175, 208, 0); }
}

/* 搜索按钮：悬停流光 + 按下回弹 */
.search-field button {
  position: relative;
  overflow: hidden;
  transition: background-color .18s ease, color .18s ease, transform .12s ease;
}
.search-field button::after {
  content: "";
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .34), transparent);
  transform: skewX(-18deg);
  transition: left .45s ease;
  pointer-events: none;
}
.search-field button:hover::after { left: 130%; }
.search-field button:active { transform: translateY(1px); }

/* ---------- 下方工具行 ---------- */
.search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.search-settings-wrap { position: relative; }
.search-settings {
  padding: 0 0 2px;
  background: none;
  border: none;
  border-bottom: 1px dotted #8C8C8C;
  color: #8C8C8C;
  font-size: 14px;
  cursor: pointer;
}
.search-settings:hover { color: #FAFAFA; border-bottom-color: #FAFAFA; }
.search-settings-panel {
  position: absolute;
  top: 30px;
  left: 0;
  z-index: 60;
  width: 252px;
  padding: 12px;
  background: #2B2D31;
  border: 1px solid #3A3D42;
  border-radius: 6px;
  box-shadow: 0 16px 24px rgba(0, 0, 0, .3);
}
.search-settings-panel[hidden] { display: none; }
.search-settings-panel .opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  color: #FAFAFA;
  font-size: 13px;
  cursor: pointer;
}
.search-settings-panel .opt input { accent-color: #49AFD0; }
.opt-clear {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: #1E1F22;
  border: 1px solid #3A3D42;
  border-radius: 4px;
  color: #BFBFBF;
  font-size: 13px;
  cursor: pointer;
}
.opt-clear:hover { border-color: #49AFD0; color: #FAFAFA; }

/* ---------- 分享 ---------- */
.share-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #BFBFBF;
  font-size: 14px;
}
.share-row > span { margin-right: 6px; }
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 3px;
  color: #fff;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.share-btn:hover { filter: brightness(1.12); color: #fff; }
.share-btn.wx { background: #07C160; }
.share-btn.qq { background: #12B7F5; }
.share-btn.bili { background: #00A1D6; }
.share-btn.xhs { background: #FF2442; }
.share-btn.wb { background: #E6162D; }
.share-btn.mail { background: #8B6B5D; }
.share-btn.link { background: #4DB8D4; }
.share-btn .share-text { color: #fff; font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: -.3px; }
.share-btn .share-text.xhs { font-size: 8px; letter-spacing: -.6px; }

/* ---------- 复制提示 ---------- */
.zl-search-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 2100;
  padding: 9px 18px;
  background: #2B2D31;
  border: 1px solid #3A3D42;
  border-radius: 4px;
  color: #FAFAFA;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
}
.zl-search-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 亮色主题 ----------
   亮色样式统一放在 zlib-light.css，避免两处规则互相覆盖。 */

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .zl-search { margin-top: 14px; }
  .search-tabs { padding-left: 10px; }
  .search-tab { padding: 7px 12px; font-size: 13px; }
  .search-field { height: 52px; }
  .search-field::after { right: 88px; }
  .search-field input { padding: 0 14px; font-size: 15px; }
  .search-field button { width: 88px; font-size: 15px; }
  .search-meta { align-items: flex-start; }
  .share-row { flex-wrap: wrap; }
  .share-row > span { width: 100%; margin: 0 0 2px; }
  .search-settings-panel { width: 236px; }
}
@media (max-width: 520px) {
  .share-row > span { display: none; }
  .share-btn { width: 26px; height: 26px; font-size: 14px; }
  .search-field button { width: 76px; }
  .search-field::after { right: 76px; }
}

/* ---------- 降低动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .search-tab,
  .search-field,
  .search-field button { transition: none; }
  .search-field:focus-within { transform: none; }
  .search-field:focus-within::after { animation: none; opacity: 0; }
  .search-field.is-searching::before { animation: none; }
  .search-field button::after { display: none; }
  .search-field button:active { transform: none; }
}
