/* 资料下载中心 — 左栏 + 搜索横幅 + 资源列表 */

.page-resources-download {
  --download-hero-start: #ffb088;
  --download-hero-end: var(--primary-dark);
  --download-row-min-h: 90px;
  font-size: 16px;
}

.page-resources-download .header-main--simple .header-main-inner {
  justify-content: space-between;
}

.page-resources-download .page-wrap {
  background: var(--bg-page);
  padding-top: 16px;
}

.download-center {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 40px;
  box-sizing: border-box;
}

.download-center-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* 左侧导航 — 固定高度，子菜单浮在卡片外 */
.download-sidebar-wrap {
  position: relative;
  align-self: start;
  width: 100%;
}

.download-sidebar {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 272px;
  box-sizing: border-box;
  background: var(--primary);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.12);
}

.download-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 10px 0 12px;
  list-style: none;
  box-sizing: border-box;
  min-height: 0;
}

.download-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}

.download-nav-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}

.download-nav-link {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0 12px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 17px;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  box-sizing: border-box;
}

.download-nav-expand {
  padding: 0 12px;
}

.download-nav-expand .download-nav-label {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}

.download-nav-link:hover,
.download-nav-link.is-active {
  background: rgba(255, 255, 255, 0.4);
  color: #fff;
  font-weight: 600;
}

.download-nav-group.is-expanded > .download-nav-expand {
  background: rgba(255, 255, 255, 0.4);
  color: #fff;
  font-weight: 600;
}

.download-nav .nav-arrow-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
  opacity: 1;
}

.download-nav-expand .nav-arrow-icon--expand {
  transition: transform 0.2s ease;
}

.download-nav-group.is-expanded .nav-arrow-icon--expand {
  transform: translateY(-50%) rotate(90deg);
}

/* 展开层：浮在卡片下方，无整体背景框，仅保留各 pill 按钮 */
.download-sidebar-wrap .download-nav-sub {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 30;
  margin: 0;
  padding: 8px 0 0;
  list-style: none;
  background: transparent;
  border: none;
  box-shadow: none;
  box-sizing: border-box;
}

.download-nav-sub li {
  margin: 0;
}

.download-nav-sub li + li {
  margin-top: 8px;
}

.download-nav-sublink {
  display: block;
  padding: 10px 8px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  background: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.12);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.download-nav-sublink:hover {
  background: var(--primary-bg);
  color: var(--primary-dark);
}

.download-nav-sublink.is-active {
  background: rgba(255, 107, 53, 0.22);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(255, 107, 53, 0.2);
}

/* 右侧主区 */
.download-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.download-panel {
  display: none;
  flex-direction: column;
  flex: 1;
}

.download-panel.is-active {
  display: flex;
}

/* 顶部横幅（背景图见 assets/icons/） */
.download-hero {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(135deg, var(--download-hero-start) 0%, var(--primary) 55%, var(--download-hero-end) 100%);
  overflow: hidden;
  min-height: 188px;
}

.download-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.download-hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  padding: 28px 56px 28px 24px;
  box-sizing: border-box;
}

.download-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  width: min(100%, 440px);
  height: 48px;
  margin: 0;
  padding: 0 6px 0 16px;
  background: #fff;
  border: none;
  border-radius: 24px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.14),
    0 0 0 4px rgba(255, 255, 255, 0.75);
  box-sizing: border-box;
}

.download-search-form input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  padding: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  outline: none;
}

.download-search-form input::placeholder {
  color: #888;
}

.download-search-btn {
  flex-shrink: 0;
  height: 36px;
  min-width: 72px;
  padding: 0 20px;
  border: none;
  border-radius: 18px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.download-search-btn:hover {
  background: var(--primary-dark);
}

/* 资源列表 */
.download-list-wrap {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 8px 0 16px;
}

.download-list-wrap--zebra {
  padding: 0;
}

.download-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.download-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.download-list-item:last-child {
  border-bottom: none;
}

.download-list-item:hover {
  background: #fafafa;
}

.download-list-wrap--zebra .download-list-item {
  min-height: var(--download-row-min-h);
  align-items: center;
  box-sizing: border-box;
  border-bottom: none;
  padding-left: 16px;
  padding-right: 12px;
}

.download-list-wrap--zebra .download-list-item:nth-child(odd) {
  background: #fff;
}

.download-list-wrap--zebra .download-list-item:nth-child(even) {
  background: #f5f5f5;
}

.download-list-wrap--zebra .download-list-item:hover {
  background: #fff8f5;
}

.download-list-wrap--zebra .download-list-action {
  margin-top: 0;
}

.download-list-info {
  flex: 1;
  min-width: 0;
}

.download-list-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}

.download-list-meta {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.download-panel[data-download-section="book"] .download-list-meta {
  color: #666666;
  line-height: 1.5;
  white-space: nowrap;
}

/* 推荐书目 — 斑马纹目录列表 */
.download-catalog-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.download-catalog-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--download-row-min-h);
  box-sizing: border-box;
}

.download-catalog-item:nth-child(odd) {
  background: #fff;
}

.download-catalog-item:nth-child(even) {
  background: #f5f5f5;
}

.download-catalog-item .download-list-action {
  flex-shrink: 0;
  margin: 0 24px 0 0;
}

.download-catalog-link {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  min-height: var(--download-row-min-h);
  padding: 16px 0 16px 24px;
  box-sizing: border-box;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: #333;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.download-catalog-link:hover {
  color: var(--primary);
}

.download-catalog-item:hover {
  background: #fff8f5;
}

/* 推书物料 — 单本 / 系列（统一字号 + 斑马纹） */
.download-promo-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.download-promo-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 10px;
  min-height: var(--download-row-min-h);
  padding: 16px 24px;
  box-sizing: border-box;
}

.download-promo-item .download-list-action {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  justify-self: end;
  margin-top: 0;
}

.download-promo-item--series-head {
  grid-template-rows: auto;
}

.download-promo-item--series-head .download-promo-series-name {
  grid-column: 1;
  grid-row: 1;
}

.download-promo-item:nth-child(odd) {
  background: #fff;
}

.download-promo-item:nth-child(even) {
  background: #f5f5f5;
}

.download-promo-item:hover {
  background: #fff8f5;
}

.download-promo-title,
.download-promo-series-name,
.download-promo-meta {
  font-size: 15px;
  line-height: 1.55;
}

.download-promo-title {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-weight: 600;
  color: #333;
}

.download-promo-series-name {
  margin: 0;
  font-weight: 700;
  color: #333;
}

.download-promo-meta {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  font-weight: 400;
  color: #666666;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 48px;
}

.download-promo-meta span {
  white-space: nowrap;
}

.download-list-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-top: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.download-list-action:hover {
  background: var(--primary-bg);
}

.download-list-action img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.download-empty,
.download-search-empty {
  padding: 56px 24px 64px;
  text-align: center;
}

.download-search-empty[hidden] {
  display: none !important;
}

.download-search-empty-icon {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 16px;
  opacity: 0.88;
}

.download-search-empty-text {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.download-list-wrap ul[hidden] {
  display: none !important;
}

@media (max-width: 992px) {
  .page-resources-download .page-wrap {
    padding-top: 0;
  }

  .download-center {
    padding: 14px 12px 24px;
    max-width: 100%;
    overflow-x: hidden;
  }

  .download-center-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .download-sidebar-wrap {
    width: 100%;
    min-width: 0;
  }

  .download-sidebar {
    height: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
    overflow: hidden;
  }

  .download-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-padding-inline: 12px;
    scrollbar-width: none;
  }

  .download-nav::-webkit-scrollbar {
    display: none;
  }

  .download-nav-item,
  .download-nav-group {
    flex: 0 0 auto;
  }

  .download-nav-link,
  .download-nav-expand {
    flex: 0 0 auto;
    justify-content: center;
    width: auto;
    min-height: 44px;
    padding: 8px 14px;
    margin: 0;
    border: none;
    border-right: 1px solid var(--border);
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    background: #fff;
  }

  .download-nav-link:last-child,
  .download-nav-item:last-child .download-nav-link {
    border-right: none;
  }

  .download-nav-link:hover,
  .download-nav-link.is-active,
  .download-nav-group.is-expanded > .download-nav-expand {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
    border-bottom-color: var(--primary);
  }

  .download-nav .nav-arrow-icon {
    display: none;
  }

  .download-nav-sub {
    padding: 8px 0 0;
  }

  .download-main {
    min-width: 0;
  }

  .download-hero {
    min-height: 118px;
    align-items: stretch;
    border-radius: 8px 8px 0 0;
  }

  .download-hero-inner {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    flex: 1;
    padding: 22px 14px 12px;
    box-sizing: border-box;
  }

  .download-search-form {
    width: 100%;
    max-width: none;
    height: 36px;
    padding: 0 4px 0 12px;
    border-radius: 18px;
    box-shadow:
      0 2px 10px rgba(0, 0, 0, 0.1),
      0 0 0 3px rgba(255, 255, 255, 0.75);
  }

  .download-search-form input {
    font-size: 14px;
  }

  .download-search-btn {
    height: 28px;
    min-width: 56px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 14px;
  }

  .download-list-item {
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 14px;
  }

  .download-list-wrap--zebra .download-list-item {
    padding: 12px 12px 12px 14px;
  }

  .download-list-action {
    align-self: center;
    margin-top: 0;
    width: 36px;
    height: 36px;
  }

  .download-list-action img {
    width: 24px;
    height: 24px;
  }

  .download-list-title {
    margin-bottom: 4px;
    font-size: 15px;
    text-align: left;
  }

  .download-list-meta {
    text-align: left;
  }

  .download-panel[data-download-section="book"] .download-list-meta {
    white-space: normal;
  }

  .download-catalog-item {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 0;
  }

  .download-catalog-link {
    padding: 12px 0 12px 14px;
    font-size: 14px;
  }

  .download-catalog-item .download-list-action {
    margin: 0 12px 0 0;
  }

  .download-promo-meta {
    gap: 8px 20px;
  }
}

@media (max-width: 768px) {
  .download-center {
    padding: 12px 12px 20px;
  }

  .download-center-layout {
    gap: 10px;
  }

  .download-hero {
    min-height: 108px;
  }

  .download-hero-inner {
    padding: 20px 12px 10px;
  }

  .download-search-form {
    height: 34px;
    padding: 0 3px 0 10px;
    border-radius: 17px;
  }

  .download-search-form input {
    font-size: 14px;
  }

  .download-search-btn {
    height: 26px;
    min-width: 52px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 13px;
  }

  .download-list-item {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 11px 10px 11px 12px;
  }

  .download-list-wrap--zebra .download-list-item {
    padding: 11px 10px 11px 12px;
  }

  .download-list-info {
    flex: 1;
    min-width: 0;
    text-align: left;
  }

  .download-list-action {
    align-self: center;
    flex-shrink: 0;
    margin-top: 0;
    width: 34px;
    height: 34px;
  }

  .download-list-title {
    font-size: 14px;
    margin-bottom: 3px;
  }

  .download-list-meta {
    font-size: 12px;
    line-height: 1.5;
  }

  .download-catalog-link {
    padding: 11px 0 11px 12px;
    font-size: 14px;
  }

  .download-catalog-item .download-list-action {
    margin: 0 10px 0 0;
  }

  .download-catalog-item .download-list-info {
    width: auto;
  }
}
