/* 
   WPA FBT Bundle — v3
   Template: class-display.php → render_fbt_bundle()
   Layout: products (horizontal) + summary panel (right)
   */

/* Outer wrapper */
.wpa-fbt-bundle-wrapper {
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 15px;
    clear: both;
    box-sizing: border-box;
}

/* Section heading */
.wpa-fbt-title,
.wpa-fbt-section-title {
    font-weight: 500;
    font-size: 24px;
    line-height: 1.33em;
    color: #000001;
    margin: 0 0 10px;
    padding-bottom: 0;
    border-bottom: none;
    text-transform: initial;
    box-sizing: border-box;
}

/* Form layout: products (left) + summary (right) */
.wpa-fbt-layout {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
}

/*  Products list */
.wpa-fbt-products {
    display: flex;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 36px;
    list-style: none;
    margin: 0 !important;
    padding: 0;
    flex: 1 1 auto;
}

/* "+" separator — legacy element hidden, now rendered as overlay via CSS */
.wpa-fbt-plus {
    display: none;
}

/* "+" overlay on the left edge of every card after the first */
.wpa-fbt-has-plus {
    position: relative;
}

.wpa-fbt-has-plus::before {
    content: '+';
    position: absolute;
    top: 40%;
    left: -18px;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: #777;
    line-height: 1;
    pointer-events: none;
    z-index: 5;
}

/* Individual product card */
.wpa-fbt-product-item {
    list-style: none;
    flex: 0 0 auto;
    width: 200px;
    position: relative;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.wpa-fbt-product-item.dimmed {
    opacity: 0.35;
    filter: grayscale(80%);
}

/* Checkbox overlay (inside .qodef-woo-product-mark-holder) */
.wpa-fbt-select {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}

.wpa-fbt-select input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.wpa-fbt-select span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #fff;
    border: 2px solid #000;
    border-radius: 3px;
    transition: background 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

.wpa-fbt-select input[type="checkbox"]:checked+span {
    background: #000;
    border-color: #000;
}

.wpa-fbt-select input[type="checkbox"]:checked+span::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

/* "This product" label under main card */
.wpa-fbt-main-label {
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 6px;
}

/* Qi theme card overrides inside FBT context */
.wpa-fbt-product-item .qodef-woo-product-image {
    position: relative !important;
}

/* Fix inline baseline gap: <a> inside image wrapper must be block */
.wpa-fbt-product-item .qodef-woo-product-image a {
    display: block;
}

.wpa-fbt-product-item .qodef-woo-product-image img {
    display: block;
    width: 100%;
    height: auto;
}

.wpa-fbt-product-item .qodef-woo-product-mark-holder {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    left: auto !important;
    bottom: auto !important;
    /* Must sit above the theme's product badge overlay (.acf-badges-top-left,
       z-index:20), which spans the full card width and would otherwise cover
       the checkbox and swallow its clicks on any card that has a badge. */
    z-index: 30 !important;
    width: auto !important;
    height: auto !important;
}

.wpa-fbt-product-item .qodef-woo-product-content {
    padding: 6px 0 0;
}

.wpa-fbt-product-item .qodef-woo-product-title-price-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
}

.wpa-fbt-product-item .qodef-woo-product-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    margin: 0;
    flex: 1 1 auto;
}

.wpa-fbt-product-item .price {
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
    line-height: 1.4;
}

.wpa-fbt-product-item .qodef-woo-product-variation-attributes {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
    line-height: 1.3;
}

.wpa-fbt-product-item .qodef-woo-product-categories {
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #888;
    margin-top: 4px;
}

.wpa-fbt-product-item .qodef-woo-product-categories a {
    font-size: 11px;
    color: #888;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* Hide only the hover overlay link inside compact FBT cards */
.wpa-fbt-product-item .woocommerce-LoopProduct-link {
    display: none;
}

/* Summary panel  */
.wpa-fbt-summary {
    flex: 0 0 260px;
    background: var(--wpa-fbt-bg-color, #f9f9f9);
    border-radius: 4px;
    padding: 20px;
    box-sizing: border-box;
    align-self: flex-start;
}

.wpa-fbt-summary-title {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    margin-bottom: 20px;
}

.wpa-fbt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
    gap: 8px;
}

.wpa-fbt-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: #111;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid #ddd;
    margin-bottom: 16px;
    gap: 8px;
}

.wpa-fbt-total-amount,
.wpa-fbt-addons-total {
    font-weight: 600;
    white-space: nowrap;
}

.wpa-fbt-total .wpa-fbt-total-amount {
    color: #111;
    font-size: 18px;
    font-weight: 600;
}

.wpa-fbt-btn-wrap {
    margin-top: 0;
}

/* Submit button — inherits WC theme styles; override width only */
.wpa-fbt-submit-btn {
    width: 100% !important;
    display: block !important;
    text-align: center !important;
    box-sizing: border-box;
    cursor: pointer;
    white-space: normal;
}

.wpa-fbt-messages {
    font-size: 12px;
    margin-top: 10px;
    min-height: 0;
    line-height: 1.4;
}

/* Only take space when messages are actually present */
.wpa-fbt-messages:empty {
    display: none;
}

/* Recommendation title (outside FBT, e.g. sliders) */
.wpa-recommendation-title {
    font-weight: 500;
    color: #000001;
    font-size: 24px;
    line-height: 1.33em;
    text-transform: initial;
    margin: 10px 0 10px;
    padding: 0;
    max-width: 1920px;
    box-sizing: border-box;
}

/* Star ratings */
.wpa-fbt-rating {
    display: inline-block;
    margin: 0 8px;
    flex-shrink: 0;
    margin-top: 2px;
}

.wpa-fbt-rating .star-rating {
    font-size: 12px;
}

/* ── Desktop Carousel: keep summary in-line when 3+ products ── */
@media (min-width: 1025px) {

    /* Prevent summary from ever wrapping to a new row */
    .wpa-fbt-layout {
        flex-wrap: nowrap;
    }

    /* Carousel wrapper — positioning context only, not flex.
       Products take full width so cards start at left: 0. */
    .wpa-fbt-carousel-wrap {
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Products track: full width, scrollable */
    .wpa-fbt-carousel-wrap .wpa-fbt-products {
        width: 100%;
        overflow-x: scroll;
        flex-wrap: nowrap;
        scrollbar-width: none;
        scroll-behavior: smooth;
        cursor: default;
    }

    .wpa-fbt-carousel-wrap .wpa-fbt-products::-webkit-scrollbar {
        display: none;
    }

    /* Prev / Next — absolutely positioned overlays, don't affect layout flow */
    .wpa-fbt-carousel-btn {
        position: absolute;
        top: 40%;
        transform: translateY(-50%);
        z-index: 10;
        width: 34px;
        height: 34px;
        background: rgba(255, 255, 255, 0.92);
        border: 1px solid #ccc;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        color: #333;
        line-height: 1;
        padding: 0;
        transition: background 0.15s, border-color 0.15s, opacity 0.2s;
    }

    .wpa-fbt-carousel-prev {
        left: 0;
    }

    .wpa-fbt-carousel-next {
        right: 0;
    }

    .wpa-fbt-carousel-btn:hover:not(:disabled) {
        background: #f5f5f5;
        border-color: #999;
    }

    .wpa-fbt-carousel-btn:disabled {
        opacity: 0.25;
        cursor: default;
    }

    /* Hide buttons when all products fit without scrolling */
    .wpa-fbt-carousel-btn.wpa-hidden {
        visibility: hidden;
        pointer-events: none;
    }
}

/* Responsive: collapse to vertical + draggable products row */
@media (max-width: 1024px) {
    .wpa-fbt-layout {
        flex-direction: column;
    }

    /* If carousel wrap was injected on desktop before resize, reset it */
    .wpa-fbt-carousel-wrap {
        display: block;
        width: 100%;
        flex: 0 0 auto;
    }

    /* Hide arrow buttons on mobile/tablet regardless of DOM state */
    .wpa-fbt-carousel-btn {
        display: none !important;
    }

    /* Horizontal drag/swipe row instead of wrapping */
    .wpa-fbt-products {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 36px !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        padding-bottom: 4px;
        cursor: grab;
    }

    .wpa-fbt-products::-webkit-scrollbar {
        display: none;
    }

    .wpa-fbt-products:active {
        cursor: grabbing;
    }

    .wpa-fbt-product-item {
        flex-shrink: 0;
        width: 130px;
        scroll-snap-align: start;
        overflow: visible;
    }

    /* Stack title and price vertically on narrow cards */
    .wpa-fbt-product-item .qodef-woo-product-title-price-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    /* Allow sale prices to wrap */
    .wpa-fbt-product-item .price {
        white-space: normal;
        text-align: left;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 4px;
    }

    /* Adjust overlay "+" size for narrower cards on tablet */
    .wpa-fbt-has-plus::before {
        font-size: 18px;
    }

    .wpa-fbt-summary {
        flex: 0 0 auto;
        width: 100%;
    }
}

/* Responsive: Mobile */
@media (max-width: 480px) {
    .wpa-fbt-bundle-wrapper {
        padding: 0 10px;
    }

    .wpa-fbt-product-item {
        width: 120px;
    }

    .wpa-fbt-has-plus::before {
        font-size: 16px;
    }

    .wpa-fbt-recommendation-title {
        padding: 0 10px;
        margin: 20px 0 10px;
    }

    .wpa-fbt-summary {
        padding: 16px;
    }

    /* Stack title and price vertically on small screens */
    .wpa-fbt-product-item .qodef-woo-product-title-price-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    /* Allow sale prices to wrap on mobile */
    .wpa-fbt-product-item .price {
        white-space: normal;
        text-align: left;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 4px;
    }
}

/* Swiper height overrides */
.wpa-recommendation-section .swiper {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: auto !important;
}

.wpa-recommendation-section .swiper-wrapper {
    display: flex;
    align-items: flex-start;
    width: 100%;
    height: auto !important;
    box-sizing: content-box;
    transition-property: transform;
}

.wpa-recommendation-section .swiper-slide {
    height: auto !important;
    flex-shrink: 0;
}

/* Remove bottom margin the Qi theme/Elementor may add to the slider wrapper */
.wpa-recommendation-section [id$="-wrapper"] {
    margin-bottom: 0 !important;
}

.wpa-recommendation-section .elementor-widget-container {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* ── Recommendation slider product cards — fix inline baseline gap ── */
.wpa-recommendation-section .wpa-product-card .qodef-woo-product-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.wpa-recommendation-section .wpa-product-card .qodef-woo-product-image img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* ── Slider product card overrides — beat Qi theme category-page loop CSS ── */

/* Fixed-width slider card — mirrors FBT card sizing */
.wpa-recommendation-section .wpa-product-card {
    width: 200px !important;
    flex-shrink: 0 !important;
}

@media (max-width: 1024px) {
    .wpa-recommendation-section .wpa-product-card {
        width: 160px !important;
    }
}

@media (max-width: 480px) {
    .wpa-recommendation-section .wpa-product-card {
        width: 140px !important;
    }
}

/* Variable products: wrap price below title on small screens.
   Uses flex-wrap + 100% width instead of flex-direction so theme CSS cannot override. */
@media (max-width: 768px) {
    .wpa-variable-product .qodef-woo-product-title-price-wrapper {
        flex-wrap: wrap !important;
        gap: 0 !important;
    }

    .wpa-variable-product .qodef-woo-product-title,
    .wpa-variable-product .qodef-woo-product-title a,
    .wpa-variable-product .woocommerce-loop-product__title {
        width: 100% !important;
        flex: 0 0 100% !important;
        min-width: 0 !important;
    }

    .wpa-variable-product .price {
        width: 100% !important;
        flex: 0 0 100% !important;
        text-align: left !important;
        justify-content: flex-start !important;
        white-space: normal !important;
        margin-top: 2px !important;
    }

    /* Collapse the title-price wrapper to column so space-between no longer pushes price right */
    .wpa-recommendation-section .wpa-product-card .qodef-woo-product-title-price-wrapper {
        flex-direction: column !important;
        justify-content: flex-start !important;
        gap: 2px !important;
    }

    /* All product card prices left-aligned on mobile */
    .wpa-recommendation-section .wpa-product-card .price {
        text-align: left !important;
        justify-content: flex-start !important;
        width: 100% !important;
        white-space: normal !important;
        flex-shrink: 1 !important;
    }

    .wpa-fbt-product-item .price {
        text-align: left !important;
        justify-content: flex-start !important;
    }
}

.wpa-recommendation-section .wpa-product-card .qodef-woo-product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    width: 100%;
}

.wpa-recommendation-section .wpa-product-card .qodef-woo-product-content {
    padding: 8px 0 0 !important;
    margin: 0 !important;
    text-align: left !important;
}

.wpa-recommendation-section .wpa-product-card .qodef-woo-product-title-price-wrapper {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    margin-bottom: 2px !important;
}

.wpa-recommendation-section .wpa-product-card .qodef-woo-product-title {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.wpa-recommendation-section .wpa-product-card .qodef-woo-product-title a {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #000 !important;
    text-decoration: none !important;
}

.wpa-recommendation-section .wpa-product-card .price {
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    text-align: right !important;
}

.wpa-recommendation-section .wpa-product-card .price,
.wpa-recommendation-section .wpa-product-card .price * {
    white-space: nowrap !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #000 !important;
}

.wpa-recommendation-section .wpa-product-card .price del,
.wpa-recommendation-section .wpa-product-card .price del * {
    text-decoration: line-through !important;
    color: #888 !important;
    font-weight: 400 !important;
}

.wpa-recommendation-section .wpa-product-card .price ins,
.wpa-recommendation-section .wpa-product-card .price ins * {
    text-decoration: none !important;
    color: #000 !important;
    font-weight: 500 !important;
}

/* Reset currency symbol — Qi Addons lifts it with top:-0.3em; override to sit inline */
.wpa-recommendation-section .wpa-product-card .price .woocommerce-Price-currencySymbol {
    position: static !important;
    top: auto !important;
    font-size: inherit !important;
    vertical-align: baseline !important;
}

/* Mobile price fix — must come AFTER the global product card rules above so it wins the cascade */
@media (max-width: 768px) {
    /* Stack title + price vertically — overrides space-between on the wrapper */
    .wpa-recommendation-section .wpa-product-card .qodef-woo-product-title-price-wrapper {
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: flex-start !important;
        gap: 2px !important;
    }
    /* Left-align the price for all products (simple + variable) */
    .wpa-recommendation-section .wpa-product-card .price {
        justify-content: flex-start !important;
        text-align: left !important;
        width: 100% !important;
        white-space: normal !important;
        flex-shrink: 1 !important;
    }
}

.wpa-recommendation-section .wpa-product-card .qodef-woo-product-categories {
    font-size: 11px !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.07em !important;
    color: #888 !important;
    margin-top: 4px !important;
}

.wpa-recommendation-section .wpa-product-card .qodef-woo-product-categories a {
    font-size: 11px !important;
    color: #888 !important;
    text-decoration: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.07em !important;
}

/* ── Global Slider Layout Overrides (Complete the Look, Related, etc) ── */
.elementor-widget-qi_addons_for_elementor_product_slider .qodef-e-product-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 2px;
}

.elementor-widget-qi_addons_for_elementor_product_slider .qodef-e-product-title {
    max-width: 65%;
    margin: 0;
    line-height: 1.3;
}

.elementor-widget-qi_addons_for_elementor_product_slider .qodef-woo-product-price {
    text-align: right;
    white-space: nowrap;
    margin: 0;
    flex-shrink: 0;
}

.elementor-widget-qi_addons_for_elementor_product_slider .qodef-e-product-categories {
    font-size: 16px;
    color: #666;
    margin-top: 2px;
}