/* ==========================================
   WooCommerce 产品筛选器 - 前端样式
   ========================================== */

/* ---------- 主容器 ---------- */
.wc-product-filter-wrapper {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* ---------- 主标题区域 ---------- */
.wc-filter-header {
    cursor: pointer;
    user-select: none;
}

.wc-filter-title-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.wc-filter-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.wc-filter-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    line-height: 1;
    color: #888;
    transition: color 0.2s;
    flex-shrink: 0;
}

/* 文本模式：继承标题字体大小 */
.wc-filter-toggle-mode-text {
    font-size: inherit;
}

/* 图标模式：可自定义大小 */
.wc-filter-toggle-mode-icon {
    font-size: 16px;
}

.wc-filter-toggle-mode-icon i,
.wc-filter-toggle-mode-icon svg {
    width: 1em;
    height: 1em;
}

.wc-filter-title-row:hover .wc-filter-toggle-icon {
    color: #555;
}

/* ---------- 筛选主体 ---------- */
.wc-filter-body {
    overflow: hidden;
    transition: max-height 0.35s ease;
}

/* ==========================================
   排列方向 - 纵向（默认）
   ========================================== */
.wc-filter-layout-vertical .wc-filter-body {
    display: flex;
    flex-direction: column;
}

.wc-filter-layout-vertical .wc-filter-group {
    margin-bottom: 16px;
}

.wc-filter-layout-vertical .wc-filter-group:last-child {
    margin-bottom: 0;
}

/* ==========================================
   排列方向 - 横向
   ========================================== */
.wc-filter-layout-horizontal .wc-filter-body {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
}

.wc-filter-layout-horizontal .wc-filter-group {
    flex: 1 1 auto;
    min-width: 160px;
}

/* ---------- 筛选组 ---------- */
.wc-filter-group {
    margin-bottom: 16px;
}

.wc-filter-group:last-child {
    margin-bottom: 0;
}

/* 组标题（纯文字标题，无折叠） */
.wc-filter-group-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px;
    margin: 0;
}

/* 组内容 */
.wc-filter-group-body {
    overflow: hidden;
}

/* ---------- 列表样式 ---------- */
.wc-filter-list {
    display: flex;
    flex-direction: column;
}

.wc-filter-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px;
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 1px solid transparent;
}

.wc-filter-list-item:last-child {
    border-bottom: none;
}

.wc-filter-list-item:hover .wc-filter-list-name {
    opacity: 0.7;
}

/* 选中状态：仅文字加粗 */
.wc-filter-list-item.active .wc-filter-list-name {
    font-weight: 700;
}

.wc-filter-list-name {
    transition: color 0.2s, font-weight 0.15s;
    font-size: 14px;
}

.wc-filter-list-count {
    font-size: 12px;
    color: #aaa;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ---------- 复选框样式 ---------- */
.wc-filter-checkbox-list {
    display: flex;
    flex-direction: column;
}

.wc-filter-checkbox-item {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 1px solid transparent;
}

.wc-filter-checkbox-item:last-child {
    border-bottom: none;
}

.wc-filter-checkbox-item:hover .wc-filter-checkbox-label {
    opacity: 0.7;
}

/* 选中状态：仅文字加粗 */
.wc-filter-checkbox-item.active .wc-filter-checkbox-label {
    font-weight: 700;
}

.wc-filter-checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    accent-color: #333;
    width: 15px;
    height: 15px;
}

.wc-filter-checkbox-label {
    flex: 1;
    transition: color 0.2s, font-weight 0.15s;
    font-size: 14px;
}

.wc-filter-checkbox-count {
    font-size: 12px;
    color: #aaa;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ---------- 颜色色块样式 ---------- */
.wc-filter-color-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wc-filter-color-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 4px;
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 1px solid transparent;
}

.wc-filter-color-item:last-child {
    border-bottom: none;
}

.wc-filter-color-item:hover .wc-filter-color-name {
    opacity: 0.7;
}

/* 选中状态：仅文字加粗 */
.wc-filter-color-item.active .wc-filter-color-name {
    font-weight: 700;
}

.wc-filter-color-swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
    transition: border-color 0.2s;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.wc-filter-color-item:hover .wc-filter-color-swatch {
    border-color: #bbb;
}

.wc-filter-color-item.active .wc-filter-color-swatch {
    border-color: #999;
}

.wc-filter-color-name {
    font-size: 14px;
    transition: color 0.2s, font-weight 0.15s;
}

.wc-filter-color-count {
    font-size: 12px;
    color: #aaa;
    margin-left: auto;
    flex-shrink: 0;
}

/* ---------- 分隔线模式 ---------- */
.wc-filter-item-separator-yes .wc-filter-list-item,
.wc-filter-item-separator-yes .wc-filter-checkbox-item,
.wc-filter-item-separator-yes .wc-filter-color-item {
    border-bottom-style: solid;
    border-bottom-width: 1px;
}

.wc-filter-item-separator-yes .wc-filter-list-item:last-child,
.wc-filter-item-separator-yes .wc-filter-checkbox-item:last-child,
.wc-filter-item-separator-yes .wc-filter-color-item:last-child {
    border-bottom: none;
}

/* ---------- 底部区域（标签 + 按钮） ---------- */
.wc-filter-bottom {
    padding-top: 8px;
}

/* ---------- 已选筛选标签 ---------- */
.wc-filter-active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 0 4px;
    justify-content: flex-start;
}

.wc-filter-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #555;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.2s;
}

.wc-filter-active-tag:hover {
    color: #333;
}

.wc-filter-tag-name {
    white-space: nowrap;
}

/* 叉号按钮：极简样式，只显示× */
.wc-filter-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #999;
    font-size: 0.9em;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    outline: none;
    transition: color 0.2s;
}

.wc-filter-tag-remove:hover {
    color: #e74c3c;
}

/* ---------- 底部按钮：Done + Clear All（右对齐） ---------- */
.wc-filter-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 4px 0 0;
    margin-top: 4px;
}

.wc-filter-btn-done,
.wc-filter-btn-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    line-height: 1;
    background: transparent;
}

.wc-filter-btn-done {
    padding: 8px 20px;
    color: #333;
}

.wc-filter-btn-clear {
    padding: 8px 16px;
    color: #e74c3c;
}

/* ---------- 产品结果区域 ---------- */
.wc-filter-results {
    width: 100%;
}

.wc-filter-results-count {
    padding: 12px 0 16px;
    font-size: 14px;
    color: #888;
}

.wc-filter-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    min-height: 0;
}

.wc-filter-product-item {
    position: relative;
}

/* ---------- 加载状态 ---------- */
.wc-filter-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.wc-filter-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid #e8e8e8;
    border-top-color: #555;
    border-radius: 50%;
    animation: wcFilterSpin 0.7s linear infinite;
}

@keyframes wcFilterSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ---------- 无结果提示 ---------- */
.wc-filter-no-results {
    text-align: center;
    padding: 48px 20px;
    color: #aaa;
    font-size: 15px;
    grid-column: 1 / -1;
}

/* ---------- 空筛选提示（编辑器） ---------- */
.wc-filter-editor-notice {
    padding: 24px;
    text-align: center;
    color: #999;
    font-style: italic;
    border: 1px dashed #ddd;
    border-radius: 6px;
    background: #fafafa;
}

.wc-filter-empty-msg {
    color: #bbb;
    font-size: 13px;
    font-style: italic;
    padding: 4px 4px;
}

/* ---------- 分页样式 ---------- */
.wc-filter-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.wc-filter-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    color: #333;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-sizing: border-box;
    text-align: center;
}

.wc-filter-pagination .page-numbers:hover {
    color: #fff;
    background-color: #333;
    border-color: #333;
}

.wc-filter-pagination .page-numbers.current {
    color: #fff;
    background-color: #333;
    border-color: #333;
    cursor: default;
}

.wc-filter-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    cursor: default;
    min-width: auto;
    padding: 8px 6px;
    color: #999;
}

.wc-filter-pagination .page-numbers.dots:hover {
    color: #999;
    background-color: transparent;
    border: none;
}

.wc-filter-pagination .page-prev,
.wc-filter-pagination .page-next {
    font-weight: 600;
}

.wc-filter-pagination .page-prev i,
.wc-filter-pagination .page-next i,
.wc-filter-pagination .page-prev svg,
.wc-filter-pagination .page-next svg {
    width: 1em;
    height: 1em;
}

/* ---------- 分页禁用状态 ---------- */
.wc-filter-pagination .page-numbers.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.wc-filter-pagination .page-numbers.disabled:hover {
    color: #333;
    background-color: transparent;
    border-color: #ddd;
}