/**
 * WooCommerce Variations Table Styles
 */

/* Wrapper */
.wvt-table-wrapper {
    margin: 20px 0;
    overflow-x: auto;
}

/* Table Base */
.wvt-variations-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table Header */
.wvt-variations-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.wvt-variations-table thead th {
    padding: 15px 10px;
    font-weight: 600;
    text-align: left;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Table Body */
.wvt-variations-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.wvt-variations-table tbody tr:hover {
    background-color: #f8f9fa;
}

.wvt-variations-table tbody td {
    padding: 15px 10px;
    vertical-align: middle;
}

/* Out of Stock Row */
.wvt-variations-table tbody tr.wvt-out-of-stock {
    opacity: 0.6;
    background-color: #f5f5f5;
}

/* Column Widths */
.wvt-col-image {
    width: 80px;
    text-align: center;
}

.wvt-col-sku {
    width: 120px;
}

.wvt-col-attributes {
    width: auto;
    min-width: 200px;
}

.wvt-col-price {
    width: 120px;
}

.wvt-col-quantity {
    width: 150px;
}

.wvt-col-action {
    width: 120px;
    text-align: center;
}

/* Image Column */
.wvt-image-link {
    display: inline-block;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.wvt-image-link:hover {
    transform: scale(1.1);
}

.wvt-variation-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.wvt-no-image {
    color: #999;
    font-style: italic;
}

/* SKU Column */
.wvt-sku {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

/* Attributes Column */
.wvt-attributes-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wvt-attribute {
    font-size: 14px;
    line-height: 1.4;
}

.wvt-attribute-label {
    font-weight: 600;
    color: #555;
    margin-right: 5px;
}

.wvt-attribute-value {
    color: #333;
}

/* Price Column */
.wvt-price {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.wvt-price del {
    opacity: 0.6;
    font-size: 14px;
    margin-right: 8px;
}

.wvt-price ins {
    text-decoration: none;
    color: #e74c3c;
}

/* Quantity Column */
.wvt-quantity-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wvt-quantity-input {
    width: 70px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.wvt-quantity-input:focus {
    outline: none;
    border-color: #007bff;
}

.wvt-stock-info {
    font-size: 12px;
    color: #28a745;
    font-style: italic;
}

.wvt-out-of-stock-label {
    color: #dc3545;
    font-weight: 600;
    font-size: 13px;
}

/* Action Column */
.wvt-add-to-cart {
    padding: 10px 20px !important;
    background: #1C2949 !important;
    background-color: #1C2949 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.wvt-add-to-cart:hover {
    background: #0f1729 !important;
    background-color: #0f1729 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(28, 41, 73, 0.3);
}

.wvt-add-to-cart:active {
    transform: translateY(0);
}

.wvt-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.wvt-add-to-cart.loading {
    position: relative;
    color: transparent;
}

.wvt-add-to-cart.loading:after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: wvt-spinner 0.6s linear infinite;
}

@keyframes wvt-spinner {
    to { transform: rotate(360deg); }
}

.wvt-unavailable {
    color: #999;
    font-style: italic;
}

/* Messages */
.wvt-message {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
}

.wvt-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wvt-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Notice */
.wvt-notice {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    margin: 20px 0;
}

/* Legend */
.wvt-legend {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.wvt-legend-note {
    margin: 0;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .wvt-variations-table {
        font-size: 13px;
    }
    
    .wvt-variations-table thead th,
    .wvt-variations-table tbody td {
        padding: 10px 8px;
    }
    
    .wvt-col-sku,
    .wvt-col-quantity {
        width: auto;
    }
}

@media screen and (max-width: 768px) {
    .wvt-table-wrapper {
        overflow-x: visible;
    }
    
    /* Nascondi la tabella standard su mobile */
    .wvt-variations-table thead {
        display: none;
    }
    
    .wvt-variations-table,
    .wvt-variations-table tbody,
    .wvt-variations-table tr {
        display: block;
        width: 100%;
    }
    
    /* Trasforma ogni riga in una card */
    .wvt-variation-row {
        display: block;
        margin-bottom: 20px;
        padding: 15px;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .wvt-variation-row:hover {
        background-color: #fff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }
    
    /* Riorganizza le celle come card */
    .wvt-variations-table tbody td {
        display: block;
        width: 100%;
        padding: 8px 0;
        border: none;
        text-align: left;
    }
    
    /* Aggiungi etichette prima di ogni dato */
    .wvt-variations-table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        margin-right: 10px;
        color: #555;
        min-width: 80px;
    }
    
    .wvt-col-image:before {
        content: "Foto:";
    }
    
    .wvt-col-sku:before {
        content: "SKU:";
    }
    
    .wvt-col-attributes:before {
        content: "Variante:";
    }
    
    .wvt-col-price:before {
        content: "Prezzo:";
    }
    
    .wvt-col-quantity:before {
        content: "Quantità:";
    }
    
    .wvt-col-action:before {
        content: "";
        display: none;
    }
    
    /* Ottimizza immagine su mobile */
    .wvt-col-image {
        text-align: left;
    }
    
    .wvt-variation-image {
        width: 80px;
        height: 80px;
        display: inline-block;
        vertical-align: middle;
    }
    
    /* Attributi inline su mobile */
    .wvt-attributes-list {
        display: inline;
    }
    
    .wvt-attribute {
        display: inline;
    }
    
    .wvt-attribute:not(:last-child):after {
        content: ", ";
    }
    
    /* Prezzo */
    .wvt-price {
        display: inline-block;
        font-size: 18px;
    }
    
    /* Quantità su mobile */
    .wvt-quantity-wrapper {
        display: inline-flex;
        align-items: center;
        gap: 10px;
    }
    
    .wvt-quantity-input {
        width: 60px;
    }
    
    .wvt-stock-info {
        display: inline-block;
    }
    
    /* Pulsante full width su mobile */
    .wvt-col-action {
        margin-top: 10px;
        padding-top: 15px;
        border-top: 1px solid #e9ecef;
    }
    
    .wvt-add-to-cart {
        width: 100%;
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .wvt-message {
        width: 100%;
        margin-top: 10px;
    }
}

/* Magnific Popup Customization */
.mfp-zoom-in .mfp-with-anim {
    opacity: 0;
    transition: all 0.2s ease-in-out;
    transform: scale(0.8);
}

.mfp-zoom-in.mfp-bg {
    opacity: 0;
    transition: all 0.3s ease-out;
}

.mfp-zoom-in.mfp-ready .mfp-with-anim {
    opacity: 1;
    transform: scale(1);
}

.mfp-zoom-in.mfp-ready.mfp-bg {
    opacity: 0.8;
}

.mfp-zoom-in.mfp-removing .mfp-with-anim {
    transform: scale(0.8);
    opacity: 0;
}

.mfp-zoom-in.mfp-removing.mfp-bg {
    opacity: 0;
}
