/*
 * asset/frontend.css - Versione 2.5
 * Author: Gianfranco Greco con Codice Sorgente
 * Copyright (c) 2025 Gianfranco Greco
 * Licensed under the GNU GPL v2 or later: https://www.gnu.org/licenses/gpl-2.0.html
*/

/* --- LAYOUT GENERALE A DUE COLONNE (DESKTOP) --- */
.wcb-bundle-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    position: relative;
    margin-top: 30px;
    width: 100%;
}

.wcb-content-col {
    flex: 1;
    min-width: 0;
}

.wcb-sidebar-col {
    width: 340px;
    flex-shrink: 0;
}

/* STICKY SIDEBAR (Solo Desktop) */
.wcb-sticky-summary {
    position: sticky;
    position: -webkit-sticky;
    top: 160px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    z-index: 90;
}

.wcb-summary-title {
    margin-top: 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    font-size: 1.3em;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.wcb-bundle-price {
    font-size: 1.8em;
    font-weight: 700;
    color: #0073aa;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
}

.wcb-price-label {
    font-size: 0.4em;
    color: #777;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

/* Stile Etichetta Sotto Prezzo */
.wcb-price-sublabel {
    font-size: 1em;
    color: #666;
    /* O un colore di brand, es #d63384 per promo */
    margin-bottom: 15px;
    line-height: 1.3;
    font-style: italic;
    text-align: center;
}

/* Fix per Mobile Bar: Flex Column per il prezzo */
.wcb-mobile-sticky-bar {
    /* Assicurati che il display sia flex nel css originale */
    align-items: center;
}

.wcb-mobile-price-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-right: auto;
    /* Spinge il bottone a destra */
    text-align: center;
}

.wcb-price-sublabel.mobile {
    font-size: 0.9em;
    font-weight: 700;
    margin-bottom: 0;
    margin-top: 2px;
    max-width: 200px;
    /* Evita che spinga via il bottone su schermi piccoli */
    white-space: normal;
    line-height: 1.1;
    padding: 5px;
}

.wcb-summary-actions .single_add_to_cart_button {
    width: 100%;
    margin-top: 10px;
    justify-content: center;
    padding: 18px;
    font-size: 1.1em;
}

/* NASCONDI SIDEBAR SU MOBILE */
.wcb-mobile-sticky-bar {
    display: none;
}

/* --- STILI DEL CONTENUTO --- */

.wcb-bundle-instructions {
    padding: 25px;
    margin-bottom: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 5px solid #0073aa;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    font-size: 1.05em;
    line-height: 1.6;
    color: #444;
}

.wcb-bundle-group {
    margin-bottom: 30px;
    padding: 25px;
    border: 1px solid #e0e0e0;
    border-left: 5px solid #ccc;
    transition: all 0.3s ease;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.wcb-group-incomplete {
    border-left-color: #d63638 !important;
    background-color: rgba(214, 54, 56, 0.04) !important;
}

.wcb-group-complete {
    border-left-color: #46b450 !important;
    background-color: rgba(70, 180, 80, 0.06) !important;
}

.wcb-group-title {
    font-size: 1.6em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #23282d;
    font-weight: 700;
}

.wcb-group-description {
    font-style: normal;
    color: #666;
    margin-bottom: 25px;
    font-size: 0.95em;
}

.wcb-group-header-price {
    font-size: 0.9em;
    color: #2271b1;
    /* Colore standard WooCommerce o il tuo brand color */
    background: #f0f6fc;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
    font-weight: normal;
    vertical-align: middle;
}

/* Item Prodotto */
.wcb-product-item {
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fff;
    transition: all 0.2s;
}

.wcb-product-item:hover {
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.wcb-product-item>label {
    display: flex;
    align-items: flex-start;
    /* Allinea in alto */
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
}

.wcb-product-item input[type="radio"],
.wcb-product-item input[type="checkbox"] {
    margin-right: 20px;
    margin-top: 10px;
    /* Allineamento ottico con l'immagine */
    min-width: 22px;
    height: 22px;
    accent-color: #0073aa;
}

/* --- IMMAGINI DESKTOP --- */
.wcb-product-thumbnail {
    margin-right: 25px;
    flex-shrink: 0;
}

.wcb-product-thumbnail img {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s;
    background: #fff;
    display: block;
}

.wcb-product-thumbnail img:hover {
    transform: scale(1.02);
    border-color: #0073aa;
}

/* Container relativo per posizionare le frecce */
.wcb-gallery-wrapper {
    position: relative;
    overflow: hidden;
    width: 280px !important;
    height: 320px !important;
    margin: 0 auto;
    /* Centrato */
    background: #fff;
    border-radius: 8px;
    /* Opzionale: stondatura */
}

/* Immagini: di base nascoste, tranne quella attiva */
.wcb-thumbnail-image {
    display: none !important;
    /* Forza il nascondimento contro ogni stile del tema */
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.wcb-thumbnail-image.active {
    display: block !important;
    /* Forza la visualizzazione */
}

/* Navigazione Frecce */
.wcb-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    width: 30px;
    /* Leggermente più grandi per il dito */
    height: 30px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    z-index: 90;
    /* Z-index alto per stare sopra l'immagine */
    opacity: 0;
    transition: opacity 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Mostra frecce in hover */
.wcb-gallery-wrapper:hover .wcb-gallery-nav {
    opacity: 1;
}

.wcb-prev {
    left: 5px;
}

.wcb-next {
    right: 5px;
}

/* Contatore */
.wcb-gallery-counter {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 90;
}

/* --- INFO COLONNA & INPUT NUMERO (MODIFICA APPLICATA) --- */
.wcb-product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    /* Impila nome, prezzo e input */
    justify-content: flex-start;
    padding-top: 5px;
}

.wcb-product-name {
    font-size: 1.1em;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.4;
}

.wcb-product-price {
    font-size: 1.1em;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 10px;
}

/* Wrapper Quantità (dentro Info) */
.wcb-qty-wrapper {
    margin-top: 10px;
    width: 100%;
}

.wcb-qty-badge {
    background: #2271b1;
    color: white;
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 5px;
    vertical-align: middle;
}

.wcb-quantity-input {
    width: 100%;
    /* Occupa tutto lo spazio della colonna info come richiesto */
    text-align: center;
    height: 45px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-weight: bold;
    font-size: 1.1em;
    margin-left: 0;
    /* Reset margine */
}

/* Campi Dinamici */
.wcb-variation-container,
.wcb-variation-sets-container,
.wcb-personalization-field-container {
    margin-top: 20px;
    padding: 20px;
    background: #fcfcfc;
    border: 1px solid #eee;
    border-radius: 6px;
    border-left: 3px solid #ddd;
    width: 100%;
}

.wcb-variation-field,
.wcb-personalization-field {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.wcb-variation-field:last-child,
.wcb-personalization-field:last-child {
    margin-bottom: 0;
}

.wcb-variation-field>label,
.wcb-personalization-field>label {
    font-weight: 600;
    margin-right: 15px;
    min-width: 120px;
    color: #555;
}

.wcb-variation-field select,
.wcb-personalization-field input[type="text"] {
    width: 100%;
    height: 40px;
}

.wcb-variation-set {
    padding-top: 20px;
    border-top: 1px dashed #ddd;
    margin-top: 20px;
}

.wcb-variation-set:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.wcb-variation-set h5 {
    margin: 0 0 15px;
    font-size: 1em;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select option:disabled {
    color: #ccc;
}

.wcb-bundle-container input[type="text"],
.wcb-bundle-container input[type="number"],
.wcb-bundle-container select {
    border: 1px solid #ddd;
    background-color: #fff;
    color: #333;
    outline: 0;
    transition: border-color 0.2s;
    padding: 0 15px;
    border-radius: 4px;
}

.wcb-bundle-container input[type="text"]:focus,
.wcb-bundle-container input[type="number"]:focus,
.wcb-bundle-container select:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.wcb-personalization-input.wcb-input-error {
    border-color: #d63638 !important;
    background-color: #fff8f8;
}

.wcb-personalization-field-container .required,
.wcb-personalization-field .required {
    color: #d63638;
    font-weight: bold;
    margin-left: 3px;
}

/* Lightbox */
.wcb-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.wcb-lightbox.show {
    display: flex;
    opacity: 1;
}

.wcb-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.wcb-lightbox.show .wcb-lightbox-content {
    transform: scale(1);
}

.wcb-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 4px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.wcb-lightbox-close {
    position: absolute;
    top: -40px;
    right: -10px;
    color: #fff;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s;
    opacity: 0.8;
}

.wcb-lightbox-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.wcb-lightbox-caption {
    color: #fff;
    text-align: center;
    margin-top: 15px;
    font-size: 18px;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

body.wcb-lightbox-open {
    overflow: hidden;
}

/* --- RESPONSIVE & MOBILE BAR --- */
@media (max-width: 991px) {
    .wcb-bundle-layout {
        flex-direction: column;
        gap: 0;
    }

    .wcb-sidebar-col {
        display: none;
    }

    .wcb-bundle-instructions,
    .wcb-bundle-group {
        padding: 20px 15px;
    }

    /* --- LAYOUT MOBILE PRODOTTO --- */
    .wcb-product-item {
        padding-bottom: 20px;
    }

    .wcb-product-item>label {
        align-items: center;
        flex-wrap: wrap;
    }

    /* RIGA 1: Immagine Grande Centrata */
    .wcb-product-thumbnail {
        width: 100%;
        text-align: center;
        margin-right: 0;
        margin-bottom: 20px;
        order: -1;
    }

    .wcb-product-thumbnail img {
        width: 85%;
        max-width: 300px;
        height: auto;
        aspect-ratio: 1/1;
        margin: 0 auto;
        display: block;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    }

    /* RIGA 2: Checkbox + Testo + Quantità */
    .wcb-product-item input[type="radio"],
    .wcb-product-item input[type="checkbox"] {
        margin-right: 15px;
        flex-shrink: 0;
        margin-top: 0;
        /* Reset margine desktop */
    }

    .wcb-product-info {
        flex-direction: row;
        /* Rimetti in riga su mobile se vuoi checkbox+testo+qty allineati */
        flex-wrap: wrap;
        align-items: center;
        width: auto;
        flex: 1;
        padding-top: 0;
    }

    .wcb-product-name {
        width: 100%;
        /* Nome su riga propria */
        font-size: 1em;
        line-height: 1.3;
        margin-bottom: 5px;
    }

    .wcb-product-price {
        margin-right: auto;
        margin-bottom: 0;
    }

    .wcb-qty-wrapper {
        margin-top: 0;
        width: 70px;
        /* Larghezza fissa su mobile */
    }

    .wcb-quantity-input {
        width: 100%;
        height: 40px;
    }

    /* Sticky Bar Mobile */
    .wcb-mobile-sticky-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        border-top: 1px solid #ddd;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
        padding: 15px 20px;
        z-index: 9999;
        justify-content: space-between;
        align-items: center;
        box-sizing: border-box;
    }

    .wcb-mobile-price {
        display: flex;
        flex-direction: column;
    }

    .wcb-mobile-price .wcb-price-label {
        font-size: 10px;
        margin-bottom: 2px;
        display: none;
    }

    .wcb-mobile-price .wcb-price-value {
        font-size: 1.4em;
        font-weight: 800;
        color: #0073aa;
    }

    .wcb-mobile-submit-btn {
        margin: 0;
        padding: 12px 25px;
        font-size: 1em;
        border-radius: 50px;
    }

    body {
        padding-bottom: 100px;
    }
}

/* Stili Carrello */
.wcb-cart-bundle-info {
    display: block !important;
    margin-top: 8px;
    font-size: 0.85em;
    background: rgba(0, 115, 170, 0.05);
    padding: 5px 10px;
    border-radius: 4px;
    width: fit-content;
}

/* Specifico per pagina carrello principale */
.woocommerce-cart .wcb-cart-bundle-info {
    display: block !important;
    margin-top: 10px;
    clear: both;
}

.wcb-bundle-label {
    display: block;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 2px;
}

.wcb-edit-bundle-link {
    font-size: 0.9em;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #999;
    transition: all 0.2s;
}

.wcb-edit-bundle-link:hover {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

/* --- STILI CART ITEM (TABLE ROW) - Sfondi alternati per bundle --- */

/* Rimuovi TUTTI i bordi del tema per gli item del bundle */
tr.cart_item.wcb-cart-item-child td {
    border-bottom: none !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}

/* Bundle con sfondo GIALLO (bundle dispari) */
tr.cart_item.wcb-cart-item-child.wcb-bundle-color-1 td {
    background-color: rgba(255, 235, 59, 0.15) !important;
}

/* Bundle con sfondo AZZURRO (bundle pari) */
tr.cart_item.wcb-cart-item-child.wcb-bundle-color-2 td {
    background-color: rgba(33, 150, 243, 0.15) !important;
}

/* Spazio sopra il primo item di ogni bundle per separazione visiva */
tr.cart_item.wcb-group-start td {
    padding-top: 12px !important;
}

/* Spazio sotto l'ultimo item di ogni bundle per separazione visiva */
tr.cart_item.wcb-group-end td,
tr.cart_item.wcb-group-single td {
    padding-bottom: 12px !important;
}


/* --- Stili info bundle dentro la cella prodotto --- */
.wcb-cart-item-name-wrapper {
    display: block;
    position: relative;
}

/* Rimuovi bordi interni dal wrapper - ora li gestisce il TR */
.wcb-group-start-internal,
.wcb-group-middle-internal,
.wcb-group-end-internal,
.wcb-group-single-internal {
    border-left: none;
    padding-left: 0;
}

/* Stile link "Modifica Bundle" */
.wcb-edit-bundle-link {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 8px;
    background: #f0f0f1;
    border-radius: 4px;
    border: 1px solid #ccc;
    text-decoration: none !important;
    font-size: 0.85em !important;
    color: #333 !important;
}

.wcb-edit-bundle-link:hover {
    background: #fff;
    border-color: #0073aa;
    color: #0073aa !important;
}

/* --- HERO SECTION (NUOVO STILE BUNDLE HEADER) --- */
.wcb-hero-section {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    /* Desktop: Altezza e layout */
    height: 500px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 40px;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Overlay scuro per leggibilità testo */
.wcb-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* 50% Nero */
    z-index: 1;
}

.wcb-hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 20px;
}

.wcb-hero-title {
    color: #fff !important;
    font-size: 3em !important;
    font-weight: 800 !important;
    margin-bottom: 15px !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.wcb-hero-description {
    font-size: 1.2em;
    color: #f0f0f0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.wcb-hero-description p {
    margin: 0;
    color: inherit;
}

/* --- MOBILE SPECIFIC OVERRIDES --- */
@media (max-width: 768px) {
    .wcb-hero-section {
        height: auto;
        min-height: 250px;
        padding: 40px 0;
    }

    .wcb-hero-title {
        font-size: 1.8em !important;
    }

    .wcb-hero-description {
        font-size: 1em;
        display: none;
        /* Opzionale: Nascondi descrizione lunga su mobile per pulizia */
    }
}

/* MOBILE FIX: Frecce sempre visibili su schermi piccoli */
@media (max-width: 768px) {
    .wcb-gallery-nav {
        opacity: 1 !important;
    }
}

/* --- NUOVO: Tabella Configurazione Prodotti (Min/Step/Price) --- */
.wcb-products-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 0;
    /* Padding gestito internamente */
    border-radius: 4px;
    margin: 15px 0;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.wcb-section-header {
    background: #f8f9fa;
    padding: 10px 15px;
    border-bottom: 1px solid #e2e4e7;
    font-weight: 600;
    color: #1d2327;
}

.wcb-product-settings-list {
    padding: 0;
}

.wcb-product-setting-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f1;
    background: #fff;
    gap: 15px;
}

.wcb-product-setting-row:last-child {
    border-bottom: none;
}

.wcb-product-setting-row:hover {
    background: #fcfcfc;
}

/* Thumbnail */
.wcb-row-thumb img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: block;
}

/* Nome Prodotto */
.wcb-row-name {
    flex: 1;
    /* Prende lo spazio disponibile */
    font-size: 14px;
    line-height: 1.3;
}

.wcb-row-name small {
    color: #646970;
    font-size: 11px;
}

/* Inputs (Min, Step, Price) */
.wcb-row-inputs {
    display: flex;
    gap: 15px;
    align-items: center;
}

.wcb-input-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wcb-input-group label {
    font-size: 10px;
    text-transform: uppercase;
    color: #646970;
    font-weight: 600;
}

.wcb-row-inputs input[type="number"],
.wcb-row-inputs input[type="text"] {
    padding: 4px 8px;
    height: 30px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #8c8f94;
}

.wcb-row-inputs .tiny-input {
    width: 60px;
    text-align: center;
}

.wcb-row-inputs .small-input {
    width: 80px;
}

/* Azioni (Rimuovi) */
.wcb-row-actions button.wcb-remove-product-row {
    color: #d63638;
    border-color: #d63638;
    background: transparent;
    padding: 0 10px;
    line-height: 28px;
    height: 30px;
}

.wcb-row-actions button.wcb-remove-product-row:hover {
    background: #d63638;
    color: #fff;
}

/* Responsive per Backend */
@media screen and (max-width: 782px) {
    .wcb-product-setting-row {
        flex-wrap: wrap;
    }

    .wcb-row-inputs {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }
}

/* --- POSIZIONAMENTO BUNDLE --- */
.wcb-wrapper {
    width: 100%;
    clear: both;
    margin-top: 20px;
}

.wcb-wrapper.wcb-position-after_summary {
    float: none;
    display: block;
}

/* --- FORCE FULL WIDTH POSITIONING --- */
.wcb-position-manual,
.wcb-wrapper {
    /* Ensure the bundle container clears any floated elements (like product images/summaries) */
    clear: both;
    width: 100%;
    display: block;
}

/* Specific fix for after_summary hook where themes might float it */
.woocommerce div.product form.cart .wcb-wrapper,
.woocommerce div.product .wcb-wrapper {
    /* If hooked inside summary, try to break out if possible, though priority 5 usually puts it after summary entries */
    margin-top: 20px;
}

/* For block themes or flex layouts */
.woocommerce div.product {
    display: block;
    /* Some themes make this flex, which can cause issues if not handled */
}