/**
 * Xblitz – strona główna: "Nowości & Promocje" + "Gorąca oferta".
 * Ładowany tylko w main-page-template.php.
 * Szablony: main-page-template.php, template-parts/bigProductTile.php
 */

.xb-home-products,
.xb-home-deal {
    --xb-red: #C41A1B;
    --xb-red-dark: #A01516;
    --xb-ink: #15171F;
    --xb-muted: #5A6070;
    --xb-faint: #A2A9B8;
    --xb-line: #ECEFF5;
    --xb-field: #D5DAE4;
    --xb-green: #1E8E4E;
}

/* ================================================================
   NAGŁÓWEK SEKCJI
   ================================================================ */

.xb-home-products h3.xb-home-title {
    margin: 0 0 22px !important;
    font-family: "Poppins SemiBold", sans-serif;
    font-weight: 600 !important;
    font-size: 28px;
    line-height: 1.2;
    color: var(--xb-ink);
    text-align: center;
}

.xb-home-products h3.xb-home-title::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    margin: 12px auto 0;
    border-radius: 3px;
    background: var(--xb-red);
}

/* ================================================================
   KARTY PRODUKTÓW
   ================================================================ */

.xb-home-products ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 0 !important;
    padding: 0 !important;
}

.xb-home-products ul.products::before,
.xb-home-products ul.products::after {
    display: none !important;
}

.xb-home-products ul.products li.product {
    position: relative;
    display: flex !important;
    flex-direction: column;
    width: auto !important;
    max-width: none !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
    padding: 14px !important;
    background: #fff;
    border: 1px solid var(--xb-line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(16, 20, 38, .04), 0 10px 26px -16px rgba(16, 20, 38, .18);
    text-align: center;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}

.xb-home-products ul.products li.product:hover {
    transform: translateY(-2px);
    border-color: #DCE3F0;
    box-shadow: 0 16px 36px -20px rgba(16, 20, 38, .32);
}

.xb-home-products li.product > a.woocommerce-loop-product__link {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center !important;
    text-decoration: none !important;
}

/* zdjęcie: kwadrat z jasnym tłem, białe tło packshotu się wtapia */
.xb-home-products li.product > a.woocommerce-loop-product__link > img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0 0 14px !important;
    padding: 10px;
    border-radius: 12px;
    background: radial-gradient(115% 115% at 50% 12%, #FFFFFF 0%, #F3F5F9 70%, #ECEFF4 100%);
    mix-blend-mode: multiply;
    transition: transform .3s ease;
}

.xb-home-products li.product:hover > a.woocommerce-loop-product__link > img {
    transform: scale(1.03);
}

/* znaczek "Promocja!" – pigułka zamiast koła */
.xb-home-products li.product span.onsale {
    position: absolute !important;
    top: 22px !important;
    left: 22px !important;
    right: auto !important;
    z-index: 3 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 5px 10px !important;
    border-radius: 999px !important;
    background: var(--xb-red) !important;
    color: #fff !important;
    font-family: "Poppins SemiBold", sans-serif;
    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    letter-spacing: .03em;
    text-transform: uppercase;
    box-shadow: 0 6px 14px -6px rgba(196, 26, 27, .55);
}

/* nazwa: typ produktu (mały, szary) + model (wyraźny) */
.xb-home-products li.product h2.woocommerce-loop-product__title {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    line-height: 1.3 !important;
}

.xb-home-products li.product h2 .product-custom-title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: "Poppins Regular", sans-serif !important;
    font-weight: 400 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--xb-muted) !important;
}

.xb-home-products li.product h2 .product-basic-title {
    display: block !important;
    font-family: "Poppins SemiBold", sans-serif !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    line-height: 1.3 !important;
    text-transform: none !important;
    color: var(--xb-ink) !important;
}

.xb-home-products li.product span.product-loop-cat {
    display: block;
    margin-top: 6px;
    font-size: 12px !important;
    color: var(--xb-faint) !important;
}

/* cena */
.xb-home-products li.product span.price {
    display: flex !important;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 2px 8px;
    margin: auto 0 0 !important;
    padding-top: 12px;
    font-family: "Poppins SemiBold", sans-serif;
    font-size: 20px !important;
    line-height: 1.2;
    color: var(--xb-ink) !important;
}

.xb-home-products li.product span.price .woocommerce-Price-amount.amount {
    font-size: inherit !important;
    color: inherit !important;
}

.xb-home-products li.product span.price ins {
    order: 1;
    text-decoration: none !important;
    color: var(--xb-red) !important;
    background: none !important;
}

.xb-home-products li.product span.price del {
    order: 2;
    font-family: "Poppins Regular", sans-serif;
    font-size: 13px !important;
    color: var(--xb-faint) !important;
    opacity: 1 !important;
}

.xb-home-products li.product span.price del .woocommerce-Price-amount.amount {
    font-size: 13px !important;
}

/* przycisk "Dodaj do koszyka" pod ceną */
.xb-home-products li.product > a.button:not(.compare) {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 12px 0 0 !important;
    padding: 11px 12px !important;
    background: var(--xb-red) !important;
    color: #fff !important;
    border: 1px solid var(--xb-red) !important;
    border-radius: 11px !important;
    font-family: "Poppins SemiBold", sans-serif;
    font-weight: 600;
    font-size: 14px !important;
    line-height: 1.2 !important;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: none !important;
    transition: background .15s, border-color .15s, opacity .15s;
}

.xb-home-products li.product > a.button:not(.compare):hover {
    background: var(--xb-red-dark) !important;
    border-color: var(--xb-red-dark) !important;
    color: #fff !important;
}

.xb-home-products li.product > a.button .xb-atc-text {
    display: inline;
}

.xb-home-products li.product > a.button.loading {
    opacity: .6 !important;
    pointer-events: none;
}

.xb-home-products li.product > a.button.loading::after {
    display: none !important;
}

.xb-home-products li.product > a.button.added {
    background: var(--xb-ink) !important;
    border-color: var(--xb-ink) !important;
}

.xb-home-products li.product > a.button.added .xb-atc-text {
    display: none;
}

.xb-home-products li.product > a.button.added::after {
    content: "Dodano do koszyka";
    display: inline !important;
    position: static !important;
    margin: 0 !important;
    font-family: inherit !important;
}

/* niedostępny / z wariantami – obrysowany, jak w kategoriach */
.xb-home-products li.product > a.button:not(.compare):not(.add_to_cart_button),
.xb-home-products li.product > a.button.product_type_variable {
    background: #fff !important;
    color: var(--xb-ink) !important;
    border-color: var(--xb-field) !important;
}

.xb-home-products li.product > a.button:not(.compare):not(.add_to_cart_button):hover,
.xb-home-products li.product > a.button.product_type_variable:hover {
    background: var(--xb-ink) !important;
    border-color: var(--xb-ink) !important;
    color: #fff !important;
}

.xb-home-products li.product a.added_to_cart,
.xb-home-products li.product a.compare {
    display: none !important;
}

/* ================================================================
   GORĄCA OFERTA
   ================================================================ */

.xb-home-deal .xb-deal {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #fff;
    border: 1.5px solid #F2C4C4;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(16, 20, 38, .04), 0 18px 40px -24px rgba(196, 26, 27, .45);
}

/* na komputerze kafelek jedzie razem z przewijaniem siatki obok */
@media (min-width: 992px) {
    .xb-home-deal .xb-deal {
        position: sticky;
        top: 24px;
    }
}

.xb-home-deal .xb-deal-title {
    margin: 0 0 14px !important;
    font-family: "Poppins SemiBold", sans-serif;
    font-weight: 600 !important;
    font-size: 22px;
    line-height: 1.2;
    color: var(--xb-ink);
    text-align: center;
}

.xb-home-deal .xb-deal-title img.emoji {
    width: 1em !important;
    height: 1em !important;
    vertical-align: -.1em !important;
}

.xb-home-deal .xb-deal-img {
    position: relative;
    display: block;
    margin-bottom: 14px;
    border-radius: 14px;
    background: radial-gradient(115% 115% at 50% 12%, #FFFFFF 0%, #F3F5F9 70%, #ECEFF4 100%);
    overflow: hidden;
}

.xb-home-deal .xb-deal-img img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    padding: 6%;
    mix-blend-mode: multiply;
    transition: transform .3s ease;
}

.xb-home-deal .xb-deal-img:hover img {
    transform: scale(1.03);
}

.xb-home-deal .xb-deal-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--xb-red);
    color: #fff;
    font-family: "Poppins SemiBold", sans-serif;
    font-size: 14px;
    line-height: 1.2;
    box-shadow: 0 6px 14px -6px rgba(196, 26, 27, .55);
}

.xb-home-deal .xb-deal-name {
    display: block;
    margin-bottom: 8px;
    font-family: "Poppins SemiBold", sans-serif;
    font-size: 16px;
    line-height: 1.35;
    color: var(--xb-ink) !important;
    text-decoration: none !important;
}

.xb-home-deal .xb-deal-name:hover {
    color: var(--xb-red) !important;
}

.xb-home-deal .xb-deal-prices {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
}

.xb-home-deal .xb-deal-price {
    font-family: "Poppins SemiBold", sans-serif;
    font-size: 28px;
    line-height: 1.15;
    color: var(--xb-red);
}

.xb-home-deal .xb-deal-old {
    font-family: "Poppins Regular", sans-serif;
    font-size: 15px;
    color: var(--xb-faint);
    text-decoration: line-through;
}

.xb-home-deal .xb-deal-note {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--xb-faint);
}

/* sprzedano / pozostało + pasek */
.xb-home-deal .xb-deal-stock {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 16px 0 6px;
    font-size: 12px;
    color: var(--xb-muted);
}

.xb-home-deal .xb-deal-stock b {
    font-family: "Poppins SemiBold", sans-serif;
    font-weight: 600;
    color: var(--xb-ink);
}

.xb-home-deal .xb-deal-bar {
    height: 8px;
    border-radius: 99px;
    background: var(--xb-line);
    overflow: hidden;
}

.xb-home-deal .xb-deal-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #E04546, var(--xb-red));
}

/* licznik */
.xb-home-deal .xb-deal-timer {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 16px 0 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
}

.xb-home-deal .xb-deal-timer > div {
    width: auto !important;
    padding: 8px 4px;
    border: 0 !important;
    border-radius: 10px;
    background: #F6F7FA;
    font-size: 11px !important;
    line-height: 1.2 !important;
    color: var(--xb-muted);
    text-align: center;
}

.xb-home-deal .xb-deal-timer > div span {
    display: block;
    margin-bottom: 2px;
    font-family: "Poppins SemiBold", sans-serif;
    font-size: 20px !important;
    line-height: 1.15 !important;
    color: var(--xb-ink);
}

.xb-home-deal .xb-deal-timer > .xb-deal-timer-label {
    grid-column: 1 / -1;
    padding: 0 0 2px;
    background: none;
    font-family: "Poppins Medium", sans-serif;
    font-size: 12px !important;
    color: var(--xb-ink);
    text-align: left;
}

/* przycisk */
.xb-home-deal a.xb-deal-btn {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 16px 0 0 !important;
    padding: 13px 16px !important;
    background: var(--xb-red) !important;
    color: #fff !important;
    border: 1px solid var(--xb-red) !important;
    border-radius: 12px !important;
    font-family: "Poppins SemiBold", sans-serif;
    font-weight: 600;
    font-size: 15px !important;
    line-height: 1.2 !important;
    text-transform: none;
    white-space: nowrap;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: 0 10px 22px -12px rgba(196, 26, 27, .7) !important;
    transition: background .15s, border-color .15s;
}

.xb-home-deal a.xb-deal-btn:hover {
    background: var(--xb-red-dark) !important;
    border-color: var(--xb-red-dark) !important;
    color: #fff !important;
}

.xb-home-deal a.xb-deal-btn.loading {
    opacity: .6 !important;
    pointer-events: none;
}

.xb-home-deal a.xb-deal-btn.loading::after {
    display: none !important;
}

.xb-home-deal a.xb-deal-btn.added {
    background: var(--xb-ink) !important;
    border-color: var(--xb-ink) !important;
}

.xb-home-deal a.xb-deal-btn.added .xb-deal-btn-text {
    display: none;
}

.xb-home-deal a.xb-deal-btn.added::after {
    content: "Dodano do koszyka";
    display: inline !important;
    position: static !important;
    margin: 0 !important;
    font-family: inherit !important;
}

.xb-home-deal a.xb-deal-btn--ghost {
    background: #fff !important;
    color: var(--xb-ink) !important;
    border-color: var(--xb-field) !important;
    box-shadow: none !important;
}

.xb-home-deal a.xb-deal-btn--ghost:hover {
    background: var(--xb-ink) !important;
    border-color: var(--xb-ink) !important;
    color: #fff !important;
}

.xb-home-deal a.added_to_cart {
    display: none !important;
}

/* ================================================================
   RESPONSYWNOŚĆ
   ================================================================ */

@media (max-width: 1199px) {
    .xb-home-products li.product > a.button:not(.compare) {
        font-size: 13px !important;
        padding: 10px 8px !important;
    }
}

@media (max-width: 991px) {
    .xb-home-deal {
        margin-bottom: 32px;
    }

    .xb-home-deal .xb-deal {
        max-width: 460px;
        margin: 0 auto;
    }

    .xb-home-products {
        padding-left: 15px !important;
    }
}

/* telefon: produkty w poziomym, przewijanym pasku */
@media (max-width: 767px) {
    .xb-home-products h3.xb-home-title {
        font-size: 22px;
        margin-bottom: 16px !important;
    }

    .xb-home-products ul.products {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 66%;
        gap: 12px;
        margin: 0 -15px !important;
        padding: 4px 15px 16px !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 15px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .xb-home-products ul.products::-webkit-scrollbar {
        display: none;
    }

    .xb-home-products ul.products li.product {
        scroll-snap-align: start;
    }

    .xb-home-products ul.products li.product:hover {
        transform: none;
    }

    .xb-home-deal .xb-deal {
        padding: 16px;
    }

    .xb-home-deal .xb-deal-price {
        font-size: 24px;
    }
}
