/* 图书模块 — 搜索区 + 左分类树 + 主内容区（对齐 bookHome 布局） */

.page-book-home .header-main--simple .header-search--compact,
.page-books .header-main--simple .header-search--compact,
.page-book-detail .header-main--simple .header-search--compact {
  display: none;
}

.page-book-home .header-main--simple .header-main-inner,
.page-books .header-main--simple .header-main-inner,
.page-book-detail .header-main--simple .header-main-inner {
  justify-content: space-between;
}

.page-book-home .main-content,
.page-books .main-content.book-home-page,
.page-books .main-content.books-page {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 40px;
  box-sizing: border-box;
}

/* —— 搜索条 —— */
.book-search-zone {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: none;
}

.book-search-title {
  flex-shrink: 0;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  line-height: 1;
}

.book-search-title .title-cn {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 2px;
}

.book-search-title .title-en {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  opacity: 0.42;
  letter-spacing: 2px;
}

.book-search-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.book-search-field {
  flex: 1;
  min-width: 0;
  position: relative;
}

.book-search-form input {
  width: 100%;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0 40px 0 16px;
  font-size: 16px;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.book-search-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.12);
}

.book-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
}

.book-search-clear img {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.book-search-clear[hidden] {
  display: none !important;
}

.book-search-btns {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.book-search-form .btn-search-main,
.book-search-form .btn-search-brief {
  height: 36px;
  padding: 0 22px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.book-search-form .btn-search-main {
  background: var(--primary);
}

.book-search-form .btn-search-main:hover {
  background: var(--primary-dark);
}

.book-search-form .btn-search-brief {
  background: var(--primary-light);
}

.book-search-form .btn-search-brief:hover {
  background: var(--primary);
}

/* —— 左分类 + 右主区 —— */
.book-portal-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  width: 100%;
  background: #f0f0f0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  min-height: 520px;
  box-sizing: border-box;
}

.book-category-sidebar {
  background: #f5f5f5;
  border-right: 1px solid var(--border);
  padding: 0;
  overflow-y: auto;
  max-height: 720px;
}

.book-cat-group {
  border-bottom: 1px solid #ebebeb;
}

.book-cat-l1 {
  display: block;
  width: 100%;
  padding: 12px 10px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.book-cat-l1:hover,
.book-cat-l1.is-open {
  color: var(--primary);
  background: rgba(255, 107, 53, 0.06);
}

.book-cat-l1.is-active {
  color: var(--primary);
  background: #fff;
}

.book-cat-sub {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  background: #fafafa;
}

.book-cat-group.is-open .book-cat-sub {
  display: block;
}

.book-cat-l2 > a {
  display: block;
  padding: 6px 12px 6px 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.book-cat-l2 > a:hover,
.book-cat-l2 > a.is-active {
  color: var(--primary);
}

.book-cat-l3 {
  list-style: none;
  margin: 0;
  padding: 0;
}

.book-cat-l3 a {
  display: block;
  padding: 4px 12px 4px 28px;
  font-size: 13px;
  color: var(--text-muted);
}

.book-cat-l3 a:hover {
  color: var(--primary);
}

.book-portal-main {
  background: #fff;
  padding: 16px 24px 28px;
  min-width: 0;
  box-sizing: border-box;
}

.book-quick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}

.book-quick-bar a {
  font-size: 16px;
  color: var(--text-secondary);
}

.book-quick-bar a:hover {
  color: var(--primary);
}

.book-section {
  margin-bottom: 28px;
}

.book-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.book-section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.book-section-head a {
  font-size: 14px;
  color: var(--text-muted);
}

.book-section-head a:hover {
  color: var(--primary);
}

/* 书目卡片网格 */
.book-grid-portal {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px 14px;
}

.book-card-portal {
  display: block;
  color: inherit;
  transition: transform 0.15s;
}

.book-card-portal:hover {
  color: inherit;
  transform: translateY(-2px);
}

.book-card-portal .cover {
  aspect-ratio: 3 / 4;
  background: #eee;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.book-card-portal .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-card-portal h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: normal;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}

.book-card-portal .author {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.series-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.series-tabs button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #fafafa;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.series-tabs button:hover {
  border-color: var(--primary-border);
  color: var(--primary);
}

.series-tabs button.is-active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 1200px) {
  .book-grid-portal {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .book-portal-layout {
    grid-template-columns: 1fr;
  }

  .book-category-sidebar {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .book-grid-portal {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .book-search-zone {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .book-search-btns {
    width: 100%;
  }

  .book-search-form .btn-search-main,
  .book-search-form .btn-search-brief {
    flex: 1;
    padding: 0 12px;
  }

  .book-portal-main {
    padding: 12px 16px 20px;
  }

  .book-grid-portal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
