/* --- Estilos para la tabla de variaciones --- */

.mtv-variations-table-wrapper {
    margin-top: 3em; /* Espacio superior para separarlo del contenido anterior */
    margin-bottom: 3em;
	clear: both;
}

.mtv-table-title {
    margin-bottom: 1.5em;
}

.mtv-variations-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e0e0e0;
}

.mtv-variations-table th,
.mtv-variations-table td {
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.mtv-variations-table thead th {
    background-color: #f7f7f7;
    font-weight: bold;
}

.mtv-variations-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Celda de la imagen */
.mtv-cell-image img {
    height: auto;
    display: block;
	width: 100%;
	max-width: 70px !important;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

/* Celda SKU */
.mtv-cell-sku {
    font-family: monospace;
    font-size: 0.9em;
    color: #666;
    white-space: nowrap;
}

/* Estilos para la celda de stock */
.mtv-stock-value {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
}

.mtv-stock-value.in-stock {
    background-color: #e4f5e4;
    color: #0b9444;
}

/* === NUEVOS ESTILOS PARA CONTROLES COMPACTOS === */

/* Celda fusionada de compra */
.mtv-cell-merged {
    padding: 8px 12px !important;
}

.mtv-purchase-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

/* === Información de cantidad mínima === */
.mtv-min-qty-info {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-bottom: 2px;
    white-space: nowrap;
}

/* Contenedor de entrada y botón */
.mtv-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

/* Contenedor de cantidad compacto */
.mtv-quantity-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.mtv-quantity-input {
    width: 50px !important;
    height: 32px;
    border: none !important;
    outline: none !important;
    text-align: center;
    font-size: 14px;
    margin: 0 !important;
    padding: 0 4px !important;
    box-shadow: none !important;
    background: transparent !important;
    -moz-appearance: textfield; /* Firefox */
}

/* Ocultar flechas nativas en Chrome/Safari */
.mtv-quantity-input::-webkit-outer-spin-button,
.mtv-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Botones de cantidad verticales */
.mtv-quantity-buttons {
    display: flex;
    flex-direction: column;
    border-left: 1px solid #ddd;
}

.mtv-qty-up,
.mtv-qty-down {
    width: 20px;
    height: 16px;
    border: none;
    background: #f8f8f8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    padding: 0;
    margin: 0;
    transition: background-color 0.2s ease;
    user-select: none;
}

.mtv-qty-up:hover,
.mtv-qty-down:hover {
    background: #e0e0e0;
}

.mtv-qty-up:active,
.mtv-qty-down:active {
    background: #d0d0d0;
}

.mtv-qty-up {
    border-bottom: 1px solid #ddd;
}

.mtv-qty-up span,
.mtv-qty-down span {
    color: #666;
    font-weight: bold;
}

/* Botón de añadir al carrito - Estilo naranja como la imagen */
.mtv_add_to_cart_button {
    background-color: #ff5722 !important; /* Naranja como en la imagen */
    color: white !important;
    border: none !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    white-space: nowrap;
    min-width: 60px;
    border-radius: 4px !important;
    cursor: pointer;
    transition: background-color 0.3s ease !important;
    font-weight: 500 !important;
}

.mtv_add_to_cart_button:hover {
    background-color: #e64a19 !important; /* Naranja más oscuro en hover */
    color: white !important;
}

.mtv_add_to_cart_button:focus {
    background-color: #e64a19 !important;
    color: white !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(255, 87, 34, 0.3) !important;
}

/* Estados del botón */
.mtv_add_to_cart_button.loading {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #ff5722 !important; /* Mantener color base cuando está loading */
}

.mtv_add_to_cart_button.added {
    background-color: #4cc17c !important; /* Verde para estado "añadido" */
    color: white !important;
}

/* === ESTILOS PARA TOGGLE DE FILAS === */

/* Filas ocultas inicialmente */
.mtv-hidden-row {
    display: none;
}

.mtv-toggle-wrapper {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.mtv-toggle-button {
    background: #ff5722 ;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    color: #FFF;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none; /* Para que funcione como link */
}

.mtv-toggle-button:hover {
    background: #e64a19;
    color: #FFF;
    text-decoration: none; /* Evitar subrayado en hover */
}

.mtv-toggle-button:focus {
    outline: none;
    text-decoration: none;
}

.mtv-toggle-count {
    font-weight: bold;
    color: #FFF;
}

/* --- Media Query para Responsividad (Móviles) --- */
@media screen and (max-width: 768px) {
    .mtv-variations-table thead {
        /* Ocultamos la cabecera en móviles, la información se mostrará en cada celda */
        display: none;
    }

    .mtv-variations-table,
    .mtv-variations-table tbody,
    .mtv-variations-table tr,
    .mtv-variations-table td {
        display: block; /* Hacemos que la tabla se comporte como bloques */
        width: 100%;
    }

    .mtv-variations-table tr {
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        overflow: hidden;
    }

    .mtv-variations-table td {
        text-align: right; /* Alineamos el contenido a la derecha */
        padding-left: 50%; /* Dejamos espacio para la etiqueta */
        position: relative;
        border-bottom: 1px solid #f0f0f0; /* Borde más suave entre celdas */
    }
    
    .mtv-variations-table td:last-child {
        border-bottom: none;
    }

    .mtv-variations-table td::before {
        /* Usamos el atributo data-label para mostrar el nombre de la columna */
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        font-weight: bold;
        text-align: left;
    }

    /* Ajustes específicos para celdas en móvil */
    .mtv-cell-image {
        display: flex;
        justify-content: flex-end; /* Alineamos la imagen a la derecha */
    }

    .mtv-cell-merged {
        padding: 15px !important;
    }

    .mtv-cell-merged::before {
        top: 15px;
    }

    /* Controles compactos en móvil */
    .mtv-purchase-controls {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .mtv-min-qty-info {
        text-align: center;
        margin-bottom: 5px;
    }

    .mtv-quantity-wrapper {
        justify-content: center;
        max-width: 120px;
        margin: 0 auto;
    }

    .mtv_add_to_cart_button {
        width: 100%;
        max-width: 120px;
        margin: 0 auto;
    }
}