/* =========================================================
   PRODUCT CARD – FINAL (STABLE BASELINE)
========================================================= */

.bf-products .products {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.bf-products .product {
    position: relative;
}

/* =========================================================
   CARD
========================================================= */

.bf-products .product-block {
    background: #fff;
    border-radius: 16px;
    transition: box-shadow .35s ease;
}

@media (hover: hover) and (pointer: fine) {
    .bf-products .product-block:hover {
        box-shadow: 0 14px 36px rgba(0,0,0,.10);
    }
}

/* =========================================================
   IMAGE
========================================================= */

.bf-products .product-transition {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
}

.bf-products .product-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f5f5f5;
}

.bf-products .product-img-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transform: scale(1);
    transition: transform .7s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (pointer: fine) {
    .bf-products .product-block:hover .product-img-wrap img {
        transform: scale(1.06);
    }
}

/* second image */
.bf-products .product-image.second-image {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .35s ease;
}

@media (hover: hover) and (pointer: fine) {
    .bf-products .product-block:hover .product-image.second-image {
        opacity: 1;
    }
}

/* =========================================================
   BADGES
========================================================= */

.bf-products .onsale {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    background: var(--e-global-color-primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 600;
    padding: .25rem .55rem;
    border-radius: 999px;
}

.bf-products .product.instock .product-transition::before {
    content: "Dostępne";
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 4;
    background: var(--e-global-color-accent);
    color: #fff;
    font-size: .65rem;
    font-weight: 600;
    padding: .25rem .55rem;
    border-radius: 999px;
    /* Tutaj jest dostępność magazynowa do ewentualnej przeróbki w przyszłości */
    display: none;
}

/* =========================================================
   OVERLAY LINK (ZOSTAJE)
========================================================= */

.bf-products .woocommerce-LoopProduct-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* =========================================================
   ADD TO CART
========================================================= */

.bf-products .group-action {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2em;
    display: flex;
    justify-content: center;
    z-index: 3;
}

/* desktop – hover reveal */
@media (hover: hover) and (pointer: fine) {
    .bf-products .group-action {
        opacity: 0;
        transform: translateY(10px);
        transition: opacity .3s ease, transform .3s ease;
    }

    .bf-products .product-block:hover .group-action {
        opacity: 1;
        transform: translateY(0);
    }
}

/* mobile – ALWAYS visible */
@media (hover: none) and (pointer: coarse) {
    .bf-products .group-action {
        opacity: 1;
        transform: none;
    }
}

.bf-products .shop-action .button {
    width: 44px;
    height: 44px;
    padding: 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 999px;
    font-size: 0;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 4;
    transition: 0.2s;
}

/* icon */
.bf-products .shop-action .button::before {
    content: "";
    width: 18px;
    height: 18px;
    background: url("/wp-content/themes/hello-elementor-child/assets/icons/cart-plus.svg")
        no-repeat center / contain;
    display: block;
}

/* DESKTOP hover – kolor */
@media (hover: hover) and (pointer: fine) {
    .bf-products .shop-action .button:hover {
        background: var(--e-global-color-primary);
    }
    .bf-products .shop-action .button:hover::before {
        filter: brightness(0) invert(1);
    }
}


@media (hover: none) and (pointer: coarse) {
    .bf-products .shop-action .button:active,
    .bf-products .shop-action .button.added {
        background: var(--e-global-color-primary);
    }

    .bf-products .shop-action .button:active::before,
    .bf-products .shop-action .button.added::before {
        filter: brightness(0) invert(1);
    }
}

/* loading */
.bf-products .shop-action .button.loading::before {
    display: none;
}

.bf-products .shop-action .button.loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: bfSpin .7s linear infinite;
}

@keyframes bfSpin {
    to { transform: rotate(360deg); }
}


.bf-products .added_to_cart {
    display: none !important;
}

/* out of stock */
.bf-products .product.outofstock {
    opacity: .6;
}

.bf-products .product.outofstock .button {
    pointer-events: none;
    background: #f7f7f7;
}

.bf-products .product.outofstock .button::before {
    opacity: .4;
}

/* =========================================================
   CAPTION
========================================================= */

.bf-products .caption {
    position: relative;
    z-index: 2;
    padding: 1rem .25rem 0;
    text-align: center;
    background: #fff;
    transition: transform .45s cubic-bezier(0.22,1,0.36,1);
}

@media (hover: hover) and (pointer: fine) {
    .bf-products .product-block:hover .caption {
        transform: translateY(-14px);
    }
}

/* =========================================================
   TYPOGRAPHY
========================================================= */

.bf-products .woocommerce-loop-product__title {
    margin: .4rem 0 .35rem;
    font-size: 1rem;
    font-weight: 400;
    position: relative;
    z-index: 3;
}

.bf-products .price {
    display: flex;
    justify-content: center;
    gap: .4rem;
    font-size: .9rem;
    position: relative;
    z-index: 3;
}

.bf-products .price del {
    opacity: .55;
    font-weight: 400;
}

.bf-products .price ins {
    font-weight: 600;
    text-decoration: none;
}

/* =========================================================
   ACCESSIBILITY
========================================================= */

.bf-products a:focus,
.bf-products button:focus {
    outline: none;
}

.bf-products a:focus-visible,
.bf-products button:focus-visible {
    outline: 2px solid var(--e-global-color-primary);
    outline-offset: 3px;
}

/* =========================================================
   RESPONSIVE GRID
========================================================= */

@media (max-width: 1024px) {
    .bf-products .products {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

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

/* =========================================================
   FIX: PRODUCT TITLE – ALWAYS BLACK
========================================================= */

.bf-products .woocommerce-loop-product__title,
.bf-products .woocommerce-loop-product__title a,
.bf-products .woocommerce-loop-product__title a:visited,
.bf-products .woocommerce-loop-product__title a:hover,
.bf-products .woocommerce-loop-product__title a:active,
.bf-products .woocommerce-loop-product__title a:focus {
    color: #000 ;
    text-decoration: none;
    transition: 0.2s;
}


.product_meta{
    display: flex;
    flex-direction: column;
}


@media (hover: hover) and (pointer: fine) {
    .bf-products .woocommerce-loop-product__title a:hover {
        color: var(--e-global-color-primary);
    }
}

/* =========================================================
   PDP – RELATED PRODUCTS GRID OVERRIDE
========================================================= */

.single-product .pdp__related .bf-products .products {
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: 6em;
}
.single-product .pdp__related .woocommerce-loop-product__title {
    font-size: 1rem;
    font-weight: 400;
}

@media (max-width: 1024px) {
    .single-product .pdp__related .bf-products .products {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .single-product .pdp__related .bf-products .products {
        grid-template-columns: 1fr;
    }
}
