/* ============================================================
   闪得 分类筛选（合并小部件）- 适配（叠加在 css/category.css 之上）
   句柄: shande-cat-filter
   复用 category.css 的响应式抽屉：PC 端横向平铺，手机端右侧抽屉。
   ============================================================ */

/* 分类标签：去掉容器下边框（源码本无，主题可能附加）；
 * 留出下内边距，避免贴边的选中下划线被 overflow-x:auto 裁切。 */
.shande-cat-filter .category-tabs {
  border-bottom: none !important;
  box-shadow: none !important;
  padding-bottom: 6px;
}

/*
 * 选中态：确保「当前分类」有明显的高亮效果。
 * 用比 category.css 基础规则更高的作用域选择器（.shande-cat-filter .category-tab.is-active），
 * 并在本文件（依赖链中晚于 category.css 加载）里重申，避免被 Elementor「文字色」控件
 * （{{WRAPPER}} .category-tab，同权重但更晚加载）盖掉选中蓝色。
 */
.shande-cat-filter .category-tab.is-active {
  color: #096ddd !important;
  font-weight: 700 !important;
}
.shande-cat-filter .category-tab.is-active::after {
  content: '' !important;
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 3px;
  height: 3px;
  background: #096ddd;
  border-radius: 3px;
  display: block !important;
}

/*
 * 编辑器平板预览中取消分类栏的横向滚动状态，保持 PC 左边线并自动换行。
 * category-tabs 左内边距 32px + category-tab 左内边距 18px = 50px，
 * 与下方 dim-row 的 50px 左内边距对齐。
 */
body.elementor-editor-active .shande-cat-filter .category-tabs {
  flex-wrap: wrap !important;
  overflow-x: visible !important;
  padding: 10px 50px 0 32px !important;
}

body.elementor-editor-active .shande-cat-filter .category-tab {
  flex: 0 0 auto;
}

/*
 * Elementor 平板预览 iframe 宽度会命中 category.css 的手机抽屉断点。
 * 编辑器内始终保持与 PC 前端一致的平铺筛选，并让超宽标签自然换行；
 * 这些覆盖仅作用于编辑器预览，不改变真实手机前端的抽屉交互。
 */
body.elementor-editor-active .shande-cat-filter .filter-bar,
body.elementor-editor-active .shande-cat-filter .filter-drawer-overlay,
body.elementor-editor-active .shande-cat-filter .filter-drawer__head,
body.elementor-editor-active .shande-cat-filter .filter-drawer__foot {
  display: none !important;
}

body.elementor-editor-active .shande-cat-filter .filter-drawer {
  display: block !important;
  position: static !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
}

body.elementor-editor-active .shande-cat-filter .filter-drawer__body {
  display: block;
  flex: none;
  overflow: visible !important;
  padding: 0 !important;
}

body.elementor-editor-active .shande-cat-filter .filter-drawer .dimension-filters {
  border-top: 1px solid #f1f5f9;
}

body.elementor-editor-active .shande-cat-filter .filter-drawer .dim-row {
  flex-direction: row !important;
  align-items: center !important;
  padding: 10px 50px !important;
  gap: 0 !important;
}

body.elementor-editor-active .shande-cat-filter .filter-drawer .dim-label {
  width: 56px !important;
  flex: 0 0 56px;
  font-size: 13px !important;
  color: #475569 !important;
}

body.elementor-editor-active .shande-cat-filter .filter-drawer .dim-tags {
  display: flex !important;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap !important;
  min-width: 0;
  gap: 6px;
}

/* 分类位置与逐级导航由原生商品分类生成，可在分类筛选小部件中开关。 */
.shande-cat-filter .category-tabs {
  flex-wrap: wrap;
  overflow-x: visible;
  row-gap: 2px;
}
.shande-cat-filter :where(a.category-tab) {
  text-decoration: none;
  color: #475569;
}
.shande-cat-filter .category-navigation {
  padding: 12px 50px 16px;
  background: #f2f6fc;
  border-top: 1px solid #e5edf7;
  border-bottom: 1px solid #e5edf7;
  font-size: 13px;
  line-height: 1.65;
}
.shande-cat-filter .category-path,
.shande-cat-filter .category-level {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 7px 0;
}
.shande-cat-filter .category-path__label,
.shande-cat-filter .category-level__label {
  flex: 0 0 56px;
  color: #64748b;
  padding-top: 3px;
}
.shande-cat-filter .category-path ol,
.shande-cat-filter .category-level__links {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.shande-cat-filter .category-path li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 3px 0;
}
.shande-cat-filter .category-path li + li::before {
  content: '/';
  color: #94a3b8;
}
.shande-cat-filter .category-path a,
.shande-cat-filter .category-choice {
  text-decoration: none;
  color: #475569;
}
.shande-cat-filter .category-choice {
  display: inline-flex;
  padding: 3px 11px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
.shande-cat-filter .category-path [aria-current],
.shande-cat-filter .category-choice.is-active {
  color: #096ddd;
  font-weight: 600;
}
.shande-cat-filter .category-choice.is-active {
  background: #dfeafb;
}
.shande-cat-filter .category-path a:hover,
.shande-cat-filter .category-choice:hover {
  color: #096ddd;
}
.shande-cat-filter a:focus-visible {
  outline: 2px solid #096ddd;
  outline-offset: 3px;
}
@media (max-width: 767px) {
  .shande-cat-filter .category-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
    padding-left: 8px;
    padding-right: 8px;
  }
  .shande-cat-filter .category-navigation {
    padding: 10px 20px 14px;
  }
  .shande-cat-filter .category-path,
  .shande-cat-filter .category-level {
    gap: 8px;
  }
  .shande-cat-filter .category-choice {
    padding: 4px 8px;
  }
}


/* J: 排序左侧、业务开关右侧；窄屏自然换行，不改变其他属性行。 */
.shande-cat-filter .filter-sort-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  min-width: 0;
  padding: 10px 50px;
  border-bottom: 1px solid #f1f5f9;
}
.shande-cat-filter .filter-sort-tools > .dim-row--sort {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border-bottom: 0;
}
.shande-cat-filter .filter-sort-tools > .dim-row--sort .dim-tags {
  flex: 1 1 auto;
  min-width: 0;
}
.shande-cat-filter .filter-sort-tools .business-toggles {
  position: relative;
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
}
.shande-cat-filter .filter-sort-tools .business-toggle-item {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
}
/* 覆盖主题按钮外观；文字及选中背景使用低权重规则，保留 Elementor 控件。 */
.shande-cat-filter .filter-sort-tools button.business-toggle,
.shande-cat-filter .filter-sort-tools button.business-clear,
.shande-cat-filter .filter-sort-tools button.business-info {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 30px;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background-image: none;
  box-shadow: none;
  text-decoration: none;
  text-shadow: none;
  transform: none;
  white-space: nowrap;
  cursor: pointer;
}
:where(.shande-cat-filter .filter-sort-tools) button.business-toggle,
:where(.shande-cat-filter .filter-sort-tools) button.business-clear,
:where(.shande-cat-filter .filter-sort-tools) button.business-info {
  background-color: transparent;
  color: #475569;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
}
:where(.shande-cat-filter .filter-sort-tools) button.business-toggle:where(:hover, :focus-visible),
:where(.shande-cat-filter .filter-sort-tools) button.business-clear:where(:hover, :focus-visible) {
  background-color: #f1f5f9;
  color: #1e293b;
}
:where(.shande-cat-filter .filter-sort-tools) button.business-toggle:where(.is-active) {
  background-color: rgba(9, 109, 221, 0.08);
  color: #096ddd;
  font-weight: 600;
}
.shande-cat-filter .filter-sort-tools button.business-toggle {
  gap: 6px;
}
.shande-cat-filter .filter-sort-tools button.business-toggle::before {
  content: '';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border: 1px solid #b6c2d2;
  border-radius: 3px;
  background: #fff;
  color: #fff;
  font: 11px/1 sans-serif;
}
.shande-cat-filter .filter-sort-tools button.business-toggle.is-active::before {
  content: '\2713';
  border-color: #096ddd;
  background: #096ddd;
}
.shande-cat-filter .filter-sort-tools button.business-info {
  flex-basis: 18px;
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  border-color: #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.shande-cat-filter .filter-sort-tools button.business-info:hover,
.shande-cat-filter .filter-sort-tools button.business-info[aria-expanded="true"] {
  border-color: #096ddd;
  color: #096ddd;
}
.shande-cat-filter .filter-sort-tools button.business-toggle:focus-visible,
.shande-cat-filter .filter-sort-tools button.business-clear:focus-visible,
.shande-cat-filter .filter-sort-tools button.business-info:focus-visible {
  outline: 2px solid #096ddd;
  outline-offset: 2px;
}
/* 以整个开关区右边界定位，换行后的最后一项也不会把气泡推到屏幕左侧。 */
.shande-cat-filter .filter-sort-tools .business-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  box-sizing: border-box;
  width: max-content;
  max-width: min(280px, 100%);
  padding: 10px 12px;
  border: 1px solid #dbe3ed;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.12);
  color: #475569;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.shande-cat-filter .filter-sort-tools .business-tooltip[hidden],
.shande-cat-filter .filter-sort-tools .business-filter-note[hidden],
.shande-cat-filter .filter-sort-tools .business-clear[hidden] {
  display: none !important;
}
.shande-cat-filter .filter-sort-tools .business-filter-note,
.shande-cat-filter .filter-sort-tools .dim-business-status {
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
@media (max-width: 768px) {
  .shande-cat-filter .filter-sort-tools {
    padding: 14px 20px;
    gap: 14px;
  }
  .shande-cat-filter .filter-sort-tools > .dim-row--sort {
    flex-basis: 100%;
  }
  .shande-cat-filter .filter-sort-tools .business-toggles {
    margin-left: 0;
  }
}

/* 只消除嵌套排序行的二次留白，其他编辑器维度行保持原样。 */
body.elementor-editor-active .shande-cat-filter .filter-drawer .filter-sort-tools {
  padding: 10px 50px;
}
body.elementor-editor-active .shande-cat-filter .filter-drawer .filter-sort-tools > .dim-row--sort {
  padding: 0 !important;
  border-bottom: 0;
}

/* 紧凑检索：常用条件先展示，其余按需展开；只改变排版，不改变分类和筛选数据。 */
.shande-cat-filter .category-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 8px;
  padding: 0 40px;
  min-height: 44px;
  scroll-padding-inline: 10px;
  overscroll-behavior-x: contain;
}
.shande-cat-filter .category-tab {
  flex: 0 0 auto;
  padding: 11px 10px;
  font-size: 14px;
  line-height: 22px;
}
.shande-cat-filter .category-tab.is-active::after {
  left: 10px;
  right: 10px;
  bottom: 2px;
}
.shande-cat-filter .category-navigation {
  padding: 4px 50px;
  line-height: 1.5;
}
.shande-cat-filter .category-path,
.shande-cat-filter .category-level {
  align-items: flex-start;
  gap: 0;
  padding: 3px 0;
  min-height: 32px;
}
.shande-cat-filter .category-path__label,
.shande-cat-filter .category-level__label {
  box-sizing: border-box;
  width: var(--sd-filter-label-width, 90px);
  flex: 0 0 var(--sd-filter-label-width, 90px);
  padding-top: 4px;
  padding-right: 12px;
  white-space: nowrap;
}
.shande-cat-filter .category-level__links {
  gap: 4px;
}
.shande-cat-filter .category-choice {
  flex: 0 0 auto;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 10px;
  white-space: normal;
}
.shande-cat-filter .dimension-filters > .dim-row {
  padding: 6px 50px;
  align-items: flex-start;
}
.shande-cat-filter .dimension-filters .dim-label {
  box-sizing: border-box;
  width: var(--sd-filter-label-width, 90px);
  flex: 0 0 var(--sd-filter-label-width, 90px);
  padding-top: 4px;
  padding-right: 12px;
  line-height: 20px;
  white-space: nowrap;
}
.shande-cat-filter .dimension-filters .dim-tags {
  flex: 1 1 auto;
  min-width: 0;
  gap: 4px;
}
.shande-cat-filter .dimension-filters .dim-tag {
  flex: 0 0 auto;
  max-width: 100%;
  min-height: 28px;
  padding: 3px 10px;
  font-size: 13px;
  line-height: 20px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.shande-cat-filter .filter-sort-tools {
  padding: 6px 50px;
  gap: 8px 16px;
}
.shande-cat-filter .filter-sort-tools > .dim-row--sort {
  align-items: flex-start;
}
.shande-cat-filter button.filter-more-toggle,
.shande-cat-filter button.category-more-toggle,
.shande-cat-filter button.dim-options-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 6px;
  width: auto;
  min-width: 0;
  min-height: 28px;
  height: auto;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: #096ddd;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  cursor: pointer;
  transform: none;
}
.shande-cat-filter button.filter-more-toggle {
  display: flex;
  margin: 4px auto;
  padding-inline: 14px;
}
.shande-cat-filter button.dim-options-toggle {
  margin-left: 8px;
}
.shande-cat-filter button.filter-more-toggle::after,
.shande-cat-filter button.category-more-toggle::after,
.shande-cat-filter button.dim-options-toggle::after {
  content: '';
  width: 5px;
  height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.shande-cat-filter button[aria-expanded="true"].filter-more-toggle::after,
.shande-cat-filter button[aria-expanded="true"].category-more-toggle::after,
.shande-cat-filter button[aria-expanded="true"].dim-options-toggle::after {
  transform: translateY(1px) rotate(225deg);
}
.shande-cat-filter button[aria-expanded="false"] > .compact-less-label,
.shande-cat-filter button[aria-expanded="true"] > .compact-more-label,
.shande-cat-filter .category-choice[hidden],
.shande-cat-filter .dim-tag[hidden],
.shande-cat-filter .dimension-filters > .dim-row[hidden],
.shande-cat-filter .filter-more-toggle[hidden],
.shande-cat-filter .category-more-toggle[hidden],
.shande-cat-filter .dim-options-toggle[hidden] {
  display: none !important;
}
.shande-cat-filter button.filter-more-toggle:hover,
.shande-cat-filter button.category-more-toggle:hover,
.shande-cat-filter button.dim-options-toggle:hover {
  background: #eaf2fc;
}
.shande-cat-filter button.filter-more-toggle:focus-visible,
.shande-cat-filter button.category-more-toggle:focus-visible,
.shande-cat-filter button.dim-options-toggle:focus-visible,
.shande-cat-filter .dim-tag:focus-visible {
  outline: 2px solid #096ddd;
  outline-offset: 2px;
}
@media (max-width: 1200px) {
  .shande-cat-filter .category-tabs { padding-inline: 14px; }
  .shande-cat-filter .category-navigation,
  .shande-cat-filter .dimension-filters > .dim-row,
  .shande-cat-filter .filter-sort-tools { padding-inline: 24px; }
}
@media (max-width: 768px) {
  .shande-cat-filter .category-tabs { padding-inline: 5px; }
  .shande-cat-filter .category-navigation { padding: 4px 15px; }
  .shande-cat-filter .category-path,
  .shande-cat-filter .category-level { gap: 0; }
  .shande-cat-filter .category-path__label,
  .shande-cat-filter .category-level__label {
    width: var(--sd-category-label-width, 60px);
    flex-basis: var(--sd-category-label-width, 60px);
    padding-right: 8px;
  }
  .shande-cat-filter .category-choice { padding: 5px 8px; min-height: 32px; }
  .shande-cat-filter button.category-more-toggle { min-height: 32px; padding-inline: 4px; }
  .shande-cat-filter .filter-bar { padding: 8px 15px; }
  .shande-cat-filter .filter-toggle-btn { min-height: 38px; padding: 7px 18px; }
  .shande-cat-filter .filter-toggle-count:not([hidden]) { display: inline-flex; }
  .shande-cat-filter .filter-drawer .dimension-filters > .dim-row {
    padding: 12px 20px;
    gap: 6px;
  }
  .shande-cat-filter .filter-drawer .dim-label { width: auto; flex-basis: auto; padding-top: 0; padding-right: 0; }
  .shande-cat-filter .filter-drawer .dim-tags { flex: 0 1 auto; width: 100%; }
  .shande-cat-filter .filter-drawer .dim-tag { padding: 6px 10px; min-height: 36px; }
  .shande-cat-filter .filter-sort-tools { padding: 12px 20px; }
}
/* 编辑器仍使用平铺筛选，但与线上桌面采用相同的紧凑行高。 */
body.elementor-editor-active .shande-cat-filter .filter-drawer .dim-row {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}
body.elementor-editor-active .shande-cat-filter .filter-drawer .filter-sort-tools {
  padding-top: 6px;
  padding-bottom: 6px;
}
body.elementor-editor-active .shande-cat-filter .filter-drawer .filter-sort-tools > .dim-row--sort {
  padding: 0 !important;
}
body.elementor-editor-active .shande-cat-filter .filter-drawer .dim-label {
  width: var(--sd-filter-label-width, 90px) !important;
  flex: 0 0 var(--sd-filter-label-width, 90px);
  padding-right: 12px;
}
