/**
 * WooSmartFilter - Modern Minimalist Black & White Style
 * Version: 1.0.0
 */

:root {
    --wsf-primary: #000000;
    --wsf-secondary: #ffffff;
    --wsf-border: #e0e0e0;
    --wsf-border-radius: 0px;
    --wsf-border-width: 1px;
    --wsf-hover: #f5f5f5;
    --wsf-text: #333333;
    --wsf-text-light: #666666;
    --wsf-spacing: 16px;
    --wsf-transition: all 0.3s ease;
}

/* Page Header */
.wsf-page-header {
    margin-bottom: calc(var(--wsf-spacing) * 2);
    padding: calc(var(--wsf-spacing) * 2);
    background: var(--wsf-secondary);
    border: var(--wsf-border-width) solid var(--wsf-border);
}

.wsf-breadcrumb {
    font-size: 14px;
    color: var(--wsf-text-light);
    margin-bottom: var(--wsf-spacing);
}

.wsf-breadcrumb a {
    color: var(--wsf-text-light);
    text-decoration: none;
    transition: var(--wsf-transition);
}

.wsf-breadcrumb a:hover {
    color: var(--wsf-primary);
}

.wsf-breadcrumb span {
    color: var(--wsf-primary);
    font-weight: 600;
}

.wsf-category-title {
    margin: 0 0 12px 0;
    font-size: 32px;
    font-weight: 700;
    color: var(--wsf-primary);
    line-height: 1.2;
}

.wsf-category-description {
    color: var(--wsf-text);
    font-size: 15px;
    line-height: 1.6;
}

.wsf-category-description p:first-child {
    margin-top: 0;
}

.wsf-category-description p:last-child {
    margin-bottom: 0;
}

/* Container */
.wsf-filter-container {
    display: flex;
    gap: calc(var(--wsf-spacing) * 2);
    margin: var(--wsf-spacing) 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    flex-wrap: wrap;
}

/* Mobile Filter Toggle Button */
.wsf-mobile-filter-toggle {
    display: none; /* Hidden on desktop */
    width: 100%;
    padding: 14px 16px;
    background: var(--wsf-primary);
    color: var(--wsf-secondary);
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--wsf-transition);
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: var(--wsf-border-radius);
    margin-bottom: var(--wsf-spacing);
}

.wsf-mobile-filter-toggle .wsf-filter-icon {
    flex-shrink: 0;
}

.wsf-mobile-filter-toggle .wsf-toggle-text {
    flex: 1;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wsf-mobile-filter-toggle .wsf-chevron-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.wsf-mobile-filter-toggle.wsf-active .wsf-chevron-icon {
    transform: rotate(180deg);
}

.wsf-mobile-filter-toggle:hover {
    background: #1a1a1a;
}

.wsf-mobile-filter-toggle:active {
    transform: scale(0.98);
}

/* Filters Sidebar */
.wsf-filters {
    flex: 0 0 280px;
    background: var(--wsf-secondary);
    border: var(--wsf-border-width) solid var(--wsf-border);
    border-radius: var(--wsf-border-radius);
    padding: var(--wsf-spacing);
}

/* Desktop: Always visible, no transition, sticky position */
@media (min-width: 1025px) {
    .wsf-filters {
        display: block !important;
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible;
        position: sticky;
        top: 20px;
        align-self: flex-start;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }

    /* Custom scrollbar for filters */
    .wsf-filters::-webkit-scrollbar {
        width: 6px;
    }

    .wsf-filters::-webkit-scrollbar-track {
        background: var(--wsf-hover);
        border-radius: 3px;
    }

    .wsf-filters::-webkit-scrollbar-thumb {
        background: var(--wsf-border);
        border-radius: 3px;
    }

    .wsf-filters::-webkit-scrollbar-thumb:hover {
        background: var(--wsf-text-light);
    }
}

/* Mobile/Tablet: Collapsible with transitions */
@media (max-width: 1024px) {
    .wsf-filters {
        transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.4s ease, margin 0.4s ease;
        overflow: hidden;
    }
}

/* Filter Groups */
.wsf-filter-group {
    margin-bottom: calc(var(--wsf-spacing) * 1.5);
    padding-bottom: calc(var(--wsf-spacing) * 1.5);
    border-bottom: var(--wsf-border-width) solid var(--wsf-border);
}

.wsf-filter-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.wsf-filter-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--wsf-primary);
    margin: 0 0 var(--wsf-spacing) 0;
}

/* Price Filter */
.wsf-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wsf-input {
    flex: 1;
    padding: 10px 12px;
    border: var(--wsf-border-width) solid var(--wsf-border);
    border-radius: var(--wsf-border-radius);
    font-size: 14px;
    color: var(--wsf-text);
    transition: var(--wsf-transition);
    background: var(--wsf-secondary);
}

.wsf-input:focus {
    outline: none;
    border-color: var(--wsf-primary);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.wsf-input::placeholder {
    color: var(--wsf-text-light);
}

.wsf-price-separator {
    color: var(--wsf-text-light);
    font-weight: 500;
}

/* Checkbox List */
.wsf-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wsf-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--wsf-border-radius);
    transition: var(--wsf-transition);
}

.wsf-checkbox-item:hover {
    background: var(--wsf-hover);
}

.wsf-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    border: var(--wsf-border-width) solid var(--wsf-border);
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--wsf-secondary);
    position: relative;
    transition: var(--wsf-transition);
}

.wsf-checkbox-item input[type="checkbox"]:checked {
    background: var(--wsf-primary);
    border-color: var(--wsf-primary);
}

.wsf-checkbox-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.wsf-checkbox-item input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.wsf-checkbox-label {
    flex: 1;
    font-size: 14px;
    color: var(--wsf-text);
    user-select: none;
}

.wsf-count {
    font-size: 12px;
    color: var(--wsf-text-light);
}

/* Filter Actions */
.wsf-filter-actions {
    display: flex;
    gap: 8px;
    margin-top: calc(var(--wsf-spacing) * 1.5);
    padding-top: calc(var(--wsf-spacing) * 1.5);
    border-top: var(--wsf-border-width) solid var(--wsf-border);
}

.wsf-btn {
    flex: 1;
    padding: 12px 20px;
    border: var(--wsf-border-width) solid var(--wsf-primary);
    border-radius: var(--wsf-border-radius);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--wsf-transition);
    background: var(--wsf-secondary);
    color: var(--wsf-primary);
}

.wsf-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wsf-btn:active {
    transform: translateY(0);
}

.wsf-btn-filter {
    background: var(--wsf-primary);
    color: var(--wsf-secondary);
}

.wsf-btn-filter:hover {
    background: #1a1a1a;
}

.wsf-btn-reset {
    background: var(--wsf-secondary);
    color: var(--wsf-primary);
}

/* Products Wrapper */
.wsf-products-wrapper {
    flex: 1;
    min-width: 0;
}

.wsf-products-count {
    margin-bottom: var(--wsf-spacing);
    padding: 12px;
    background: var(--wsf-hover);
    border-radius: var(--wsf-border-radius);
    border: var(--wsf-border-width) solid var(--wsf-border);
}

.wsf-count-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--wsf-text);
}

.wsf-products-container {
    position: relative;
    min-height: 300px;
}

.wsf-products-container.wsf-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* No Products */
.wsf-no-products {
    text-align: center;
    padding: calc(var(--wsf-spacing) * 3);
    background: var(--wsf-hover);
    border-radius: var(--wsf-border-radius);
    border: var(--wsf-border-width) solid var(--wsf-border);
}

.wsf-no-products p {
    margin: 0;
    font-size: 16px;
    color: var(--wsf-text-light);
}

/* Loader */
.wsf-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 8px;
}

.wsf-loader span {
    width: 12px;
    height: 12px;
    background: var(--wsf-primary);
    border-radius: 50%;
    animation: wsf-bounce 1.4s infinite ease-in-out both;
}

.wsf-loader span:nth-child(1) {
    animation-delay: -0.32s;
}

.wsf-loader span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes wsf-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile/Tablet: Collapsed State */
@media (max-width: 1024px) {
    /* Show toggle button */
    .wsf-mobile-filter-toggle {
        display: flex;
    }

    /* Collapsed filters panel */
    .wsf-filters.wsf-collapsed {
        max-height: 0;
        opacity: 0;
        padding: 0;
        margin: 0;
        border: none;
    }

    /* Expanded filters panel */
    .wsf-filters:not(.wsf-collapsed) {
        max-height: 2000px; /* Large enough for content */
        opacity: 1;
        margin-bottom: var(--wsf-spacing);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .wsf-filter-container {
        flex-direction: column;
    }

    .wsf-filters {
        flex: 1;
        width: 100%;
    }

    .wsf-filter-actions {
        flex-direction: column;
    }

    .wsf-btn {
        width: 100%;
    }
}

/* Custom Properties Override (from admin settings) */
.wsf-filter-container[data-primary-color] {
    --wsf-primary: var(--wsf-custom-primary, #000000);
    --wsf-secondary: var(--wsf-custom-secondary, #ffffff);
    --wsf-border: var(--wsf-custom-border, #e0e0e0);
    --wsf-border-radius: var(--wsf-custom-radius, 0px);
    --wsf-border-width: var(--wsf-custom-width, 1px);
}

/* Skeleton Loader */
.wsf-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: wsf-skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes wsf-skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.wsf-skeleton-product {
    border: var(--wsf-border-width) solid var(--wsf-border);
    padding: var(--wsf-spacing);
    margin-bottom: var(--wsf-spacing);
}

.wsf-skeleton-image {
    width: 100%;
    height: 250px;
    margin-bottom: calc(var(--wsf-spacing) / 2);
}

.wsf-skeleton-title {
    width: 80%;
    height: 20px;
    margin-bottom: calc(var(--wsf-spacing) / 2);
}

.wsf-skeleton-price {
    width: 40%;
    height: 16px;
    margin-bottom: calc(var(--wsf-spacing) / 2);
}

.wsf-skeleton-button {
    width: 100%;
    height: 40px;
}

.wsf-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--wsf-spacing);
    margin-top: var(--wsf-spacing);
}

/* Infinite Scroll */
.wsf-load-more-trigger {
    height: 1px;
    margin: calc(var(--wsf-spacing) * 2) 0;
}

.wsf-loading-more {
    text-align: center;
    padding: calc(var(--wsf-spacing) * 2);
    color: var(--wsf-text-light);
}

.wsf-no-more-products {
    text-align: center;
    padding: calc(var(--wsf-spacing) * 2);
    color: var(--wsf-text-light);
    font-style: italic;
}

/* Products Header */
.wsf-products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--wsf-spacing);
    background: var(--wsf-secondary);
    border: var(--wsf-border-width) solid var(--wsf-border);
    margin-bottom: var(--wsf-spacing);
}

.wsf-products-sorting {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wsf-products-sorting label {
    font-size: 14px;
    font-weight: 600;
    color: var(--wsf-text);
}

.wsf-orderby-select {
    padding: 8px 32px 8px 12px;
    border: var(--wsf-border-width) solid var(--wsf-border);
    background: var(--wsf-secondary);
    color: var(--wsf-text);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23333' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: var(--wsf-transition);
}

.wsf-orderby-select:hover {
    border-color: var(--wsf-primary);
}

.wsf-orderby-select:focus {
    outline: none;
    border-color: var(--wsf-primary);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

/* Product Grid */
.wsf-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: calc(var(--wsf-spacing) * 1.5);
    max-width: 100%;
}

/* Maximum 3 columns on wide screens */
@media (min-width: 1024px) {
    .wsf-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (min-width: 1400px) {
    .wsf-products-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 100%;
    }
}

/* Product Item */
.wsf-product-item {
    background: var(--wsf-secondary);
    border: var(--wsf-border-width) solid var(--wsf-border);
    overflow: hidden;
    transition: var(--wsf-transition);
    display: flex;
    flex-direction: column;
}

.wsf-product-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Product Image */
.wsf-product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--wsf-hover);
}

.wsf-product-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.wsf-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--wsf-transition);
}

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

/* Product Badges */
.wsf-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    background: var(--wsf-primary);
    color: var(--wsf-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 1;
}

.wsf-badge-out-of-stock {
    background: #999;
}

/* Product Content */
.wsf-product-content {
    padding: var(--wsf-spacing);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.wsf-product-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.wsf-product-title a {
    color: var(--wsf-text);
    text-decoration: none;
    transition: var(--wsf-transition);
}

.wsf-product-title a:hover {
    color: var(--wsf-primary);
}

.wsf-product-price {
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--wsf-primary);
}

.wsf-product-price del {
    font-size: 14px;
    font-weight: 400;
    color: var(--wsf-text-light);
    margin-right: 8px;
}

.wsf-product-price ins {
    text-decoration: none;
}

/* Product Cart */
.wsf-product-cart {
    margin-top: auto;
}

.wsf-cart-btn {
    width: 100%;
    padding: 12px;
    border: var(--wsf-border-width) solid var(--wsf-primary);
    background: var(--wsf-primary);
    color: var(--wsf-secondary);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--wsf-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wsf-cart-btn:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.wsf-cart-btn:active {
    transform: translateY(0);
}

.wsf-cart-btn svg {
    flex-shrink: 0;
}

.wsf-cart-btn.loading {
    position: relative;
    pointer-events: none;
}

.wsf-cart-btn.loading svg,
.wsf-cart-btn.loading span {
    opacity: 0;
}

.wsf-cart-btn.loading::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--wsf-secondary);
    border-radius: 50%;
    animation: wsf-spin 0.8s linear infinite;
}

@keyframes wsf-spin {
    to { transform: rotate(360deg); }
}

/* Incremental Cart */
.wsf-cart-quantity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: var(--wsf-border-width) solid var(--wsf-border);
    padding: 4px;
}

.wsf-cart-decrease,
.wsf-cart-increase {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--wsf-hover);
    color: var(--wsf-primary);
    cursor: pointer;
    transition: var(--wsf-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.wsf-cart-decrease i,
.wsf-cart-increase i {
    color: var(--wsf-primary);
    transition: var(--wsf-transition);
}

.wsf-cart-decrease:hover,
.wsf-cart-increase:hover {
    background: var(--wsf-primary);
}

.wsf-cart-decrease:hover i,
.wsf-cart-increase:hover i {
    color: var(--wsf-secondary);
}

.wsf-cart-decrease:disabled,
.wsf-cart-increase:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wsf-cart-count {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--wsf-text);
}

/* Out of Stock */
.wsf-product-out-of-stock {
    padding: 12px;
    background: var(--wsf-hover);
    text-align: center;
    color: var(--wsf-text-light);
    font-size: 14px;
    font-weight: 600;
}

/* Responsive Grid */
@media (max-width: 1200px) {
    .wsf-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 992px) {
    .wsf-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .wsf-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .wsf-page-header {
        padding: var(--wsf-spacing);
    }

    .wsf-category-title {
        font-size: 24px;
    }

    .wsf-breadcrumb {
        font-size: 12px;
    }

    .wsf-products-header {
        flex-direction: column;
        gap: var(--wsf-spacing);
        align-items: stretch;
    }

    .wsf-products-sorting {
        flex-direction: column;
        align-items: stretch;
    }

    .wsf-orderby-select {
        width: 100%;
    }

    .wsf-product-title {
        font-size: 14px;
    }

    .wsf-product-price {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .wsf-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
