/* ==============================================
   ESTILOS PARA MATRIZ MULTIDIMENSIONAL
   ============================================== */

/* Contenedor principal de dimensiones */
.selector-dimension {
    margin-bottom: 20px;
}

.selector-dimension h3 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #222;
}

.dimension-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    display: block;
}

/* Botón de guía */
.btn-guia {
    display: inline-block;
    padding: 4px 8px;
    background: #f0f8ff;
    border: 1px solid #034D8E;
    border-radius: 4px;
    color: #034D8E;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s ease;
}

.btn-guia:hover {
    background: #034D8E;
    color: white;
}

/* Opciones visuales (para colores/imágenes) */
.opciones-visuales {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.opcion-visual {
    position: relative;
    display: inline-block;
    padding: 0;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.opcion-visual img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    display: block;
}

.opcion-visual span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.2s ease;
}

.opcion-visual:hover span {
    transform: translateY(0);
}

.opcion-visual:hover {
    border-color: #034D8E;
    transform: scale(1.05);
}

.opcion-visual.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ccc;
}

.opcion-visual.disabled:hover {
    transform: none;
    border-color: #ccc;
}

/* Opciones de texto (para talles/medidas) */
.opciones-texto {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.opcion-texto {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 50px;
    text-align: center;
}

.opcion-texto:hover {
    border-color: #034D8E;
    background: #f0f8ff;
    color: #034D8E;
}

.opcion-texto.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ccc;
    color: #999;
}

.opcion-texto.disabled:hover {
    border-color: #ccc;
    background: white;
    color: #999;
}

/* Estados seleccionados */
.contenedor-color input[type="radio"]:checked+label.imagen,
.opcion-visual.selected {
    border-color: #034D8E;
    box-shadow: 0 0 0 2px rgba(3, 77, 142, 0.2);
}

.contenedor-talle input[type="radio"]:checked+label.texto,
.opcion-texto.selected {
    border-color: #034D8E;
    background: #034D8E;
    color: white;
}

/* Estilos para cards de productos */
.opciones-card {
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 8px;
}

.opciones-card-texto {
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 8px;
}

.opcion-texto-mini {
    font-size: 10px;
    padding: 2px 6px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-right: 4px;
    margin-bottom: 2px;
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {

    .opciones-visuales,
    .opciones-texto {
        gap: 6px;
    }

    .opcion-visual img {
        width: 40px;
        height: 40px;
    }

    .opcion-texto {
        padding: 6px 12px;
        font-size: 12px;
        min-width: 40px;
    }

    .selector-dimension {
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .opcion-visual img {
        width: 35px;
        height: 35px;
    }

    .opcion-texto {
        padding: 5px 10px;
        font-size: 11px;
        min-width: 35px;
    }

    .opciones-card {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }

    .opciones-card a {
        margin-right: 3px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selector-dimension {
    animation: fadeIn 0.3s ease-out;
}

/* Estados de carga */
.opciones-loading {
    opacity: 0.6;
    pointer-events: none;
}

.opciones-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #034D8E;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Accesibilidad */
.opcion-visual:focus,
.opcion-texto:focus {
    outline: 2px solid #034D8E;
    outline-offset: 2px;
}

/* Tooltips para especificaciones */
.guia-dimension {
    margin-bottom: 10px;
}

.guia-dimension .btn-guia {
    position: relative;
}

.guia-dimension .btn-guia::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.guia-dimension .btn-guia:hover::after {
    opacity: 1;
}

/**
 * Estilos para productos matriz y rangos de precio
 */

/* Indicador de producto matriz */
.indicador-matriz {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #007bff;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7em;
    z-index: 10;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Precios de matriz */
.precio-rango {
    font-size: 0.9em;
    color: #666;
    font-weight: normal;
    line-height: 1.2;
}

.precio-unico {
    font-size: 1.2em;
    color: #000;
    font-weight: bold;
}

.precio-normal {
    font-size: 1.2em;
    color: #000;
    font-weight: bold;
}

/* Producto matriz en listados */
.product-card[data-es-padre-matriz="true"] {
    position: relative;
}

.product-card[data-es-padre-matriz="true"]::after {
    content: "Múltiples opciones";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #007bff;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: 500;
    z-index: 10;
}

/* Mensaje de sin stock */
.mensaje-sin-stock {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
}

.mensaje-sin-stock strong {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

/* Estilos para rangos de precio en diferentes contextos */
.precio-desde-hasta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.precio-desde {
    font-size: 0.8em;
    color: #666;
}

.precio-hasta {
    font-size: 1.1em;
    color: #000;
    font-weight: bold;
}

/* Indicador visual adicional para productos matriz */
.producto-matriz-indicador {
    display: inline-block;
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 500;
    margin-left: 8px;
    vertical-align: middle;
}

/* Hover effects para productos matriz */
.product-card[data-es-padre-matriz="true"]:hover {
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
    transition: box-shadow 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .indicador-matriz {
        font-size: 0.6em;
        padding: 1px 4px;
    }

    .precio-rango {
        font-size: 0.8em;
    }

    .product-card[data-es-padre-matriz="true"]::after {
        font-size: 0.6em;
        padding: 1px 4px;
    }
}

/* Animaciones para transiciones suaves */
.product-card {
    transition: all 0.3s ease;
}

.precio-rango,
.precio-unico,
.precio-normal {
    transition: color 0.3s ease;
}

/* Estados de carga para redirecciones */
.cargando-redireccion {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.cargando-redireccion .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}