.npf-widget {
    max-width: 100%;
    background: #fff;
}

/* 外层 Filter 手风琴容器 */
.npf-filter-wrapper {
    overflow: hidden;
}

/* Filter 主标题栏 */
.npf-filter-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    cursor: pointer;
    user-select: none;
}

.npf-filter-title {
    margin: 0;
    overflow: hidden;
    color: #333;
    text-overflow: ellipsis;
    font-size: 16px;
    font-style: normal;
    font-weight: 700;
    line-height: 100%;
    white-space: nowrap;
    transition: color 0.2s ease;
}

/* 当没有选中项时的标题颜色 */
.npf-widget:not(.has-selection) .npf-filter-title {
    color: #707070;
}

/* Filter 右侧按钮组 */
.npf-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.npf-clear-all,
.npf-filter-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    transition: opacity 0.2s ease;
}

.npf-clear-all:hover svg path {
    stroke: #170057;
}

.npf-filter-toggle:hover {
    opacity: 0.7;
}

.npf-filter-toggle svg {
    transition: transform 0.3s ease;
    transform: rotate(180deg);
}

.npf-filter-wrapper.collapsed .npf-filter-toggle svg {
    transform: rotate(0deg);
}

/* Filter 内容区域 */
.npf-filter-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.npf-filter-wrapper.collapsed .npf-filter-content {
    display: none;
}

.npf-accordion {
    display: flex;
    flex-direction: column;
}

.npf-accordion-item {
    overflow: hidden;
    padding: 0 16px;
    position: relative;
}

.npf-accordion-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: #EEE;
}

.npf-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    background: #fff;
    cursor: pointer;
    user-select: none;
    border: none;
}

.npf-accordion-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 23px;
    color: #707070;
    transition: color 0.2s ease;
}

/* 当该筛选器有选中项时的标题颜色 */
.npf-accordion-item.has-selection .npf-accordion-header h4 {
    color: #333;
}

.npf-toggle-icon {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
    width: 16px !important;
    height: 16px !important;
}

.npf-expanded .npf-toggle-icon {
    transform: rotate(180deg);
}

.npf-toggle-icon svg {
    width: 16px !important;
    height: 16px !important;
}

.npf-accordion-content {
    background: #fff;
}

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

.npf-filter-item {
    margin: 0;
    padding: 9px 0;
}

.npf-filter-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.npf-filter-item input[type="checkbox"] {
    margin: 0 8px 0 0;
    width: 12px;
    height: 12px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    position: relative;
    flex-shrink: 0;
}

.npf-filter-item input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 13 13' fill='none'%3E%3Cpath d='M11.1667 0.5H1.83333C1.09695 0.5 0.5 1.09695 0.5 1.83333V11.1667C0.5 11.903 1.09695 12.5 1.83333 12.5H11.1667C11.903 12.5 12.5 11.903 12.5 11.1667V1.83333C12.5 1.09695 11.903 0.5 11.1667 0.5Z' stroke='%23BBBBBB' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

.npf-filter-item input[type="checkbox"]:checked::before {
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0_17_7013)'%3E%3Cpath d='M0 2.08333C0 0.932741 0.93274 0 2.08333 0H17.9167C19.0673 0 20 0.93274 20 2.08333V17.9167C20 19.0673 19.0673 20 17.9167 20H2.08333C0.932741 20 0 19.0673 0 17.9167V2.08333Z' fill='%23170057'/%3E%3Cpath d='M16.6668 5L7.50016 14.1667L3.3335 10' stroke='white' stroke-width='1.875' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_17_7013'%3E%3Cpath d='M0 2.08333C0 0.932741 0.93274 0 2.08333 0H17.9167C19.0673 0 20 0.93274 20 2.08333V17.9167C20 19.0673 19.0673 20 17.9167 20H2.08333C0.932741 20 0 19.0673 0 17.9167V2.08333Z' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
    background-size: 12px 12px;
}

.npf-term-name {
    flex: 1;
    font-size: 14px;
    font-weight: 400;
    color: #707070;
    transition: color 0.2s ease;
}

/* 选中项的文字颜色 */
.npf-filter-item input[type="checkbox"]:checked + .npf-term-name {
    color: #333;
}

.npf-term-count {
    font-size: 13px;
    color: #999;
    margin-left: 8px;
}

.npf-results {
    margin-top: 20px;
}

.npf-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.npf-product-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.npf-product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.npf-product-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f5f5f5;
}

.npf-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.npf-product-item:hover .npf-product-image img {
    transform: scale(1.05);
}

.npf-product-info {
    padding: 15px;
}

.npf-product-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.npf-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #2271b1;
}

.npf-product-price del {
    font-size: 14px;
    color: #999;
    margin-right: 6px;
}

.npf-results-info {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.npf-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 15px;
}

.npf-widget.npf-loading {
    opacity: 0.6;
    pointer-events: none;
}

.npf-widget.npf-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: npf-spin 1s linear infinite;
}

@keyframes npf-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 768px) {
    .npf-widget {
        padding: 15px;
    }
    
    .npf-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .npf-products-grid {
        grid-template-columns: 1fr;
    }
    
    .npf-accordion-header h4 {
        font-size: 14px;
    }
    
    .npf-product-info {
        padding: 12px;
    }
    
    .npf-product-title {
        font-size: 14px;
    }
}
