/**
 * Product Filter Widgets Styles
 * 产品筛选小工具样式
 */

/* =====================================
   Widget Container
   ===================================== */

.filter-widget {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e5e5;
}

.filter-widget:last-child {
  border-bottom: none;
}

.filter-widget__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: #1a1a1a;
}

.filter-widget__content {
  font-size: 14px;
}

/* =====================================
   Filter List (通用列表)
   ===================================== */

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

.filter-item {
  margin-bottom: 12px;
}

.filter-item:last-child {
  margin-bottom: 0;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.filter-label:hover {
  color: #666;
}

.filter-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1a1a1a;
}

.filter-count {
  margin-left: auto;
  color: #999;
  font-size: 13px;
}

/* =====================================
   Price Filter
   ===================================== */

.price-filter__inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.price-filter__input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  font-size: 14px;
}

.price-filter__input:focus {
  outline: none;
  border-color: #1a1a1a;
}

.price-filter__separator {
  color: #999;
}

.price-filter__range {
  margin-top: 8px;
}

.price-filter__slider {
  width: 100%;
  height: 4px;
  background: #e5e5e5;
  outline: none;
  border-radius: 2px;
  appearance: none;
  -webkit-appearance: none;
}

.price-filter__slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #1a1a1a;
  cursor: pointer;
  border-radius: 50%;
}

.price-filter__slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #1a1a1a;
  cursor: pointer;
  border-radius: 50%;
  border: none;
}

.price-filter__values {
  margin-top: 8px;
  font-size: 13px;
  color: #666;
}

/* =====================================
   Swatch Filter (Color & Image)
   ===================================== */

.filter-swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.filter-swatch-item {
  position: relative;
}

.filter-swatch-label {
  display: block;
  cursor: pointer;
  position: relative;
}

/* 隐藏复选框 */
.filter-swatch-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* 颜色样本 */
.filter-swatch--color {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--swatch-bg);
  border: 2px solid #e0e0e0;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* 图片样本 */
.filter-swatch--image {
  display: block;
  width: 40px;
  height: 40px;
  border: 2px solid #e0e0e0;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.filter-swatch--image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 悬停效果 */
.filter-swatch-label:hover .filter-swatch--color,
.filter-swatch-label:hover .filter-swatch--image {
  transform: scale(1.1);
  border-color: #999;
  z-index: 2;
}

/* 选中状态 - 黑色边框 */
.filter-swatch-checkbox:checked + .filter-swatch--color,
.filter-swatch-checkbox:checked + .filter-swatch--image {
  border-color: #000;
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Tooltip */
.filter-swatch__tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.filter-swatch__tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

.filter-swatch-label:hover .filter-swatch__tooltip {
  opacity: 1;
}

/* =====================================
   Category Filter
   ===================================== */

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

.filter-category-item {
  margin-bottom: 8px;
}

.filter-category-children {
  list-style: none;
  margin: 8px 0 0 20px;
  padding: 0;
}

.filter-category-children .filter-category-item {
  margin-bottom: 6px;
}

/* =====================================
   Filter Notice
   ===================================== */

.filter-widget-notice {
  padding: 16px;
  background: #f5f5f5;
  border-radius: 4px;
  color: #666;
  font-size: 14px;
}

.filter-widget-notice p {
  margin: 0;
}

/* =====================================
   Responsive
   ===================================== */

@media (max-width: 1279px) {
  .filter-widget {
    margin-bottom: 20px;
    padding-bottom: 20px;
  }
  
  .filter-widget__title {
    font-size: 15px;
  }
  
  .filter-swatch--color,
  .filter-swatch--image {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 768px) {
  .filter-widget {
    margin-bottom: 16px;
    padding-bottom: 16px;
  }
  
  .filter-widget__title {
    font-size: 14px;
    margin-bottom: 12px;
  }
  
  .filter-item {
    margin-bottom: 10px;
  }
  
  .filter-checkbox {
    width: 16px;
    height: 16px;
  }
}

/* =====================================
   Active States
   ===================================== */

.filter-checkbox:checked + span {
  font-weight: 600;
  color: #1a1a1a;
}

.filter-item:has(.filter-checkbox:checked) {
  background: #f9f9f9;
  margin-left: -8px;
  margin-right: -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 4px;
}

/* =====================================
   Animations
   ===================================== */

.filter-label,
.filter-color-swatch,
.filter-checkbox {
  transition: all 0.2s ease;
}

.filter-checkbox:focus {
  outline: 2px solid #4A90E2;
  outline-offset: 2px;
}
