/* ============================================================
   Birdie Bundle Creator — Frontend Styles
   ============================================================ */

.birdie-bundle-creator {
    --bbc-accent:      #2e7d32;
    --bbc-accent-light:#f1f8e9;
    --bbc-border:      #e0e0e0;
    --bbc-radius:      8px;
    --bbc-gap:         1.5rem;
    font-family: inherit;
    container-type: inline-size;
}

/* ── Header ──────────────────────────────────────────────── */

.bbc-title {
    text-align: center;
    margin: 0 0 0.4rem;
    font-size: 1.75rem;
}

.bbc-subtitle {
    text-align: center;
    color: #555;
    margin: 0 0 2rem;
    font-size: 1rem;
}

/* ── 3-column slot grid ──────────────────────────────────── */

.bbc-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--bbc-gap);
    margin-bottom: 2rem;
}

@container (max-width: 820px) {
    .bbc-slots { grid-template-columns: 1fr 1fr; }
}
@container (max-width: 520px) {
    .bbc-slots { grid-template-columns: 1fr; }
}

/* Fallback for browsers without container queries */
@media (max-width: 820px)  { .bbc-slots { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px)  { .bbc-slots { grid-template-columns: 1fr; } }

/* ── Slot card ───────────────────────────────────────────── */

.bbc-slot {
    border: 2px solid var(--bbc-border);
    border-radius: var(--bbc-radius);
    overflow: hidden;
    transition: border-color 0.2s;
}

.bbc-slot.is-complete {
    border-color: var(--bbc-accent);
}

.bbc-slot-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, #f1f8f1 0%, #e8f5e9 100%);
    border-bottom: 1px solid #d4ebd4;
    font-weight: 600;
    font-size: 0.95rem;
}

.bbc-slot-num {
    width: 26px;
    height: 26px;
    background: #444;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.2s;
}

.bbc-slot.is-complete .bbc-slot-num {
    background: var(--bbc-accent);
}

.bbc-slot-label {
    flex: 1;
}

.bbc-slot-check {
    opacity: 0;
    color: var(--bbc-accent);
    font-size: 1rem;
    transition: opacity 0.2s;
}

.bbc-slot.is-complete .bbc-slot-check {
    opacity: 1;
}

/* ── Slot search ─────────────────────────────────────────── */

.bbc-slot-search {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--bbc-border);
    background: #fafafa;
}

.bbc-search-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--bbc-border);
    border-radius: 20px;
    padding: 0.28rem 1.6rem 0.28rem 0.7rem;
    font-size: 0.78rem;
    line-height: 1.3;
    outline: none;
    background: #fff;
    transition: border-color 0.15s;
}

.bbc-search-input:focus {
    border-color: var(--bbc-accent);
}

.bbc-slot-search .bbc-search-clear {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 0.65rem;
    color: #bbb;
    padding: 0 0.15rem;
    line-height: 1;
    user-select: none;
}

.bbc-slot-search .bbc-search-clear:hover {
    color: #555;
}

.bbc-search-hidden {
    display: none !important;
}

.bbc-search-no-results {
    font-size: 0.82rem;
    color: #999;
    text-align: center;
    padding: 0.5rem 0;
    margin: 0;
}

/* ── Scrollable product list ─────────────────────────────── */

.bbc-products {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.bbc-products::-webkit-scrollbar          { width: 4px; }
.bbc-products::-webkit-scrollbar-track    { background: #f0f0f0; }
.bbc-products::-webkit-scrollbar-thumb    { background: #ccc; border-radius: 2px; }

/* ── Product card ────────────────────────────────────────── */

.bbc-product {
    display: block;
    cursor: pointer;
    margin: 0;
    line-height: 1;
}

/* Visually hide native radio while keeping it accessible */
.bbc-product input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.bbc-product-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border: 1.5px solid var(--bbc-border);
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
}

.bbc-product:hover .bbc-product-inner {
    border-color: #aaa;
    background: #fafafa;
}

/* CSS-only selected state via adjacent sibling */
.bbc-product input[type="radio"]:checked + .bbc-product-inner {
    border-color: var(--bbc-accent);
    background: var(--bbc-accent-light);
}

/* Focus ring for keyboard users */
.bbc-product input[type="radio"]:focus-visible + .bbc-product-inner {
    outline: 2px solid var(--bbc-accent);
    outline-offset: 1px;
}

.bbc-product-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

.bbc-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bbc-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bbc-product-name {
    display: block;
    font-size: 0.865rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bbc-product-variation {
    font-size: 0.78rem;
    color: #777;
    display: block;
}

.bbc-product-price {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.bbc-product-price ins {
    text-decoration: none;
}

.bbc-product-checkmark {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--bbc-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    flex-shrink: 0;
    color: transparent;
    background: transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bbc-product input[type="radio"]:checked + .bbc-product-inner .bbc-product-checkmark {
    background: var(--bbc-accent);
    border-color: var(--bbc-accent);
    color: #fff;
}

/* ── Empty slot ──────────────────────────────────────────── */

.bbc-empty {
    padding: 1.5rem;
    text-align: center;
    color: #aaa;
    font-style: italic;
    font-size: 0.9rem;
    margin: 0;
}

/* ── Footer / summary ────────────────────────────────────── */

.bbc-footer {
    text-align: center;
    background: #f9f9f9;
    border: 1px solid var(--bbc-border);
    border-radius: var(--bbc-radius);
    padding: 1.5rem;
}

.bbc-selection-summary {
    margin-bottom: 1.25rem;
}

/* ── Summary product cards ───────────────────────────────── */

.bbc-summary-products {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.bbc-summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    flex: 1;
    max-width: 130px;
}

.bbc-summary-card-img {
    width: 68px;
    height: 68px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--bbc-border);
    background: #f5f5f5;
    transition: border-color 0.2s;
}

.bbc-summary-card:not(.bbc-summary-card--empty) .bbc-summary-card-img {
    border-color: var(--bbc-accent);
}

.bbc-summary-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bbc-summary-card-name {
    font-size: 0.75rem;
    text-align: center;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Pricing row ─────────────────────────────────────────── */

.bbc-summary-pricing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.bbc-summary-original {
    color: #aaa;
    font-size: 0.9rem;
    text-decoration: line-through;
}

.bbc-savings-notice {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bbc-accent-light);
    color: var(--bbc-accent);
    border-radius: 20px;
    padding: 0.25rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.bbc-summary-final {
    font-size: 1.05rem;
    color: #1a1a1a;
}

.bbc-summary-final strong {
    font-size: 1.2rem;
}

.birdie-bundle-creator .bbc-footer .bbc-submit.button {
    display: block;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 1.1rem 2rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    border: none !important;
    border-radius: 50px !important;
    background: linear-gradient(135deg, #2e7d32 0%, #43a047 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 18px rgba(46, 125, 50, 0.35) !important;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: none;
    line-height: normal;
}

.birdie-bundle-creator .bbc-footer .bbc-submit.button:not(:disabled) {
    animation: bbc-btn-pulse 2.4s ease-in-out infinite;
}

@keyframes bbc-btn-pulse {
    0%, 100% { box-shadow: 0 4px 18px rgba(46,125,50,0.35) !important; }
    50%       { box-shadow: 0 6px 28px rgba(46,125,50,0.6) !important; }
}

.birdie-bundle-creator .bbc-footer .bbc-submit.button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(46,125,50,0.5) !important;
    color: #fff !important;
    background: linear-gradient(135deg, #2e7d32 0%, #43a047 100%) !important;
    animation: none;
}

.birdie-bundle-creator .bbc-footer .bbc-submit.button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
    animation: none;
}

.bbc-message {
    margin-top: 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 1.3rem;
    line-height: 1.5;
}

.bbc-message a {
    color: inherit;
    text-decoration: underline;
}

.bbc-message.is-success { color: var(--bbc-accent); }
.bbc-message.is-error   { color: #c62828; }

/* ── Cart badge (next to product name in cart/checkout) ──── */

.bbc-cart-badge {
    display: inline-block;
    background: var(--bbc-accent-light);
    color: var(--bbc-accent);
    border: 1px solid #c8e6c9;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Success Modal ───────────────────────────────────────── */

.bbc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: bbc-fade-in 0.25s ease;
}

.bbc-modal-overlay.is-closing {
    animation: bbc-fade-out 0.25s ease forwards;
}

@keyframes bbc-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes bbc-fade-out { from { opacity: 1; } to { opacity: 0; } }

.bbc-modal {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem 2rem 2rem;
    max-width: 460px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: bbc-slide-up 0.3s ease;
}

@keyframes bbc-slide-up {
    from { transform: translateY(28px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.bbc-modal-icon {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 0.75rem;
    animation: bbc-bounce 0.6s ease 0.2s both;
}

@keyframes bbc-bounce {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.bbc-modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
    color: #1a1a1a;
}

.bbc-modal-msg {
    color: #555;
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

.bbc-modal-savings {
    display: inline-block;
    background: var(--bbc-accent-light);
    color: var(--bbc-accent);
    border-radius: 20px;
    padding: 0.35rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.bbc-modal-products {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.bbc-modal-product {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
}

.bbc-modal-product-label {
    display: block;
    color: #888;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.bbc-modal-product-body {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.bbc-modal-product-img {
    width: 44px;
    height: 44px;
    border-radius: 7px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--bbc-border);
}

.bbc-modal-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bbc-modal-product-name {
    font-weight: 600;
    color: #222;
    flex: 1;
    line-height: 1.3;
}

.bbc-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.bbc-modal-overlay .bbc-modal .bbc-modal-btn {
    display: block;
    width: 100%;
    padding: 0.85rem 1.5rem;
    border-radius: 50px !important;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    transition: transform 0.15s, box-shadow 0.15s;
    border: none !important;
    text-transform: none;
    line-height: normal;
    box-sizing: border-box;
}

.bbc-modal-overlay .bbc-modal .bbc-modal-btn--primary {
    background: linear-gradient(135deg, #2e7d32, #43a047) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(46,125,50,0.35) !important;
}

.bbc-modal-overlay .bbc-modal .bbc-modal-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(46,125,50,0.5) !important;
    color: #fff !important;
    background: linear-gradient(135deg, #2e7d32, #43a047) !important;
}

.bbc-modal-overlay .bbc-modal .bbc-modal-btn--secondary {
    background: transparent !important;
    color: #666 !important;
    border: 1.5px solid #ddd !important;
    font-size: 0.9rem;
}

.bbc-modal-overlay .bbc-modal .bbc-modal-btn--secondary:hover {
    border-color: #aaa !important;
    color: #333 !important;
    background: transparent !important;
}

/* ── Confetti ─────────────────────────────────────────────── */

.bbc-confetti-piece {
    position: fixed;
    top: -40px;
    pointer-events: none;
    user-select: none;
    z-index: 1000000;
    animation: bbc-confetti-fall linear forwards;
    will-change: transform;
}

@keyframes bbc-confetti-fall {
    0%   { transform: translateY(0)    rotate(0deg);   opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}

/* ── Mobile sticky bar ────────────────────────────────────── */

.bbc-sticky-bar {
    display: none;
}

@media (max-width: 768px) {
    /* Hide theme toolbar when bundle widget is on the page */
    body.has-bbc-widget .wd-toolbar,
    body.has-bbc-widget .wd-toolbar-label-show {
        display: none !important;
    }

    .bbc-sticky-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background: #fff;
        border-top: 1px solid #e0e0e0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
        align-items: center;
        gap: 0;
        height: 72px;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .bbc-sticky-bar.is-visible {
        transform: translateY(0);
    }

    .bbc-sticky-track {
        flex: 1;
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0 0.75rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .bbc-sticky-track::-webkit-scrollbar { display: none; }

    .bbc-sticky-slot {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        flex-shrink: 0;
        scroll-snap-align: start;
        min-width: 56px;
    }

    .bbc-sticky-img {
        width: 44px;
        height: 44px;
        border-radius: 8px;
        overflow: hidden;
        border: 2px solid var(--bbc-border);
        background: #f5f5f5;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .bbc-sticky-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .bbc-sticky-img.is-empty::after {
        content: '?';
        font-size: 1.1rem;
        color: #ccc;
    }

    .bbc-sticky-img.is-selected {
        border-color: var(--bbc-accent);
    }

    .bbc-sticky-slot-label {
        font-size: 0.6rem;
        color: #999;
        text-align: center;
        line-height: 1;
        max-width: 56px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bbc-sticky-divider {
        color: #ddd;
        font-size: 1.2rem;
        flex-shrink: 0;
        align-self: flex-start;
        padding-top: 12px;
    }

    .bbc-sticky-cta {
        flex-shrink: 0;
        padding: 0 0.75rem 0 0.5rem;
    }

    .bbc-sticky-bar .bbc-sticky-cta .bbc-sticky-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #2e7d32, #43a047) !important;
        color: #fff !important;
        border: none !important;
        border-radius: 50px !important;
        padding: 0.65rem 1.15rem !important;
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        cursor: pointer;
        white-space: nowrap;
        box-shadow: 0 3px 12px rgba(46,125,50,0.4) !important;
        transition: opacity 0.2s, transform 0.2s;
        min-width: 100px;
        text-transform: none;
        line-height: normal;
        animation: bbc-btn-pulse 2.4s ease-in-out infinite;
    }

    .bbc-sticky-bar .bbc-sticky-cta .bbc-sticky-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
        animation: none;
    }

    /* Add bottom padding to page so content isn't hidden behind sticky bar */
    body.has-bbc-widget {
        padding-bottom: 72px !important;
    }
}
