/* =========================================================
   WC VARIATION SWATCHES - STYLE COMPLETO
   ========================================================= */

/* Area generale variazioni */
form.variations_form {
    margin-top: 10px;
}

form.variations_form table.variations {
    width: 100%;
    border: 0;
    margin: 0 0 14px;
}

form.variations_form table.variations tbody,
form.variations_form table.variations tr,
form.variations_form table.variations td,
form.variations_form table.variations th {
    border: 0;
}

form.variations_form table.variations tr {
    display: block;
    margin-bottom: 14px;
}

form.variations_form table.variations th.label {
    display: block;
    width: 100%;
    padding: 0 0 8px;
    margin: 0;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    color: #333333;
    line-height: 1.2;
}

form.variations_form table.variations th.label label {
    font-size: 14px;
    font-weight: 700;
    color: #333333;
    text-transform: none;
    letter-spacing: 0;
}

form.variations_form table.variations td.value {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* Select originale nascosto */
.wc-swatches-hidden-select,
form.variations_form table.variations td.value select {
    display: none !important;
}

/* =========================================================
   CONTENITORE SWATCHES
   ========================================================= */
.wc-swatch-wrapper {
    display: block;
    margin: 0 0 2px;
}

.wc-swatch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* reset base pulsanti per evitare stili aggressivi del tema */
.wc-swatch-wrapper button {
    font-family: inherit;
    box-shadow: none !important;
    background-image: none !important;
    text-shadow: none !important;
}

.wc-swatch-wrapper button::before,
.wc-swatch-wrapper button::after {
    box-sizing: border-box;
}

/* =========================================================
   BOTTONI TESTUALI (TAGLIA, GENERE, ECC.)
   ========================================================= */
.wc-swatch-wrapper .swatch-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: 42px;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    margin: 0;
    border: 1px solid #d9d9d9 !important;
    border-radius: 2px !important;
    background: #f2f2f2 !important;
    color: #555555 !important;
    cursor: pointer;
    outline: none;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.wc-swatch-wrapper .swatch-btn:hover {
    background: #ebebeb !important;
    border-color: #cccccc !important;
    color: #333333 !important;
}

.wc-swatch-wrapper .swatch-btn:focus {
    outline: none;
    border-color: #d7a132 !important;
    box-shadow: 0 0 0 2px rgba(240, 181, 58, 0.18) !important;
}

.wc-swatch-wrapper .swatch-btn.active {
    background: #efb233 !important;
    border-color: #db9f24 !important;
    color: #ffffff !important;
}

.wc-swatch-wrapper .swatch-btn.active:hover {
    background: #e6aa2f !important;
    border-color: #cf941c !important;
    color: #ffffff !important;
}

.wc-swatch-wrapper .swatch-btn:active {
    transform: translateY(1px);
}

/* Taglie / genere non disponibili */
.wc-swatch-wrapper .swatch-btn.disabled,
.wc-swatch-wrapper .swatch-btn:disabled {
    background: #f7f7f7 !important;
    border-color: #e5e5e5 !important;
    color: #b7b7b7 !important;
    cursor: not-allowed;
    opacity: 1;
    pointer-events: none;
    position: relative;
}

.wc-swatch-wrapper .swatch-btn.disabled::after,
.wc-swatch-wrapper .swatch-btn:disabled::after {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    top: 50%;
    height: 1px;
    background: #cbcbcb;
    transform: rotate(-18deg);
    transform-origin: center;
}

/* =========================================================
   SWATCH COLORI
   ========================================================= */
.wc-swatch-wrapper .swatch-color {
    appearance: none;
    -webkit-appearance: none;
    display: inline-block !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    margin: 0;
    border-radius: 50% !important;
    border: 2px solid #d8d8d8 !important;
    cursor: pointer;
    outline: none;
    position: relative;
    vertical-align: middle;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.wc-swatch-wrapper .swatch-color:hover {
    transform: scale(1.06);
    border-color: #bdbdbd !important;
}

.wc-swatch-wrapper .swatch-color:focus {
    outline: none;
    border-color: #d7a132 !important;
    box-shadow: 0 0 0 2px rgba(240, 181, 58, 0.18) !important;
}

.wc-swatch-wrapper .swatch-color.active {
    border-color: #efb233 !important;
    box-shadow: 0 0 0 2px #ffffff inset, 0 0 0 1px #efb233 !important;
}

.wc-swatch-wrapper .swatch-color.disabled,
.wc-swatch-wrapper .swatch-color:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Se il colore è bianco */
.wc-swatch-wrapper .swatch-color[style*="#ffffff"],
.wc-swatch-wrapper .swatch-color[style*="#fff"],
.wc-swatch-wrapper .swatch-color[style*="rgb(255, 255, 255)"] {
    border-color: #cfcfcf !important;
}

/* =========================================================
   RESET VARIAZIONI
   ========================================================= */
form.variations_form .reset_variations {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #777777;
    text-decoration: none;
    transition: color 0.15s ease;
}

form.variations_form .reset_variations:hover {
    color: #333333;
    text-decoration: underline;
}

/* =========================================================
   WRAP QUANTITÀ + BOTTONE CARRELLO
   ========================================================= */
form.variations_form .single_variation_wrap {
    margin-top: 14px;
}

/* Prezzo variazione / stock */
form.variations_form .single_variation {
    margin-bottom: 10px;
}

form.variations_form .woocommerce-variation-price,
form.variations_form .woocommerce-variation-availability {
    margin-bottom: 8px;
}

/* Riga quantità + add to cart */
form.variations_form .woocommerce-variation-add-to-cart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* Quantità */
form.variations_form .quantity {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

form.variations_form .quantity input.qty {
    width: 58px;
    height: 42px;
    padding: 0 8px;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    background: #ffffff;
    color: #333333;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    box-shadow: none;
}

form.variations_form .quantity input.qty:focus {
    outline: none;
    border-color: #d7a132;
    box-shadow: 0 0 0 2px rgba(240, 181, 58, 0.15);
}

/* Bottone aggiungi al carrello */
form.variations_form .single_add_to_cart_button,
form.variations_form button.single_add_to_cart_button.button.alt {
    appearance: none;
    -webkit-appearance: none;
    min-height: 44px;
    padding: 0 26px;
    border: 1px solid #FEDF03;
    border-radius: 4px;
    background: #FEDF03;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    line-height: 42px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
    cursor: pointer;
    transition: all 0.18s ease;
}

form.variations_form .single_add_to_cart_button:hover,
form.variations_form button.single_add_to_cart_button.button.alt:hover {
    background: linear-gradient(to bottom, #f8842e 0%, #d95512 100%);
    border-color: #c74d0e;
    color: #ffffff;
}

form.variations_form .single_add_to_cart_button:focus,
form.variations_form button.single_add_to_cart_button.button.alt:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(244, 124, 34, 0.18);
}

form.variations_form .single_add_to_cart_button.disabled,
form.variations_form .single_add_to_cart_button:disabled,
form.variations_form button.single_add_to_cart_button.button.alt.disabled,
form.variations_form button.single_add_to_cart_button.button.alt:disabled {
    background: #d9d9d9;
    border-color: #cdcdcd;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
}

/* =========================================================
   ALLINEAMENTO BLOCCO RIEPILOGO
   ========================================================= */
.summary form.cart {
    margin-top: 12px;
}

.summary .product_meta {
    margin-top: 16px;
}

.summary .woocommerce-variation-description {
    margin-bottom: 8px;
}

/* =========================================================
   EVENTUALI LABEL / TESTO ATTRIBUTO SELEZIONATO
   ========================================================= */
.wc-swatch-selected-value {
    display: inline-block;
    margin-left: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #777777;
}

/* =========================================================
   MOBILE
   ========================================================= */
@media (max-width: 767px) {
    form.variations_form table.variations tr {
        margin-bottom: 12px;
    }

    .wc-swatch {
        gap: 7px;
    }

    .wc-swatch-wrapper .swatch-btn {
        min-width: 40px;
        height: 32px !important;
        min-height: 32px !important;
        padding: 0 10px !important;
        font-size: 13px !important;
    }

    .wc-swatch-wrapper .swatch-color {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
        min-height: 26px !important;
    }

    form.variations_form .woocommerce-variation-add-to-cart {
        gap: 10px;
    }

    form.variations_form .quantity input.qty {
        width: 54px;
        height: 40px;
        font-size: 15px;
    }

    form.variations_form .single_add_to_cart_button,
    form.variations_form button.single_add_to_cart_button.button.alt {
        min-height: 42px;
        padding: 0 20px;
        font-size: 14px;
        line-height: 40px;
    }
}

/* =========================================================
   PICCOLE RIFINITURE VISIVE
   ========================================================= */
.wc-swatch-wrapper .swatch-btn,
.wc-swatch-wrapper .swatch-color,
form.variations_form .single_add_to_cart_button,
form.variations_form .quantity input.qty {
    vertical-align: middle;
}

.wc-swatch-wrapper + .reset_variations {
    margin-top: 8px;
}

.woocommerce div.product form.cart .variations td, .woocommerce div.product form.cart .variations th {
    background: white !important;
}