/* 搜索页面样式 */
.search-page {
  padding: 20px 0 40px;
}

.search-header {
  margin-bottom: 24px;
}
.search-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.search-header .search-info {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 移动端隐藏搜索标题 */
@media (max-width: 768px) {
  .search-header {
    display: none;
  }
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-primary);
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}
.toolbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.toolbar-count {
  color: var(--text-secondary);
  font-size: 14px;
}
.toolbar-count span {
  color: var(--primary-color);
  font-weight: 600;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  transition: all 0.3s ease;
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
  width: 100%;
  margin-top: 0;
}

/* 筛选面板折叠状态 */
.toolbar-right.filter-collapsed {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
}

/* 筛选面板展开状态 */
.toolbar-right.filter-expanded {
  max-height: 500px;
  opacity: 1;
  margin-top: 12px;
}

/* 筛选切换按钮 */
.filter-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.filter-toggle-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.filter-toggle-btn.active {
  background: var(--primary-color);
  color: var(--text-white);
  border-color: var(--primary-color);
}

.filter-toggle-btn i {
  font-size: 16px;
}

/* 分享按钮 */
.btn-share {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  font-size: 14px;
}

.btn-share:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-share i {
  font-size: 16px;
}

/* 筛选控件 */
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-select:hover {
  border-color: var(--primary-color);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* 关键字输入框 */
.filter-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.3s ease;
  height: 38px;
}

.filter-input::placeholder {
  color: var(--text-tertiary);
}

.filter-input:hover {
  border-color: var(--primary-color);
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* 搜索包裹容器 */
.filter-search-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 33.33%;
  flex-shrink: 0;
}

/* 搜索按钮 */
.filter-search-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.filter-search-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.filter-search-btn:active {
  transform: scale(0.95);
}

.filter-search-btn i {
  font-size: 16px;
}

/* 筛选复选框 */
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
}

.filter-checkbox:hover {
  border-color: var(--primary-color);
}

.filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.filter-checkbox span {
  white-space: nowrap;
}

/* 暗色主题：筛选复选框 */
[data-theme="dark"] .filter-checkbox {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .filter-checkbox:hover {
  border-color: var(--primary-color);
}

/* 暗色主题：关键字输入框 */
[data-theme="dark"] .filter-input {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .filter-input::placeholder {
  color: var(--text-tertiary);
}

[data-theme="dark"] .filter-input:hover {
  border-color: var(--primary-color);
}

[data-theme="dark"] .filter-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* 暗色主题：搜索按钮 */
[data-theme="dark"] .filter-search-btn {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .filter-search-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* 暗色主题：搜索包裹容器 */
[data-theme="dark"] .filter-search-wrapper {
  gap: 8px;
}

/* ==================== Select2 样式优化 ==================== */

/* 筛选控件使用 flex: 1 自适应宽度 */
.filter-select {
  flex: 1;
}

/* 个性化排序选择框宽度适应内容 */
#sort {
  flex: 0 1 auto;
  min-width: 120px;
}

.filter-checkbox {
  flex: 0 1 auto;
  white-space: nowrap;
}

/* Select2 容器 */
.filter-select + .select2-container {
  flex: 1;
  min-width: 150px !important;
  width: 100%;
}

/* 个性化排序 select2 容器宽度适应内容 */
#sort + .select2-container {
  flex: 0 1 auto;
  min-width: 120px !important;
  max-width: auto;
}

.select2-container--default .select2-selection--single {
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  transition: all var(--transition-base);
}

.select2-container--default .select2-selection--single:hover {
  border-color: var(--primary-color);
}

/* Select2 容器聚焦状态 */
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Select2 下拉箭头 */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px;
  right: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--text-secondary) transparent transparent transparent;
  border-width: 5px 5px 0 5px;
}

/* Select2 选中项文本 */
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 36px;
  padding-left: 12px;
  padding-right: 28px;
  color: var(--text-primary);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 36px;
}

/* Select2 占位符 */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text-tertiary);
  line-height: 36px;
}

/* Select2 下拉框 */
.select2-dropdown {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
  overflow: hidden;
  width: auto;
  min-width: 120px;
}

/* Select2 搜索框 */
.select2-search--dropdown .select2-search__field {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
}

.select2-search--dropdown .select2-search__field:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Select2 结果列表 */
.select2-results {
  max-height: 300px;
  overflow-y: auto;
}

.select2-results__options {
  padding: 4px;
}

/* Select2 结果项 */
.select2-results__option {
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  border-radius: 6px;
  margin: 2px 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.select2-results__option:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.select2-results__option--highlighted {
  background: var(--primary-light);
  color: var(--primary-color);
}

.select2-results__option--selected {
  background: var(--primary-color);
  color: var(--text-white);
  font-weight: 500;
}

.select2-results__option--selected:hover {
  background: var(--primary-hover);
}

/* Select2 禁用状态 */
.select2-results__option:disabled {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* Select2 分组 */
.select2-results__group {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 8px 12px;
  font-size: 13px;
}

/* ==================== Select2 暗色主题 ==================== */

[data-theme="dark"] .filter-select {
  flex: 1;
}

[data-theme="dark"] #sort {
  flex: 0 1 auto;
  min-width: 120px;
}

[data-theme="dark"] .filter-checkbox {
  flex: 0 1 auto;
  white-space: nowrap;
}

[data-theme="dark"] .filter-select + .select2-container {
  flex: 1;
  min-width: 150px !important;
  width: 100%;
}

[data-theme="dark"] #sort + .select2-container {
  flex: 0 1 auto;
  min-width: 120px !important;
  max-width: auto;
}

[data-theme="dark"] .filter-select + .select2-container .select2-selection--single {
  min-width: 150px !important;
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
}

/* 选中后显示的文字颜色 */
[data-theme="dark"] .filter-select + .select2-container .select2-selection__rendered {
  color: var(--text-white) !important;
}

[data-theme="dark"] .filter-select + .select2-container:hover .select2-selection--single {
  border-color: var(--primary-color);
}

[data-theme="dark"] .select2-container--default .select2-selection--single {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .select2-container--default .select2-selection--single:hover {
  border-color: var(--primary-color);
}

[data-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-white);
}

[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text-tertiary);
}

[data-theme="dark"] .select2-dropdown {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* 确保 select2 的所有元素都是深色背景 */
[data-theme="dark"] .select2-results,
[data-theme="dark"] .select2-results__options {
  background: var(--bg-primary) !important;
}

/* 暗黑模式下下拉选项使用深色文字 */
[data-theme="dark"] .select2-results__option {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .select2-results__option:hover {
  background: var(--primary-light) !important;
  color: var(--primary-color) !important;
}

/* 暗色主题：选项不换行 */
[data-theme="dark"] .select2-results__option {
  white-space: nowrap;
}

/* 暗色主题：下拉框宽度自适应 */
[data-theme="dark"] .select2-dropdown {
  width: auto;
  min-width: 120px;
}

/* 暗色主题：选中项不换行 */
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .select2-results__option--highlighted {
  background: var(--primary-light);
  color: var(--primary-color);
}

[data-theme="dark"] .select2-results__option--selected {
  background: var(--primary-color);
  color: var(--text-white);
}

[data-theme="dark"] .select2-results__option--selected:hover {
  background: var(--primary-hover);
}

[data-theme="dark"] .select2-results__option:disabled {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
}

[data-theme="dark"] .select2-results__group {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* ==================== 暗黑模式响应式 ==================== */
@media (max-width: 767px) {
  [data-theme="dark"] .toolbar-left, [data-theme="dark"] .toolbar-right {
    width: 100%;
  }

  /* 移动端优化筛选控件 */
  [data-theme="dark"] .filter-select {
    flex: 1;
    min-width: calc(50% - 6px);
    font-size: 13px;
  }

  [data-theme="dark"] #sort {
    flex: 0 1 auto;
    min-width: auto;
  }

  [data-theme="dark"] .filter-select + .select2-container {
    flex: 1;
    min-width: calc(50% - 6px) !important;
    width: 100%;
  }

  [data-theme="dark"] #sort + .select2-container {
    flex: 0 1 auto;
    min-width: auto !important;
    max-width: auto;
  }

  [data-theme="dark"] .filter-select + .select2-container .select2-selection--single {
    height: 36px;
  }

  [data-theme="dark"] .filter-checkbox {
    flex: 0 1 auto;
    white-space: nowrap;
    min-width: auto;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  [data-theme="dark"] .filter-input {
    flex: 2;
    min-width: 100%;
    font-size: 12px;
    height: 36px;
    order: -1;
  }

  [data-theme="dark"] .filter-select {
    flex: 1;
    min-width: calc(50% - 6px);
    font-size: 12px;
  }

  [data-theme="dark"] #sort {
    flex: 0 1 auto;
    min-width: auto;
  }

  [data-theme="dark"] .filter-select + .select2-container {
    flex: 1;
    min-width: calc(50% - 6px) !important;
    width: 100%;
  }

  [data-theme="dark"] #sort + .select2-container {
    flex: 0 1 auto;
    min-width: auto !important;
    max-width: auto;
  }

  [data-theme="dark"] .filter-checkbox {
    flex: 0 1 auto;
    white-space: nowrap;
    min-width: auto;
    font-size: 12px;
  }

  [data-theme="dark"] .filter-search-btn {
    width: 36px;
    height: 36px;
  }

  [data-theme="dark"] .filter-search-btn i {
    font-size: 14px;
  }
}

.view-toggle {
  display: flex;
  gap: 8px;
}
.view-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: var(--text-secondary);
}
.view-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.view-btn.active {
  background: var(--primary-color);
  color: var(--text-white);
  border-color: var(--primary-color);
}
.view-btn i {
  font-size: 18px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state i {
  font-size: 64px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
  opacity: 0.5;
}
.empty-state h3 {
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

/* 暗色主题适配 - 原生筛选框 */
[data-theme="dark"] .filter-select {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}
[data-theme="dark"] .filter-select:hover {
  border-color: var(--primary-color);
}
[data-theme="dark"] .view-btn {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

/* ==================== 列表视图 ==================== */
.list-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-item {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  gap: 16px;
  transition: var(--transition-base);
}

.product-item:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.item-img {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
}

.item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.item-img .img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-img .img-placeholder i {
  font-size: 48px;
  color: var(--text-tertiary);
}

.favorite-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.favorite-icon:hover {
  background: var(--primary-color);
  color: var(--text-white);
  border-color: var(--primary-color);
}

.favorite-icon.favorited {
  color: var(--favorite-color);
  border-color: var(--favorite-color);
}

.favorite-icon.favorited:hover {
  background: var(--delete-danger);
  color: var(--text-white);
  border-color: var(--delete-danger);
}

.item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.item-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.item-meta span {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.item-bottom {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.price-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.current-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

.current-price small {
  font-size: 14px;
  font-weight: 400;
}

.stock-sales-row {
  display: flex;
  gap: 16px;
  font-size: 12px;
  flex-wrap: wrap;
}

.stock-info {
  color: var(--text-secondary);
}

.sales-info {
  color: var(--warning-color);
  font-weight: 500;
}

.btn-view {
  display: inline-block;
  padding: 8px 20px;
  background: var(--gradient-primary);
  color: var(--text-white);
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition-base);
  text-align: center;
  cursor: pointer;
}

.btn-view:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-add-cart-quick {
  width: 36px;
  height: 36px;
  border: 1px solid var(--primary-color);
  background: var(--bg-primary);
  color: var(--primary-color);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-add-cart-quick:hover {
  background: var(--primary-color);
  color: var(--text-white);
}

.btn-add-cart-quick i {
  font-size: 16px;
}

/* 预订按钮 */
.btn-reserve-quick {
  width: 36px;
  height: 36px;
  border: 1px solid #ff6b6b;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
  color: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-reserve-quick:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(238, 90, 90, 0.4);
}

.btn-reserve-quick i {
  font-size: 16px;
}

/* 无库存商品样式调整 */
.product-card.no-stock .btn-reserve-quick,
.product-item.no-stock .btn-reserve-quick {
  opacity: 1;
  pointer-events: auto;
  transform: none !important;
}

.product-card.no-stock .btn-reserve-quick:hover,
.product-item.no-stock .btn-reserve-quick:hover {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1.1) !important;
}

/* ==================== 网格视图 ==================== */
.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: var(--transition-base);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
  transform: translateY(-4px);
}

.product-card .img-box {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  background: var(--bg-secondary);
  overflow: hidden;
}

.product-card .img-box img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
}

.product-card .img-box .img-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card .img-box .img-placeholder i {
  font-size: 48px;
  color: var(--text-tertiary);
}

.product-card .info-box {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card .product-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  height: 40px;
}

.product-card .price-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.product-card .price-box .current-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}

.product-card .price-box .current-price small {
  font-size: 12px;
  font-weight: 400;
}

.product-card .stock-sales-row {
  display: flex;
  gap: 12px;
  font-size: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* ==================== 分页样式 ==================== */
.pagination {
  margin: 0;
}

.page-item {
  margin: 0 2px;
}

.page-link {
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.page-link:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.page-item.active .page-link {
  background: var(--gradient-primary);
  color: var(--text-white);
  border-color: var(--primary-color);
  font-weight: 600;
}

.page-item.disabled .page-link {
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border-color: var(--border-color);
  cursor: not-allowed;
}

/* ==================== 响应式 ==================== */
@media (max-width: 767px) {
  .product-item {
    flex-direction: column;
  }

  .item-img {
    width: 100%;
    height: 200px;
  }

  .item-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .stock-sales-row {
    justify-content: space-between;
  }

  .grid-view {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .toolbar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    padding: 12px;
    padding-bottom: 0; /* 移动端减少底部padding,因为筛选面板折叠时会留空 */
  }

  .toolbar-left {
    justify-content: space-between;
    flex-wrap: wrap;
    width: 100%;
  }

  .toolbar-actions {
    justify-content: flex-end;
    margin-top: 0;
  }

  /* 移动端隐藏视图切换按钮 */
  .view-toggle {
    display: none;
  }

  /* 移动端隐藏分享按钮 */
  .btn-share {
    display: none;
  }

  .toolbar-right {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    width: 100%;
  }

  /* 当筛选面板折叠时,toolbar底部不留空白 */
  .toolbar-right.filter-collapsed + * {
    margin-top: 0;
  }

  /* 筛选面板在移动端也保持折叠功能 */
  .toolbar-right.filter-collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
  }

  .toolbar-right.filter-expanded {
    max-height: 500px;
    opacity: 1;
  }

  /* 移动端优化筛选控件 */
  .filter-search-wrapper {
    gap: 6px;
    order: -1;
    width: 100%;
  }

  .filter-input {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    height: 36px;
    padding: 9px 13px;
  }

  .filter-search-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .filter-search-btn i {
    font-size: 14px;
  }

  .filter-select {
    flex: 1;
    min-width: calc(50% - 6px);
    font-size: 13px;
  }

  #sort {
    flex: 0 1 auto;
    min-width: auto;
  }

  .filter-checkbox {
    flex: 0 1 auto;
    white-space: nowrap;
    min-width: auto;
    font-size: 13px;
  }

  /* Select2 容器移动端优化 */
  .filter-select + .select2-container {
    flex: 1;
    min-width: calc(50% - 6px) !important;
    width: 100%;
  }

  #sort + .select2-container {
    flex: 0 1 auto;
    min-width: auto !important;
    max-width: auto;
  }

  .select2-container--default .select2-selection--single {
    height: 36px;
    font-size: 13px;
  }

  .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    padding-left: 10px;
    padding-right: 24px;
    font-size: 13px;
  }

  .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px;
    right: 8px;
  }

  /* 筛选复选框优化 */
  .filter-checkbox {
    flex: 1;
    min-width: calc(50% - 6px);
    justify-content: center;
    padding: 8px 10px;
    font-size: 13px;
  }

  .filter-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
  }

  .filter-checkbox span {
    font-size: 13px;
  }

  /* 筛选切换按钮移动端优化 */
  .filter-toggle-btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .filter-toggle-btn i {
    font-size: 14px;
  }
}

/* 超小屏幕进一步优化 */
@media (max-width: 480px) {
  .toolbar {
    padding: 10px;
    padding-bottom:0;
    gap: 10px;
  }

  .toolbar-title {
    font-size: 14px;
  }

  .toolbar-count {
    font-size: 13px;
  }

  .filter-input {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    height: 36px;
    padding: 8px 12px;
  }

  .filter-search-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .filter-search-btn i {
    font-size: 14px;
  }

  .filter-search-wrapper {
    gap: 6px;
    width: 100%;
  }

  .filter-select {
    flex: 1;
    min-width: calc(50% - 6px);
    font-size: 12px;
    padding: 6px 10px;
  }

  .filter-select + .select2-container {
    flex: 1;
    min-width: calc(50% - 6px) !important;
    width: 100%;
  }

  #sort {
    flex: 0 1 auto;
    min-width: auto;
  }

  #sort + .select2-container {
    flex: 0 1 auto;
    min-width: auto !important;
    max-width: auto;
  }

  .filter-checkbox {
    flex: 0 1 auto;
    white-space: nowrap;
    min-width: auto;
    padding: 6px 8px;
    font-size: 12px;
  }

  .filter-checkbox input[type="checkbox"] {
    width: 13px;
    height: 13px;
  }

  .filter-checkbox span {
    font-size: 12px;
  }
}

/* ==================== 暗色主题补充 ==================== */
[data-theme="dark"] .product-item {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .product-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .item-img {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .item-meta span {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

[data-theme="dark"] .item-name {
  color: var(--text-primary);
}

[data-theme="dark"] .current-price {
  color: var(--primary-color);
}

[data-theme="dark"] .stock-info {
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-view {
  background: var(--gradient-primary);
  color: var(--text-white);
}

[data-theme="dark"] .btn-view:hover {
  background: var(--primary-hover);
}

[data-theme="dark"] .toolbar {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .toolbar-title {
  color: var(--text-primary);
}

[data-theme="dark"] .toolbar-count {
  color: var(--text-secondary);
}

[data-theme="dark"] .product-card {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .product-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .product-card .img-box {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .product-card .product-name {
  color: var(--text-primary);
}

[data-theme="dark"] .product-card .price-box .current-price {
  color: var(--primary-color);
}

[data-theme="dark"] .search-header h1 {
  color: var(--text-primary);
}

[data-theme="dark"] .search-header .search-info {
  color: var(--text-secondary);
}

[data-theme="dark"] .search-page .empty-state h3 {
  color: var(--text-primary);
}

[data-theme="dark"] .search-page .empty-state p {
  color: var(--text-secondary);
}

[data-theme="dark"] .search-page .empty-state i {
  color: var(--text-tertiary);
}

[data-theme="dark"] .favorite-icon {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .favorite-icon:hover {
  background: var(--primary-color);
  color: var(--text-white);
  border-color: var(--primary-color);
}

[data-theme="dark"] .btn-add-cart-quick {
  background: var(--bg-primary);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

[data-theme="dark"] .btn-add-cart-quick:hover {
  background: var(--primary-color);
  color: var(--text-white);
}

/* ==================== 无库存商品样式 ==================== */

/* 商品卡片无库存（网格视图） */
.product-card.no-stock .img-box {
  position: relative;
}

.product-card.no-stock .img-box::after {
  content: '缺货';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  z-index: 5;
  pointer-events: none;
}

.product-card.no-stock .img-box img {
  filter: brightness(0.6) saturate(0.8);
  transition: filter 0.3s ease;
}

.product-card.no-stock:hover .img-box img {
  filter: brightness(0.8) saturate(0.9);
}

.product-card.no-stock .btn-add-cart-quick {
  opacity: 0.4;
  pointer-events: none;
  position: relative;
}

.product-card.no-stock .btn-add-cart-quick::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
}

.product-card.no-stock:hover .btn-add-cart-quick {
  opacity: 0.4;
  pointer-events: none;
}

/* 商品项无库存（列表视图） */
.product-item.no-stock .item-img {
  position: relative;
}

.product-item.no-stock .item-img::after {
  content: '缺货';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--primary-color);
  background: rgba(var(--primary-rgb), 0.85);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  z-index: 5;
  pointer-events: none;
  border-radius: 8px;
}

.product-item.no-stock .item-img img {
  filter: brightness(0.6) saturate(0.8);
  transition: filter 0.3s ease;
}

.product-item.no-stock:hover .item-img img {
  filter: brightness(0.8) saturate(0.9);
}

.product-item.no-stock .btn-add-cart-quick {
  opacity: 0.4;
  pointer-events: none;
  position: relative;
}

.product-item.no-stock .btn-add-cart-quick::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
}

.product-item.no-stock:hover .btn-add-cart-quick {
  opacity: 0.4;
  pointer-events: none;
}

/* 暗色主题：无库存蒙层 */
[data-theme="dark"] .product-card.no-stock .img-box img,
[data-theme="dark"] .product-item.no-stock .item-img img {
  filter: brightness(0.7) saturate(0.75);
}

[data-theme="dark"] .product-card.no-stock:hover .img-box img,
[data-theme="dark"] .product-item.no-stock:hover .item-img img {
  filter: brightness(0.9) saturate(0.85);
}
