/* ============================================
   🔥 CARDS MOBILE ULTRA-DINÁMICAS V2
   Con efecto 3D, imágenes grandes y optimizaciones
   ============================================ */

/* ================================
   MOBILE PRINCIPAL (<768px)
   ================================ */
@media (max-width: 768px) {
    
    /* ===== 1. ESTRUCTURA BASE MEJORADA ===== */
    .products-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        padding: 0 12px !important;
    }
    
    .product-card-premium {
        border-radius: 24px !important;
        width: calc(100% - 24px) !important;
        margin: 0 auto !important;
        
        /* Glassmorphism background */
        background: linear-gradient(
            135deg,
            rgba(25, 25, 25, 0.95) 0%,
            rgba(15, 15, 15, 0.95) 100%
        ) !important;
        backdrop-filter: blur(10px) !important;
        
        /* Borde sutil */
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        
        /* Sombra dinámica */
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
        
        /* Transiciones suaves */
        transition: all 0.25s ease-out !important;
        
        /* Altura mínima */
        min-height: 420px !important;
        
        /* Overflow para efectos */
        overflow: hidden !important;
        position: relative !important;
        
        /* IMPORTANTE: Preparar para 3D */
        transform-style: preserve-3d !important;
        perspective: 1000px !important;
    }
    
    
    /* ===== 2. ANIMACIÓN AL APARECER (Slide-in desde derecha) ===== */
    .product-card-premium {
        animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
        animation-fill-mode: both !important;
    }
    
    /* Delays escalonados para efecto cascada */
    .product-card-premium:nth-child(1) { animation-delay: 0.05s !important; }
    .product-card-premium:nth-child(2) { animation-delay: 0.1s !important; }
    .product-card-premium:nth-child(3) { animation-delay: 0.15s !important; }
    .product-card-premium:nth-child(4) { animation-delay: 0.2s !important; }
    .product-card-premium:nth-child(5) { animation-delay: 0.25s !important; }
    .product-card-premium:nth-child(6) { animation-delay: 0.3s !important; }
    
    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(40px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateX(0) scale(1);
        }
    }
    
    
    /* ===== 3. EFECTO 3D AL TOCAR ===== */
    .product-card-premium:active {
        transform: 
            scale(0.96) 
            rotateX(8deg) 
            rotateY(-5deg) !important;
        box-shadow: 
            0 35px 70px rgba(0, 0, 0, 0.95),
            inset 0 2px 5px rgba(255, 255, 255, 0.15),
            0 0 50px rgba(0, 255, 156, 0.25) !important;
        transition: all 0.2s ease-out !important;
    }
    
    /* La imagen crece cuando se toca la card */
    .product-card-premium:active .product-img {
        transform: scale(2.0) !important; /* De 1.8 a 2.0 cuando se toca */
        filter: 
            brightness(1.12) 
            drop-shadow(0 0 30px rgba(0, 255, 156, 0.4)) !important;
    }
    
    
    /* ===== 4. IMAGEN MUCHO MÁS GRANDE - ENFOQUE AGRESIVO ===== */
    .product-image-container {
        position: relative !important;
        overflow: visible !important; /* Dejar que la imagen crezca */
        padding: 0px !important; 
        margin: 0px !important; 
        height: 300px !important; /* Contenedor más alto */
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .product-image-wrapper {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: visible !important;
    }
    
    .product-img {
        /* IMAGEN GIGANTE CON SCALE */
        width: 100% !important; 
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        min-height: 300px !important; /* Altura mínima grande */
        object-fit: contain !important;
        transform: scale(1.8) !important; /* ESCALA GRANDE - 1.8x */
        transform-origin: center center !important;
        transition: all 0.3s ease-out !important;
        transform-style: preserve-3d !important;
        /* Drop shadow controlado */
        filter: drop-shadow(0 10px 30px rgba(0, 255, 156, 0.15)) !important;
    }
    
    
    /* ===== 5. GRADIENTE SUTIL EN FONDO ===== */
    .product-card-premium::before {
        content: '' !important;
        position: absolute !important;
        inset: 0 !important;
        background: radial-gradient(
            circle at 30% 30%,
            rgba(0, 255, 156, 0.03) 0%,
            transparent 60%
        ) !important;
        opacity: 1 !important;
        display: block !important;
        z-index: 0 !important;
        pointer-events: none !important;
    }
    
    /* Asegurar que el contenido esté encima */
    .product-content,
    .product-image-container,
    .product-badges,
    .btn-favorite {
        position: relative !important;
        z-index: 1 !important;
    }
    
    
    /* ===== 6. BADGES ANIMADOS (Pulse) ===== */
    .product-badge {
        animation: badgePulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    }
    
    @keyframes badgePulse {
        0%, 100% {
            transform: scale(1);
            opacity: 1;
        }
        50% {
            transform: scale(1.05);
            opacity: 0.9;
        }
    }
    
    .product-badge.new {
        animation: badgePulseGlow 2s ease-in-out infinite !important;
    }
    
    @keyframes badgePulseGlow {
        0%, 100% {
            box-shadow: 0 4px 12px rgba(0, 255, 156, 0.4);
        }
        50% {
            box-shadow: 0 6px 20px rgba(0, 255, 156, 0.7);
        }
    }
    
    
    /* ===== 7. BOTONES CON RIPPLE EFFECT ===== */
    .btn-view-premium,
    .btn-cart-premium {
        position: relative !important;
        overflow: hidden !important;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }
    
    .btn-view-premium:active {
        transform: scale(0.95) !important;
        background: rgba(255, 255, 255, 0.12) !important;
    }
    
    .btn-cart-premium:active {
        transform: scale(0.92) rotate(10deg) !important;
        box-shadow: 0 6px 20px rgba(0, 255, 156, 0.5) !important;
    }
    
    /* Efecto ripple */
    .ripple {
        position: absolute !important;
        border-radius: 50% !important;
        background: rgba(0, 255, 156, 0.5) !important;
        transform: scale(0) !important;
        animation: ripple-animation 0.6s ease-out !important;
        pointer-events: none !important;
    }
    
    @keyframes ripple-animation {
        to {
            transform: scale(4);
            opacity: 0;
        }
    }
    
    
    /* ===== 8. PRECIO CON GLOW EFFECT ===== */
    .product-price-premium {
        font-size: 1.5rem !important;
        text-shadow: 
            0 0 10px rgba(0, 255, 156, 0.3),
            0 0 20px rgba(0, 255, 156, 0.2),
            0 2px 4px rgba(0, 0, 0, 0.5) !important;
        animation: priceGlow 3s ease-in-out infinite !important;
    }
    
    @keyframes priceGlow {
        0%, 100% {
            text-shadow: 
                0 0 10px rgba(0, 255, 156, 0.3),
                0 0 20px rgba(0, 255, 156, 0.2);
        }
        50% {
            text-shadow: 
                0 0 15px rgba(0, 255, 156, 0.5),
                0 0 30px rgba(0, 255, 156, 0.3);
        }
    }
    
    
    /* ===== 9. STOCK BADGE MEJORADO ===== */
    .stock-badge {
        border-radius: 12px !important;
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
        transition: all 0.3s ease !important;
    }
    
    .stock-badge.stock-available {
        animation: stockPulse 2s ease-in-out infinite !important;
    }
    
    @keyframes stockPulse {
        0%, 100% {
            box-shadow: 0 4px 12px rgba(0, 255, 156, 0.3);
        }
        50% {
            box-shadow: 0 6px 16px rgba(0, 255, 156, 0.5);
        }
    }
    
    
    /* ===== 10. TÍTULO CON EFECTO HOVER ===== */
    .product-title {
        font-size: 1.1rem !important;
        transition: all 0.3s ease !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    }
    
    .product-card-premium:active .product-title {
        color: #00ff9c !important;
        text-shadow: 
            0 0 10px rgba(0, 255, 156, 0.5),
            0 1px 2px rgba(0, 0, 0, 0.3) !important;
    }
    
    
    /* ===== 11. SPECS PILLS ANIMADAS ===== */
    .product-specs .spec {
        padding: 6px 14px !important;
        border-radius: 20px !important;
        background: rgba(0, 255, 156, 0.08) !important;
        border: 1px solid rgba(0, 255, 156, 0.15) !important;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
        display: inline-block !important;
    }
    
    .product-card-premium:active .product-specs .spec {
        background: rgba(0, 255, 156, 0.15) !important;
        border-color: rgba(0, 255, 156, 0.3) !important;
        transform: scale(1.05) !important;
    }
    
    
    /* ===== 12. LOADING SKELETON MEJORADO ===== */
    .product-card-premium.loading {
        background: linear-gradient(
            90deg,
            rgba(20, 20, 20, 1) 0%,
            rgba(30, 30, 30, 1) 25%,
            rgba(40, 40, 40, 1) 50%,
            rgba(30, 30, 30, 1) 75%,
            rgba(20, 20, 20, 1) 100%
        ) !important;
        background-size: 200% 100% !important;
        animation: skeletonShimmer 1.5s ease-in-out infinite !important;
    }
    
    @keyframes skeletonShimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
    
    
    /* ===== 13. BOTÓN FAVORITO A LA DERECHA ===== */
    .btn-favorite {
        position: absolute !important;
        top: 12px !important;
        right: 12px !important; /* A LA DERECHA */
        left: auto !important; /* Anular cualquier left */
        width: 44px !important;
        height: 44px !important;
        border-radius: 12px !important;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
        background: rgba(0, 0, 0, 0.6) !important;
        backdrop-filter: blur(10px) !important;
        z-index: 10 !important; /* Por encima de badges */
    }
    
    .btn-favorite:active {
        transform: scale(0.9) rotate(10deg) !important;
    }
    
    .btn-favorite.active {
        animation: heartBeat 0.6s ease-in-out !important;
    }
    
    @keyframes heartBeat {
        0%, 100% { transform: scale(1); }
        25% { transform: scale(1.3); }
        50% { transform: scale(1.1); }
        75% { transform: scale(1.2); }
    }
    
}


/* ================================
   MOBILE PEQUEÑO (<480px)
   ================================ */
@media (max-width: 480px) {
    .products-grid {
        gap: 16px !important;
        padding: 0 10px !important;
    }
    
    .product-card-premium {
        border-radius: 20px !important;
        min-height: 400px !important;
    }
    
    .product-price-premium {
        font-size: 1.3rem !important;
    }
    
    .product-title {
        font-size: 1rem !important;
    }
}


/* ================================
   MOBILE MUY PEQUEÑO (<375px)
   ================================ */
@media (max-width: 375px) {
    .products-grid {
        gap: 14px !important;
        padding: 0 8px !important;
    }
    
    .product-card-premium {
        border-radius: 18px !important;
        min-height: 380px !important;
    }
    
    .product-price-premium {
        font-size: 1.2rem !important;
    }
}


/* ================================
   OPTIMIZACIONES DE PERFORMANCE
   ================================ */

/* Reducir animaciones en dispositivos con poca batería */
@media (prefers-reduced-motion: reduce) {
    .product-card-premium,
    .product-badge,
    .product-price-premium,
    .btn-favorite,
    .product-img,
    .btn-view-premium,
    .btn-cart-premium {
        animation: none !important;
        transition: none !important;
    }
}

/* GPU acceleration para animaciones */
@media (max-width: 768px) {
    .product-card-premium,
    .product-img,
    .btn-view-premium,
    .btn-cart-premium {
        will-change: transform !important;
        transform: translateZ(0) !important;
        backface-visibility: hidden !important;
    }
}


/* ================================
   NOTAS DE IMPLEMENTACIÓN
   ================================ */

/*
EFECTOS INCLUIDOS:

✅ 1. Bordes redondeados (24px) - Look moderno
✅ 2. Glassmorphism - Profundidad visual
✅ 3. Slide-in animation - Entrada dinámica
✅ 4. Active scale - Feedback táctil
✅ 5. Shimmer en imagen - Efecto premium
✅ 6. Parallax en imagen - Interactividad
✅ 7. Gradiente sutil - Profundidad
✅ 8. Badge pulsante - Atención
✅ 9. Ripple effect - Feedback visual
✅ 10. Precio con glow - Llamativo
✅ 11. Stock animado - Urgencia
✅ 12. Título reactive - Interacción
✅ 13. Specs animadas - Detalle
✅ 14. Skeleton mejorado - Carga elegante
✅ 15. Favorito animated - Satisfacción

PARA RIPPLE EFFECT FUNCIONAL:
Agregar este JavaScript en products.js:

document.querySelectorAll('.btn-view-premium, .btn-cart-premium').forEach(btn => {
    btn.addEventListener('click', function(e) {
        const ripple = document.createElement('span');
        ripple.classList.add('ripple');
        const rect = this.getBoundingClientRect();
        ripple.style.left = (e.clientX - rect.left) + 'px';
        ripple.style.top = (e.clientY - rect.top) + 'px';
        ripple.style.width = ripple.style.height = '100px';
        this.appendChild(ripple);
        setTimeout(() => ripple.remove(), 600);
    });
});

*/