/* Simple Product Tabs CSS */
.spt-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box;
}

.spt-tabs {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    border-bottom: 2px solid #eee;
}

.spt-tab {
    padding: 10px 20px;
    cursor: pointer;
    margin-bottom: -2px;
    /* Overlap border */
    border-bottom: 2px solid transparent;
    font-weight: 600;
    color: #555;
    transition: all 0.3s ease;
    list-style: none !important;
}

.spt-tab:hover {
    color: #000;
}

.spt-tab.active {
    border-bottom: 2px solid #000;
    color: #000;
}

.spt-content {
    position: relative;
    min-height: 200px;
}

/* Loader Styling - Green Spinner */
.spt-loader {
    width: 40px;
    height: 40px;
    margin: 30px auto;
    border: 4px solid #f3f3f3;
    /* Light Grey Background */
    border-top: 4px solid #7fac35;
    /* Veggie Green to match theme */
    border-radius: 50%;
    animation: spt-spin 1s linear infinite;
    display: none;
    /* Toggled by JS */
    clear: both;
    text-indent: -9999px;
    /* Hide 'Loading...' text */
}

@keyframes spt-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Grid Animations */
#spt-product-grid {
    transition: opacity 0.3s ease;
}

/* Force Reset on Product UL */
.spt-container ul.products {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
}

/* Ensure LI items are clean */
.spt-container ul.products li.product {
    list-style: none !important;
    margin-left: 0 !important;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    /* Contain absolute elements */
}

/* Fallback columns - Aggressive Overrides */
.spt-container ul.products.columns-4 li.product {
    flex: 0 0 25% !important;
    max-width: 25% !important;
    width: 25% !important;
    padding: 0 10px;
    margin: 0 0 20px 0 !important;
    clear: none !important;
    /* Prevent theme from clearing rows */
    float: none !important;
    /* Disable floats if theme uses them */
}

@media (max-width: 768px) {
    .spt-container ul.products.columns-4 li.product {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
    }
}

@media (max-width: 480px) {
    .spt-container ul.products.columns-4 li.product {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
        padding: 0 5px;
    }
}

/* Hover Secondary Image Logic */
.spt-container ul.products li.product a {
    display: block;
    position: relative !important;
    overflow: hidden;
}

/* Hide conflicting third-party hover images (like QCLD) */
.spt-container .qcld-secondary-image,
.spt-container .secondary-image {
    display: none !important;
}

/* Enforce uniform image size and ratio */
.spt-container ul.products li.product a img,
.spt-container .spt-secondary-image {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 0;
    margin: 0 auto;
}

/* Specific transition for main image */
.spt-container ul.products li.product a img {
    transition: opacity 0.3s ease;
}

/* Secondary image is ABSOLUTE positioned over the main one */
.spt-container .spt-secondary-image {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    opacity: 0;
    z-index: 10;
    transition: opacity 0.3s ease-in-out;
}

/* Reveal on hover */
.spt-container ul.products li.product a:hover .spt-secondary-image {
    opacity: 1;
    display: block !important;
}

/* Ensure Badges (Sale, Sold Out) stay ON TOP of images */
.spt-container ul.products li.product .onsale,
.spt-container ul.products li.product .sold-out-badge,
.spt-container ul.products li.product .out-of-stock-badge {
    z-index: 20 !important;
    /* Higher than hover image (10) */
    position: absolute;
    /* Reinforce positioning */
}