/**
 * Powder Bundle Builder - Main Stylesheet
 * 
 * Two-step builder UI:
 *   Step 1: Product grid with filters
 *   Step 2: Review + add to cart
 */

/* ── Container ────────────────────────────────────────────────────────────── */

#pbb-builder {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: #e9e9e9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Step Container ───────────────────────────────────────────────────────── */

.pbb-step {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.pbb-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pbb-step-header {
    margin-bottom: 2rem;
}

.pbb-step-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.pbb-step-subtitle {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
}

/* ── Step 1: Mode/Cap Selector ────────────────────────────────────────────── */

.pbb-step-1-content {
    background: white;
    padding: 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ── Sticky top bar (toolbar + size/filter row) ──────────────────────────── */

.pbb-top-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    padding-top: 1rem;
    margin-top: -1rem;
    /* Offset the step content padding */
}

/* ── Toolbar Row (Reset + Active Size Badge) ─────────────────────────────── */

.pbb-toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

/* ── Size Selector + Filter Row (side-by-side) ───────────────────────────── */

.pbb-selector-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

/* ── Size Selector Pills ─────────────────────────────────────────────────── */

.pbb-size-selector {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.pbb-size-selector-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.pbb-size-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#pbb-builder .pbb-size-pill {
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

#pbb-builder .pbb-size-pill:hover {
    border-color: #2987c8;
    color: #2987c8;
    background: #f0f7fb;
}

#pbb-builder .pbb-size-pill.active {
    border-color: #2987c8;
    background: #2987c8;
    color: white;
    box-shadow: 0 2px 6px rgba(41, 135, 200, 0.3);
}

/* ── Gated Content (hidden until size selected) ──────────────────────────── */

.pbb-gated-content {
    animation: fadeIn 0.3s ease-in;
}

/* ── Step 2: Product Grid ─────────────────────────────────────────────────── */

.pbb-step-2-content {
    background: white;
    padding: 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pbb-filters-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.pbb-filter-group {
    margin-bottom: 1.25rem;
}

.pbb-filter-group:last-child {
    margin-bottom: 0;
}

.pbb-filter-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.pbb-filter-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    color: #333;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.pbb-filter-select:focus {
    outline: none;
    border-color: #2987c8;
    box-shadow: 0 0 0 3px rgba(0, 135, 190, 0.1);
}

/* .pbb-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
} */

.pbb-product-tile {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pbb-product-tile:hover {
    border-color: #2987c8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.pbb-tile-header {
    padding: 1rem;
    background: #f9f9f9;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.pbb-color-swatch {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    border: 2px solid #ddd;
    flex-shrink: 0;
}

.pbb-product-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    line-height: 1.3;
    flex: 1;
}

.pbb-tile-details {
    padding: 0.75rem 1rem;
    background: white;
}

.pbb-product-size {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.pbb-product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2987c8;
}

.pbb-tile-input {
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

.pbb-product-qty {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;

    number-input {
        -moz-appearance: textfield;
    }
}

.pbb-product-qty::-webkit-outer-spin-button,
.pbb-product-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pbb-product-qty:focus {
    outline: none;
    border-color: #2987c8;
    box-shadow: 0 0 0 3px rgba(0, 135, 190, 0.1);
}

.pbb-input-label {
    font-size: 0.8rem;
    color: #999;
    text-align: center;
    font-weight: 500;
}

.pbb-no-products {
    grid-column: 1 / -1;
    padding: 2rem;
    text-align: center;
    color: #999;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px dashed #ddd;
}

/* ── Step 2: Review Bundle ────────────────────────────────────────────────── */

.pbb-step-2-content {
    background: white;
    padding: 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pbb-bundle-summary {
    background: #f0f7fb;
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid #2987c8;
    margin-bottom: 1.5rem;
}

.pbb-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 135, 190, 0.2);
    font-size: 0.95rem;
}

.pbb-summary-item:last-child {
    border-bottom: none;
}

.pbb-item-name {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.pbb-item-qty {
    color: #666;
    font-size: 0.9rem;
    text-align: right;
}

.pbb-totals-section {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.pbb-total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.pbb-total-line:last-child {
    padding-top: 1rem;
    border-top: 2px solid rgba(0, 135, 190, 0.3);
    font-size: 1.25rem;
    font-weight: 700;
    color: #2987c8;
}

.pbb-total-value {
    font-weight: 700;
    color: #2987c8;
}

.pbb-discount-info {
    background: #d2ffd2;
    padding: 1rem;
    border-radius: 6px;
    border: solid #27ae60;
    border-width: 0 0 0 4px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: #27ae60;
}

.pbb-discount-info strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.pbb-button-row {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

.pbb-button-row.full-width {
    justify-content: center;
}

#pbb-builder button.pbb-btn,
#pbb-builder .pbb-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

#pbb-builder button.pbb-btn:disabled,
#pbb-builder .pbb-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pbb-builder .pbb-btn-primary {
    background-color: #2987c8;
    color: white;
}

#pbb-builder .pbb-btn-primary:hover:not(:disabled) {
    background-color: #006a94;
    box-shadow: 0 4px 12px rgba(0, 135, 190, 0.3);
}

#pbb-builder .pbb-btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

#pbb-builder .pbb-btn-secondary:hover:not(:disabled) {
    background-color: #d0d0d0;
}

#pbb-builder .pbb-next-btn,
#pbb-builder .pbb-review-btn,
#pbb-builder .pbb-add-to-cart-btn {
    width: 100%;
    min-height: 44px;
    font-size: 1.05rem;
    font-weight: 700;
}

#pbb-builder .pbb-back-btn {
    flex: 0;
}

button.pbb-oz-stepper-btn.pbb-oz-minus,
button.pbb-oz-stepper-btn.pbb-oz-plus,
button.pbb-btn.pbb-btn-primary.pbb-next-btn,
button.pbb-btn.pbb-btn-secondary.pbb-back-btn,
button.pbb-btn.pbb-btn-primary.pbb-review-btn,
button#pbb-add-to-cart-btn,
button.pbb-qty-plus,
button.pbb-qty-minus {
    background: #2987c8 !important;
}

button:hover.pbb-oz-stepper-btn.pbb-oz-minus,
button:hover.pbb-oz-stepper-btn.pbb-oz-plus,
button:hover.pbb-btn.pbb-btn-primary.pbb-next-btn,
button:hover.pbb-btn.pbb-btn-secondary.pbb-back-btn,
button:hover.pbb-btn.pbb-btn-primary.pbb-review-btn,
button:hover#pbb-add-to-cart-btn,
button:hover.pbb-qty-plus,
button:hover.pbb-qty-minus {
    background: #1c5677 !important;
}

/* ── Accessibility ────────────────────────────────────────────────────────── */

.pbb-btn:focus,
.pbb-filter-select:focus,
.pbb-product-qty:focus {
    outline: 2px solid #2987c8;
    outline-offset: 2px;
}

/* Skip link (for screen readers) */
.pbb-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2987c8;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.pbb-skip-link:focus {
    top: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP INDICATOR
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-step-indicator {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 2rem;
    gap: 0;
}

.pbb-step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.pbb-step-dot .dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #aaa;
    transition: all 0.3s ease;
}

.pbb-step-dot .step-label {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.pbb-step-dot.active .dot {
    border-color: #2987c8;
    background: #2987c8;
    color: white;
}

.pbb-step-dot.active .step-label {
    color: #2987c8;
    font-weight: 600;
}

.pbb-step-dot.completed .dot {
    border-color: #27ae60;
    background: #27ae60;
    color: white;
}

.pbb-step-dot.completed .step-label {
    color: #27ae60;
}

.pbb-step-connector {
    width: 30rem;
    height: 2px;
    background: #ddd;
    margin: 17px 0 0;
    /* vertically centre on dot */
    transition: background 0.3s ease;
}

.pbb-step-connector.done {
    background: #27ae60;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 1 — OZ STEPPER
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-oz-stepper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.pbb-oz-stepper-btn {
    width: 38px;
    height: 38px;
    border: 2px solid #2987c8;
    background: white;
    color: #2987c8;
    border-radius: 6px;
    font-size: 20px;
    line-height: 0 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.pbb-oz-stepper-btn:hover:not(:disabled) {
    background: #2987c8;
    color: white;
}

.pbb-oz-stepper-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#pbb-oz-units {
    width: 80px;
    text-align: center;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
}

#pbb-oz-units:focus {
    outline: none;
    border-color: #2987c8;
}

.pbb-oz-display {
    font-size: 14px;
    color: #666;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 1 — LBS ROW
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-lbs-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 12px 0;
}

.pbb-lbs-num {
    width: 80px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.pbb-lbs-num:focus {
    outline: none;
    border-color: #2987c8;
}

.pbb-lbs-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 2px;
    /* margin-left: 12px;
    margin-right: 12px; */
}

.pbb-tick {
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    transition: color 0.2s;
    user-select: none;
}

.pbb-tick:hover {
    color: #2987c8;
    background: rgba(0, 135, 190, 0.08);
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 1 — SIZE TILES (OZ MODE DISPLAY)
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-size-tiles-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /* margin-top: 10px; */
}

.pbb-size-tile {
    padding: 10px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    text-align: center;
    user-select: none;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 2 — FILTER ROW
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-sticky-header {
    /* No longer sticky - main sticky container is now .pbb-top-sticky */
    background: transparent;
}

.pbb-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.pbb-filter-row .pbb-filter-label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
    white-space: nowrap;
}

.pbb-active-size-badge {
    padding: 6px 12px;
    border-radius: 20px;
    background: #e3f2fd;
    color: #1976d2;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(25, 118, 210, 0.2);
}

#pbb-builder .pbb-filter-reset-btn {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#pbb-builder .pbb-filter-reset-btn:hover {
    border-color: #c0392b;
    color: #c0392b;
    background: #fdf2f2;
}

#pbb-builder .pbb-filter-clear-btn {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: transparent;
    color: #888;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: auto;
}

#pbb-builder .pbb-filter-clear-btn:hover {
    border-color: #2987c8;
    color: #2987c8;
    background: #f0f7fb;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 2 — DISCOUNT BAR (per-group tracks)
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-discount-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    align-items: start;
    margin-bottom: 1.5rem;
}

.pbb-discount-track {
    margin-bottom: 10px;
    padding: 10px 14px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #efefef;
}

.pbb-discount-track__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    color: #444;
}

.pbb-savings-badge {
    background: #27ae60;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.pbb-savings-track-outer {
    background: #e0e0e0;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}

.pbb-savings-track-fill {
    height: 100%;
    background: linear-gradient(90deg, #2987c8 0%, #27ae60 100%);
    border-radius: 4px;
    transition: width 0.35s ease;
}

.pbb-savings-hint {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.pbb-savings-hint--maxed {
    color: #27ae60;
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 2 — COLOUR TILES
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-colour-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pbb-colour-tile {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    background: white;
}

.pbb-colour-tile:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.09);
}

/* Tile header — the clickable row */
.pbb-colour-tile .pbb-tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    background: #fafafa;
    border-bottom: 1px solid transparent;
    transition: background 0.2s;
    user-select: none;
}

.pbb-colour-tile .pbb-tile-header:hover {
    background: #f0f7fb;
}

.pbb-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.pbb-colour-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
    display: inline-block;
}

.pbb-tile-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.pbb-tile-badge {
    background: #2987c8;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.pbb-tile-arrow {
    font-size: 12px;
    color: #aaa;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.pbb-tile-arrow.open {
    transform: rotate(180deg);
}

/* Tile body — hidden by default, shown when .open */
.pbb-tile-body {
    display: none;
    border-top: 1px solid #f0f0f0;
}

.pbb-tile-body.open {
    display: block;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 2 — SIZE ROWS (inside colour tile body)
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-size-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
    flex-direction: row;
}

.pbb-size-row:last-child {
    border-bottom: none;
}

.pbb-size-row:hover {
    background: #fafcff;
}

.pbb-size-tag {
    font-size: 13px;
    color: #555;
    min-width: 55px;
    font-weight: 500;
}

.pbb-cross-group-hint {
    display: block;
    font-size: 11px;
    color: #9e9e9e;
    font-style: italic;
    line-height: 1.3;
    margin-top: 2px;
}

.pbb-size-price {
    font-size: 13px;
    color: #2987c8;
    font-weight: 600;
    flex: 0.5;
}

/* Mini stepper */
.pbb-mini-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pbb-qty-minus,
.pbb-qty-plus {
    width: 30px;
    height: 30px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.pbb-qty-minus:hover:not(:disabled),
.pbb-qty-plus:hover:not(:disabled) {
    border-color: #2987c8;
    color: #2987c8;
    background: #f0f7fb;
}

.pbb-qty-minus:disabled,
.pbb-qty-plus:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pbb-qty-val {
    min-width: 26px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    color: #333;
}

/* Manual quantity input (replaces .pbb-qty-val span) */
.pbb-qty-input {
    width: 48px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: 700;
    font-size: 15px;
    color: #333;
    padding: 2px 4px;
    -moz-appearance: textfield;
    background: white;
    transition: border-color 0.2s ease;
}

.pbb-qty-input::-webkit-outer-spin-button,
.pbb-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pbb-qty-input:focus {
    outline: none;
    border-color: #2987c8;
    box-shadow: 0 0 0 2px rgba(41, 135, 200, 0.15);
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 2 — TIER DISCOUNT TILES (bubble tiles)
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-tier-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #ddd;
}

.pbb-tier-tile {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #e8f4f8 0%, #dbedf5 100%);
    border: 1px solid #b8dae8;
    border-radius: 35px;
    font-size: 13px;
    color: #1a5276;
    font-weight: 500;
    white-space: normal;
    max-width: 10rem;
    text-align: center;
    transition: all 0.2s ease;
}

.pbb-tier-tile:hover {
    background: linear-gradient(135deg, #d1ecf5 0%, #c4e3ef 100%);
    border-color: #8ec6d9;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Empty message */
.pbb-empty-message {
    text-align: center;
    color: #999;
    padding: 2rem;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px dashed #ddd;
    font-size: 14px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 2 — REVIEW ITEMS
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-review-color-group {
    padding: 8px 0 4px;
    font-size: 13px;
    color: #888;
    border-top: 1px solid #f0f0f0;
    margin-top: 4px;
}

.pbb-review-color-group:first-child {
    border-top: none;
    margin-top: 0;
}

.pbb-review-item {
    display: grid;
    grid-template-columns: 2fr 0.7fr 1.2fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.pbb-review-item:last-child {
    border-bottom: none;
}

.pbb-review-name {
    font-weight: 500;
    color: #333;
}

.pbb-review-size {
    color: #888;
    font-size: 12px;
}

.pbb-review-qty {
    color: #555;
    font-size: 13px;
}

.pbb-review-subtotal {
    font-weight: 600;
    color: #2987c8;
    text-align: right;
}

/* ══════════════════════════════════════════════════════════════════════════════
   BUTTONS — ADDITIONS
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-btn-success {
    background-color: #27ae60;
    color: white;
}

.pbb-btn-success:hover:not(:disabled) {
    background-color: #1e8449;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.pbb-btn-success:active:not(:disabled) {
    transform: scale(0.98);
}

/* ══════════════════════════════════════════════════════════════════════════════
   ALERT MESSAGES
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-messages {
    min-height: 0;
    transition: min-height 0.2s;
}

.pbb-alert {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 0;
}

.pbb-alert-success {
    background: #e8f8ee;
    color: #1e8449;
    border-left: 4px solid #27ae60;
}

.pbb-alert-error {
    background: #fdf2f2;
    color: #c0392b;
    border-left: 4px solid #e74c3c;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE ADDITIONS
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .pbb-review-item {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }

    .pbb-review-name {
        grid-column: 1 / 3;
    }

    .pbb-step-connector {
        width: 30rem;
    }
}

@media (max-width: 480px) {
    .pbb-size-row {
        gap: 8px;
        padding: 8px 12px;
    }

    .pbb-tile-header {
        padding: 10px 12px;
    }

    .pbb-review-item {
        grid-template-columns: 1fr;
    }

    .pbb-review-name {
        grid-column: auto;
    }

    .pbb-step-connector {
        width: 30rem;
    }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    #pbb-builder {
        margin: 1rem;
        padding: 1rem;
    }

    .pbb-top-sticky {
        padding-top: 0.5rem;
        margin-top: -0.5rem;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        border-bottom: 1px solid #e0e0e0;
    }

    .pbb-toolbar-row {
        margin-bottom: 0.5rem;
    }

    .pbb-selector-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: none;
    }

    .pbb-size-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        gap: 6px;
    }

    .pbb-size-pills::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .pbb-filter-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .pbb-filter-row::-webkit-scrollbar {
        display: none;
    }

    .pbb-discount-bar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 8px;
        margin-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .pbb-discount-track {
        flex: 0 0 240px;
        margin-bottom: 0;
    }

    .pbb-size-pill {
        padding: 6px 14px;
        font-size: 13px;
    }

    .pbb-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .pbb-product-tile {
        font-size: 0.9rem;
    }

    .pbb-button-row {
        flex-direction: column-reverse;
    }

    .pbb-button-row.full-width {
        flex-direction: column;
    }

    .pbb-next-btn,
    .pbb-review-btn,
    .pbb-add-to-cart-btn,
    .pbb-back-btn {
        width: 100%;
    }

    .pbb-step-title {
        font-size: 1.5rem;
    }

    .pbb-sticky-header {
        position: static;
        padding-top: 0;
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    #pbb-builder {
        margin: 0;
        padding: 0.75rem;
        border-radius: 0;
    }

    .pbb-step-1-content,
    .pbb-step-2-content {
        padding: 1rem;
        border-radius: 0;
    }

    .pbb-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .pbb-tile-header {
        padding: 0.75rem;
    }

    .pbb-tile-details {
        padding: 0.5rem 0.75rem;
    }

    .pbb-tile-input {
        padding: 0.75rem;
    }

    .pbb-color-swatch {
        width: 40px;
        height: 40px;
    }

    .pbb-product-name {
        font-size: 0.85rem;
    }

    .pbb-product-price {
        font-size: 1rem;
    }

    .pbb-button-row {
        gap: 0.5rem;
    }

    button.pbb-btn,
    .pbb-btn {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    .pbb-step-title {
        font-size: 1.25rem;
    }
}


/* Row layout: thumbnail | meta (name+size+price) | stepper */
.pbb-size-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f4f8;
    transition: background 0.15s;
    flex-direction: row;
    flex-wrap: nowrap;
}

.pbb-product-identity {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

/* Thumbnail */
.pbb-product-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e8ecf0;
    flex-shrink: 0;
    display: block;
    background: #f5f9ff;
}

.pbb-product-thumb--placeholder {
    background: #f0f4f8;
    border: 1px dashed #d0d8e0;
}

/* Name + size label + price stacked */
.pbb-discount-bar-intro {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
    padding-left: 2px;
}

.pbb-discount-bar-title {
    font-size: 13px;
    font-weight: 700;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pbb-discount-bar-hinttext {
    font-size: 12px;
    color: #8c8f94;
}

.pbb-product-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.pbb-product-name {
    font-size: 13px;
    font-weight: 700;
    color: #2987c8;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.pbb-product-name:hover {
    text-decoration: underline;
    color: #1450a0;
}

.pbb-size-tag {
    font-size: 11px;
    color: #888;
    font-weight: 400;
}

/* Pricing block: price + optional discount badge */
.pbb-product-pricing {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.pbb-size-price {
    font-size: 14px;
    color: #2987c8;
    font-weight: 700;
    white-space: nowrap;
}

/* ── Discount badge (inline on row) ── */
.pbb-discount-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: #27ae60;
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.4;
    white-space: nowrap;
}

.pbb-discount-badge--none {
    background: #f0f0f1;
    color: #646970;
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SUMMARY BOX (reference design grid)
   ══════════════════════════════════════════════════════════════════════════════ */

.pbb-summary-box {
    background: #e5e5e5;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 1.25rem 0;
}

.summary-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
}

/* Config-driven grid: one cell per active size group, auto-wrapping */
.pbb-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.pbb-summary-cell {
    background: #fff;
    border-radius: 6px;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.pbb-summary-cell .sc-label {
    font-size: 10px;
    color: #888;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pbb-summary-cell .sc-val {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Total bar */
.pbb-summary-total-bar {
    display: flex;
    justify-content: right;
    align-items: baseline;
    border-top: 1px solid #e0e0e0;
    padding-top: 10px;
}

.pbb-summary-total-bar .tb-label {
    font-size: 18px;
    font-weight: 600;
    padding-right: 1rem;
    color: #888;
}

#pbb-summary-grand-total {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

#pbb-summary-grand-total.exact {
    color: #2e7d32;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP 2 DISCOUNT PREVIEW
   ══════════════════════════════════════════════════════════════════════════════ */

/* Review item grid: expand last column to hold the price+discount stack */
.pbb-review-item {
    grid-template-columns: 2fr 0.7fr 1.2fr 1.1fr;
    align-items: start;
}

.pbb-review-price-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

/* Strike through the base price when a discount applies */
.pbb-review-subtotal--struck {
    text-decoration: line-through;
    color: #aaa;
    font-weight: 400;
    font-size: 12px;
}

.pbb-review-discount-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: #27ae60;
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.4;
}

.pbb-review-discounted-price {
    font-size: 13px;
    font-weight: 600;
    color: #2e7d32;
    text-align: right;
}

.pbb-review-saving {
    font-size: 11px;
    font-weight: 400;
    font-style: normal;
    color: #888;
}

/* -- Responsive header and rows ------------------------------------------------------------ */

@media (max-width: 768px) {
    #pbb-builder {
        margin: 1rem;
        padding: 1rem;
    }

    .pbb-size-pills {
        gap: 6px;
    }

    .pbb-size-pill {
        padding: 6px 14px;
        font-size: 13px;
    }

    .pbb-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .pbb-product-tile {
        font-size: 0.9rem;
    }

    .pbb-button-row {
        flex-direction: column-reverse;
    }

    .pbb-button-row.full-width {
        flex-direction: column;
    }

    .pbb-next-btn,
    .pbb-review-btn,
    .pbb-add-to-cart-btn,
    .pbb-back-btn {
        width: 100%;
    }

    .pbb-step-title {
        font-size: 1.5rem;
    }

    .pbb-sticky-header {
        position: static;
        padding-top: 0;
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    #pbb-builder {
        margin: 0;
        padding: 0.75rem;
        border-radius: 0;
    }

    .pbb-step-1-content,
    .pbb-step-2-content {
        padding: 1rem;
        border-radius: 0;
    }

    .pbb-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .pbb-tile-header {
        padding: 0.75rem;
    }

    .pbb-tile-details {
        padding: 0.5rem 0.75rem;
    }

    .pbb-tile-input {
        padding: 0.75rem;
    }

    .pbb-color-swatch {
        width: 40px;
        height: 40px;
    }

    .pbb-product-name {
        font-size: 0.85rem;
    }

    .pbb-product-price {
        font-size: 1rem;
    }

    .pbb-button-row {
        gap: 0.5rem;
    }

    button.pbb-btn,
    .pbb-btn {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    .pbb-step-title {
        font-size: 1.25rem;
    }
}

/* -- Responsive adjustments for enhanced rows -- */
@media (max-width: 480px) {
    .pbb-product-thumb {
        width: 5rem;
        height: 5rem;
    }

    .pbb-size-row {
        gap: 8px;
    }

    .pbb-product-pricing {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }

    .pbb-review-item {
        grid-template-columns: 1fr 1fr;
    }

    .pbb-review-price-col {
        align-items: flex-start;
    }

    .pbb-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}