﻿/* 数字教材列表页样式（设计稿：dbook-docs\renyou\css\style.css）
   类名统一加 dbook- 前缀，避免与 bootstrap / ptp.css 冲突 */

/* 页面整体底色改灰（body 背景会外扩到整个画布，短页面也不露白）。
   本文件只在 /dbook 页加载；导航主栏 .head 在 ptp.css 自带白底不受影响，
   顶部登录条 .head-login 无自带背景，显式补白底保持原观感 */
body {
  background: #f5f5f5;
}

.head-login {
  background: #fff;
}

/* .head 原有 margin-top:6px 在灰底上会露出一条灰缝，导航区需与原来一致保持全白：
   6px 间距改由 .head-login 的白底 padding 提供（总高不变，仅换底色） */
@media only screen and (min-width: 768px) {
  .head-login {
    padding-bottom: 6px;
  }

  .head {
    margin-top: 0;
  }
}

.dbook-main {
  padding-top: 36px;
  padding-bottom: 60px;
}

/* :where 让重置规则零权重，组件类（如 .dbook-book-title 的 margin-bottom）不被它压住 */
.dbook-main :where(h2, p, ul, li) {
  margin: 0;
  padding: 0;
}

.dbook-main ul {
  list-style: none;
}

/* 只重置搜索输入框；不要全局重置 button，否则会以更高优先级盖掉确认/重置按钮的底色 */
.dbook-filter-search input {
  font: inherit;
  border: none;
  outline: none;
  background: none;
}

/* :where 让通用链接规则零权重，组件类（按钮/分页等）的颜色不被它压住 */
.dbook-main :where(a) {
  text-decoration: none;
  color: inherit;
}

.dbook-main a:hover {
  text-decoration: none;
}

/* Hero：设计稿 2093×386 全宽 banner，负 margin 收紧头部下方空隙（头部 margin-bottom 30px + 1px 边框） */
.dbook-hero {
  width: 100%;
  line-height: 0;
  background: #0a2d5c;
  animation: dbookFadeIn 0.5s ease;
  margin-top: -31px;
}

.dbook-hero img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  aspect-ratio: 2093 / 386;
}

/* 标题 */
.dbook-title {
  text-align: center;
  margin-bottom: 28px;
}

.dbook-title h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  color: #1a1a1a;
}

.dbook-title-line {
  display: block;
  width: 70px;
  height: 6px;
  background: linear-gradient(90deg, #0148BE 0%, #32CAE1 100%);
  margin: 10px auto 0;
}

/* 筛选条 — 白底青绿描边 */
.dbook-filter-bar {
  position: relative;
  background: #F8FAFC;
  border-radius: 3px;
  border: 2px solid #2CB590;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  margin-bottom: 18px;
}

.dbook-filter-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dbook-filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  user-select: none;
  white-space: nowrap;
}

.dbook-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 50px;
  width: 150px;
  padding: 0 20px;
  box-sizing: border-box;
  border-radius: 3px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  box-shadow: 0px 4px 10px 0px #0000001A;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s, color 0.2s;
}

.dbook-filter-item:hover,
.dbook-filter-item.open,
.dbook-filter-item.active {
  border-color: #2CB590;
  color: #2CB590;
}

.dbook-filter-icon {
  width: 30px;
  height: 30px;
  color: #333333;
}

.dbook-caret {
  color: #999;
  transition: transform 0.2s, color 0.2s;
}

.dbook-filter-item.open .dbook-caret,
.dbook-filter-item.active .dbook-caret {
  color: #2CB590;
}

.dbook-filter-item.open .dbook-caret {
  transform: rotate(180deg);
}

/* 触发按钮选中态（服务端渲染 .active）：文本换所选节点名，× 一键清除替代 caret */
.dbook-filter-item.active .dbook-caret {
  display: none;
}

.dbook-filter-item-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbook-filter-clear {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  font-size: 14px;
  color: #2CB590;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.dbook-filter-clear:hover {
  background: #eef6f3;
  color: #26a883;
}

.dbook-filter-search {
  display: flex;
  align-items: center;
  width: 270px;
  height: 50px;
  border: 1px solid #e0e3e8;
  border-radius: 3px;
  padding: 16px 20px;
  background: #fff;
  transition: border-color 0.2s;
}

.dbook-filter-search:focus-within {
  border-color: #2CB590;
}

.dbook-filter-search input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #333;
}

.dbook-filter-search input::placeholder {
  color: #bbb;
}

.dbook-filter-search-btn {
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  font: inherit;
  color: #999;
  cursor: pointer;
  display: flex;
  padding: 0;
  /* 放大镜与后方输入文字留出间距 */
  margin-right: 8px;
  flex-shrink: 0;
}

.dbook-filter-search-btn:hover {
  color: #2CB590;
}

/* 关键词输入有值时外显的一键清除（设计稿 .filter-search-clear；显式清底色/边框，本页不做全局 button 重置） */
.dbook-filter-search-clear {
  display: none;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: #c5c5c5;
  cursor: pointer;
}

.dbook-filter-search-clear.is-on {
  display: flex;
}

.dbook-filter-search-clear:hover {
  color: #999;
}

/* 分类面板：left 由 JS 对齐到当前筛选项中心 */
.dbook-category-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 520px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0px 0px 15px 0px #00000026;
  z-index: 50;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.dbook-category-panel.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dbook-category-panel-body {
  display: flex;
  min-height: 460px;
  max-height: 660px;
}

.dbook-category-main {
  width: 260px;
  background: #fff;
  overflow-y: auto;
  padding: 10px 0;
  flex-shrink: 0;
}

.dbook-category-right {
  flex: 1;
  /* 右侧留白收窄，让子分类滚动条更贴近面板右缘 */
  padding: 10px 4px 10px 36px;
  display: flex;
  flex-direction: column;
  background: #F5F8FB;
}

.dbook-category-main li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 30px;
  font-size: 14px;
  color: #444;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.dbook-category-main li.dbook-cat-all {
  color: #333;
  font-weight: 600;
}

.dbook-category-main li.dbook-cat-all.active,
.dbook-category-main li.dbook-cat-all.active:hover,
.dbook-category-main li.active .dbook-cat-name {
  color: #2CB590;
}

.dbook-category-main li:hover {
  background: #eef6f3;
}

.dbook-category-main li.current,
.dbook-category-main li.dbook-cat-all.active {
  background: #F5F8FB;
  font-weight: 700;
}

.dbook-cat-check {
  margin-left: auto;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.dbook-category-main li.active .dbook-cat-check::before,
.dbook-category-sub li.active .dbook-cat-check::before {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  margin: 1px auto 0;
  border: solid #2CB590;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.dbook-category-main li.checked .dbook-cat-name {
  color: #2CB590;
}

.dbook-category-main .dbook-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 4px solid transparent;
  box-sizing: border-box;
}

.dbook-category-main .dbook-cat-name {
  flex: 1;
  min-width: 0;
}

.dbook-category-sub {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
  background: #f7f8fa;
  min-height: 0;
}

.dbook-category-sub li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  font-size: 14px;
  color: #555;
  cursor: pointer;
  transition: color 0.15s;
}

.dbook-category-sub li:hover {
  color: #2CB590;
}

.dbook-category-sub li.active {
  color: #2CB590;
  font-weight: 600;
  background: transparent;
}

/* 排序条 */
.dbook-sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 4px;
}

.dbook-sort-options {
  display: flex;
  gap: 28px;
}

.dbook-sort-item {
  font: inherit;
  font-size: 14px;
  color: #666;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.dbook-sort-item:hover {
  color: #2CB590;
}

.dbook-sort-item.active {
  color: #2CB590;
  font-weight: 700;
}

.dbook-sort-total {
  font-size: 13px;
  color: #888;
}

.dbook-sort-total span {
  color: #2CB590;
  font-weight: 600;
}

/* 教材卡片栅格 */
.dbook-book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 36px;
}

.dbook-book-card {
  position: relative;
  min-width: 0; /* grid 项默认 min-width:auto，书名单行 nowrap 会把列撑爆出横向滚动条 */
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 24px;
  display: flex;
  gap: 16px;
  transition: box-shadow 0.25s, transform 0.25s;
  animation: dbookCardIn 0.35s ease both;
  background: #fff url(../img/dbook/bg.png) -7px center / auto 101% no-repeat;
}

.dbook-book-grid .dbook-book-card:nth-child(2) { animation-delay: 0.04s; }
.dbook-book-grid .dbook-book-card:nth-child(3) { animation-delay: 0.08s; }
.dbook-book-grid .dbook-book-card:nth-child(4) { animation-delay: 0.12s; }
.dbook-book-grid .dbook-book-card:nth-child(5) { animation-delay: 0.16s; }
.dbook-book-grid .dbook-book-card:nth-child(6) { animation-delay: 0.2s; }

.dbook-book-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}

/* 封面容器：角标叠在封面上 */
.dbook-cover-wrap {
  position: relative;
  flex-shrink: 0;
  width: 105px;
  height: 150px;
}

.dbook-cover-wrap > a {
  display: block;
  width: 100%;
  height: 100%;
}

/* 数字教材标识：蓝青渐变 + 右侧圆角 + 左下折角 */
.dbook-book-badge {
  position: absolute;
  top: 14px;
  left: -8px;
  z-index: 2;
  width: 76px;
  height: 25px;
  text-align: center;
  background: linear-gradient(270deg, #32CAE1 0%, #0148BE 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 25px;
  white-space: nowrap;
  border-radius: 0 30px 30px 0;
  box-shadow: 0 2px 6px rgba(1, 72, 190, 0.28);
  pointer-events: none;
}

.dbook-book-badge::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -7px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 6px 6px 0;
  border-color: transparent #003589 transparent transparent;
}

/* 封面：外链图片（缺失时视图层回退 qldbook 默认封面地址） */
.dbook-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.dbook-book-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dbook-book-title {
  font-size: 16px;
  color: #333333;
  line-height: 22px;
  height: 44px;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbook-book-meta {
  font-size: 12px;
  color: #666;
  line-height: 1.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dbook-book-footer {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
}

.dbook-book-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.dbook-book-price .sale {
  font-size: 16px;
  color: #e60012;
}

.dbook-book-price .origin {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
}

.dbook-detail-btn {
  flex-shrink: 0;
  height: 30px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #FC9143 0%, #FC7020 30%, #FB3B16 70%, #FB1016 100%);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.15s;
  display: inline-block;
  line-height: 30px;
}

.dbook-detail-btn:hover {
  opacity: 0.92;
  color: #fff;
}

.dbook-detail-btn:active {
  transform: scale(0.97);
}

/* 分页 — 当前页绿下划线，可点击的翻页按钮为绿圆 */
.dbook-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.dbook-page-btn {
  min-width: 28px;
  height: 32px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0 4px;
  position: relative;
  transition: color 0.2s;
  text-decoration: none;
}

.dbook-page-btn:hover:not(.disabled):not(.active) {
  color: #2CB590;
  text-decoration: none;
}

.dbook-page-btn.active {
  color: #2CB590;
  font-weight: 600;
  background: transparent;
}

.dbook-page-btn.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 14px;
  height: 2px;
  background: #2CB590;
  border-radius: 1px;
}

.dbook-page-btn[data-page="prev"],
.dbook-page-btn[data-page="next"] {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

/* ‹ › 字形在其字框内偏上，微调使视觉垂直居中 */
.dbook-page-btn[data-page="prev"],
.dbook-page-btn[data-page="next"] {
  padding-bottom: 2px;
}

.dbook-page-btn[data-page="prev"]:not(.disabled),
.dbook-page-btn[data-page="next"]:not(.disabled) {
  background: #2CB590;
  color: #fff;
}

.dbook-page-btn[data-page="prev"]:hover:not(.disabled),
.dbook-page-btn[data-page="next"]:hover:not(.disabled) {
  color: #fff;
}

.dbook-page-btn[data-page="prev"].disabled,
.dbook-page-btn[data-page="next"].disabled {
  background: #e8e8e8;
  color: #bbb;
}

.dbook-page-btn.disabled {
  cursor: not-allowed;
}

.dbook-page-ellipsis {
  color: #999;
  font-size: 14px;
  padding: 0 2px;
}

/* 空列表提示 */
.dbook-empty {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 60px 0;
}

@keyframes dbookFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dbookCardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== 响应式布局变形（PC 窗口较窄时） ========== */

/* < 1200：教材卡片收紧 */
@media (max-width: 1199px) {
  .dbook-book-grid {
    gap: 16px;
  }

  .dbook-book-card {
    padding: 16px 14px 14px;
    gap: 12px;
  }

  .dbook-cover-wrap {
    width: 88px;
    height: 124px;
  }

  .dbook-category-panel {
    width: 460px;
  }
}

/* < 992：筛选换行、教材两列 */
@media (max-width: 991px) {
  .dbook-main {
    padding-top: 28px;
    padding-bottom: 48px;
  }

  .dbook-title h2 {
    font-size: 22px;
  }

  .dbook-filter-bar {
    height: auto;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }

  .dbook-filter-left {
    flex: 1;
    flex-wrap: wrap;
    min-width: 0;
  }

  .dbook-filter-search {
    width: 100%;
  }

  .dbook-category-panel {
    width: 100%;
  }

  .dbook-category-main {
    width: 150px;
  }

  .dbook-book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}
