.pfm-filter-wrapper {
    position: relative;
    margin-bottom: 30px;
}

.pfm-filter-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pfm-filter-title {
    margin: 0 0 20px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.pfm-filter-section {
    margin-bottom: 25px;
}

.pfm-section-title {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 500;
    color: #555;
}

/* Categories styling */
.pfm-categories-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.pfm-categories-list::-webkit-scrollbar {
    width: 6px;
}

.pfm-categories-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pfm-categories-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.pfm-categories-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.pfm-category-item {
    margin-bottom: 5px;
}

.pfm-category-item[data-level="0"] {
    margin-left: 0;
}

.pfm-category-item[data-level="1"] {
    margin-left: 20px;
}

.pfm-category-item[data-level="2"] {
    margin-left: 40px;
}

.pfm-category-item[data-level="3"] {
    margin-left: 60px;
}

.pfm-category-header {
    display: flex;
    align-items: center;
    padding: 5px 0;
}

.pfm-toggle-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    color: #666;
    font-size: 12px;
    transition: transform 0.2s;
}

.pfm-toggle-icon:hover {
    color: #333;
    transform: scale(1.1);
}

.pfm-no-toggle {
    display: inline-block;
    width: 20px;
    height: 20px;
}

.pfm-category-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex: 1;
    padding: 2px 0;
}

.pfm-category-label:hover {
    background: #f8f8f8;
    border-radius: 4px;
}

.pfm-category-checkbox {
    margin-right: 8px;
    cursor: pointer;
}

.pfm-category-checkbox:indeterminate {
    opacity: 0.6;
}

.pfm-category-name {
    flex: 1;
    color: #333;
    font-size: 14px;
}

.pfm-category-count {
    margin-left: 5px;
    color: #999;
    font-size: 12px;
}

.pfm-subcategories {
    margin-top: 5px;
    padding-left: 5px;
    border-left: 1px solid #e8e8e8;
}

.pfm-category-item.collapsed > .pfm-subcategories {
    display: none;
}

/* Stock filter styling */
.pfm-stock-filter {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pfm-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.pfm-checkbox-label:hover {
    background: #f8f8f8;
}

.pfm-checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.pfm-checkbox-label span {
    font-size: 14px;
    color: #333;
}

.pfm-count {
    margin-left: 5px;
    color: #999;
    font-size: 12px;
}

/* Filter actions */
.pfm-filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.pfm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.pfm-btn-primary {
    background: #2271b1;
    color: white;
}

.pfm-btn-primary:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.3);
}

.pfm-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.pfm-btn-secondary:hover {
    background: #e0e0e0;
}

/* Loading overlay */
.pfm-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    border-radius: 8px;
}

.pfm-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: pfm-spin 1s linear infinite;
}

@keyframes pfm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination */
.pfm-pagination {
    margin-top: 30px;
    text-align: center;
}

.pfm-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.pfm-pagination .page-numbers:hover {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

.pfm-pagination .page-numbers.current {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

/* No products message */
.pfm-no-products {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

/* Widget specific styles */
.pfm-widget .pfm-filter-container {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.pfm-widget .pfm-filter-section {
    background: #fff;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.pfm-widget .pfm-section-title {
    font-size: 14px;
    margin-bottom: 12px;
}

.pfm-widget .pfm-categories-list {
    max-height: 350px;
}

.pfm-widget .pfm-filter-actions {
    background: #fff;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-top: 15px;
}

.pfm-widget .pfm-btn {
    font-size: 13px;
    padding: 8px 15px;
}

/* Widget in sidebar adjustments */
.widget-area .pfm-widget .pfm-filter-actions {
    flex-direction: column;
}

.widget-area .pfm-widget .pfm-btn {
    width: 100%;
}

/* Auto-apply mode styles */
.pfm-filter-actions.pfm-auto-apply {
    flex-direction: column;
    align-items: stretch;
}

.pfm-btn-full {
    width: 100%;
}

.pfm-auto-apply-note {
    text-align: center;
    color: #666;
    font-size: 11px;
    margin-top: 8px;
    display: block;
    font-style: italic;
}

/* Collapsed categories when collapsed_by_default is true */
.pfm-filter-wrapper[data-collapsed="true"] .pfm-subcategories {
    display: none;
}

.pfm-filter-wrapper[data-collapsed="true"] .pfm-toggle-icon {
    transform: rotate(-90deg);
}

/* Responsive design */
@media (max-width: 768px) {
    .pfm-filter-container {
        padding: 15px;
    }
    
    .pfm-filter-title {
        font-size: 18px;
    }
    
    .pfm-categories-list {
        max-height: 300px;
    }
    
    .pfm-filter-actions {
        flex-direction: column;
    }
    
    .pfm-btn {
        width: 100%;
    }
}