/* B2B Fuzzy Filter Search - Frontend Styles */

/* Main Container */
.b2b-fuzzy-search-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.b2b-fuzzy-search-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

/* Search Bar */
.b2b-search-bar-wrapper {
    margin-bottom: 30px;
    position: relative;
}

.b2b-search-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.b2b-search-input-container {
    flex: 1;
    position: relative;
    min-width: 0; /* Prevent flex item from overflowing */
}

.b2b-search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.b2b-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.1);
}

.b2b-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
    z-index: 2;
}

.b2b-search-clear:hover {
    color: #333;
}

.b2b-search-spinner {
    position: absolute;
    right: 38px;
    top: 50%;
    transform: translateY(-50%);
    color: #0073aa;
    z-index: 2;
}

.b2b-search-spinner .dashicons {
    animation: b2b-spin 1s linear infinite;
}

.b2b-search-reset {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 12px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.b2b-search-reset:hover {
    background: #005a87;
}

/* Search Suggestions */
.b2b-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: -1px; /* Connect with search input border */
}

.b2b-suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
}

.b2b-suggestion-item:hover {
    background-color: #f8f9fa;
}

.b2b-suggestion-item:last-child {
    border-bottom: none;
}

/* Filters */
.b2b-filters-wrapper {
    width: 300px;
    flex-shrink: 0;
}

.b2b-filters {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.b2b-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.b2b-filters-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.b2b-filters-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s ease;
}

.b2b-filters-toggle.collapsed {
    transform: rotate(180deg);
}

.b2b-filters-content {
    padding: 20px;
}

.b2b-filters-content.collapsed {
    display: none;
}

.b2b-filter-section {
    margin-bottom: 25px;
}

.b2b-filter-section:last-child {
    margin-bottom: 0;
}

.b2b-filter-section h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #555;
    font-weight: 600;
}

.b2b-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.b2b-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.b2b-filter-option:hover {
    background-color: #f8f9fa;
}

.b2b-filter-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.b2b-filter-option label {
    cursor: pointer;
    font-size: 14px;
    color: #666;
    margin: 0;
    flex: 1;
}

.b2b-filter-count {
    font-size: 12px;
    color: #999;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 12px;
}

.b2b-filter-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: #666;
    font-size: 14px;
}

.b2b-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: b2b-spin 1s linear infinite;
}

.b2b-filter-empty {
    padding: 10px;
    color: #999;
    font-size: 14px;
    font-style: italic;
    text-align: center;
}

/* Price Range Slider */
.b2b-price-range-container {
    padding: 10px 0;
}

.b2b-price-slider {
    margin: 20px 0;
}

.b2b-price-slider .ui-slider {
    height: 6px;
    background: #ddd;
    border: none;
    border-radius: 3px;
}

.b2b-price-slider .ui-slider-range {
    background: #0073aa;
            border-radius: 3px;
}

.b2b-price-slider .ui-slider-handle {
    width: 20px;
    height: 20px;
    background: #0073aa;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    top: -7px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.b2b-price-slider .ui-slider-handle:hover {
    transform: scale(1.1);
}

.b2b-price-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.b2b-price-min,
.b2b-price-max {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* Products Grid */
.b2b-products-wrapper {
    flex: 1;
}

.b2b-products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.b2b-products-info {
    font-size: 14px;
    color: #666;
}

.b2b-items-per-page {
    display: flex;
    align-items: center;
    gap: 10px;
}

.b2b-items-per-page label {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.b2b-items-per-page-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.b2b-products-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
    grid-template-columns: repeat(3, 1fr); /* Default 3 columns */
}

.b2b-products-grid[data-columns="1"] {
    grid-template-columns: 1fr;
}

.b2b-products-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.b2b-products-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.b2b-products-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.b2b-products-grid[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr);
}

/* Product Card */
.b2b-product-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.b2b-product-hover:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.b2b-product-image {
    position: relative;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    background: #f8f9fa;
    overflow: hidden;
}

.b2b-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.b2b-product-hover:hover .b2b-product-image img {
    transform: scale(1.05);
}

.b2b-product-content {
    padding: 20px;
}

.b2b-product-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.b2b-product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.b2b-product-title a:hover {
    color: #0073aa;
}

.b2b-product-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.b2b-product-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
}

.b2b-category {
    background: #f0f0f0;
    color: #666;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.b2b-product-price {
    margin-bottom: 15px;
}

.b2b-price-current {
    font-size: 20px;
    font-weight: 700;
    color: #0073aa;
}

.b2b-price-sale {
    font-size: 20px;
    font-weight: 700;
    color: #dc3545;
}

.b2b-price-regular {
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
    margin-left: 8px;
}

.b2b-stock {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 15px;
}

.b2b-stock.in-stock {
    background: #d4edda;
    color: #155724;
}

.b2b-stock.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.b2b-stock.backorder {
    background: #fff3cd;
    color: #856404;
}

.b2b-product-actions {
    margin-top: 15px;
}

.b2b-add-to-cart {
    width: 100%;
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.b2b-add-to-cart:hover {
    background: #005a87;
}

/* Pagination */
.b2b-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.b2b-pagination-prev,
.b2b-pagination-next {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.b2b-pagination-prev:hover:not(:disabled),
.b2b-pagination-next:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #0073aa;
    color: #0073aa;
}

.b2b-pagination-prev:disabled,
.b2b-pagination-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.b2b-pagination-numbers {
    display: flex;
    gap: 5px;
}

.b2b-pagination-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.b2b-pagination-number:hover {
    background: #f8f9fa;
    border-color: #0073aa;
    color: #0073aa;
}

.b2b-pagination-number.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.b2b-pagination-ellipsis {
    padding: 0 5px;
    color: #666;
}

/* Loading States */
.b2b-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.b2b-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: b2b-spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Empty State */
.b2b-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.b2b-empty-state-icon {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.b2b-empty-state h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
}

.b2b-empty-state p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 16px;
}

.b2b-empty-state-button {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.b2b-empty-state-button:hover {
    background: #005a87;
}

/* Animations */
@keyframes b2b-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .b2b-fuzzy-search-container {
        flex-direction: column;
    }
    
    .b2b-filters-wrapper {
        width: 100%;
        order: 2;
    }
    
    .b2b-products-wrapper {
        order: 1;
    }
    
    .b2b-products-grid[data-columns="4"],
    .b2b-products-grid[data-columns="5"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .b2b-fuzzy-search-wrapper {
        padding: 15px;
    }
    
    .b2b-search-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .b2b-search-input-container {
        width: 100%;
    }
    
    .b2b-search-reset {
        width: 100%;
    }
    
    .b2b-products-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .b2b-products-grid[data-columns="3"],
    .b2b-products-grid[data-columns="4"],
    .b2b-products-grid[data-columns="5"] {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .b2b-pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .b2b-products-grid[data-columns="2"],
    .b2b-products-grid[data-columns="3"],
    .b2b-products-grid[data-columns="4"],
    .b2b-products-grid[data-columns="5"] {
        grid-template-columns: 1fr;
    }
    
    .b2b-pagination-numbers {
        display: none;
    }
}