/**
 * WooCommerce Volume Variations - Frontend Styles
 * V2 - Con tabla horizontal y 100% responsive sin scroll
 */

/* Contenedor principal */
.wvv-variations-matrix {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Tabla de precios por volumen */
.wvv-pricing-tiers {
    margin-bottom: 30px;
    padding: 15px;
    background: #fff;
    border-radius: 3px;
}

.wvv-pricing-tiers h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #333;
    text-align: center;
}

/* Tabla horizontal de precios */
.wvv-pricing-table.wvv-pricing-horizontal {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Columnas de igual ancho */
}

.wvv-pricing-horizontal th,
.wvv-pricing-horizontal td {
    padding: 10px 5px;
    text-align: center;
    border: 1px solid #ddd;
}

.wvv-pricing-horizontal th {
    background: #f5f5f5;
    font-weight: 600;
}

.wvv-pricing-horizontal td {
    background: #fff;
    font-weight: 600;
    color: #77a464;
}

.wvv-pricing-horizontal tbody tr:hover td {
    background: #f9f9f9;
}

/* Tabla de variaciones */
.wvv-variations-table-wrapper {
    margin-bottom: 20px;
    overflow: visible; /* Sin scroll */
}

.wvv-variations-table-wrapper h4 {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #333;
}

.wvv-variations-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.wvv-variations-table th,
.wvv-variations-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

.wvv-variations-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.wvv-variations-table tbody tr:hover {
    background: #f9f9f9;
}

.wvv-variations-table .variation-name {
    font-weight: 500;
}

.wvv-variations-table .variation-sku {
    color: #666;
    font-size: 0.9em;
}

.wvv-variations-table .variation-price {
    font-weight: 600;
    color: #77a464;
}

.wvv-variations-table .variation-stock {
    font-size: 0.9em;
}

.wvv-variations-table .variation-quantity {
    width: 120px;
    text-align: center;
}

/* Inputs de cantidad */
.wvv-quantity-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
    font-size: 14px;
}

.wvv-quantity-input:focus {
    outline: none;
    border-color: #77a464;
    box-shadow: 0 0 2px rgba(119, 164, 100, 0.3);
}

.wvv-quantity-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Estado agotado */
.wvv-variations-table .out-of-stock {
    color: #e2401c;
    font-weight: 600;
}

/* Resumen de totales */
.wvv-totals-summary {
    padding: 20px;
    background: #fff;
    border-radius: 3px;
    margin-bottom: 20px;
}

.wvv-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.wvv-total-row:last-child {
    border-bottom: none;
}

.wvv-total-row.total {
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid #ddd;
    font-size: 1.2em;
    font-weight: 600;
}

.wvv-total-row .label {
    color: #666;
}

.wvv-total-row .value {
    font-weight: 600;
    color: #333;
}

.wvv-total-row.total .value {
    color: #77a464;
    font-size: 1.1em;
}

/* Botón de añadir al carrito */
.wvv-add-to-cart-wrapper {
    text-align: center;
}

.wvv-add-to-cart-button {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    background: #77a464;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.wvv-add-to-cart-button:hover:not(:disabled) {
    background: #5a8049;
}

.wvv-add-to-cart-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Mensajes */
.wvv-message {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 3px;
    text-align: center;
}

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

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

.wvv-message.notice {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ========================================
   RESPONSIVE - Tablet y móvil
   ======================================== */

@media (max-width: 1024px) {
    .wvv-variations-table {
        font-size: 0.95em;
    }
    
    .wvv-variations-table th,
    .wvv-variations-table td {
        padding: 10px;
    }
    
    .wvv-quantity-input {
        width: 70px;
    }
}

@media (max-width: 768px) {
    .wvv-variations-matrix {
        padding: 15px;
    }
    
    /* Tabla de precios horizontal responsive */
    .wvv-pricing-horizontal {
        font-size: 0.85em;
    }
    
    .wvv-pricing-horizontal th,
    .wvv-pricing-horizontal td {
        padding: 8px 3px;
        font-size: 0.95em;
    }
    
    /* Tabla de variaciones responsive */
    .wvv-variations-table {
        font-size: 0.85em;
    }
    
    .wvv-variations-table th,
    .wvv-variations-table td {
        padding: 8px 6px;
    }
    
    .wvv-quantity-input {
        width: 60px;
        padding: 5px 4px;
        font-size: 13px;
    }
    
    .wvv-variations-table .variation-quantity {
        width: 80px;
    }
    
    .wvv-totals-summary {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .wvv-variations-matrix {
        padding: 12px;
    }
    
    /* Tabla de precios muy compacta en móvil pequeño */
    .wvv-pricing-horizontal {
        font-size: 0.75em;
    }
    
    .wvv-pricing-horizontal th,
    .wvv-pricing-horizontal td {
        padding: 6px 2px;
    }
    
    /* Tabla de variaciones muy compacta */
    .wvv-variations-table {
        font-size: 0.75em;
    }
    
    .wvv-variations-table th,
    .wvv-variations-table td {
        padding: 6px 4px;
    }
    
    .wvv-quantity-input {
        width: 50px;
        padding: 4px 2px;
        font-size: 12px;
    }
    
    .wvv-variations-table .variation-quantity {
        width: 60px;
    }
    
    /* Botón a ancho completo en móvil */
    .wvv-add-to-cart-button {
        width: 100%;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wvv-message {
    animation: fadeIn 0.3s ease;
}