/**
 * XC Bundle Products Builder — front-end styles.
 */

.xc-bpb-form {
    margin: 18px 0;
}
.xc-bpb-bundle {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 2px 6px rgba( 0, 0, 0, 0.04 );
}
.xc-bpb-bundle-title {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 700;
}

/* List of items. */
.xc-bpb-items {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}
.xc-bpb-item {
    display: grid;
    grid-template-columns: 56px 24px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f1;
}
.xc-bpb-item:last-child {
    border-bottom: 0;
}
.xc-bpb-item-image img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.xc-bpb-item-name {
    font-weight: 600;
    margin: 0;
}
.xc-bpb-item-name a {
    color: inherit;
    text-decoration: none;
}
.xc-bpb-item-meta {
    display: block;
    font-size: 12px;
    color: #50575e;
    margin-top: 2px;
}
.xc-bpb-item-price {
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}
.xc-bpb-item-discount {
    display: inline-block;
    background: #ecfccb;
    color: #365314;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 6px;
}
.xc-bpb-required-marker {
    color: #b32d2e;
    font-weight: 700;
    font-size: 14px;
}

/* Custom checkbox for optional items. */
.xc-bpb-check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #c3c4c7;
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all .2s ease;
    position: relative;
}
.xc-bpb-check:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}
.xc-bpb-check:checked {
    border-color: #6366f1;
    background: linear-gradient( 135deg, #6366f1 0%, #8b5cf6 100% );
}
.xc-bpb-check:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate( 45deg );
}

/* Variation select (when allow_variations is on). */
.xc-bpb-variation-select {
    margin-top: 6px;
    width: 100%;
    max-width: 280px;
}

/* Quantity input per item. */
.xc-bpb-item-qty {
    width: 64px;
}

/* Summary box. */
.xc-bpb-summary {
    margin-top: 18px;
    padding: 16px 18px;
    background: linear-gradient( 135deg, rgba( 99, 102, 241, 0.08 ) 0%, rgba( 139, 92, 246, 0.08 ) 100% );
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    justify-content: space-between;
}
.xc-bpb-summary-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.xc-bpb-summary-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
}
.xc-bpb-summary-regular {
    text-decoration: line-through;
    color: #6b7280;
}
.xc-bpb-summary-total {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
}
.xc-bpb-savings {
    background: #fff;
    border: 1px solid #ecfccb;
    color: #365314;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
}

/* Layout — compact. */
.xc-bpb-layout-compact .xc-bpb-item {
    grid-template-columns: 24px 1fr auto;
    padding: 6px 0;
}
.xc-bpb-layout-compact .xc-bpb-item-image {
    display: none;
}

/* Layout — grid. */
.xc-bpb-layout-grid .xc-bpb-items {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax( 180px, 1fr ) );
    gap: 14px;
}
.xc-bpb-layout-grid .xc-bpb-item {
    display: block;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}
.xc-bpb-layout-grid .xc-bpb-item-image {
    margin: 0 auto 8px;
}
.xc-bpb-layout-grid .xc-bpb-item-image img {
    width: 100%;
    height: 130px;
}
.xc-bpb-layout-grid .xc-bpb-item-meta,
.xc-bpb-layout-grid .xc-bpb-item-price {
    text-align: center;
}

/* Recalculating spinner. */
.xc-bpb-form.is-recalculating .xc-bpb-summary-total {
    opacity: .5;
}
.xc-bpb-form.is-recalculating::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 16px;
    width: 14px;
    height: 14px;
    border: 2px solid #c7d2fe;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: xc-bpb-spin 0.7s linear infinite;
}
@keyframes xc-bpb-spin {
    to { transform: rotate( 360deg ); }
}
.xc-bpb-form {
    position: relative;
}

/* Cart row tag + edit link. */
.xc-bpb-cart-tag {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: linear-gradient( 135deg, #6366f1 0%, #8b5cf6 100% );
    color: #fff;
    padding: 1px 8px;
    border-radius: 999px;
    vertical-align: middle;
}
.xc-bpb-edit-link {
    color: #6366f1;
}

/* Cross-sell on simple product pages. */
.xc-bpb-cross-sell {
    margin: 24px 0;
    padding: 16px 18px;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    background: #fafafb;
}
.xc-bpb-cross-sell-title {
    margin: 0 0 8px;
    font-size: 16px;
}
.xc-bpb-cross-sell-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.xc-bpb-cross-sell-list li {
    padding: 4px 0;
}
.xc-bpb-cross-savings {
    color: #365314;
    font-weight: 600;
}

@media ( max-width: 600px ) {
    .xc-bpb-item {
        grid-template-columns: 48px 1fr;
        gap: 10px;
    }
    .xc-bpb-item-name {
        grid-column: 2 / -1;
    }
    .xc-bpb-item-price {
        grid-column: 2 / -1;
        text-align: left;
    }
}
