/* Popup upsellowy w koszyku (ShavPL)
 * Wytyczne Figma (Desktop) - dopasowanie 1:1
 */

body.bgpu-open {
    overflow: hidden;
}

.bgpu-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(9, 9, 11, 0.65);
    opacity: 0;
    visibility: hidden;
    overflow-y: auto;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bgpu-overlay[hidden] {
    display: none !important;
}

.bgpu-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.bgpu-stage {
    flex: 0 0 auto;
    margin: auto;
    transform: translateY(16px);
    transition: transform 0.3s ease;
}

.is-visible .bgpu-stage {
    transform: none;
}

.bgpu-modal {
    position: relative;
    width: 994px;
    height: 614px;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    transform-origin: top left;
}

.bgpu-panel {
    width: 994px;
    height: 614px;
    box-sizing: border-box;
    background: #FAFAFA;
    border-radius: 0;
    padding: 32px 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.bgpu-close {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #09090B;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bgpu-close:hover {
    opacity: 0.6;
    transform: scale(1.05);
}

.bgpu-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* ---------------------------------------------------------------- Nagłówek */

.bgpu-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
    margin-bottom: 8px;
}

.bgpu-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
}

.bgpu-title {
    margin: 0;
    padding: 0;
    color: #09090B;
    font-family: "bebas-neue-pro", sans-serif;
    font-size: 56px;
    line-height: 56px;
    font-weight: 400;
    font-style: normal;
    letter-spacing: 0;
    text-align: left;
    text-transform: none;
    flex: 1 1 auto;
}

.bgpu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #18181B;
    color: #FAFAFA;
    font-family: "Roboto", sans-serif;
    font-weight: 700;
    font-size: 14px;
    line-height: 16px;
    letter-spacing: 0;
    padding: 4px 12px;
    white-space: nowrap;
    text-transform: uppercase;
    border-radius: 0;
    flex-shrink: 0;
}

.bgpu-header-divider {
    width: 100%;
    height: 1px;
    background: #D4D4D8;
    border: none;
    margin: 0;
}

/* ---------------------------------------------------------------- Siatka produktów */

.bgpu-grid {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 16px;
    width: 100%;
    /* 350 + 52 px na przycisk „Dodaj do koszyka” (12 px odstępu + 40 px) */
    height: 402px;
    flex: 0 0 402px;
}

.bgpu-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 278px;
    height: 402px;
    min-height: 402px;
    max-height: 402px;
    flex: 0 0 278px;
    box-sizing: border-box;
    background: #F2F2F3;
    border-radius: 0 !important;
    padding: 12px;
    position: relative;
    overflow: hidden;
}

/* Sztywny kontener na miniaturę ze stałą proporcją */
.bgpu-card-media-wrap {
    position: relative;
    width: 100%;
    height: 224px;
    max-height: 224px;
    flex: 0 0 224px;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    overflow: hidden;
}

.bgpu-card-media {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: transparent !important;
    overflow: hidden;
    text-decoration: none;
}

.bgpu-card-image {
    width: auto;
    height: auto;
    max-width: 254px;
    max-height: 224px;
    object-fit: contain;
    background: transparent !important;
    display: block;
    transition: transform 0.25s ease;
}

.bgpu-card:hover .bgpu-card-image {
    transform: scale(1.04);
}

/* Pływające selektory wariantów: nałożone bezpośrednio wewnątrz diva ze zdjęciem (w lewym dolnym rogu) */
.bgpu-floating-swatches {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 5;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.bgpu-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
}

/* Swatch: czysty kwadrat 24x24px bez zewnetrznych borderow */
.bgpu-swatch {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    padding: 0;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none;
    background-clip: padding-box;
    background-color: transparent;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.bgpu-swatch:hover {
    transform: scale(1.06);
}

.bgpu-swatch.is-active,
.bgpu-swatch[aria-checked="true"] {
    box-shadow: 0 0 0 2px #18181B !important;
}

.bgpu-swatch:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.bgpu-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 !important;
    display: block;
}

.bgpu-swatch-color {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 0 !important;
}

.bgpu-swatch-label {
    font-family: "Roboto", sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #18181B;
    padding: 0 2px;
}

.bgpu-card-body {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    flex: 1 1 auto;
    padding: 0;
    margin: 0;
}

.bgpu-card-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

/* Nazwa produktu: Subtitle M / Bold (Roboto 16px / 20px, 700, #18181B) */
.bgpu-card-title {
    margin: 0;
    padding: 0;
    color: #18181B;
    font-family: "Roboto", sans-serif;
    font-size: 16px;
    font-weight: 700;
    font-style: normal;
    line-height: 20px;
    letter-spacing: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    text-align: left;
    width: 100%;
}

.bgpu-card-title a {
    color: inherit;
    text-decoration: none;
}

.bgpu-card-title a:hover {
    text-decoration: underline;
}

/* Subtitle produktowy: Subtitle S / Light (Roboto 14px / 16px, 300, #71717B) — 4px pod tytułem */
.bgpu-card-subtitle {
    margin: 4px 0 0 0;
    padding: 0;
    color: #71717B;
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    font-weight: 300;
    font-style: normal;
    line-height: 16px;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    width: 100%;
}

/* Ceny: 12px pod subtitle, równane do lewej w rzędzie */
.bgpu-prices {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 8px;
    text-align: left;
    margin-top: 12px;
    width: 100%;
    flex-shrink: 0;
}



/* Cena promocyjna / bazowa nieprzekreślona: Subtitle M / Bold (Roboto 16px / 20px, 700, #AC0000) */
.bgpu-price {
    color: #AC0000 !important;
    font-family: "Roboto", sans-serif;
    font-size: 16px;
    font-weight: 700;
    font-style: normal;
    line-height: 20px;
    letter-spacing: 0;
    text-decoration: none !important;
    white-space: nowrap;
}

.bgpu-price *,
.bgpu-price .woocommerce-Price-currencySymbol,
.bgpu-price .woocommerce-Price-amount,
.bgpu-price bdi {
    color: #AC0000 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

/* Cena bazowa przekreślona: Subtitle M / Regular (Roboto 16px / 20px, 400, #71717B, line-through) */
.bgpu-price-old {
    color: #71717B !important;
    font-family: "Roboto", sans-serif;
    font-size: 16px;
    font-weight: 400;
    font-style: normal;
    line-height: 20px;
    letter-spacing: 0;
    text-decoration: line-through !important;
    text-decoration-color: #71717B !important;
    -webkit-text-decoration-color: #71717B !important;
    white-space: nowrap;
}

/* Sufiks zł i cała kwota przekreślona ZAWSZE szare (#71717B) */
.bgpu-price-old *,
.bgpu-price-old .woocommerce-Price-currencySymbol,
.bgpu-price-old .woocommerce-Price-amount,
.bgpu-price-old bdi {
    color: #71717B !important;
    font-weight: 400 !important;
    text-decoration: line-through !important;
    text-decoration-color: #71717B !important;
    -webkit-text-decoration-color: #71717B !important;
}

.bgpu-price-old[hidden] {
    display: none !important;
}



/* Pojedynczy przycisk na kafelku (decyzja Kuby 06.11: produkt da się dodać sam, nie tylko w zestawie) */
.bgpu-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 40px;
    margin: 12px 0 0 0;
    padding: 0 16px;
    box-sizing: border-box;
    border: 1px solid #18181B;
    border-radius: 6px;
    background: transparent;
    color: #18181B;
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.bgpu-add.is-loading {
    opacity: 0.6;
    cursor: progress;
}

.bgpu-add.is-added,
.bgpu-add:disabled {
    border-color: #18181B;
    background: #18181B;
    color: #FAFAFA;
    cursor: default;
}

@media (hover: hover) {
    .bgpu-add:not(:disabled):hover {
        background: #18181B;
        color: #FAFAFA;
    }
}

/* ---------------------------------------------------------------- Przycisk zestawu (Bundle) */

.bgpu-bundle {
    min-width: 295px;
    height: 52px;
    flex: 0 0 52px;
    margin: 12px auto 0 auto;
    padding: 8px 24px;
    box-sizing: border-box;
    border-radius: 6px;
    background: #AC0000;
    border: none;
    color: #FAFAFA;
    font-family: "Roboto", sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 20px;
    line-height: 24px;
    letter-spacing: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: background-color 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
}

/* ::before rysuje górną (lewo -> prawo) oraz prawą krawędź (góra -> dół) */
.bgpu-bundle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-radius: 6px;
    border-top: 3px solid #000000;
    border-right: 3px solid #000000;
    border-bottom: 3px solid transparent;
    border-left: 3px solid transparent;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: 
        opacity 0.2s ease,
        height 0.12s ease-out,
        width 0.12s ease-out 0.12s;
}

/* ::after rysuje dolną (prawo -> lewo) oraz lewą krawędź (dół -> góra) */
.bgpu-bundle::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-radius: 6px;
    border-bottom: 3px solid #000000;
    border-left: 3px solid #000000;
    border-top: 3px solid transparent;
    border-right: 3px solid transparent;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: 
        opacity 0.2s ease,
        height 0.12s ease-out 0.24s,
        width 0.12s ease-out 0.36s;
}

.bgpu-bundle > * {
    position: relative;
    z-index: 2;
}

@media (hover: hover) {
    .bgpu-bundle:not(.is-loading):hover {
        background-color: #960000;
    }

    .bgpu-bundle:not(.is-loading):hover::before {
        opacity: 1;
        width: 100%;
        height: 100%;
        transition: 
            opacity 0.05s ease,
            width 0.16s ease-out,
            height 0.16s ease-out 0.16s;
    }

    .bgpu-bundle:not(.is-loading):hover::after {
        opacity: 1;
        width: 100%;
        height: 100%;
        transition: 
            opacity 0.05s ease 0.32s,
            width 0.16s ease-out 0.32s,
            height 0.16s ease-out 0.48s;
    }
}

.bgpu-bundle:active {
    transform: scale(0.98);
}

/* Stan ładowania — tylko tutaj border krąży w pętli */
.bgpu-bundle.is-loading {
    cursor: wait;
}

.bgpu-bundle.is-loading::before {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 260% !important;
    height: 460% !important;
    transform: translate(-50%, -50%) !important;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 160deg,
        rgba(0, 0, 0, 0.4) 240deg,
        #000000 360deg
    ) !important;
    animation: bgpuBorderOrbit 1s linear infinite !important;
    opacity: 1 !important;
    border: none !important;
    border-radius: 0 !important;
    transition: none !important;
}

.bgpu-bundle.is-loading::after {
    content: '' !important;
    position: absolute !important;
    inset: 3px !important;
    background: #8B0000 !important;
    border-radius: 4px !important;
    border: none !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    transition: none !important;
}

.bgpu-bundle.is-added::after {
    background: #09090b;
}

@keyframes bgpuBorderOrbit {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.bgpu-bundle-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #FAFAFA;
    font-family: "Roboto", sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 20px;
    line-height: 24px;
    letter-spacing: 0;
    white-space: nowrap;
}

.bgpu-bundle-price,
.bgpu-bundle-price * {
    color: #FAFAFA !important;
    font-family: "Roboto", sans-serif !important;
    font-weight: 400 !important;
    font-style: normal !important;
    font-size: 20px !important;
    line-height: 24px !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
}

/* Całkowicie ukryta przekreślona stara cena w przycisku zestawu */
.bgpu-bundle-old {
    display: none !important;
}

.bgpu-error {
    margin: 0;
    color: #AC0000;
    font-family: "Roboto", sans-serif;
    font-size: 12px;
    text-align: center;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---------------------------------------------------------------- Mobile (do 899px) */
@media (max-width: 899px) {
    .bgpu-overlay {
        padding: 16px;
    }

    .bgpu-modal {
        width: 398px;
        max-width: calc(100vw - 32px);
        height: auto;
        max-height: calc(100vh - 32px);
    }

    .bgpu-panel {
        width: 100%;
        max-width: 398px;
        height: auto;
        min-height: 0;
        padding: 32px 24px;
        gap: 0;
        box-sizing: border-box;
        overflow: visible;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .bgpu-close {
        top: 20px;
        right: 20px;
        width: 28px;
        height: 28px;
    }

    .bgpu-close svg {
        width: 18px;
        height: 18px;
    }

    /* 1. Heading (H2 Headline Mobile) */
    .bgpu-header {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-bottom: 0;
        gap: 0;
    }

    .bgpu-header-row {
        display: contents;
    }

    .bgpu-title {
        order: 1;
        font-family: "bebas-neue-pro", sans-serif;
        font-weight: 400;
        font-style: normal;
        font-size: 36px;
        line-height: 44px;
        letter-spacing: 0;
        color: #09090B;
        text-align: left;
        margin: 0;
        padding: 0 32px 0 0;
    }

    /* 2. Border 16px pod headingiem */
    .bgpu-header-divider {
        order: 2;
        display: block;
        width: 100%;
        height: 1px;
        margin-top: 16px;
        margin-bottom: 0;
        background: #D4D4D8;
        border: none;
    }

    /* 3. Badge 16px pod borderem, wyrównany do prawej (Subtitle S Mobile) */
    .bgpu-badge {
        order: 3;
        margin-top: 16px;
        margin-bottom: 0;
        margin-left: auto;
        align-self: flex-end;
        font-family: "Roboto", sans-serif;
        font-weight: 700;
        font-style: normal;
        font-size: 12px;
        line-height: 14px;
        letter-spacing: 0;
        background: #18181B;
        color: #FAFAFA;
        padding: 4px 8px;
        border-radius: 0;
    }

    /* 4. Kafle 18px pod badgem, jeden pod drugim */
    .bgpu-grid {
        margin-top: 18px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        height: auto;
        flex: 1 1 auto;
    }

    /* Pozioma karta produktu: 350x120px, gap: 8px */
    .bgpu-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        width: 350px;
        max-width: 100%;
        height: 120px;
        min-height: 120px;
        max-height: 120px;
        flex: 0 0 120px;
        padding: 0;
        background: #F2F2F3;
        border-radius: 0 !important;
        gap: 8px;
        box-sizing: border-box;
        overflow: hidden;
    }

    /* Zdjęcie z lewej: 120x120px */
    .bgpu-card-media-wrap {
        width: 120px;
        height: 120px;
        max-height: 120px;
        flex: 0 0 120px;
        margin: 0;
        position: relative;
        overflow: hidden;
        background: transparent !important;
    }

    .bgpu-card-media {
        width: 120px;
        height: 120px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .bgpu-card-image {
        width: 120px;
        height: 120px;
        max-width: 120px;
        max-height: 120px;
        object-fit: contain;
    }

    .bgpu-floating-swatches {
        bottom: 8px;
        left: 8px;
        gap: 6px;
        z-index: 5;
    }

    .bgpu-swatch {
        width: 26px;
        height: 26px;
        min-width: 26px;
        min-height: 26px;
        flex: 0 0 26px;
        padding: 0;
        border: none !important;
        border-radius: 0 !important;
        box-sizing: border-box;
        position: relative;
        touch-action: manipulation;
        cursor: pointer;
    }

    /* Powiększona strefa dotyku (hitbox) na mobile */
    .bgpu-swatch::after {
        content: "";
        position: absolute;
        inset: -6px;
        z-index: 1;
    }

    .bgpu-swatch.is-active,
    .bgpu-swatch[aria-checked="true"] {
        box-shadow: 0 0 0 2px #18181B !important;
    }

    .bgpu-swatch-color {
        width: 100% !important;
        height: 100% !important;
        display: block;
        border-radius: 0 !important;
    }

    .bgpu-swatch img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover;
        display: block;
        border-radius: 0 !important;
    }

    /* Prawa strona karty z treścią */
    .bgpu-card-body {
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1 1 auto;
        min-width: 0;
        padding: 8px 12px 8px 0;
    }

    /* Nazwa produktu: Subtitle M / Bold (Roboto 14px / 20px, 700) */
    .bgpu-card-title {
        font-family: "Roboto", sans-serif;
        font-weight: 700;
        font-style: normal;
        font-size: 14px;
        line-height: 20px;
        letter-spacing: 0;
        color: #18181B;
    }

    /* Subtitle: Subtitle S / Light (Roboto 12px / 14px, 300) */
    /* Figma „Mobile_pop'up” 5181:1763 — Subtitle S / Light: Roboto 12/18, 300, zinc/700.
       !important przebija globalne `.product-subtitle { font-size: 20px !important }` ze strony produktu. */
    .bgpu-card .bgpu-card-subtitle {
        font-family: "Roboto", sans-serif;
        font-weight: 300;
        font-style: normal;
        font-size: 12px !important;
        line-height: 18px !important;
        letter-spacing: 0;
        color: #3F3F47;
        margin: 4px 0 0 0;
    }

    /* Układ cen */
    .bgpu-prices {
        margin-top: 8px;
        gap: 6px;
    }

    /* Cena bazowa (stara, przekreślona): Subtitle M / Regular (Roboto 14px / 20px, 400, line-through) */
    .bgpu-price-old {
        font-family: "Roboto", sans-serif !important;
        font-weight: 400 !important;
        font-style: normal !important;
        font-size: 14px !important;
        line-height: 20px !important;
        letter-spacing: 0 !important;
        text-decoration: line-through !important;
        color: #71717B !important;
    }

    /* Cena promo (nowa): Subtitle M / Bold (Roboto 14px / 20px, 700) */
    .bgpu-price,
    .bgpu-price *,
    .bgpu-price .woocommerce-Price-currencySymbol,
    .bgpu-price .woocommerce-Price-amount,
    .bgpu-price bdi {
        font-family: "Roboto", sans-serif !important;
        font-weight: 700 !important;
        font-style: normal !important;
        font-size: 14px !important;
        line-height: 20px !important;
        letter-spacing: 0 !important;
        color: #AC0000 !important;
    }

    .bgpu-add {
        height: 32px;
        margin-top: 8px;
        font-size: 13px;
        line-height: 16px;
    }

    /* Przycisk zestawu na dole: Subtitle L / Regular (Roboto 16px / 24px, 400, text-align: center) */
    .bgpu-bundle {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 16px auto 0 auto;
        height: 48px;
        flex: 0 0 48px;
        text-align: center;
        justify-content: center;
    }

    .bgpu-bundle-text,
    .bgpu-bundle-price,
    .bgpu-bundle-price * {
        font-family: "Roboto", sans-serif !important;
        font-weight: 400 !important;
        font-style: normal !important;
        font-size: 16px !important;
        line-height: 24px !important;
        letter-spacing: 0 !important;
        text-align: center !important;
    }
}

