/* Interdigitale AddVisualSet — shared bundle presentation */
/* Blocca lo scroll generale solo nel pannello laterale */
html:has(body.avs-drawer-open),
body.avs-drawer-open {
    overflow: hidden !important;
}
.avs-overlay:not([hidden]){position:fixed;inset:0;background:rgba(0,0,0,.52);z-index:9997;opacity:1;transition:opacity .24s ease}
.avs-overlay.avs-overlay-closing{opacity:0;pointer-events:none}
.avs-panel:not([hidden]){display:flex;flex-direction:column;position:fixed;top:0;right:0;bottom:0;min-width:537px;max-width:537px;overflow-y:auto;overscroll-behavior:contain;background:#fff;z-index:9998;padding:20px;box-shadow:-8px 0 36px rgba(0,0,0,.14);animation:avs-slide-in .24s ease-out;will-change:transform}
.avs-panel.avs-closing:not([hidden]){animation:avs-slide-out .24s ease-in both;pointer-events:none}
.avs-panel .avs-grid{display:grid;grid-template-columns:repeat(3,minmax(0,150px));align-content:start;gap:20px}.avs-panel .avs-selections{display:none}
.avs-panel .avs-close{display:inline-flex;align-items:center;justify-content:center;height:40px;flex:none;color:#6b7280;background:transparent;cursor:pointer}
.avs-panel .avs-close:hover{color:#000}
body.avs-drawer-open{overflow:hidden}@keyframes avs-slide-in{from{transform:translateX(100%)}to{transform:translateX(0)}}
@keyframes avs-slide-out{from{transform:translateX(0)}to{transform:translateX(100%)}}
@media(max-width:640px){.avs-panel:not([hidden]){padding:16px;width:100%}}
@media(prefers-reduced-motion:reduce){.avs-panel:not([hidden]){animation:none}.avs-overlay:not([hidden]){transition:none}}

.avs-tile{position:relative}.avs-option{padding:0;min-width:150px;min-height:150px;overflow:hidden}
.avs-option .badge-text{z-index:2;line-height:1.25;gap:4px;padding:5px 8px;}.avs-tile .avs-reset{position:absolute;right:0;top:-2px;z-index:4;border-radius:50%;padding:0 7px;font-size:26px}
.avs-panel .avs-product-card {
    position: relative;
    text-align: center;
    cursor: pointer;
    max-width: 150px;
    min-height: fit-content;
    border: 2px solid #ccc;
    will-change: transform;
    transition: transform 0.2s ease, border-color 0.2s ease;
    overflow-wrap:anywhere
}
.avs-panel .avs-product-card img{max-width:100%;height:auto;object-fit:contain}
.avs-panel .avs-product-card:hover{border-color:#a65d68;box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1)}
.avs-panel .avs-product-card.is-selected{border-color:#525252}
.avs-panel .avs-product-card:disabled{opacity:.45;cursor:not-allowed}
.avs-panel .avs-qty{position:relative;z-index:2}

.avs-panel .avs-loading:not([hidden]){display:flex;align-items:center;justify-content:center;padding:28px 0;min-height:96px}
.avs-panel .avs-spinner{display:inline-block;flex:none;box-sizing:border-box;width:30px;height:30px;border:3px solid #e5e7eb;border-top-color:#d94689;border-radius:50%;animation:avs-spinner-spin .65s linear infinite}
.avs-panel .avs-counter:not([hidden]){display:flex;justify-content:center;align-items:center;padding:12px 0}
@keyframes avs-spinner-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.avs-panel .avs-spinner{animation-duration:2s}}


/* Stock conflict feedback is a viewport toast, never part of the product flex grid. */
.avs-stock-toast {position:fixed;top:20px;left:50%;transform:translateX(-50%);z-index:2147483000;
 width:min(520px,calc(100vw - 32px));padding:14px 42px 14px 18px;
 border:1px solid #d97706;border-left:5px solid #b45309;border-radius:8px;
 background:#fffaf0;color:#713f12;box-shadow:0 12px 35px rgba(0,0,0,.24);
 font-size:15px;line-height:1.5;pointer-events:none;}
.avs-stock-toast[hidden]{display:none!important;}

/* The bundle summary is replaced by the Estensa option-price presentation. */
div#bundleSummary{display:none}

#product-options-wrapper { margin-top: 35px; }

/* Original bundle price: isolated from Magento's generic .old-price visibility rules. */
.price-final_price_first .avs-bundle-old-price:not([hidden]) {
    display: inline-flex;
    align-items: baseline;
}

.price-final_price_first .avs-bundle-old-price:not([hidden]) .price-wrapper .price {
    font-size: 1.3rem;
}

.price-final_price_first .avs-bundle-old-price[hidden] {
    display: none !important;
}

/* Shared Estensa theme tokens for both bundle and custom visual option elements. */

.avs-native .badge-text, .avs-native .message-price,
.message-price, .label-box .save-percent,
.avs-visual-panel .save-percent, .field.visual .save-percent {
    background-color: var(--bg-color-main) !important;
    color: var(--text-color-main) !important;
}

/* Small screens: the drawer occupies the viewport and displays two products per row. */
@media (max-width: 640px) {
    [data-panel-layout="standard"] .avs-panel:not([hidden]) {
        box-sizing: border-box;
        left: 0;
        right: 0;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 16px;
    }
    .avs-panel .avs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        min-width: 0;
    }
    .avs-panel .avs-product-card {
        box-sizing: border-box;
        width: 100%;
        max-width: none;
        min-width: 0;
    }
}

/* Desktop: fit a short product list instead of reserving empty columns.
   Infinite-scroll panels with more products retain their normal layout. */
@media (min-width: 761px) {
    [data-panel-layout="standard"] .avs-panel:not([hidden]):has(.avs-grid > .avs-product-card:first-child:last-child) {
        width: 215px; min-width: 215px; max-width: 215px;
    }
    [data-panel-layout="standard"] .avs-panel:not([hidden]):has(.avs-grid > .avs-product-card:nth-child(2):last-child) {
        width: 376px; min-width: 376px; max-width: 376px;
    }
    .avs-panel .avs-grid:has(> .avs-product-card:first-child:last-child) {
        grid-template-columns: repeat(1, minmax(0, 150px));
    }
    .avs-panel .avs-grid:has(> .avs-product-card:nth-child(2):last-child) {
        grid-template-columns: repeat(2, minmax(0, 150px));
    }
    [data-panel-layout="center"] .avs-panel .avs-grid:has(> .avs-product-card:nth-child(3):last-child) {
        grid-template-columns: repeat(3, minmax(125px, 145px));
    }
}

/* Desktop standard bundle panel: match Custom Options visual card spacing.
   Center modal and mobile keep their dedicated responsive layouts. */
@media (min-width: 761px) {
    [data-panel-layout="standard"] .avs-panel .avs-grid {
        column-gap: 20px;
        row-gap: 12px;
    }
    [data-panel-layout="standard"] .avs-panel .avs-product-card {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
    }
}

/* Desktop: fixed 150px product tiles, never shrink for the vertical scrollbar.
   Drawer width includes 3 columns, two 20px gaps, padding and scrollbar. */
@media (min-width: 761px) {
    [data-panel-layout="standard"] .avs-panel:not([hidden]) {
        width: 552px;
        min-width: 552px;
        max-width: 552px;
    }
    [data-panel-layout="standard"] .avs-panel .avs-grid {
        grid-template-columns: repeat(3, 150px);
    }
    [data-panel-layout="center"] .avs-panel .avs-grid {
        grid-template-columns: repeat(4, 150px);
    }
    .avs-panel .avs-product-card {
        box-sizing: border-box;
        width: 150px;
        min-width: 150px;
        max-width: 150px;
    }
    [data-panel-layout="standard"] .avs-panel .avs-grid:has(> .avs-product-card:first-child:last-child),
    [data-panel-layout="center"] .avs-panel .avs-grid:has(> .avs-product-card:first-child:last-child) {
        grid-template-columns: 150px;
    }
    [data-panel-layout="standard"] .avs-panel .avs-grid:has(> .avs-product-card:nth-child(2):last-child),
    [data-panel-layout="center"] .avs-panel .avs-grid:has(> .avs-product-card:nth-child(2):last-child) {
        grid-template-columns: repeat(2, 150px);
    }
    [data-panel-layout="center"] .avs-panel .avs-grid:has(> .avs-product-card:nth-child(3):last-child) {
        grid-template-columns: repeat(3, 150px);
    }
}

/* Product cards match Custom Options Visual label/image structure exactly.
   Desktop uses 150px cards; mobile keeps fluid two-column sizing. */
.avs-panel .avs-product-card {
    box-sizing: border-box;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 4px;
    align-items: center;
    transition: all .2s ease;
}
.avs-panel .avs-product-card:hover {
    transform: translateY(-2px);
}
.avs-panel .avs-product-image-wrapper {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 0 10px;
}
.avs-panel .avs-product-card img.avs-product-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: cover;
    margin: 0;
}

.avs-inline-visual-box .avs-panel .avs-product-card img.avs-product-image {
    max-height: none;
}

/* Product-page tile layouts only. The drawer and modal selectors are intentionally excluded. */
.avs-native[data-box-layout="three"] .bundle-block,
.avs-native[data-box-layout="three_alternative"] .bundle-block {
    display:grid;
    grid-template-columns:repeat(3, minmax(0, 150px));
    justify-content:space-between;
    column-gap:8px;
    row-gap:16px;
    width:100%;
    align-items:start;
}
.avs-native[data-box-layout="three_alternative"] .bundle-block {
    grid-template-columns:repeat(3, minmax(0, 120px));
    justify-content:center;
    column-gap:clamp(10px, 3.2vw, 14px);
    row-gap:14px;
}
.avs-native[data-box-layout="three"] .bundle-block > .avs-tile,
.avs-native[data-box-layout="three_alternative"] .bundle-block > .avs-tile {
    width:100%;min-width:0;max-width:100%;align-items:center;
}
.avs-native[data-box-layout="three"] .bundle-block .avs-option,
.avs-native[data-box-layout="three_alternative"] .bundle-block .avs-option {
    box-sizing:border-box;
    display:flex;
    width:100%;height:auto;
    min-width:0;min-height:0;
    aspect-ratio:1 / 1;
}
.avs-native[data-box-layout="three"] .bundle-block .avs-option .icon,
.avs-native[data-box-layout="three"] .bundle-block .avs-option .boximage,
.avs-native[data-box-layout="three_alternative"] .bundle-block .avs-option .icon,
.avs-native[data-box-layout="three_alternative"] .bundle-block .avs-option .boximage {
    width:100% !important;height:100% !important;
}
.avs-native[data-box-layout="three"] .bundle-block .avs-tile .block-title-price,
.avs-native[data-box-layout="three_alternative"] .bundle-block .avs-tile .block-title-price {
    box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin-top:8px;
}
.avs-native[data-box-layout="three"] .bundle-block .avs-option .badge-text,
.avs-native[data-box-layout="three_alternative"] .bundle-block .avs-option .badge-text {font-size:clamp(9px,2.3vw,13px);}
/* Center panel: 150px is the actual fixed-width ceiling, independently of box layout. */
[data-panel-layout="center"] .avs-panel .avs-grid {
    grid-template-columns:repeat(4, 150px);
    justify-content:center;
}
[data-panel-layout="center"] .avs-panel .avs-product-card {
    box-sizing:border-box; width:150px; min-width:0; max-width:150px;
}
@media(max-width:760px){
    [data-panel-layout="center"] .avs-panel .avs-grid {
        grid-template-columns:repeat(2, minmax(0,150px));
        justify-content:center; gap:10px;
    }
    [data-panel-layout="center"] .avs-panel .avs-product-card {
        width:100%; min-width:0; max-width:150px;
    }
}

/* Configurable theme values. Only product page Bundle box layouts use data-box-layout. */
.avs-native .bundle-block .avs-option {border-color:var(--border-color-main,#ccc);border-radius:var(--avs-box-radius,4px)!important;}
.avs-native .bundle-block .avs-option:hover {border-color:var(--border-color-main,#ccc);box-shadow:0 5px 13px rgba(0,0,0,.17)!important;}
.avs-native .avs-panel .avs-product-card {background-color:#fff;border-color:var(--border-color-main,#ccc);border-radius:var(--avs-box-radius,4px)!important;}
.avs-native .avs-panel .avs-product-card:hover {border-color:var(--border-color-main-hover,#a65d68);}
.avs-native .avs-panel .avs-product-card.is-selected {border-color:var(--border-color-main-selected,#525252);}
.avs-native[data-box-layout="three_alternative"] .bundle-block {
 grid-template-columns:repeat(3,minmax(0,120px));
 justify-content:center;
 column-gap:clamp(8px, calc((100% - 360px)/2), 118px);
 row-gap:16px;
}
.avs-native[data-box-layout="three_alternative"] .bundle-block > .avs-tile {width:120px;max-width:120px;min-width:0;}
.avs-native[data-box-layout="three_alternative"] .bundle-block .avs-option {width:120px;height:120px;min-width:120px;max-width:120px;min-height:120px;max-height:120px;aspect-ratio:auto;}
.avs-native[data-box-layout="three_alternative"] .bundle-block .avs-option .icon,
.avs-native[data-box-layout="three_alternative"] .bundle-block .avs-option .boximage {width:100%!important;height:100%!important;}
@media(max-width:389px){
 .avs-native[data-box-layout="three_alternative"] .bundle-block {grid-template-columns:repeat(3,minmax(0,1fr));column-gap:8px;}
 .avs-native[data-box-layout="three_alternative"] .bundle-block > .avs-tile {width:100%;max-width:120px;}
 .avs-native[data-box-layout="three_alternative"] .bundle-block .avs-option {width:100%;height:auto;min-width:0;min-height:0;aspect-ratio:1/1;}
}

/* Card surfaces, scoped to Bundle product-page boxes only. */
.avs-native .bundle-block .avs-option {background-color:var(--avs-box-background,#f9f9f9)!important;}

/* Visual Box / Aperto: same AJAX engine; embedded in product details. */
.avs-native .avs-inline-visual-box{width:100%;margin:35px 0 20px}
.avs-native .avs-inline-legend{font-size:18px;font-weight:600;margin-bottom:18px}
.avs-native .avs-inline-panel-host{width:100%}
.avs-native .avs-panel.avs-inline-panel:not([hidden]),
.avs-native[data-panel-layout="center"] .avs-panel.avs-inline-panel:not([hidden]),
.avs-native[data-panel-layout="standard"] .avs-panel.avs-inline-panel:not([hidden]){
 position:static!important;inset:auto!important;display:flex!important;width:100%!important;
 min-width:0!important;max-width:none!important;height:auto!important;max-height:none!important;
 overflow:visible!important;z-index:auto!important;padding:0!important;background:transparent!important;
 box-shadow:none!important;animation:none!important;transform:none!important;
}
.avs-native .avs-inline-panel .avs-panel-heading{display:none!important}
.avs-native .avs-inline-panel .avs-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,150px))!important;justify-content:start!important;gap:18px 12px!important}
.avs-native .avs-inline-panel .avs-product-card{width:100%!important;max-width:150px!important}
@media(max-width:480px){.avs-native .avs-inline-panel .avs-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:12px 8px!important}}

/* Dedicated colors for inline Visual Box cards; Panel mode keeps generic panel colors. */
.avs-native .avs-panel.avs-inline-panel .avs-product-card:hover {
 border-color:var(--avs-visual-box-border-hover,#979494)!important;
}
.avs-native .avs-panel.avs-inline-panel .avs-product-card.is-selected,
.avs-native .avs-panel.avs-inline-panel .avs-product-card.is-selected:hover {
 border-color:var(--avs-visual-box-border-selected,#a65d68)!important;
}


/* Keep the drawer width stable from its first rendered frame.
   Product counts are known in PHP before AJAX cards are loaded. */
@media (min-width: 761px) {
    .avs-native[data-panel-layout="standard"] .avs-panel[data-total-products="1"]:not([hidden]) {
        width: 215px;
        min-width: 215px;
        max-width: 215px;
    }
    .avs-native[data-panel-layout="standard"] .avs-panel[data-total-products="2"]:not([hidden]) {
        width: 376px;
        min-width: 376px;
        max-width: 376px;
    }
}
