/**
 * Frontend Styles
 *
 * @author  WebSailors <info@websailors.com>
 * @package WebSailors\ProductBundles
 */

/* Bundle Items Container */
.wspb-bundle-items {
    margin: 20px 0;
}



.wspb-bundle-items-title {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: none;
}

.wspb-bundle-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Bundle Item */
.wspb-bundle-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: all 0.3s ease;
}



/* Bundled quantity styling - make it clear it's not editable */
.wspb-bundled-quantity {
    display: inline-block;
    padding: 4px 8px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #666;
    font-weight: 500;
}

.wspb-bundle-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wspb-bundle-item.wspb-optional {
    border-left: 4px solid #0073aa;
}

.wspb-bundle-item.wspb-required {
    border-left: 4px solid #f3bb0d;
}

.wspb-bundle-item-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 5px;
}

.wspb-bundle-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wspb-bundle-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wspb-bundle-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.wspb-bundle-item-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.wspb-bundle-item-title a {
    color: #333;
    text-decoration: none;
}

.wspb-bundle-item-title a:hover {
    color: #0073aa;
}

.wspb-optional-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #0073aa;
    color: #fff;
    font-size: 11px;
    font-weight: normal;
    border-radius: 3px;
    margin-left: 8px;
}

.wspb-bundle-item-price {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.wspb-bundle-item-price del {
    color: #999;
    margin-right: 5px;
}

.wspb-bundle-item-price ins {
    text-decoration: none;
    color: #f3bb0d;
}

.wspb-discount-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #f3bb0d;
    color: #fff;
    font-size: 11px;
    border-radius: 3px;
    margin-left: 5px;
}

.wspb-bundle-item-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.wspb-bundle-item-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

/* Logo upload block */
.wspb-logo-upload {
    margin: 26px 0 8px;
}

.wspb-logo-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.wspb-logo-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}

.wspb-logo-heading {
    line-height: 1.15;
    color: #2d3640;
}

.wspb-logo-heading .wspb-step-line {
    font-size: 22px;
    font-weight: 500;
}

.wspb-logo-heading .wspb-step-line.wspb-strong {
    font-size: 24px;
    font-weight: 700;
}

/* Dropzone */
.wspb-upload-dropzone {
    position: relative;
    border: 2px dashed #d9d9d9;
    background: #fff;
    border-radius: 8px;
    padding: 18px;
}

.wspb-upload-dropzone:focus {
    outline: none;
    box-shadow: 0 0 0 2px #e0f0ff;
}

.wspb-upload-dropzone.is-dragover {
    background: #f7fbff;
    border-color: #76baff;
}

.wspb-upload-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.wspb-drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.wspb-drop-text {
    color: #6b7280;
    font-size: 14px;
}

.wspb-upload-btn {
    pointer-events: all;
    background: #f3bb0d !important;
    border-color: #f3bb0d !important;
    color: #fff !important;
    text-transform: none !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    letter-spacing: normal;
    padding: 8px 16px !important;
    border-radius: 6px !important;
}

.wspb-upload-btn:hover {
    filter: brightness(0.95);
}

.wspb-upload-filename {
    font-size: 13px;
    color: #374151;
}

.wspb-upload-help {
    font-size: 14px;
    color: #5b6b7b;
    margin-top: 10px;
}

/* ---------- STEP 3: Optional Add On ---------- */
.wspb-addons {
    margin: 24px 0;
}

.wspb-addons-title {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    color: #2d3640;
}

.wspb-addons-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wspb-addon-item {
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 12px;
    transition: border-color .2s, box-shadow .2s;
}

.wspb-addon-item {
    cursor: pointer;
}

.wspb-addon-item.selected {
    border-color: #f3bb0d;
    box-shadow: none;
}

.wspb-addon-item:focus,
.wspb-addon-item:focus-visible,
.wspb-addon-row:focus,
.wspb-addon-row:focus-visible {
    outline: none;
    box-shadow: none;
}

.wspb-addon-row {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
}

.wspb-addon-row input[type="checkbox"] {
    margin: 0 2px 0 0;
}

.wspb-addon-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.wspb-addon-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d3640;
}

.wspb-addon-price {
    margin-left: auto;
    color: #f3bb0d;
    font-weight: 700;
}

.wspb-addon-upload {
    padding: 14px 10px 6px 10px;
}

.wspb-addon-upload {
    cursor: default;
}

.wspb-addon-upload-heading {
    margin: 8px 0 10px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    color: #2d3640;
}

.wspb-addon-upload-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}

.wspb-addon-preview,
.wspb-logo-preview {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wspb-preview-img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}

.wspb-preview-placeholder {
    font-size: 13px;
    color: #6b7280;
}

.wspb-bundle-item-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.wspb-bundle-item-quantity {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wspb-bundle-item-qty {
    width: 60px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.wspb-bundle-item-variations {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wspb-bundle-item-variation {
    min-width: 150px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.wspb-bundle-item-stock {
    font-size: 12px;
    font-weight: 600;
}

.wspb-in-stock {
    color: #46b450;
}

.wspb-out-of-stock {
    color: #f3bb0d;
}

/* Bundle Total */
.wspb-bundle-total {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.wspb-bundle-total-price {
    font-size: 18px;
    font-weight: 600;
}

.wspb-bundle-total-label {
    color: #333;
    margin-right: 10px;
}

.wspb-bundle-total-amount {
    color: #0073aa;
}

/* Layout Variations */
.wspb-layout-table .wspb-bundle-items-list {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.wspb-layout-table .wspb-bundle-item {
    display: table-row;
}

.wspb-layout-table .wspb-bundle-item-image,
.wspb-layout-table .wspb-bundle-item-content {
    display: table-cell;
    vertical-align: top;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.wspb-layout-list .wspb-bundle-item {
    flex-direction: column;
}

.wspb-layout-list .wspb-bundle-item-image {
    width: 100%;
    height: 200px;
}

/* Widget Styles */
.wspb-bundle-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wspb-bundle-widget-item {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.wspb-bundle-widget-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.wspb-bundle-widget-image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    overflow: hidden;
    border-radius: 3px;
}

.wspb-bundle-widget-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wspb-bundle-widget-content {
    flex: 1;
}

.wspb-bundle-widget-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
}

.wspb-bundle-widget-title a {
    color: #333;
    text-decoration: none;
}

.wspb-bundle-widget-title a:hover {
    color: #0073aa;
}

.wspb-bundle-widget-price {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.wspb-bundle-widget-items-count {
    font-size: 11px;
    color: #999;
}

/* Shortcode Styles */
.wspb-shortcode-bundle-item {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
}

.wspb-shortcode-item-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    overflow: hidden;
    border-radius: 3px;
}

.wspb-shortcode-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wspb-shortcode-item-content {
    flex: 1;
}

.wspb-shortcode-item-title {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
}

.wspb-shortcode-item-title a {
    color: #333;
    text-decoration: none;
}

.wspb-shortcode-item-title a:hover {
    color: #0073aa;
}

.wspb-shortcode-item-price {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.wspb-shortcode-item-quantity,
.wspb-shortcode-item-optional {
    font-size: 12px;
    color: #666;
}

.wspb-shortcode-item-optional {
    color: #0073aa;
    font-weight: 600;
}

/* Cart Item Styles */
.woocommerce-cart .wspb-bundled-item {
    font-size: 0.9em;
    color: #666;
}

.woocommerce-checkout .wspb-bundled-item {
    font-size: 0.9em;
    color: #666;
}

/* Loading States */
.wspb-loading {
    opacity: 0.6;
    pointer-events: none;
}

.wspb-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: wspb-spin 1s linear infinite;
}

@keyframes wspb-spin {
    to {
        transform: rotate(360deg);
    }
}


.wspb-add-to-cart-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wspb-add-to-cart-container .quantity {
    margin-right: 10px;
}

.wspb-add-to-cart-container .single_add_to_cart_button {
    white-space: nowrap;
}

/* Swatches */
.wspb-swatches-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.wspb-swatch-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    /* allow options to wrap while label stays intact */
}

.wspb-swatch-label {
    font-weight: 700;
    font-size: 12px;
    text-transform: capitalize;
    letter-spacing: .02em;
    color: #1e1e1e;
    white-space: nowrap;
    /* prevent awkward breaks like "Choic e" */
    min-width: 80px;
    /* keep labels aligned in a column */
}

.wspb-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1 1 auto;
    /* let options take remaining space next to label */
    min-width: 0;
}

.wspb-swatch {
    --wspb-swatch-size: 28px;
    width: var(--wspb-swatch-size);
    height: var(--wspb-swatch-size);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #d6d6d6;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: #222;
    transition: box-shadow .2s ease, transform .06s ease, border-color .2s ease, background-color .2s ease, color .2s ease;
}

.wspb-swatch:hover:not(.disabled) {
    border-color: #999;
}

.wspb-swatch:active:not(.disabled) {
    transform: translateY(1px);
}

.wspb-swatch:focus-visible {
    outline: 1px solid rgba(0, 115, 170, .35);
    outline-offset: 2px;
}

.wspb-swatch.selected {
    border-color: #111;
    /* Slightly thinner inner ring for selection */
    box-shadow: 0 0 0 1px #111 inset;
}

.label-swatch {
    /* Text swatches as compact chips (circle where possible) */
    width: var(--wspb-swatch-size);
    min-width: var(--wspb-swatch-size);
    height: var(--wspb-swatch-size);
    border-radius: 9999px;
    padding: 0;
    background-color: #fff;
    border: 2px solid #d6d6d6;
}

.label-swatch .swatch-label {
    font-size: 12px;
    color: inherit;
    white-space: nowrap;
    line-height: 1;
}

.radio-swatch {
    width: auto;
    height: 34px;
    /* taller pills for better tap targets */
    padding: 6px 14px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 2px solid #d6d6d6;
    background-color: #fff;
    color: #222;
}

.radio-swatch .wspb-radio-input {
    margin: 0;
    accent-color: #111;
}

/* Remove default square focus box on the tiny radio control.
   We provide focus visibility on the chip itself via :focus-within below. */
.radio-swatch .wspb-radio-input:focus,
.radio-swatch .wspb-radio-input:focus-visible {
    outline: none;
    box-shadow: none;
}



/* Radio-style swatch selected state: avoid heavy double outline */
.radio-swatch.selected {
    border-color: #111;
    box-shadow: none;
    /* keep it clean on pill labels */
}


/* Keep default Woo style, then override inside our bundle container */
.wspb-add-to-cart-container .single_add_to_cart_button.button.alt {
    background-color: #f3bb0d;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-family: 'Manrope';
    cursor: pointer;
    text-transform: capitalize;
    letter-spacing: .04em;
    font-weight: 700;
}

.wspb-add-to-cart-container .single_add_to_cart_button.button.alt:hover,
.wspb-add-to-cart-container .single_add_to_cart_button.button.alt:focus {
    background: #f3bb0d;
    color: #fff;
}


.radio-swatch .swatch-label {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
}

/* Disabled/Unavailable states for swatches */
.wspb-swatch.disabled,
.wspb-swatch[aria-disabled="true"] {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(.2);
}

/* Color swatch selected: emphasize ring without obscuring color */
.wspb-swatch.color-swatch.selected {
    /* Thinner dual ring so the color remains prominent */
    box-shadow: 0 0 0 1px #fff inset, 0 0 0 1px #111;
    border-color: #111;
}

/* Quantity + layout polish next to Add to Cart */
.wspb-add-to-cart-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wspb-add-to-cart-container .quantity .qty {
    height: 36px;
    min-width: 72px;
    border: 1px solid #cfcfcf;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
}

/* Improve bundle header spacing and emphasis */
.wspb-bundle-item-title {
    font-weight: 800;
    letter-spacing: .01em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wspb-bundle-item {
        flex-direction: column;
    }

    .wspb-bundle-item-image {
        width: 100%;
        height: 200px;
    }

    .wspb-bundle-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .wspb-bundle-item-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .wspb-bundle-item-variations {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .wspb-bundle-item-variation {
        width: 100%;
    }

    .wspb-shortcode-bundle-item {
        flex-direction: column;
    }

    .wspb-shortcode-item-image {
        width: 100%;
        height: 150px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wspb-bundle-items {
        background: #1e1e1e;
        border-color: #3c3c3c;
        color: #fff;
    }

    .wspb-bundle-item {
        background: #2c2c2c;
        border-color: #3c3c3c;
        color: #fff;
    }

    .wspb-bundle-item-title a {
        color: #fff;
    }

    .wspb-bundle-item-title a:hover {
        color: #0073aa;
    }

    .wspb-bundle-total {
        background: #2c2c2c;
        border-color: #0073aa;
        color: #fff;
    }
}

/* Keep desktop layout on mobile (override stacking) */
@media (max-width: 768px) {

    /* Keep row layout */
    .wspb-bundle-item {
        flex-direction: row;
    }

    .wspb-bundle-item-image {
        width: 80px;
        height: 80px;
    }

    /* Header stays horizontal */
    .wspb-bundle-item-header {
        flex-direction: row;
        align-items: flex-start;
        gap: 15px;
    }

    /* Options and variations stay inline with wrapping as needed */
    .wspb-bundle-item-options {
        flex-direction: row;
        align-items: center;
        gap: 15px;
        flex-wrap: wrap;
    }

    .wspb-bundle-item-variations {
        flex-direction: row;
        align-items: center;
        gap: 5px;
    }

    .wspb-bundle-item-variation {
        width: auto;
        min-width: 150px;
    }

    /* Shortcode items keep row layout too */
    .wspb-shortcode-bundle-item {
        flex-direction: row;
    }

    .wspb-shortcode-item-image {
        width: 60px;
        height: 60px;
    }
}

/* ========================================
   YITH-Style Bundle Classes
   ======================================== */

/* Classic Cart/Checkout: Hide bundled items when body has the class */
body.wspb-hide-bundled .cart_item.wspb-is-bundled-item,
body.wspb-hide-bundled .woocommerce-cart-form__cart-item.wspb-is-bundled-item,
body.wspb-hide-bundled .woocommerce-checkout-review-order-table .wspb-is-bundled-item {
    display: none !important;
}

/* Mini-cart: Hide bundled items */
body.wspb-hide-bundled .woocommerce-mini-cart-item.wspb-is-bundled-item {
    display: none !important;
}

/* WooCommerce Blocks: Hide bundled items */
body.wspb-hide-bundled .wc-block-cart .wc-block-cart-items tr.wspb-is-bundled-item,
body.wspb-hide-bundled .wc-block-components-order-summary .wc-block-components-order-summary-item.wspb-is-bundled-item,
body.wspb-hide-bundled .wc-block-mini-cart__items .wc-block-mini-cart-item.wspb-is-bundled-item {
    display: none !important;
}

/* Hide remove link for bundled items */
.wspb-is-bundled-item .remove,
.wspb-is-bundled-item .product-remove {
    display: none !important;
}

/* Hide prices for bundled items with fixed pricing */
.wspb-is-bundled-item.wspb-has-fixed-price .woocommerce-Price-amount,
.wspb-is-bundled-item.wspb-has-fixed-price .amount,
.wspb-is-bundled-item.wspb-has-fixed-price .wc-block-cart-item__prices,
.wspb-is-bundled-item.wspb-has-fixed-price .wc-block-components-product-price {
    display: none !important;
}

/* Remove border after bundle parent in Blocks */
.wc-block-components-order-summary .wc-block-components-order-summary-item.wspb-is-bundle:after {
    border: none !important;
}

/* Hide sale badges on bundled items in Blocks */
.wc-block-cart .wc-block-cart-items tr.wspb-is-bundled-item .wc-block-components-sale-badge {
    display: none !important;
}

/* Bundled item styling - make them visually distinct when visible */
.wspb-is-bundled-item {
    opacity: 0.8;
}

.wspb-is-bundled-item.wspb-is-hidden {
    display: none !important;
    visibility: hidden !important;
}

/* Prevent flash of bundled items before JS processes them */
/* Hide all cart rows until JavaScript has processed them */
.wc-block-cart-items__row:not(.wspb-processed-item),
.wc-block-components-order-summary-item:not(.wspb-processed-item),
.wc-block-mini-cart__line-item:not(.wspb-processed-item) {
    visibility: hidden !important;
}

/* Show processed items that are NOT bundled children */
.wc-block-cart-items__row.wspb-processed-item:not(.wspb-bundled-child-item),
.wc-block-components-order-summary-item.wspb-processed-item:not(.wspb-bundled-child-item),
.wc-block-mini-cart__line-item.wspb-processed-item:not(.wspb-bundled-child-item) {
    visibility: visible !important;
}

/* Hide bundled child items on cart page*/
.wspb-bundled-child-item {
    display: none !important;
    visibility: hidden !important;
}

/* Hide bundled child items in cart */
.wc-block-cart-items__row.wspb-bundled-child-item {
    display: none !important;
}

/* Hide bundled child items in order summary (checkout) */
.wc-block-components-order-summary-item.wspb-bundled-child-item {
    display: none !important;
}