/* === Variables === */
:root {
    --bb-accent: var(--primary-color, #202f5a);
    --bb-accent-hover: var(--primary-color-hover, #162241);
    --bb-text: var(--color-text, #202532);
    --bb-text-light: var(--color-text-light, #667085);
    --bb-font: var(--font-family, inherit);
    --bb-radius: var(--border-radius, 12px);
    --bb-success: #157347;
    --bb-border: #eadfcd;
    --bb-bg-warm: linear-gradient(180deg, #fffdf8 0%, #f8f3ea 100%);
    --bb-card-bg: rgba(255, 255, 255, 0.76);
}

/* === Animations === */
@keyframes bb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bb-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes bb-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes bb-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes bb-spinner-spin { to { transform: rotate(360deg); } }
@keyframes bb-success-flash { 0% { box-shadow: 0 0 0 0 rgba(21,115,71,0.4); } 100% { box-shadow: 0 0 0 12px rgba(21,115,71,0); } }

/* === Container === */
.bb-bundles-container {
    margin: 24px 0 24px;
    padding: 20px;
    border: 1px solid var(--bb-border);
    border-radius: 16px;
    background: var(--bb-bg-warm);
    box-shadow: 0 12px 32px rgba(32, 37, 50, 0.08);
    font-family: var(--bb-font);
    animation: bb-fade-in 400ms ease-out both;
}

/* === Header === */
.bb-bundles-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.bb-bundles-kicker { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #966d34; }
.bb-bundles-title { margin: 4px 0 0; font-size: 26px; line-height: 1.1; color: var(--bb-text); }
.bb-bundles-subtitle { margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--bb-text-light); }
.bb-bundles-badge {
    align-self: flex-start; padding: 8px 12px; border-radius: 999px;
    background: var(--bb-accent); color: #fff; font-weight: 700; white-space: nowrap;
}

/* === Products layout === */
.bb-bundles-products { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,2.2fr); gap: 12px; align-items: center; }
.bb-bundles-plus {
    width: 32px; height: 32px; border-radius: 999px; display: inline-flex;
    align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
    color: #966d34; background: rgba(150,109,52,0.12); flex-shrink: 0;
    align-self: center;
}

/* === Product cards === */
.bb-bundle-card {
    display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 14px;
    padding: 14px; background: var(--bb-card-bg); border: 1px solid var(--bb-border);
    border-radius: 14px; transition: transform 200ms, box-shadow 200ms; position: relative;
    box-sizing: border-box;
}
/* Fixed card height — all cards (primary + candidates) equal size */
.bb-bundles-products .bb-bundle-card {
    height: 155px;
    align-content: center;
    overflow: hidden;
}
.bb-bundles-products .bb-bundle-info { overflow: hidden; }
.bb-bundle-card--candidate:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(32,37,50,0.12); }
.bb-bundle-card--candidate .bb-bundle-image,
.bb-bundle-card--candidate .bb-bundle-name { cursor: pointer; }
.bb-bundle-card--candidate .bb-bundle-name:hover { text-decoration: underline; }
.bb-bundle-image {
    width: 92px; height: 92px; display: flex; align-items: center; justify-content: center;
    background: #fff; border-radius: 12px; overflow: hidden;
}
.bb-bundle-image img { width: 100%; height: 100%; object-fit: contain; }
.bb-bundle-label { margin-bottom: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--bb-text-light); }
.bb-bundle-name {
    font-size: 15px; line-height: 1.35; color: var(--bb-text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bb-bundle-price { margin-top: 8px; font-size: 17px; font-weight: 700; color: var(--bb-text); }
.bb-bundle-price del { color: #98a2b3; font-weight: 400; font-size: 14px; margin-right: 6px; }
.bb-bundle-price ins { text-decoration: none; color: var(--bb-success); }

/* Staggered fade-in for candidate slides */
.bb-candidate-slide { animation: bb-fade-in 400ms ease-out both; }
.bb-candidate-slide:nth-child(1) { animation-delay: 100ms; }
.bb-candidate-slide:nth-child(2) { animation-delay: 200ms; }
.bb-candidate-slide:nth-child(3) { animation-delay: 300ms; }
.bb-candidate-slide:nth-child(4) { animation-delay: 400ms; }
.bb-candidate-slide:nth-child(5) { animation-delay: 500ms; }

/* === Checkbox === */
.bb-candidate-check {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; cursor: pointer;
}
.bb-candidate-cb { position: absolute; opacity: 0; width: 0; height: 0; }
.bb-candidate-checkmark {
    width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--bb-border);
    background: #fff; display: flex; align-items: center; justify-content: center;
    transition: background 200ms, border-color 200ms;
}
.bb-candidate-cb:checked + .bb-candidate-checkmark {
    background: var(--bb-accent); border-color: var(--bb-accent);
}
.bb-candidate-cb:checked + .bb-candidate-checkmark::after {
    content: ''; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
/* Card opacity on uncheck handled by JS (DOM structure prevents pure-CSS sibling selector) */

/* === Splide pagination dots (mobile only) === */
.bb-candidates-wrap.splide .splide__pagination {
    display: flex !important; justify-content: center; align-items: center;
    gap: 6px; padding: 10px 0 2px; list-style: none !important; margin: 0;
    position: static !important; bottom: auto !important;
}
.bb-candidates-wrap.splide .splide__pagination li {
    list-style: none; margin: 0; padding: 0; line-height: 0;
}
.bb-candidates-wrap.splide .splide__pagination__page {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: block !important;
    width: 8px !important; height: 8px !important;
    min-width: 0 !important; min-height: 0 !important;
    max-width: 8px !important; max-height: 8px !important;
    border-radius: 50% !important;
    background: var(--bb-border) !important; border: 0 !important;
    box-shadow: none !important; outline: 0 !important;
    cursor: pointer; transition: background 200ms, transform 200ms;
    padding: 0 !important; margin: 0 !important;
    opacity: 1 !important; transform: none !important;
    overflow: hidden !important; flex-shrink: 0 !important;
    line-height: 1 !important; font-size: 0 !important;
}
.bb-candidates-wrap.splide .splide__pagination__page.is-active {
    background: var(--bb-accent) !important; transform: scale(1.3) !important;
}

/* === Carousel / Grid === */
.bb-candidates-wrap { min-width: 0; position: relative; padding: 0 6px; }
.bb-candidates-wrap.splide .splide__track { overflow: hidden; }
.bb-candidates-grid .bb-candidates-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.bb-candidates-grid .bb-candidate-slide { min-height: 120px; }

/* Splide arrows — core CSS has no arrow styles, so we define everything */
.bb-candidates-wrap.splide .splide__arrows {
    position: absolute; top: 50%; left: 0; right: 0;
    transform: translateY(-50%); pointer-events: none; z-index: 5;
}
.bb-candidates-wrap.splide .splide__arrow {
    position: absolute; top: 0;
    width: 36px; height: 36px; border-radius: 999px;
    background: #fff; border: 1px solid var(--bb-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer; pointer-events: all;
    display: flex; align-items: center; justify-content: center;
    opacity: 1; transition: background 200ms, box-shadow 200ms, transform 200ms;
    transform: translateY(-50%); padding: 0;
}
.bb-candidates-wrap.splide .splide__arrow--prev { left: -12px; transform: translateY(-50%) scaleX(-1); }
.bb-candidates-wrap.splide .splide__arrow--next { right: -12px; }
.bb-candidates-wrap.splide .splide__arrow:hover {
    background: var(--bb-accent); box-shadow: 0 4px 12px rgba(32,37,50,0.2); transform: translateY(-50%) scale(1.08);
}
.bb-candidates-wrap.splide .splide__arrow:disabled { opacity: 0.3; cursor: default; transform: translateY(-50%); }
.bb-candidates-wrap.splide .splide__arrow svg { fill: var(--bb-text); width: 14px; height: 14px; }
.bb-candidates-wrap.splide .splide__arrow:hover svg { fill: #fff; }

/* === Quick View trigger === */
.bb-qv-trigger {
    display: inline-block; margin-top: 6px; font-size: 13px;
    color: var(--bb-accent); text-decoration: underline; cursor: pointer;
    transition: color 200ms;
}
.bb-qv-trigger:hover { color: var(--bb-accent-hover); }

/* === Footer === */
.bb-bundles-footer {
    display: flex; justify-content: space-between; gap: 20px; align-items: flex-end;
    margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--bb-border);
}
.bb-bundles-total-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--bb-text-light); }
.bb-bundles-total-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.bb-bundles-old-price { color: #98a2b3; transition: opacity 200ms; }
.bb-bundles-total-price { font-size: 30px; color: var(--bb-text); transition: opacity 200ms; }
.bb-bundles-savings { margin-top: 6px; color: var(--bb-success); font-weight: 700; transition: transform 200ms; }
.bb-bundles-savings.bb-pulse { animation: bb-pulse 300ms ease; }

/* === Button === */
.bb-bundle-add-btn {
    min-width: 220px; min-height: 48px; border: 0; border-radius: var(--bb-radius); padding: 0 24px;
    background: linear-gradient(135deg, var(--bb-accent) 0%, var(--bb-accent-hover) 100%);
    color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
    font-family: var(--bb-font); transition: transform 150ms, box-shadow 200ms, background 200ms;
}
.bb-bundle-add-btn:hover { background: linear-gradient(135deg, var(--bb-accent-hover) 0%, var(--bb-accent) 100%); }
.bb-bundle-add-btn:active { transform: scale(0.97); }
.bb-bundle-add-btn:disabled { opacity: 0.7; cursor: wait; }
.bb-bundle-add-btn.bb-loading .bb-spinner { display: inline-block; }
.bb-bundle-add-btn.bb-success { animation: bb-success-flash 600ms ease; }
.bb-spinner {
    display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%; animation: bb-spinner-spin 600ms linear infinite;
    vertical-align: middle;
}
.bb-bundle-feedback { min-height: 20px; margin-top: 8px; font-size: 13px; }
.bb-bundle-feedback.is-error { color: #b42318; }

/* === Skeleton === */
.bb-bundle-skeleton {
    padding: 20px; border: 1px solid var(--bb-border); border-radius: 16px;
    background: var(--bb-bg-warm);
}
.bb-skel-loading-text {
    font-size: 13px; color: var(--bb-accent); font-weight: 600;
    margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.bb-skel-loading-text::before {
    content: ""; width: 14px; height: 14px; flex: 0 0 auto; border-radius: 50%;
    border: 2px solid var(--bb-border); border-top-color: var(--bb-accent);
    animation: bb-spinner-spin 600ms linear infinite;
}
.bb-skel-line {
    height: 14px; border-radius: 6px; margin-bottom: 10px;
    background: linear-gradient(90deg, #eadfcd 25%, #f5efe5 50%, #eadfcd 75%);
    background-size: 200% 100%; animation: bb-shimmer 1.5s ease infinite;
}
.bb-skel-line--title { width: 40%; height: 20px; }
.bb-skel-line--subtitle { width: 65%; }
.bb-skel-card {
    display: grid; grid-template-columns: 80px 1fr; gap: 12px;
    padding: 14px; background: var(--bb-card-bg); border: 1px solid var(--bb-border);
    border-radius: 14px; margin-bottom: 12px;
}
.bb-skel-img {
    width: 80px; height: 80px; border-radius: 10px;
    background: linear-gradient(90deg, #eadfcd 25%, #f5efe5 50%, #eadfcd 75%);
    background-size: 200% 100%; animation: bb-shimmer 1.5s ease infinite;
}
.bb-skel-text { display: flex; flex-direction: column; gap: 8px; }
.bb-skel-text .bb-skel-line:nth-child(1) { width: 30%; }
.bb-skel-text .bb-skel-line:nth-child(2) { width: 80%; }
.bb-skel-text .bb-skel-line:nth-child(3) { width: 50%; }

/* === Quick View modal === */
.bb-qv-overlay {
    position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    animation: bb-fade-in 200ms ease;
}
.bb-qv-modal {
    position: relative; background: #fff; border-radius: 16px; max-width: 520px; width: 90%;
    max-height: 85vh; overflow-y: auto; padding: 24px;
    transform: scale(1); animation: bb-qv-appear 250ms ease;
}
@keyframes bb-qv-appear { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.bb-qv-close {
    position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
    border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--bb-text-light);
    border-radius: 999px; transition: background 200ms;
}
.bb-qv-close:hover { background: rgba(0,0,0,0.05); }
.bb-qv-product { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bb-qv-image { border-radius: 12px; overflow: hidden; }
.bb-qv-image img { width: 100%; height: auto; object-fit: contain; }
.bb-qv-title { font-size: 20px; color: var(--bb-text); margin: 0 0 8px; }
.bb-qv-title a { color: inherit; text-decoration: none; }
.bb-qv-title a:hover { text-decoration: underline; }
.bb-qv-price { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.bb-qv-price del { color: #98a2b3; font-weight: 400; margin-right: 8px; }
.bb-qv-price ins { text-decoration: none; color: var(--bb-success); }
.bb-qv-desc { font-size: 14px; color: var(--bb-text-light); line-height: 1.5; margin-bottom: 16px; }
.bb-qv-toggle-btn {
    width: 100%; padding: 12px 16px; border: 2px solid var(--bb-accent); border-radius: var(--bb-radius);
    background: var(--bb-accent); color: #fff; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: background 200ms, color 200ms; white-space: nowrap;
}
.bb-qv-toggle-btn.bb-in-bundle { background: #fff; color: var(--bb-accent); }
.bb-qv-full-link {
    display: block; margin-top: 12px; text-align: center;
    font-size: 13px; color: var(--bb-text-light); text-decoration: underline;
    transition: color 200ms;
}
.bb-qv-full-link:hover { color: var(--bb-accent); }


/* === Placeholder (variable product initial state) === */
.bb-bundle-root { margin-top: 16px; }
.bb-bundle-placeholder-text {
    padding: 18px; border-radius: 12px; background: #f8f3ea;
    color: var(--bb-text-light); text-align: center;
}

/* === Responsive: tablet === */
@media (max-width: 768px) {
    .bb-bundles-head { flex-direction: column; align-items: stretch; }
    .bb-bundles-badge { align-self: flex-start; }
    .bb-bundles-products { grid-template-columns: 1fr; }
    .bb-bundles-plus { margin: 0 auto; }
    .bb-bundles-footer { flex-direction: column; align-items: stretch; }
    .bb-bundle-add-btn { width: 100%; min-width: 0; }
    .bb-qv-product { grid-template-columns: 1fr; }
    .bb-qv-image { max-height: 250px; }

    /* Hide arrows on tablet — Splide handles via breakpoint */
    .bb-candidates-wrap.splide .splide__arrows { display: none; }
}

/* === Responsive: mobile === */
@media (max-width: 480px) {
    .bb-bundles-container { padding: 16px; }
    .bb-bundles-title { font-size: 22px; }
    .bb-bundle-card { grid-template-columns: 72px minmax(0,1fr); gap: 10px; padding: 10px; }
    .bb-bundle-image { width: 72px; height: 72px; }
    .bb-bundles-total-price { font-size: 24px; }

    /* Modal as bottom sheet */
    .bb-qv-overlay { align-items: flex-end; }
    .bb-qv-modal {
        width: 100%; max-width: none; border-radius: 16px 16px 0 0;
        max-height: 85vh; animation: bb-slide-up 250ms ease;
    }
    .bb-qv-modal::before {
        content: ''; display: block; width: 40px; height: 4px;
        background: #d0d5dd; border-radius: 2px; margin: 0 auto 16px;
    }

}

/* === Bundle cart item prices === */
.bb-cart-old-price { color: #98a2b3; font-weight: 400; margin-right: 4px; }
.bb-cart-new-price { text-decoration: none; color: #157347; font-weight: 700; }

