/**
 * HSM Product Filter Styles
 */

/* Main filter container */
.hsm-product-filter {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 30px;
}

/* Vertical layout */
.hsm-product-filter.hsm-filter-vertical {
    max-width: 280px;
}

.hsm-product-filter.hsm-filter-vertical .hsm-filter-section {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e5e5e5;
}

.hsm-product-filter.hsm-filter-vertical .hsm-filter-section:last-of-type {
    border-bottom: none;
}

/* Filter section title - inherit Impreza font styles */
.hsm-filter-title {
    font-size: inherit;
    font-family: inherit;
    font-weight: normal;
    margin-bottom: 15px;
    color: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

/* Color swatches section */
.hsm-color-swatches {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 195px;
    overflow-y: auto;
    padding-right: 5px;
    padding-bottom: 5px;
}

/* Custom scrollbar for color swatches */
.hsm-color-swatches::-webkit-scrollbar {
    width: 6px;
}

.hsm-color-swatches::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.hsm-color-swatches::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.hsm-color-swatches::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.hsm-color-swatch-item {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.hsm-color-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.hsm-color-swatch-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: center;
}

.hsm-color-swatch {
    width: 35px;
    height: 35px;
    border-radius: 4px;
    border: 2px solid #ddd;
    display: block;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 0 auto 5px;
}

.hsm-swatch-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hsm-swatch-name {
    font-size: 10px;
    text-align: center;
    color: #666;
    word-wrap: break-word;
    line-height: 1.2;
    max-width: 100%;
}

/* Selected state for color swatches */
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Light colors get dark checkmark */
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="white"],
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="FFFFFF"],
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="fff"],
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="F5F5"],
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="FFFF"],
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="beige"],
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="yellow"] {
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="white"]::after,
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="FFFFFF"]::after,
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="fff"]::after,
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="F5F5"]::after,
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="FFFF"]::after,
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="beige"]::after,
.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-color-swatch[style*="yellow"]::after {
    color: #333;
    text-shadow: none;
}

/* Hover state for color swatches */
.hsm-color-swatch-label:hover .hsm-color-swatch {
    transform: scale(1.05);
    border-color: #666;
}

.hsm-color-checkbox:checked + .hsm-color-swatch-label .hsm-swatch-name {
    color: #333;
    font-weight: 600;
}

/* Size checkboxes section */
.hsm-size-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hsm-size-item {
    display: flex;
    align-items: center;
}

.hsm-size-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.hsm-size-item label {
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: color 0.2s ease;
    margin: 0;
}

.hsm-size-item:hover label {
    color: #666;
}

.hsm-size-checkbox:checked + label {
    color: #000;
    font-weight: 600;
}

/* Child categories section */
.hsm-category-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hsm-category-item {
    display: flex;
    align-items: center;
}

.hsm-category-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.hsm-category-item label {
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: color 0.2s ease;
    margin: 0;
}

.hsm-category-item:hover label {
    color: #666;
}

.hsm-category-checkbox:checked + label {
    color: #000;
    font-weight: 600;
}

/* Filter actions */
.hsm-filter-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
}

.hsm-filter-actions button {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hsm-clear-filters:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* Loading state */
.hsm-filter-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.hsm-filter-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: hsm-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* Horizontal layout */
.hsm-product-filter.hsm-filter-horizontal {
    display: flex;
    align-items: flex-start;
    gap: 30px;
}

.hsm-product-filter.hsm-filter-horizontal .hsm-filter-section {
    flex: 1;
}

.hsm-product-filter.hsm-filter-horizontal .hsm-filter-actions {
    flex-direction: column;
    margin-top: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .hsm-product-filter.hsm-filter-vertical {
        max-width: 100%;
    }
    
    .hsm-product-filter.hsm-filter-horizontal {
        flex-direction: column;
    }
    
    .hsm-color-swatches {
        grid-template-columns: 1fr 1fr 1fr;
        max-height: 150px;
    }
    
    .hsm-color-swatch {
        width: 30px;
        height: 30px;
    }
    
    .hsm-swatch-name {
        font-size: 9px;
    }
    
    .hsm-filter-actions {
        flex-direction: column;
    }
    
    .hsm-filter-section {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    
    /* Single product page color variations responsive */
    .color-swatches-grid,
    .color-swatches-wrapper,
    .color-swatches-container {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .color-swatches-wrapper,
    .color-swatches-container {
        display: block !important;
    }
    
    .single-product .variations .value,
    .single-product .variations .value .variation-radios,
    .single-product .variations .value table {
        width: 100% !important;
    }
    
    .single-product .variations .value .variation-radios {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        max-width: 100% !important;
    }
}

/* Force max 5 columns on all screens above mobile */
@media (min-width: 769px) {
    .color-swatches-grid,
    .color-swatches-wrapper,
    .color-swatches-container {
        display: grid !important;
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 12px !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .color-swatches-wrapper,
    .color-swatches-container {
        display: block !important;
    }
    
    .single-product .variations .value .variation-radios,
    .single-product .variations td,
    .single-product .variations .value,
    .woocommerce .single-product .variations .value .variation-radios,
    .woocommerce-variation-radios,
    .variations .value .variation-radios,
    .variations td .variation-radios,
    .woocommerce .variations .value .variation-radios,
    .woocommerce .variations td .variation-radios,
    .variation-radios {
        display: grid !important;
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 12px !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Override any inline styles or theme styles */
    .variations .value * {
        max-width: none !important;
    }
}
    
    .single-product .variations .value .variation-radios .radio-option {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        width: 100% !important;
        max-width: none !important;
    }
    
    .single-product .variations .value .variation-radios .radio-option .swatch {
        width: 35px !important;
        height: 35px !important;
        margin: 0 auto 5px auto !important;
    }
    
    .single-product .variations .value .variation-radios .radio-option .label {
        font-size: 10px !important;
        line-height: 1.2 !important;
        text-align: center !important;
        word-wrap: break-word !important;
    }
}

/* Integration with Impreza theme */
.l-sidebar .hsm-product-filter.hsm-filter-vertical {
    max-width: 100%;
    margin-bottom: 30px;
}

.w-grid-list .hsm-product-filter {
    margin-bottom: 30px;
}

/* WooCommerce compatibility */
.woocommerce .hsm-product-filter {
    margin-bottom: 2em;
}

.woocommerce-page .hsm-product-filter {
    clear: both;
}

/* Disabled state */
.hsm-product-filter.filtering .hsm-filter-section {
    opacity: 0.5;
    pointer-events: none;
}

.hsm-product-filter.filtering .hsm-filter-actions button {
    opacity: 0.5;
    pointer-events: none;
}

/* No results message */
.woocommerce-info {
    background-color: #f7f7f7;
    border-left: 4px solid #007cba;
    padding: 15px;
    margin: 20px 0;
}

/* Preserve Impreza grid animations after filtering - FORCE HOVER EFFECTS */
.w-grid .product,
.w-grid .w-grid-item,
.products .product {
    position: relative !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    cursor: pointer !important;
}

/* CRITICAL: Force hover animations to work after AJAX filtering */
.w-grid .product:hover,
.w-grid .w-grid-item:hover,
.products .product:hover,
.w-grid-item:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15) !important;
    transition: all 0.3s ease !important;
}

/* Sale badge styling for Impreza grid */
.layout_823650 .usg_product_field_1 {
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    padding-right: 0.8rem !important;
    padding-left: 0.8rem !important;
    border-radius: 2rem !important;
    background: var(--color-content-primary) !important;
}

/* Fallback sale badges */
.w-grid .onsale,
.products .onsale {
    position: absolute !important;
    z-index: 9 !important;
    top: 10px !important;
    left: 10px !important;
    border-radius: 2rem !important;
}

/* Make buttons visible on hover */
.w-grid .product:hover .button,
.w-grid .w-grid-item:hover .button,
.products .product:hover .button {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Product image hover effects */
.w-grid .product .product-loop-hover,
.w-grid-item .w-post-elm,
.products .product a img {
    transition: all 0.3s ease !important;
}

/* Hide buttons by default and make them full width */
.w-grid .product .button,
.w-grid .product .add_to_cart_button,
.w-grid .w-grid-item .button,
.w-grid .w-grid-item .add_to_cart_button,
.products .product .button,
.products .product .add_to_cart_button {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
    width: 100% !important;
    margin: 0 !important;
    text-align: center !important;
}

/* Show buttons on hover with full width */
.w-grid .product:hover .button,
.w-grid .product:hover .add_to_cart_button,
.w-grid .w-grid-item:hover .button,
.w-grid .w-grid-item:hover .add_to_cart_button,
.products .product:hover .button,
.products .product:hover .add_to_cart_button {
    opacity: 1 !important;
    visibility: visible !important;
    width: 100% !important;
    margin: 0 !important;
    text-align: center !important;
}

/* Preserve Impreza animation classes */
.w-grid .animate_reveal,
.w-grid .animate_fade,
.w-grid .animate_afc,
.w-grid .animate_afl,
.w-grid .animate_afr,
.w-grid .animate_afb,
.w-grid .animate_aft,
.w-grid .animate_hfc,
.w-grid .animate_wfc,
.w-grid .animate_rfc,
.w-grid .animate_rfl,
.w-grid .animate_rfr,
.w-grid .animate_rfb,
.w-grid .animate_rft {
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

/* Product titles - centered and smaller */
.w-grid .product .woocommerce-loop-product__title,
.w-grid .w-grid-item .woocommerce-loop-product__title,
.w-grid .w-grid-item .w-post-title,
.products .product .woocommerce-loop-product__title {
    font-family: inherit;
    font-size: 1.1rem !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    color: inherit;
    text-align: center !important;
    margin: 10px 0 5px 0 !important;
}

/* Product prices - centered and proper spacing */
.w-grid .product .price,
.w-grid .w-grid-item .price,
.products .product .price {
    text-align: center !important;
    margin: 5px 0 15px 0 !important;
    font-size: 1rem !important;
}

/* Fix filter title to match Impreza headings */
.w-grid-list .hsm-filter-title,
.l-sidebar .hsm-filter-title {
    font-family: var(--font-family, inherit);
    font-size: 1.2rem;
    color: var(--color-header-middle-text, #333);
}

/* CRITICAL: Override any existing grid layout for color swatches */
.woocommerce .variations .color-swatches-grid,
.single-product .variations .color-swatches-grid,
.variations .value .color-swatches-grid,
table.variations .color-swatches-grid,
.woocommerce table.variations .color-swatches-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 12px !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Mobile override for color swatches */
@media (max-width: 768px) {
    .woocommerce .variations .color-swatches-grid,
    .single-product .variations .color-swatches-grid,
    .variations .value .color-swatches-grid,
    table.variations .color-swatches-grid,
    .woocommerce table.variations .color-swatches-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }
}

/* CRITICAL: Ultimate override for color swatches - must be at end */
.color-swatches-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 12px !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Ensure container has proper spacing */
.color-swatches-container,
.color-swatches-wrapper {
    padding-right: 20px !important;
    overflow: visible !important;
    width: 100% !important;
}

/* Mobile final override */
@media (max-width: 768px) {
    .color-swatches-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }
}

/* --- Grid Image Cropping Fix --- */

.w-grid-item .w-grid-item-h {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.w-grid-item .w-grid-item-anchor {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.w-grid-item .w-grid-item-image {
    height: 250px; /* You can adjust this value to your liking */
    overflow: hidden;
    flex-shrink: 0;
}

.w-grid-item .w-grid-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.w-grid-item .w-grid-item-text {
    text-align: center;
    padding: 1em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.w-grid-item .woocommerce-loop-product__title {
    font-size: 1.1rem !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    color: inherit;
    text-align: center !important;
    margin: 0 0 5px 0 !important;
}

.w-grid-item .price {
    text-align: center !important;
    margin: 5px 0 0 0 !important;
    font-size: 1rem !important;
}

/* Fix grid item height and spacing issues */
.w-grid-item {
    height: auto !important;
    min-height: auto !important;
    margin-bottom: 0 !important;
}

.w-grid-item-h {
    height: auto !important;
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
}

/* SIMPLE FIX FOR FILTERED IMAGES - Just prevent cropping */
.hsm-filtered-image {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important; /* Remove any height restrictions */
    object-fit: none !important; /* Don't manipulate the image at all */
    aspect-ratio: unset !important; /* Let image use its natural proportions */
    margin: 0 auto !important;
    display: block !important;
}

/* Simple container - just don't crop */
.hsm-filtered-container {
    width: 100% !important;
    height: auto !important; /* Auto height to fit content */
    display: block !important; /* Simple block display */
    overflow: visible !important; /* Never crop */
    text-decoration: none !important;
}

/* Ensure product link container doesn't crop images */
.w-grid-item .woocommerce-LoopProduct-link {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    text-decoration: none !important;
}

/* Fix grid container spacing */
.w-grid-list {
    display: grid !important;
    grid-gap: 1.5rem !important;
    gap: 1.5rem !important;
}

/* Ensure proper product content layout */
.w-grid-item .woocommerce-loop-product__title {
    margin: 10px 0 5px 0 !important;
}

.w-grid-item .price {
    margin: 5px 0 10px 0 !important;
}

/* CRITICAL: Override any forced square image styling for filtered results */
.hsm-filtered-image,
.hsm-filtered-image.attachment-woocommerce_thumbnail,
.hsm-filtered-image.size-woocommerce_thumbnail,
.hsm-filtered-image.wp-post-image,
body .hsm-filtered-image {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important; /* Show full image without cropping */
    object-position: center center !important;
    aspect-ratio: unset !important; /* Allow natural proportions */
    display: block !important;
    margin: 0 auto !important; /* Center horizontally */
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    text-align: center !important; /* Center the image */
    padding: 0 !important; /* Remove any padding */
    box-sizing: border-box !important;
    border-radius: 0 !important;
}

/* Force containers to accommodate natural image size ONLY for filtered items */
body .hsm-filtered-container {
    display: block !important;
    height: auto !important; /* Allow natural height */
    min-height: auto !important;
    overflow: visible !important;
    text-decoration: none !important;
    text-align: center !important; /* Center the image */
    padding: 0 !important; /* Remove any padding that might cause white space */
}

/* Ensure grid items don't have excess spacing around filtered images */
body .hsm-filtered-item {
    text-align: center !important;
}

body .hsm-filtered-item .w-grid-item-image,
body .hsm-filtered-item .product-image {
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ========================================
   MOBILE FILTER/SORT INTERFACE
======================================== */

/* Default desktop styles - show desktop filter, hide mobile controls */
@media (min-width: 769px) {
    .hsm-product-filter.hsm-desktop-filter {
        display: block !important;
    }

    .hsm-filter-content .hsm-product-filter {
        display: none !important;
    }
}

.hsm-mobile-controls {
    display: none !important;
}

.hsm-mobile-sort-overlay,
.hsm-mobile-filter-overlay {
    display: none !important;
}

/* Mobile styles */
@media (max-width: 768px) {

    /* Show mobile controls - positioned under header */
    .hsm-mobile-controls {
        display: flex !important;
        gap: 10px;
        margin: 0 0 20px 0;
        padding: 15px;
        background: #fff;
        border-bottom: 1px solid #eee;
        position: sticky !important;
        top: 0 !important;
        z-index: 999 !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    /* Remove fixed positioning spacing adjustments */

    .hsm-mobile-btn {
        flex: 1;
        padding: 12px 15px;
        border: 2px solid #ddd;
        background: white;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        outline: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .hsm-mobile-btn:hover,
    .hsm-mobile-btn:active,
    .hsm-mobile-btn:focus {
        border-color: #333;
        background: #f5f5f5;
        transform: translateY(-1px);
        outline: none;
    }

    .hsm-mobile-btn:active {
        transform: translateY(0);
        background: #e0e0e0;
    }

    .hsm-btn-icon {
        font-size: 16px;
        font-weight: bold;
    }

    /* Hide desktop filter on mobile, show only mobile filter in panel */
    .hsm-product-filter.hsm-desktop-filter {
        display: none !important;
    }

    /* Overlay styles - ensure they're visible on mobile */
    .hsm-mobile-sort-overlay,
    .hsm-mobile-filter-overlay {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .hsm-mobile-sort-overlay.active,
    .hsm-mobile-filter-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Sort panel sliding from left, Filter panel from right */
    .hsm-mobile-sort-panel {
        position: absolute;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 400px;
        height: 100%;
        background: white;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .hsm-mobile-filter-panel {
        position: absolute;
        top: 0;
        right: 0;
        width: 85%;
        max-width: 400px;
        height: 100%;
        background: white;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .hsm-mobile-sort-overlay.active .hsm-mobile-sort-panel,
    .hsm-mobile-filter-overlay.active .hsm-mobile-filter-panel {
        transform: translateX(0);
    }

    /* Panel header */
    .hsm-panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid #eee;
        background: #f9f9f9;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .hsm-panel-header h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #333;
    }

    .hsm-close-panel {
        background: none;
        border: none;
        font-size: 24px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border-radius: 50%;
        transition: background 0.2s ease;
    }

    .hsm-close-panel:hover {
        background: #e0e0e0;
    }

    /* Sort options */
    .hsm-sort-options {
        padding: 20px;
    }

    .hsm-sort-options label {
        display: block;
        padding: 15px 0;
        border-bottom: 1px solid #f0f0f0;
        cursor: pointer;
        font-size: 16px;
        transition: background 0.2s ease;
    }

    .hsm-sort-options label:hover {
        background: #f9f9f9;
        margin: 0 -20px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .hsm-sort-options input[type="radio"] {
        margin-right: 12px;
        transform: scale(1.2);
    }

    /* Filter content */
    .hsm-filter-content {
        padding: 20px;
    }

    .hsm-filter-content .hsm-product-filter {
        display: block !important;
    }

    /* Adjust filter sections for mobile */
    .hsm-filter-content .hsm-filter-section {
        margin-bottom: 25px;
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 20px;
    }

    .hsm-filter-content .hsm-filter-section:last-of-type {
        border-bottom: none;
        padding-bottom: 0;
    }

    .hsm-filter-content .hsm-filter-section h4 {
        font-size: 16px;
        font-weight: 600;
        margin: 0 0 15px 0;
        color: #333;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Color swatches in mobile */
    .hsm-filter-content .hsm-color-options {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 10px;
    }

    /* Size options in mobile */
    .hsm-filter-content .hsm-size-options label {
        display: block;
        padding: 12px 15px;
        margin-bottom: 8px;
        border: 2px solid #eee;
        border-radius: 6px;
        background: white;
        cursor: pointer;
        transition: all 0.2s ease;
        font-weight: 500;
    }

    .hsm-filter-content .hsm-size-options label:hover {
        border-color: #ddd;
        background: #f9f9f9;
    }

    .hsm-filter-content .hsm-size-options input[type="checkbox"]:checked + span {
        border-color: #333;
        background: #333;
        color: white;
    }

    /* Clear button in mobile */
    .hsm-filter-content .hsm-filter-actions {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid #f0f0f0;
    }

    .hsm-filter-content .hsm-clear-filters {
        width: 100%;
        padding: 15px;
        background: #f44336;
        color: white;
        border: none;
        border-radius: 6px;
        font-size: 16px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .hsm-filter-content .hsm-clear-filters:hover {
        background: #d32f2f;
    }
}

/* Prevent body scroll when mobile overlay is open */
body.hsm-mobile-overlay-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/**
 * Product Grid Color Swatches
 */

/* Main container for color swatches in product grid */
.product-grid-color-swatches {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
    padding: 4px 0;
    flex-wrap: wrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show swatches when loaded */
.product-grid-color-swatches:not(:empty) {
    opacity: 1;
}

/* Individual color swatch */
.product-grid-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    position: relative;
    background-size: cover;
    background-position: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Swatch hover effects */
.product-grid-color-swatch:hover {
    transform: scale(1.15);
    border-color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

/* Swatch active/selected state */
.product-grid-color-swatch.active,
.product-grid-color-swatch.selected {
    border-color: #333;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #333;
    transform: scale(1.1);
}

/* Loading state for swatches */
.hsw-color-loading .product-grid-color-swatches {
    min-height: 30px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: hsm-loading 1.5s infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .product-grid-color-swatches {
        gap: 4px;
        margin: 6px 0;
    }

    .product-grid-color-swatch {
        width: 16px;
        height: 16px;
        border-width: 1px;
    }
}

@media (max-width: 480px) {
    .product-grid-color-swatches {
        gap: 3px;
        margin: 4px 0;
    }

    .product-grid-color-swatch {
        width: 14px;
        height: 14px;
    }
}

/* Integration with Impreza theme */
.w-grid-item .product-grid-color-swatches {
    order: 1; /* Position between image and content */
}

.w-grid-item-h {
    display: flex;
    flex-direction: column;
}

.w-grid-item-anchor {
    order: 0;
}

.product-grid-color-swatches {
    order: 1;
}

.w-grid-item-text {
    order: 2;
}

/* Alternative positioning if flexbox doesn't work */
.w-grid-item:not(.w-grid-item-h) .product-grid-color-swatches {
    margin-top: -10px;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}

/* Ensure swatches don't interfere with product links */
.product-grid-color-swatch {
    pointer-events: auto;
    z-index: 10;
}

/* Subtle animation when swatches are added */
@keyframes hsm-swatch-fade-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.product-grid-color-swatches .product-grid-color-swatch {
    animation: hsm-swatch-fade-in 0.3s ease forwards;
}

/* Stagger animation for multiple swatches */
.product-grid-color-swatches .product-grid-color-swatch:nth-child(1) { animation-delay: 0.05s; }
.product-grid-color-swatches .product-grid-color-swatch:nth-child(2) { animation-delay: 0.1s; }
.product-grid-color-swatches .product-grid-color-swatch:nth-child(3) { animation-delay: 0.15s; }
.product-grid-color-swatches .product-grid-color-swatch:nth-child(4) { animation-delay: 0.2s; }
.product-grid-color-swatches .product-grid-color-swatch:nth-child(5) { animation-delay: 0.25s; }

.hsm-filtered-image, .hsm-filtered-image.attachment-woocommerce_thumbnail, .hsm-filtered-image.size-woocommerce_thumbnail, .hsm-filtered-image.wp-post-image, body .hsm-filtered-image {

    width: unset !important;

    height: unset !important;

    max-width: unset !important;

    max-height: unset !important;

    object-fit: unset !important;

    object-position: unset !important;

    aspect-ratio: unset !important;

    display: unset !important;

    margin: unset !important;

    position: unset !important;

    top: 0 !important;

    left: 0 !important;

    right: 0 !important;

    bottom: 0 !important;

    transform: unset !important;

    text-align: unset !important;

    padding: unset !important;

    box-sizing: unset !important;

    border-radius: unset !important;

}

/* Color dropdown options list - Light grey border instead of blue */
.color-options-list {
    border: 2px solid #ddd !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;

/* Guest user restrictions */
body:not(.logged-in) .price,
body:not(.logged-in) .woocommerce-Price-amount,
body:not(.logged-in) .amount {
    display: none !important;
}

/* View Details button styling for guests */
.button.product_type_simple {
    display: inline-block;
    padding: 8px 16px;
    background: #333;
    color: #fff !important;
    text-decoration: none;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.button.product_type_simple:hover {
    background: #000;
}
