.cbb-product__component {
    margin-bottom: 2rem
}

.cbb-product__component-header {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cbb-product__count {
    background: #eee;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-family: 'Amatic SC';
}

.product-type-cbb_bundle .summary__details .summary__container {
    display: block;
}

.cbb-product__qty-value {
    width: 1.4rem;
}

.cbb-product__count--valid {
    background: #cdeccd
}

.cbb-product__grid,
.cbb-product__grid.products {
    /*display: grid;
    grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px
    */
    display: flex;
    /* Switches from grid to a single row */
    overflow-x: auto;
    /* Enables horizontal scrolling */
    gap: 1rem;
    /* Space between products */
    padding: 0 1rem;

    /* Smooth scrolling and snap-to-position (Optional but recommended) */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    justify-content: flex-start;
    margin: 0 -1rem;
    scroll-padding-left: 1rem;

    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Only enable snapping on touch devices */
@media (pointer: coarse) {

    .cbb-product__grid,
    .cbb-product__grid.products {
        scroll-snap-type: x proximity;
    }
}

.cbb-product__grid::-webkit-scrollbar {
    display: none;
}

.cbb-product__grid {
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}

.cbb-product__grid img {
    -webkit-user-drag: none;
    pointer-events: none;
}

.cbb-product__grid--dragging {
    cursor: grabbing;
    scroll-snap-type: none !important;
}

.cbb-product__grid--dragging .cbb-product__item {
    pointer-events: none;
}

.cbb-product__item {
    display: flex;
    flex-direction: column;
    flex: 0 0 calc(40% - 0.25rem);
    scroll-snap-align: start;
    /* scroll-margin-left: 1rem; */
}

.cbb-product__item-title {
    font-weight: normal;
    margin-bottom: 6px
}

@media (min-width: 768px) {
    .cbb-product__item {
        flex: 0 0 calc(28.5% - 0.75rem);
    }
}

@media (min-width: 1280px) {

    .cbb-product__grid,
    .cbb-product__grid.products {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
        overflow-x: visible;
        scroll-snap-type: none;
        margin: 0;
        padding: 0;
        scrollbar-width: auto;
    }

    .cbb-product__grid::-webkit-scrollbar {
        display: block;
    }

    .cbb-product__grid {
        cursor: default;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    .cbb-product__grid--collapsed {
        max-height: 480px;
        /* Initial estimate, will be overridden by JS */
    }

    .cbb-product__item {
        flex: 0 0 calc((100% - (5 * 1.5rem)) / 6);
    }
}

.cbb-product__grid-toggle-wrap {
    display: none;
    justify-content: center;
    margin-top: 1rem;
}

@media (min-width: 1280px) {
    .cbb-product__grid-toggle-wrap {
        display: flex;
    }
}

.cbb-product__grid-toggle {
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    font-size: 0.9em;
    padding: 0.5rem 1rem;
    text-decoration: underline;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cbb-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.cbb-product__grid-toggle:hover {
    color: #333;
}

@media (min-width: 1600px) {
    .cbb-product__item {
        flex: 0 0 calc((100% - (7 * 1.5rem)) / 8);
    }
}

.cbb-product__grid .cbb-product__item .price {
    /* Keeping .price generic as it might be woo specific, but namespacing parent */
    flex-grow: 1;
}

.cbb-product__item[data-requires-variation="1"] .price {
    flex-grow: 0;
}

.cbb-product__variation-wrapper {
    flex-grow: 1;
}


.cbb-product__item-controls {
    display: flex;
    gap: 6px;
    align-items: center
}

.cbb-product__child-indicator {
    /* Renamed from .cbb-child */
    display: inline-block;
    margin-left: 2em;
    opacity: .9;
    font-size: 90%;
}



span.cbb-product__count {
    font-size: 2rem;
}


.cbb-product__component h4 {
    font-size: calc(1rem * var(--heading-ratio) * var(--heading-ratio));
}

.cbb-product__explanation {
    color: #777;
}

.cbb-product__variation-stock {
    font-size: 0.9em;
    margin-top: 4px;
}


/** Bilka style add **/

/* only for sticky elements */
/*
body,
html {
    overflow-x: initial !important;
}
*/

.cbb-product__add-variation-btn--hidden {
    display: none !important;
}

/* Footer: default state (hidden off-screen) */
.cbb-product__footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    margin: 0;
    border-radius: 4px 4px 0 0;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.5s ease;
    will-change: transform;
}

/* Footer: visible fixed at bottom of viewport */
.cbb-product__footer--fixed {
    transform: translateY(0);
}

/* Footer: docked in its natural document position */
.cbb-product__footer--docked {
    position: relative;
    transform: none;
    background: transparent;
    border-radius: 0;
}

/* Placeholder keeps space when footer is fixed */
.cbb-product__footer-placeholder {
    display: none;
}

.cbb-product__footer-placeholder--active {
    display: block;
}

.cbb-product__footer-toggle-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.cbb-product__footer-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
}

#cbb-add-to-cart {
    margin: 0;
}

.cbb-product__footer-main>.cbb-btn-tooltip-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}


.cbb-product__item-controls {
    margin-top: 5px;
    justify-content: center;
}

.cbb-product__qty-controls {
    display: none;
    align-items: center;
    gap: 5px;
}

.cbb-product__qty-controls button {
    /*padding: 2px 6px;*/
}

button.cbb-product__add-btn {
    /* Styles can go here */
}

.cbb-product .stock {
    /* .cbb-product block root? No, waiting for PHP update to wrap it in .cbb-product if it wasn't already. Previously .cbb-bundle .stock */
    font-size: .8rem;
    color: #555;
}

.cbb-product__selected-variations {
    margin-top: .5rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.cbb-product__selected-variation-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .5rem;
    border: 1px solid #eee;
    border-radius: 8px;
}

.cbb-product__selected-variation-label {
    font-size: .9rem;
    text-align: center;
}

.cbb-product__selected-variation-controls {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* =========================================
 * Footer Overview Panel
 * -----------------------------------------
 * Handles the collapsible "Show Selection" panel
 * in the sticky footer.
 * ========================================= */

.cbb-product__overview-panel {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    max-height: 50vh;
    overflow-y: auto;
    z-index: 999;
}

.cbb-product__overview-panel[hidden] {
    display: none;
}

.cbb-product__overview-content {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Toggle Button & Layout */
.cbb-product__summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}


.cbb-product__overview-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.9em;
    padding: 0;
    text-decoration: underline;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =========================================
 * Overview Components
 * -----------------------------------------
 * Individual component lists in the panel.
 * ========================================= */

.cbb-overview__component-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cbb-overview__list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9em;
    color: #555;
}

.cbb-overview__list li {
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
}

/* =========================================
 * Status Indicators
 * -----------------------------------------
 * Visual feedback for component requirements.
 * ========================================= */

.cbb-overview__status-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ccc;
    /* Default / Empty */
    flex-shrink: 0;
}

.cbb-overview__status-icon--valid {
    background: #4caf50;
    /* Green */
}

.cbb-overview__status-icon--invalid {
    background: #ff9800;
    /* Orange/Warning */
}

/* =========================================
 * Detailed Overview Items
 * -----------------------------------------
 * Styles for thumbnails and meta info
 * ========================================= */

.cbb-overview__list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0;
    border-bottom: 1px dashed #f0f0f0;
}

.cbb-overview__list li:last-child {
    border-bottom: none;
}

.cbb-overview__thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    background: #f9f9f9;
}

.cbb-overview__details {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.cbb-overview__prod-title {
    font-weight: normal;
}

.cbb-overview__meta {
    font-size: 0.85em;
    color: #888;
}

.cbb-overview__qty {
    font-weight: 600;
    color: #555;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Tooltip wrapper */
.cbb-btn-tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Ensure disabled buttons don't block clicks on the wrapper */
.cbb-btn-tooltip-wrap button:disabled {
    pointer-events: none;
}

/* Tooltip bubble */
.cbb-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    max-width: 200px;
    min-width: 160px;
    text-align: center;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;

    /* Dynamic offset logic */
    margin-left: var(--cbb-tooltip-offset, 0px);
}

/* Triangle for tooltip */
.cbb-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;

    /* Counter-shift arrow to stay pointing at button */
    transform: translateX(calc(-1 * var(--cbb-tooltip-offset, 0px)));
}


/* =========================================
 * Start Configuration
 * ========================================= */

.cbb-product__start-configuration {
    margin-bottom: 2rem;
}