/* ==========================================================================
   TOPSPIN STORE - COMPONENTE: VENTANA MODAL (PRODUCTOS)
   ================================================================          */

/* 1. OVERLAY (El fondo oscuro transparente) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 15, 25, 0.85); /* Fondo oscuro semitransparente */
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Oculto por defecto */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Clase para activar el modal desde JavaScript */
.modal-overlay.activo {
    opacity: 1;
    visibility: visible;
}

/* 2. CONTENEDOR PRINCIPAL DEL MODAL */
.modal-content {
    background-color: var(--bg-dark);
    border: 0.2rem solid var(--gold-primary);
    border-radius: 1.2rem;
    width: 90%;
    max-width: 90rem;
    max-height: 90vh;
    padding: 4.5rem 3rem 3rem;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.5);
    transform: translateY(2rem) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-overlay.activo .modal-content {
    transform: translateY(0) scale(1);
}

/* Botón Cerrar (X) */
.btn-cerrar-modal {
    position: absolute;
    top: 1.8rem;
    right: 2.2rem;
    background: none;
    border: none;
    color: var(--text-gray, #A0AEC0);
    font-size: 3rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.btn-cerrar-modal:hover {
    color: var(--gold-primary, #D4AF37);
    transform: rotate(90deg);
}

/* 3. GRID DEL MODAL (2 Columnas) */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

/* --- COLUMNA IZQUIERDA (Info y Compra) --- */
.modal-izq {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.modal-izq h2 {
    color: var(--text-light);
    font-size: 2.2rem;
    margin-bottom: 2rem;
}

#modal-img {
    width: 100%;
    max-width: 250px; /* Limita el tamaño máximo pero le permite encogerse */
    height: auto;
    object-fit: contain;
    border-radius: 0.8rem;
    margin: 0 auto 2rem; /* Centrado automático */
    background-color: var(--bg-light, #FFFFFF);
    padding: 1rem;
    display: block;
}

.precio-destacado {
    font-size: 2.8rem;
    color: var(--gold-primary);
    font-weight: 800;
    margin-bottom: 2rem;
}

.btn-whatsapp {
    width: 100%;
    background-color: #25D366; /* Color oficial de WhatsApp */
    color: #FFFFFF;
    padding: 1.5rem;
    border-radius: 0.6rem;
    font-size: 1.6rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    transition: background-color 0.3s ease, transform 0.3s ease;
    margin-bottom: 2rem;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
    transform: translateY(-2px);
}

.veredicto-tactico {
    color: var(--text-gray, #A0AEC0);
    font-size: 1.4rem;
    line-height: 1.6;
    font-style: italic;
}

/* --- COLUMNA DERECHA (Barras y Ficha) --- */
.modal-der {
    margin-top: 1rem;
}

/* --- COLUMNA DERECHA (Barras y Ficha) --- */
.stats-container {
    margin-bottom: 3rem;
}

.stat-row {
    margin-bottom: 1.5rem;
}

.stat-info {
    display: flex;
    justify-content: space-between;
    color: var(--text-light);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

/* Fondo de la barra */
.stat-bar-bg {
    width: 100%;
    height: 1.2rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    overflow: hidden;
}

/* Relleno de la barra animada */
.stat-bar-fill {
    height: 100%;
    border-radius: 1rem;
    width: 0%; /* Inicia en 0 para la animación por JS */
    transition: width 1s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Colores para cada atributo */
.stat-1 { background: linear-gradient(90deg, #E65100, #FF9800); } /* Potencia */
.stat-2 { background: linear-gradient(90deg, #0277BD, #29B6F6); } /* Efecto */
.stat-3 { background: linear-gradient(90deg, #2E7D32, #66BB6A); } /* Control */
.stat-4 { background: linear-gradient(90deg, #4527A0, #7E57C2); } /* Rigidez */
.stat-5 { background: linear-gradient(90deg, #B8860B, #FFD700); } /* Sweet Spot */
.stat-6 { background: linear-gradient(90deg, #00838F, #26C6DA); } /* Linealidad */

/* Ficha Técnica */
.ficha-tecnica {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 0.8rem;
}

.ficha-tecnica h4 {
    color: var(--gold-primary);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    letter-spacing: 0.1rem;
}

.ficha-tecnica p {
    color: var(--text-gray, #A0AEC0);
    font-size: 1.4rem;
    line-height: 1.6;
}

/* ==========================================================================
   4. MEDIA QUERIES (MODAL RESPONSIVE)
   ================================================================          */
@media (max-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .modal-content {
        padding: 4.5rem 2rem 2rem; /* Mantiene el espacio superior para la X */
    }
    
    .precio-destacado {
        font-size: 2.4rem;
    }
}

/* ==========================================================================
   OVERRIDE: COLORES EXCLUSIVOS PARA MODAL DE GOMAS
   ================================================================          */
.modal-gomas .stat-1 { background: linear-gradient(90deg, #ff4757, #ff6b81); } 
.modal-gomas .stat-2 { background: linear-gradient(90deg, #2ed573, #7bed9f); } 
.modal-gomas .stat-3 { background: linear-gradient(90deg, #1e90ff, #70a1ff); } 
.modal-gomas .stat-4 { background: linear-gradient(90deg, #ffa502, #eccc68); } 
.modal-gomas .stat-5 { background: linear-gradient(90deg, #9b59b6, #cd84f1); } 
.modal-gomas .stat-6 { background: linear-gradient(90deg, #e58e26, #f6b93b); } 

/* ==========================================================================
   OVERRIDE: MODAL SIMPLIFICADO (ACCESORIOS E INSUMOS)
   ================================================================          */
.modal-accesorio .modal-grid { 
    grid-template-columns: 1fr; 
    max-width: 500px; 
    text-align: center; 
}
.modal-accesorio #modal-img { 
    max-width: 250px; 
    margin: 0 auto 2rem auto; 
}
.modal-accesorio #modal-specs { 
    text-align: left; 
    background: rgba(255, 255, 255, 0.03); 
    padding: 1.5rem; 
    border-radius: 0.8rem; 
    margin-top: 2rem; 
    line-height: 1.6; 
    color: var(--text-gray); 
    font-size: 1.4rem; 
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   VARIANTES DE PRODUCTO (MODAL)
   ================================================================          */
.contenedor-variantes {
    width: 100%;
    margin-bottom: 2rem;
    text-align: left;
}

.grupo-variante {
    margin-bottom: 1.5rem;
}

.grupo-variante p {
    color: var(--text-gray, #A0AEC0);
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    letter-spacing: 0.1rem;
}

.botones-variantes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Botones de selección genéricos */
.btn-variante {
    background: transparent;
    border: 1px solid var(--text-gray, #A0AEC0);
    color: var(--text-light, #FFFFFF);
    padding: 0.8rem 1.5rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-variante:hover {
    border-color: var(--gold-primary, #D4AF37);
}

.btn-variante.seleccionado {
    background-color: var(--gold-primary);
    color: var(--bg-dark);
    border-color: var(--gold-primary);
}

/* Clases específicas para colores */
.btn-color-rojo.seleccionado { background-color: #ff4757; border-color: #ff4757; color: #fff;}
.btn-color-negro.seleccionado { background-color: #2f3542; border-color: #ffffff; color: #fff;}
.btn-color-azul.seleccionado { background-color: #1e90ff; border-color: #1e90ff; color: #fff;}

/* Estado inactivo del botón de compra */
.btn-whatsapp.inactivo {
    background-color: #2c323f;
    color: #718096;
    cursor: not-allowed;
    pointer-events: none; /* Bloquea el clic */
}

/* ==========================================================================
   ACCIONES DEL MODAL (AGREGAR AL PEDIDO + VOLVER)
   ================================================================ */
.modal-acciones {
    width: 100%;
    display: flex;
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.modal-acciones .btn-whatsapp {
    flex: 2;
    width: auto;
    margin-bottom: 0;
    border: none;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.35rem;
    padding: 1.3rem 1.4rem;
}

.modal-acciones .btn-volver-modal {
    flex: 1;
    width: auto;
    font-size: 1.3rem;
    padding: 1.3rem 1.4rem;
}

@media (max-width: 480px) {
    .modal-acciones {
        flex-direction: column;
    }
}