/* =================================================================
   Products Bundle Widget
   ================================================================= */

/* --- Wrapper ---------------------------------------------------- */
.pbd-wrapper {
    --pbd-panel-w: 320px;   /* overridden by Elementor panel_width slider */
    display: grid;
    grid-template-columns: var(--pbd-panel-w) 1fr;
    gap: 40px;
    align-items: start;
}

.pbd-wrapper.pbd-products-left {
    grid-template-columns: 1fr var(--pbd-panel-w);
}

.pbd-wrapper.pbd-products-left .pbd-panel {
    order: 2;
}

/* --- Panel ------------------------------------------------------ */

/* Sticky on the grid item itself (not the inner wrapper).
   align-self: start keeps the panel at its natural height so the
   grid row (driven by the taller products column) gives the sticky
   element the scroll range it needs. */
.pbd-panel {
    position: sticky;
    top: 100px;
    align-self: start;
}

.pbd-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.45);
    margin-bottom: 12px;
}

.pbd-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    color: #111111;
    margin: 0 0 16px;
    letter-spacing: -0.02em;
}

.pbd-title em {
    font-style: normal;
    font-weight: 900;
}

.pbd-desc {
    font-size: 0.875rem;
    line-height: 1.65;
    color: rgba(0, 0, 0, 0.52);
    margin: 0 0 28px;
}

/* --- Selected Slots --------------------------------------------- */
.pbd-selected {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.pbd-slot {
    width: 86px;
    height: 86px;
    border-radius: 12px;
    overflow: visible;
    position: relative;
    flex-shrink: 0;
    background-color: #f2f2f2;
    border: 1.5px dashed rgba(0, 0, 0, 0.14);
    transition: border-color 0.2s, background-color 0.2s;
}

.pbd-slot.is-filled {
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.1);
}

.pbd-slot-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    overflow: hidden;
}

.pbd-slot-inner img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: inherit;
}

.pbd-slot-icon {
    color: rgba(0, 0, 0, 0.22);
    flex-shrink: 0;
}

/* Remove button */
.pbd-slot-remove {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #111111;
    color: #ffffff;
    border: 2px solid #ffffff;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 3;
    transition: background 0.15s, transform 0.15s;
}

.pbd-slot.is-filled .pbd-slot-remove {
    display: flex;
}

.pbd-slot-remove:hover {
    background: #e84142;
    transform: scale(1.15);
}

/* --- Progress --------------------------------------------------- */
.pbd-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 22px;
}

.pbd-progress-bar {
    display: block;
    height: 3px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 99px;
    overflow: hidden;
}

.pbd-progress-fill {
    display: block;
    height: 100%;
    background: #111111;
    border-radius: 99px;
    transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pbd-progress-text {
    font-size: 0.8125rem;
    color: rgba(0, 0, 0, 0.45);
}

.pbd-count {
    font-weight: 700;
    color: #111111;
    transition: color 0.2s;
}

/* --- CTA Button ------------------------------------------------- */
.pbd-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 28px;
    background: #111111;
    color: #ffffff;
    border: none;
    border-radius: 99px;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, opacity 0.25s;
}

.pbd-cta:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pbd-cta:not(:disabled):hover {
    transform: translateY(-2px);
}

.pbd-cta-arrow {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.pbd-cta:not(:disabled):hover .pbd-cta-arrow {
    transform: translateX(4px);
}

.pbd-cta.is-success {
    background: #1a9e5c;
    opacity: 1;
    cursor: default;
}

.pbd-cta.is-success:hover {
    transform: none;
}

/* --- Product Grid ----------------------------------------------- */
/* Products_Renderer outputs ul.products.col-row (Kitify flexbox).
   Override with CSS Grid so column count is controlled by Elementor. */
.pbd-wrapper ul.products {
    display: grid !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    grid-template-columns: repeat(3, 1fr);
}

/* Reset Kitify col-* width/padding so grid controls sizing */
.pbd-wrapper ul.products li.product {
    width: auto !important;
    max-width: none !important;
    flex: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Selected state: inset ring follows border-radius automatically */
.pbd-wrapper ul.products li.product.is-added .product-item__thumbnail {
    box-shadow: inset 0 0 0 2.5px #111111;
}

/* --- Card Actions ----------------------------------------------- */
.pbd-card-actions {
    margin-top: auto;
}

/* Simple product: full-width button */
.pbd-card-actions > .pbd-add-btn {
    width: 100%;
    justify-content: center;
}

/* Variable product: form fills full width */
.pbd-variation-form {
    width: 100%;
}

.pbd-actions-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Full-width Add button stacked below variations */
.pbd-actions-row > .pbd-add-btn {
    width: 100%;
    justify-content: center;
}

/* Attribute wrapper (one row per attribute group) */
.pbd-variations {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* --- WCBoost Variation Swatches --------------------------------- */

/* Force horizontal row layout */
.pbd-wrapper .wcboost-variation-swatches__wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Color / Image swatches: smaller circles */
.pbd-wrapper .wcboost-variation-swatches--color .wcboost-variation-swatches__item,
.pbd-wrapper .wcboost-variation-swatches--image .wcboost-variation-swatches__item {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    position: relative !important;
}

/* Selected ring for color / image swatches via ::after */
.pbd-wrapper .wcboost-variation-swatches--color .wcboost-variation-swatches__item.selected::after,
.pbd-wrapper .wcboost-variation-swatches--image .wcboost-variation-swatches__item.selected::after {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    inset: -5px !important;
    border: 2.5px solid #111111 !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

/* Scale down the ring at compact size */
.pbd-wrapper .wcboost-variation-swatches--color .wcboost-variation-swatches__item.selected::after,
.pbd-wrapper .wcboost-variation-swatches--image .wcboost-variation-swatches__item.selected::after {
    inset: -4px !important;
    border-width: 2px !important;
}

/* Label / Button swatches: compact pill */
.pbd-wrapper .wcboost-variation-swatches--label .wcboost-variation-swatches__item,
.pbd-wrapper .wcboost-variation-swatches--button .wcboost-variation-swatches__item {
    font-size: 0.6875rem !important;
    font-weight: 500 !important;
    padding: 3px 10px !important;
    height: auto !important;
    min-height: unset !important;
    line-height: 1.4 !important;
    border-radius: 99px !important;
}

/* Selected state for label / button swatches */
.pbd-wrapper .wcboost-variation-swatches--button .wcboost-variation-swatches__item.selected,
.pbd-wrapper .wcboost-variation-swatches--label  .wcboost-variation-swatches__item.selected {
    background-color: #111111 !important;
    color: #ffffff !important;
    border-color: #111111 !important;
    box-shadow: none !important;
}

/* Fallback select (shown when WCBoost is not active) */
.pbd-variations select {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 99px;
    font-size: 0.8125rem;
    font-weight: 500;
    background: #ffffff;
    color: #111111;
    cursor: pointer;
    appearance: auto;
    transition: border-color 0.2s;
}

.pbd-variations select:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.35);
}

.pbd-variations select.has-value {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
    font-weight: 600;
}

/* --- Add button ------------------------------------------------- */
.pbd-add-btn {
    flex-shrink: 0;
    height: 40px;
    padding: 0 20px;
    background: rgba(0, 0, 0, 0.07);
    color: #111111;
    border: none;
    border-radius: 99px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    white-space: nowrap;
}

.pbd-add-btn:hover:not(.is-added):not(:disabled) {
    background: rgba(0, 0, 0, 0.14);
    transform: scale(1.03);
}

/* Added state */
.pbd-add-btn.is-added {
    background: #111111;
    color: #ffffff;
}

.pbd-add-btn.is-added:hover {
    background: #e84142;
    transform: none;
}

/* Disabled when bundle is full */
.pbd-add-btn:disabled:not(.is-added) {
    opacity: 0.35;
    cursor: not-allowed;
}

/* --- Empty state ------------------------------------------------ */
.pbd-empty {
    grid-column: 1 / -1;
    color: rgba(0, 0, 0, 0.38);
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}

/* --- Responsive ------------------------------------------------- */
@media (max-width: 1200px) {
    .pbd-wrapper {
        --pbd-panel-w: 280px;
        gap: 28px;
    }
}

@media (max-width: 1024px) {
    .pbd-wrapper {
        grid-template-columns: 1fr;
    }

    .pbd-panel {
        position: static;
    }

    .pbd-selected {
        flex-wrap: nowrap;
    }
}

@media (max-width: 767px) {
    .pbd-wrapper ul.products {
        grid-template-columns: repeat(2, 1fr);
    }

    .pbd-title {
        font-size: 1.5rem;
    }

    .pbd-slot {
        width: 72px;
        height: 72px;
    }
}
