/* UI refresh · discover
   搜索页（发现）：搜索框、分类发现、搜索结果列表、批量导入入口。选择器范围：.discover-search-panel、#searchForm、#searchResults、.result-card、.discover-panel。
   只使用 refresh/foundation.css 中的 --ds-* 设计令牌；不得修改其他文件负责的选择器。 */

/* 「分类发现」和「批量导入」是搜索的辅助入口：放在搜索框下面同一行，
   而不是一个压在搜索框上方的标题栏里、一个孤零零地单占一行。
   （取自 feat/ui-polish 10b7d1a 的搜索页部分，改用 --ds-* 令牌。） */
.discover-search-panel .discover-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-2);
  margin-top: var(--ds-space-2);
}

.discover-search-panel .discover-tools > button {
  flex: 0 0 auto;
  min-height: var(--ds-control);
  padding: 0 var(--ds-space-4);
}

/* #477 搜书 / 搜作者切换：和「分类发现」同一行，两个按钮拼成一组。 */
.discover-search-panel .search-mode-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: var(--ds-control);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  overflow: hidden;
}

.discover-search-panel .search-mode-toggle > button {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 var(--ds-space-3);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ds-text-muted);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.discover-search-panel .search-mode-toggle > button + button {
  border-left: 1px solid var(--ds-border);
}

.discover-search-panel .search-mode-toggle > button[aria-pressed="true"] {
  background: var(--ds-accent-soft);
  color: var(--ds-on-accent-soft);
  font-weight: var(--ds-weight-strong);
}

/* #477 作者结果卡片：头像 + 名字 + 代表作；作者作品列表顶部的作者信息。 */
#searchResults .author-result-card {
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
}

#searchResults .author-result-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--ds-radius-full);
  object-fit: cover;
  background: var(--ds-surface-field);
  color: var(--ds-text-muted);
  font-weight: var(--ds-weight-strong);
}

#searchResults .author-result-body {
  display: grid;
  gap: var(--ds-space-1);
  min-width: 0;
}

#searchResults .author-result-badge {
  margin-left: var(--ds-space-1);
  color: var(--ds-text-muted);
  font-size: var(--ds-text-caption);
  font-weight: normal;
}

#searchResults .author-works-head {
  display: grid;
  grid-column: 1 / -1;
  gap: var(--ds-space-2);
}

#searchResults .author-works-head:empty {
  display: none;
}

#searchResults .author-works-back {
  justify-self: start;
}

#searchResults .author-works-profile {
  display: flex;
  align-items: center;
  gap: var(--ds-space-3);
  min-width: 0;
}

#searchResults .author-works-desc {
  white-space: pre-line;
}

#searchResults .author-works-note {
  color: var(--ds-text-muted);
  font-size: var(--ds-text-caption);
}

/* #419 小说推荐：默认小说页没搜索时，#searchResults 顶部的标题行。
   卡片沿用 .result-card，滚动方式和搜索结果一样：电脑上列表自己滚，
   手机上随整页滚（424badb），这里不加任何 overflow。 */
.discover-search-panel .novel-recommend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-3);
  padding: var(--ds-space-1) var(--ds-space-1) var(--ds-space-2);
}

.discover-search-panel .novel-recommend-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.discover-search-panel .novel-recommend-title {
  color: var(--ds-text);
  font-size: var(--ds-text-title-sm);
  font-weight: var(--ds-weight-strong);
}

.discover-search-panel .novel-recommend-source {
  overflow: hidden;
  color: var(--ds-text-muted);
  font-size: var(--ds-text-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discover-search-panel .novel-recommend-refresh {
  flex: 0 0 auto;
  min-height: var(--ds-control-sm);
  padding: 0 var(--ds-space-3);
}

.discover-search-panel .novel-recommend-head ~ .page-state {
  grid-column: 1 / -1;
}

/* 手机：两个入口平分一行，触控高度 44px。 */
@media (max-width: 720px) {
  body.mobile-shell .discover-search-panel .discover-tools > button {
    flex: 1 1 0;
    min-width: 0;
    min-height: var(--ds-control-touch);
  }

  body.mobile-shell .discover-search-panel .search-mode-toggle {
    flex: 1 1 0;
    min-height: var(--ds-control-touch);
  }

  body.mobile-shell .discover-search-panel .novel-recommend-refresh {
    min-height: var(--ds-control-touch);
  }

  body.mobile-shell .discover-search-panel .novel-recommend-source {
    white-space: normal;
  }
}
