/* CLS Fix: Pre-load Layout */
.product-slider:not(.slick-initialized) {
    display: flex;
    overflow: hidden;
    margin: 0 -15px;
    /* Compensate for item padding */
}

.product-slider:not(.slick-initialized) .slider-item {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 0 15px;
    /* Match initialized padding */
    box-sizing: border-box;
}

.products-section {
    padding: 80px 0;
    background: var(--section-bg);
    transition: background-color 0.5s ease;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.section-header .section-title {
    left: 0;
    transform: none;
    margin-bottom: 0;
}

.view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.view-all:hover {
    color: var(--text-color);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--product-bg);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s, background-color 0.5s ease;
    position: relative;
    border: 1px solid var(--border-color);
}

.slider-item.slick-slide.slick-active .product-image {
    background: #FFF;
    border-radius: 14px;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.product-image {
    height: 250px;
    background: var(--input-bg);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

/* Smooth fade-in for LiteSpeed lazy-loaded images */
.product-image img[data-lazyloaded] {
    opacity: 0;
}

.product-image img.litespeed-loaded {
    opacity: 1;
    transition: opacity 0.33s ease-in-out, transform 0.5s;
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
}

.badge.sale {
    background: #ff4757;
    color: #fff;
}

.badge.new {
    background: var(--primary-color);
    color: #000;
}

.product-info {
    padding: 20px;
}

.product-info h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.product-info h3 a {
    color: var(--text-color);
    text-decoration: none;
}

.product-info h3 a:hover {
    color: var(--primary-color);
}

.price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: block;
}

.old-price {
    text-decoration: line-through;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    margin-right: 10px;
}

/* WooCommerce Overrides - Premium Product Cards */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    background: var(--product-bg);
    border-radius: 15px;
    padding: 0;
    border: 1px solid var(--border-color);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-card);
    position: relative;
    margin-bottom: 0;
}

.woocommerce ul.products li.product:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--primary-color);
}

.woocommerce ul.products li.product a img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.33s ease-in-out;
}

/* Smooth fade-in for LiteSpeed lazy-loaded product images */
.woocommerce ul.products li.product a img[data-lazyloaded] {
    opacity: 0;
}

.woocommerce ul.products li.product a img.litespeed-loaded {
    opacity: 1;
}

.woocommerce ul.products li.product .woocommerce-loop-product__link.goled-img-loading img {
    opacity: 0;
}

.woocommerce ul.products li.product .woocommerce-loop-product__link.goled-img-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            var(--skeleton-bg) 0%,
            var(--skeleton-shine) 50%,
            var(--skeleton-bg) 100%);
    background-size: 200% 100%;
    animation: goled_skeleton_shimmer 1.1s ease-in-out infinite;
    z-index: 1;
}

@keyframes goled_skeleton_shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.woocommerce ul.products li.product:hover a img {
    transform: scale(1.08);
}

/* Product Info Section */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    padding: 20px 20px 10px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
    margin: 0;
    transition: color 0.3s;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title:hover {
    color: var(--primary-color);
}

/* Price Styling */
.woocommerce ul.products li.product .price {
    font-weight: 700;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    line-height: 1.2;
    background: var(--single-price-bg);
    border: 1px solid var(--single-price-border-color);
    border-radius: 8px;
    color: var(--primary-color) !important;
}

.woocommerce ul.products li.product .price del {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

.woocommerce ul.products li.product .price ins {
    text-decoration: none;
    color: var(--primary-color);
}

/*hide z vat dla promocji*/
li.sale .price small {
    display: none;
}

/* Add to Cart Button - Responsive Style */
.woocommerce ul.products li.product .button {
    margin: 0 0 10px 0;
    background: var(--primary-color);
    border: none;
    color: #000;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 14px 20px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(254, 185, 0, 0.3);
    text-align: center;
    left: 50%;
    transform: translateX(-50%);
}

span.ast-woo-product-category {
    text-align: center;
}

.woocommerce ul.products li.product .button:hover {
    background: #e0a800;
    transform: translateY(-2px) translateX(-50%);
    box-shadow: 0 6px 20px rgba(254, 185, 0, 0.4);
    color: #000;
}

.woocommerce ul.products li.product .button:active {
    transform: translateY(0) translateX(-50%);
}

/* Wishlist/Favorites Button */
.woocommerce ul.products li.product .product-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    z-index: 10;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.woocommerce ul.products li.product:hover .product-actions {
    opacity: 1;
    transform: translateY(0);
}

.woocommerce ul.products li.product .wishlist-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-color);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow-icon);
    padding: 0 !important;
    opacity: 0.8;
}

.woocommerce ul.products li.product .wishlist-button:hover,
.woocommerce ul.products li.product .yith-wcwl-add-to-wishlist a:hover {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(254, 185, 0, 0.4);
}

.woocommerce ul.products li.product .wishlist-button.active,
.woocommerce ul.products li.product .yith-wcwl-add-to-wishlist a.added {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
}

/* Sale Badge in Slider */
.product-slider .ast-onsale-card {
    color: var(--ast-global-color-3);
    background-color: var(--ast-global-color-primary, var(--ast-global-color-5));
    width: fit-content;
    border-radius: 20px;
    padding: 0.4em 0.8em;
    font-size: .87em;
    font-weight: 500;
    line-height: normal;
    letter-spacing: normal;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.15);
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}

.ast-on-card-button {
    right: unset !important;
    left: 0;
    top: 0;
    border-radius: 14px;
    border-top-right-radius: 0;
    border-bottom-left-radius: 0;
    opacity: 0.8 !important;
    background: var(--card-bg) !important;
}

@media (max-width: 1390px) {
    .section-header {
        flex-direction: column;
        margin-bottom: 1.1em;
    }

    .section-header .view-all {
        margin-top: -5px;
    }
}

@media (max-width: 1024px) {
    .product-slider:not(.slick-initialized) .slider-item {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
}

@media (min-width: 769px) and (max-width: 991px) {
    .goled-shop-layout {
        padding-top: 25px !important;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .woocommerce ul.products li.product .button {
        font-size: 0.9rem;
        padding: 12px 18px;
    }
}

@media (max-width: 768px) {
    .product-slider:not(.slick-initialized) .slider-item {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 480px),
(min-width: 545px) and (max-width: 748px) {
    .woocommerce ul.products li.product .button {
        font-size: 0;
        padding: 12px 16px;
        line-height: 1;
        text-indent: 0;
        letter-spacing: 0;
    }

    .woocommerce ul.products li.product .button::before {
        content: "Do koszyka";
        font-size: 0.85rem;
        display: inline-block;
        letter-spacing: normal;
    }

    .product-slider:not(.slick-initialized) .slider-item {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .button.add_to_cart_button.added::before {
        color: transparent;
    }

    body:not(.single-product) .button.add_to_cart_button.added::after {
        color: #000 !important;
        display: block;
        margin-left: 0 !important;
        font-size: 18px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .woocommerce-js ul.products li.product .button.added,
    .woocommerce-page ul.products li.product .button.added {
        margin-bottom: 10px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .woocommerce ul.products li.product .woocommerce-loop-product__link.goled-img-loading::before {
        animation: none;
    }
}