/* ============================================================
   闪得 需求广场筛选列表 - 作用域样式（复刻 demand-plaza.css）
   句柄: shande-dp-filter
   ============================================================ */

.shande-dp-filter .dp-filter {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(17, 24, 39, 0.06);
  padding: 16px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}
.shande-dp-filter .dp-filter__row {
  flex: 1 1 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.shande-dp-filter .dp-filter__row:last-child { border-bottom: none; }
.shande-dp-filter .dp-filter__row--bottom { align-items: center; justify-content: space-between; }
.shande-dp-filter .dp-filter__label {
  flex-shrink: 0;
  font-size: 14px;
  color: #4b5563;
  font-weight: 600;
  padding-top: 4px;
}
.shande-dp-filter .dp-filter__row--bottom .dp-filter__label { padding-top: 0; }
.shande-dp-filter .dp-filter__tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.shande-dp-filter .dp-filter__tab {
  font-size: 14px;
  color: #4b5563;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.shande-dp-filter .dp-filter__tab:hover { background: #eff6ff; color: #096ddd; }
.shande-dp-filter .dp-filter__tab.is-active { background: #096ddd; color: #fff; font-weight: 600; }
.shande-dp-filter .dp-filter__sort-group { display: flex; align-items: center; gap: 18px; }
.shande-dp-filter .dp-filter__sort-item {
  font-size: 14px;
  color: #86909c;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}
.shande-dp-filter .dp-filter__sort-item:hover { color: #096ddd; }
.shande-dp-filter .dp-filter__sort-item.is-active { color: #096ddd; font-weight: 600; }
.shande-dp-filter .dp-filter__sort-item.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: #096ddd;
  border-radius: 2px;
}
.shande-dp-filter .dp-filter__right { display: flex; align-items: center; gap: 16px; }
.shande-dp-filter .dp-filter__only-wait {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
}
/*
 * 开关。
 *
 * checkbox 用「绝对定位 + 尺寸 1px」隐藏，而不是 display:none 或
 * visibility:hidden —— 后两者会让元素从无障碍树里消失，键盘 Tab 也
 * 聚焦不到，等于把开关变成只有鼠标能用。
 */
.shande-dp-filter .dp-filter__only-wait-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.shande-dp-filter .dp-filter__switch {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #d5dae1;
  transition: background 0.2s;
}
.shande-dp-filter .dp-filter__switch-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
  transition: transform 0.2s;
}
/* 开启：轨道变主色、滑块右移 */
.shande-dp-filter .dp-filter__only-wait-input:checked + .dp-filter__switch {
  background: #096ddd;
}
.shande-dp-filter .dp-filter__only-wait-input:checked + .dp-filter__switch .dp-filter__switch-dot {
  transform: translateX(16px);
}
/* 键盘聚焦给光环，鼠标点击不显示（:focus-visible 语义） */
.shande-dp-filter .dp-filter__only-wait-input:focus-visible + .dp-filter__switch {
  box-shadow: 0 0 0 3px rgba(9, 109, 221, 0.28);
}
.shande-dp-filter .dp-filter__only-wait:hover .dp-filter__switch { background: #c3cad3; }
.shande-dp-filter .dp-filter__only-wait:hover .dp-filter__only-wait-input:checked + .dp-filter__switch { background: #0857b0; }
/* 开启后文字也变主色，状态更明确 */
.shande-dp-filter .dp-filter__only-wait-input:checked ~ .dp-filter__only-wait-text {
  color: #096ddd;
  font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
  .shande-dp-filter .dp-filter__switch,
  .shande-dp-filter .dp-filter__switch-dot { transition: none; }
}

/* 视图切换 */
.shande-dp-filter .dp-view-switch { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 3px; gap: 2px; flex-shrink: 0; }
.shande-dp-filter .dp-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #86909c;
  border-radius: 6px;
  cursor: pointer;
  line-height: 0;
  box-shadow: none;
  transition: all 0.2s ease;
}
.shande-dp-filter .dp-view-btn svg { width: 16px; height: 16px; display: block; }
.shande-dp-filter .dp-view-btn:hover { color: #096ddd; background: transparent; }
.shande-dp-filter .dp-view-btn.is-active { background: #fff; color: #096ddd; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1); }

/* 表格 */
.shande-dp-filter .dp-table-wrap { background: #fff; border-radius: 14px; box-shadow: 0 6px 24px rgba(17, 24, 39, 0.06); overflow-x: auto; -webkit-overflow-scrolling: touch; }
/*
 * 描述与状态两列各收窄 30px，min-width 从 1100 相应降到 1040。
 * 这个值是「不出横向滚动的最小可读宽度」，不等于各列 width 之和：
 * auto 布局下 th 的 width 只是建议值，真实宽度由内容与可用空间协商。
 */
.shande-dp-filter .dp-table { width: 100%; border-collapse: collapse; min-width: 1040px; margin: 0; background: transparent; }
/* 清除主题(Astra/WP)默认表格边框 */
.shande-dp-filter .dp-table,
.shande-dp-filter .dp-table th,
.shande-dp-filter .dp-table td,
.shande-dp-filter .dp-table tr {
  border: 0 !important;
  background-image: none !important;
  box-shadow: none !important;
}
.shande-dp-filter .dp-table thead th {
  /* 内容一律左对齐：居中在长短不一的中文里显得散，左对齐才有列的边界感 */
  text-align: left !important;
  padding: 14px 10px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #86909c !important;
  background: #f8fafc !important;
  white-space: nowrap;
  border: 0 !important;
}
.shande-dp-filter .dp-table tbody td {
  padding: 14px 10px !important;
  color: #4b5563;
  font-size: 13px;
  border: 0 !important;
  border-bottom: 1px solid #f1f5f9 !important;
  text-align: left;
  background: transparent !important;
}
/*
 * 首尾列留出边距。
 *
 * 单元格统一 10px 横向内边距，第一列文字就紧贴卡片圆角，
 * 最后一列的按钮也顶到右边缘。这里单独给首尾列加到 20px，
 * 与 .dp-table-wrap 的圆角留出呼吸。
 * 写在 th / td 上而不是给 .dp-table 加 padding：
 * 表格的 padding 会把 thead 的灰底一起缩进，露出白边。
 */
.shande-dp-filter .dp-table thead th:first-child,
.shande-dp-filter .dp-table tbody td:first-child { padding-left: 20px !important; }
.shande-dp-filter .dp-table thead th:last-child,
.shande-dp-filter .dp-table tbody td:last-child { padding-right: 20px !important; }
/*
 * 整行可点（点任意位置弹详情，见 shande-dp-list.js）。
 * 给手型光标，否则用户不知道这里能点。
 * 骨架屏期间不给手型：那时点了没有意义。
 */
.shande-dp-filter .dp-table tbody tr { cursor: pointer; }
.shande-dp-filter.is-loading .dp-table tbody tr { cursor: default; }
.shande-dp-filter .dp-table tbody tr:hover { background: #f8fafc; }
/* 卡片同理 */
.shande-dp-filter .dp-demand-card { cursor: pointer; }
.shande-dp-filter.is-loading .dp-demand-card { cursor: default; }
.shande-dp-filter .dp-table tbody tr:last-child td { border-bottom: 0 !important; }
/*
 * 编号与标题：不加粗，字号与摘要一致（12px）。
 * 原来标题 600 + 13px、编号 600 + 12px，一行里三种字重两种字号，
 * 视觉重心全在左侧，右边的预算与状态反而被压下去。
 */
.shande-dp-filter .dp-td-no { font-weight: 400; color: #86909c; font-size: 12px; }
.shande-dp-filter .dp-td-title {
  font-weight: 400;
  color: #1e293b;
  font-size: 12px;
  line-height: 1.6;
}
/* 标题同样限一行：auto 布局下长标题会把这一列顶宽，挤压右边各列 */
.shande-dp-filter .dp-td-title span {
  display: block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shande-dp-filter .dp-td-thumb { display: inline-block; width: 64px; height: 48px; border-radius: 6px; background: #f1f5f9 center/cover no-repeat; border: 1px solid #e2e8f0; }
.shande-dp-filter .dp-td-type { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eff6ff; color: #096ddd; font-size: 12px; white-space: nowrap; }
/*
 * 摘要限一行，超出打省略号。
 *
 * 省略号必须写在 td 里的 span 上，不能直接写在 td：
 * 表格是 auto 布局（.dp-table 只设了 min-width，没有 table-layout:fixed），
 * auto 布局下 td 会被内容撑开，text-overflow 永远不触发。
 * 套一层块级 span 并给 max-width，才有确定的裁剪宽度。
 * span 上带 title，鼠标悬停能看全文。
 */
.shande-dp-filter .dp-td-desc {
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
}
.shande-dp-filter .dp-td-desc span {
  display: block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shande-dp-filter .dp-td-budget { color: #096ddd; font-weight: 600; white-space: nowrap; }
.shande-dp-filter .dp-td-time, .shande-dp-filter .dp-td-deadline { color: #94a3b8; font-size: 12px; white-space: nowrap; }
.shande-dp-filter .dp-count-num { font-size: 12px; color: #64748b; margin-bottom: 6px; white-space: nowrap; }
.shande-dp-filter .dp-count-num strong { color: #096ddd; font-size: 15px; }
.shande-dp-filter .dp-vote-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #096ddd;
  background: #fff;
  color: #096ddd;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.shande-dp-filter .dp-vote-btn:hover { background: #096ddd; color: #fff; }
.shande-dp-filter .dp-vote-btn.voted { border-color: #16a34a; background: #f0fdf4; color: #16a34a; cursor: default; }
/* 状态列收窄到 130px 后加 nowrap，避免「等待制作」被拆成两行 */
.shande-dp-filter .dp-status-link { display: inline-flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; line-height: 1.5; text-decoration: none; white-space: nowrap; }
.shande-dp-filter .dp-status-link--wait { color: #d97706; }
.shande-dp-filter .dp-status-link--done { color: #16a34a; }
.shande-dp-filter .dp-status-link--done em { font-style: normal; font-size: 11px; color: #86909c; font-weight: 400; }
.shande-dp-filter .dp-detail-trigger { font-size: 12px; font-weight: 500; color: #096ddd; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.shande-dp-filter .dp-detail-trigger:hover { color: #0857b0; }
.shande-dp-filter .dp-make-btn {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #096ddd, #49c9e9);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.shande-dp-filter .dp-make-btn:hover { opacity: 0.88; }
.shande-dp-filter .dp-empty { text-align: center; padding: 48px 0; color: #a5adb6; font-size: 14px; }

/* 卡片视图 */
.shande-dp-filter .dp-card-grid { display: none; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.shande-dp-filter.is-card .dp-table-wrap { display: none; }
.shande-dp-filter.is-card .dp-card-grid { display: grid; }
.shande-dp-filter .dp-demand-card {
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.05);
  transition: box-shadow 0.2s, transform 0.2s;
}
.shande-dp-filter .dp-demand-card:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); transform: translateY(-2px); }
.shande-dp-filter .dp-demand-card__top { display: flex; gap: 12px; }
.shande-dp-filter .dp-demand-card__thumb { width: 84px; height: 64px; border-radius: 8px; background: #f1f5f9 center/cover no-repeat; border: 1px solid #e2e8f0; flex-shrink: 0; }
.shande-dp-filter .dp-demand-card__head { flex: 1; min-width: 0; }
.shande-dp-filter .dp-demand-card__no { font-size: 12px; color: #a5adb6; margin-bottom: 4px; }
.shande-dp-filter .dp-demand-card__title { font-size: 14px; font-weight: 600; color: #1d2129; margin-bottom: 6px; }
.shande-dp-filter .dp-demand-card__type { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eff6ff; font-size: 12px; color: #096ddd; }
/* 卡片摘要：截断在 JS 里按字数做，这里只管排版 */
.shande-dp-filter .dp-demand-card__desc {
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
  margin: 10px 0;
}
.shande-dp-filter .dp-demand-card__meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: #94a3b8; margin-bottom: 12px; }
.shande-dp-filter .dp-demand-card__meta strong { color: #096ddd; }
.shande-dp-filter .dp-demand-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

@media (max-width: 768px) {
  .shande-dp-filter .dp-filter__row { flex-direction: column; align-items: flex-start; }
  .shande-dp-filter .dp-filter__row--bottom { flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .shande-dp-filter .dp-card-grid { grid-template-columns: 1fr; }
}


/* 「加载更多」按钮上的转圈用到这两个动画；首屏加载已改用骨架屏 */
@keyframes sd-dp-spin { to { transform: rotate(360deg); } }
@keyframes sd-dp-pulse { 50% { opacity: 0.35; } }

/* 加载更多 */
.shande-dp-filter .dp-more {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.shande-dp-filter .dp-more__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 190px;
  min-height: 44px;
  padding: 12px 30px;
  border-radius: 999px;
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #4b5563;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.shande-dp-filter .dp-more__btn:hover:not(:disabled) {
  border-color: #096ddd;
  color: #096ddd;
  background: #f5f9ff;
}
.shande-dp-filter .dp-more__btn:focus { outline: none; }
.shande-dp-filter .dp-more__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(9, 109, 221, 0.25);
}
.shande-dp-filter .dp-more__btn:disabled { cursor: default; color: #8a94a6; }
/*
 * 加载中的转圈用 ::before 生成，避免 JS 拼 DOM。
 * 之前的实现只把文字换成「加载中」，没有任何视觉反馈。
 */
.shande-dp-filter .dp-more__btn.is-loading::before {
  content: '';
  width: 15px;
  height: 15px;
  border: 2px solid #dbe3ee;
  border-top-color: #096ddd;
  border-radius: 50%;
  animation: sd-dp-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
  .shande-dp-filter .dp-more__btn.is-loading::before { animation: sd-dp-pulse 1.2s ease-in-out infinite; }
}
.shande-dp-filter .dp-more__end {
  text-align: center;
  margin-top: 24px;
  color: #a5adb6;
  font-size: 13px;
}

/* 缩略图缺失时的占位，避免出现碎图 */
.shande-dp-filter .dp-td-thumb--none,
.shande-dp-filter .dp-demand-card__thumb--none {
  background: #f1f5f9;
  border: 1px dashed #dfe6ef;
}

/* 卡片底部操作区 */
.shande-dp-filter .dp-demand-card__ops { display: flex; gap: 8px; align-items: center; }

/* 「我来制作」在已上架时变成「查看产品」，用 a 渲染，需要抹掉下划线 */
.shande-dp-filter .dp-make-btn--view { text-decoration: none; }

/*
 * 需求详情弹窗的样式不在这里。
 * 它统一走 shande-demand-plaza.css 里的 .sd-modal 一套（含进出场动画），
 * 由 window.shandeDemandDetail 渲染；本文件曾另写一份 .dp-modal-mask，
 * 造成同一个「查看需求详情」在两个小部件里长得不一样，已删除。
 */

/*
 * 卡片视图的空状态。
 * .dp-empty-rows 在 .dp-table-wrap 里，卡片模式下整块被隐藏，
 * 所以卡片这边用 ::after 单独出提示，JS 只负责切 is-empty。
 */
.shande-dp-filter.is-card .dp-card-grid.is-empty::after {
  content: '没有符合条件的需求';
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 0;
  color: #a5adb6;
  font-size: 14px;
}

/* 底部规则说明 */
.shande-dp-filter .dp-rules-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 14px 18px;
  background: #f8fafc;
  border-radius: 10px;
  font-size: 13px;
  color: #86909c;
  line-height: 1.7;
}
.shande-dp-filter .dp-rules-note svg { flex-shrink: 0; margin-top: 2px; }
.shande-dp-filter .dp-rules-note .demand-rules-link {
  color: #096ddd;
  text-decoration: none;
}
.shande-dp-filter .dp-rules-note .demand-rules-link:hover { text-decoration: underline; }

/* ============================================================
 * 骨架屏
 *
 * 表格与卡片两套骨架同时铺进各自容器，由 .is-card 决定谁可见，
 * 所以切换视图时看到的是对应视图的骨架，不用重新生成。
 * 骨架元素都是 aria-hidden，加载状态由 .dp-sr-only 的 live region 播报。
 * ============================================================ */
.shande-dp-filter .dp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.shande-dp-filter .dp-sk {
  display: block;
  height: 12px;
  border-radius: 5px;
  background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 37%, #eef1f6 63%);
  background-size: 400% 100%;
  animation: sd-sk-shimmer 1.3s ease-in-out infinite;
}
@keyframes sd-sk-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
/* 尊重「减少动效」：不做扫光，只留静态灰块加轻微呼吸 */
@media (prefers-reduced-motion: reduce) {
  .shande-dp-filter .dp-sk {
    animation: sd-sk-pulse 1.6s ease-in-out infinite;
    background: #eef1f6;
  }
  @keyframes sd-sk-pulse { 50% { opacity: 0.55; } }
}

/* 表格骨架：撑住单元格高度，避免加载时表格塌成一条 */
.shande-dp-filter .dp-sk-row td { padding: 16px 12px; }
/* 缩略图列给个方块，视觉重心和真实行一致 */
.shande-dp-filter .dp-sk-row td:nth-child(3) .dp-sk { height: 44px; border-radius: 6px; }
.shande-dp-filter .dp-sk-row td:nth-child(2) .dp-sk { height: 14px; }

/* 卡片骨架 */
.shande-dp-filter .dp-sk-card {
  background: #fff;
  border: 1px solid #eef1f6;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.04);
}
.shande-dp-filter .dp-sk-card__top { display: flex; gap: 12px; margin-bottom: 14px; }
.shande-dp-filter .dp-sk-card__head { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.shande-dp-filter .dp-sk--thumb { width: 64px; height: 64px; border-radius: 8px; flex-shrink: 0; }
.shande-dp-filter .dp-sk--xs { width: 40%; height: 10px; }
.shande-dp-filter .dp-sk--sm { width: 55%; }
.shande-dp-filter .dp-sk--lg { width: 85%; height: 15px; }
.shande-dp-filter .dp-sk--line { width: 100%; margin-bottom: 8px; }
.shande-dp-filter .dp-sk--short { width: 65%; }
.shande-dp-filter .dp-sk-card__foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.shande-dp-filter .dp-sk-card__foot .dp-sk { width: 42%; height: 14px; }

/*
 * 骨架期间禁掉交互：内容还没到位，点了也没有意义，
 * 还可能点到上一批数据残留的按钮。
 */
.shande-dp-filter.is-loading .dp-table-wrap,
.shande-dp-filter.is-loading .dp-card-grid { pointer-events: none; }

/*
 * 视图切换的短暂过渡：数据在本地，不发请求，
 * 只做一次淡入，避免瞬间换布局的突兀感。
 */
.shande-dp-filter.is-switching .dp-table-wrap,
.shande-dp-filter.is-switching .dp-card-grid {
  animation: sd-dp-fade 0.22s ease-out;
}
@keyframes sd-dp-fade {
  from { opacity: 0.35; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shande-dp-filter.is-switching .dp-table-wrap,
  .shande-dp-filter.is-switching .dp-card-grid { animation: none; }
}
