/* =================================
   MOBILE GAMING SNAP SYSTEM - VERSION CORRIGÉE
   Actif uniquement sur mobile (768px-)
   ================================= */

.apps-gaming-snap {
    display: none; /* Masqué par défaut, activé sur mobile */
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: 0;
}

@media (max-width: 768px) {
    .apps-gaming-snap {
        display: block;
        padding: 0 20px;
    }
    
    /* =================================
       GAMING TABS MOBILE AMÉLIORÉS
       ================================= */
    
    .gaming-tabs {
        display: flex;
        justify-content: center;
        gap: 8px;
        margin-bottom: 25px;
        flex-wrap: wrap;
        padding: 0 10px;
    }
    
    .gaming-tab {
        background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-mid) 100%);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: 14px;
        padding: 10px 16px;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        display: flex;
        align-items: center;
        flex-direction: column;
        gap: 4px;
        position: relative;
        overflow: hidden;
        min-width: 90px;
        backdrop-filter: blur(10px);
        transform-origin: center center;
    }
    
    .gaming-tab::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
        transition: left 0.6s ease;
    }
    
    .gaming-tab:active::before {
        left: 100%;
    }
    
    .gaming-tab.active {
        border-color: var(--primary-gold);
        transform: translateY(-4px) scale(1.08);
        box-shadow: 
            0 15px 30px rgba(245, 158, 11, 0.4),
            0 0 20px rgba(245, 158, 11, 0.3);
        background: linear-gradient(145deg, rgba(245, 158, 11, 0.15) 0%, var(--bg-card) 100%);
        animation: tabActivePulse 2s ease-in-out infinite;
    }
    
    .gaming-tab.active::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--primary-gold), var(--primary-blue));
        border-radius: 0 0 14px 14px;
        animation: tabGradientShift 3s ease-in-out infinite;
    }
    
    .tab-icon {
        font-size: 1.1rem;
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    
    .gaming-tab.active .tab-icon {
        transform: scale(1.2) rotateY(10deg);
        filter: drop-shadow(0 6px 12px rgba(245, 158, 11, 0.6));
        animation: iconFloat 2s ease-in-out infinite;
    }
    
    .tab-name {
        font-weight: 700;
        color: var(--text-light);
        font-size: 0.75rem;
        text-align: center;
        transition: all 0.4s ease;
    }
    
    .gaming-tab.active .tab-name {
        color: var(--primary-gold);
        text-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
        transform: translateY(-1px);
    }
    
    .tab-badge {
        background: var(--primary-gold);
        color: var(--bg-dark);
        padding: 2px 6px;
        border-radius: 8px;
        font-size: 0.55rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        opacity: 0.9;
        transition: all 0.3s ease;
    }
    
    .gaming-tab.active .tab-badge {
        opacity: 1;
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
    }
    
    /* Couleurs spécifiques par tab avec animations */
    .gaming-tab[data-app="0"].active {
        border-color: var(--primary-gold);
        box-shadow: 
            0 15px 30px rgba(245, 158, 11, 0.4),
            0 0 25px rgba(245, 158, 11, 0.6);
    }
    
    .gaming-tab[data-app="1"].active {
        border-color: var(--success-green);
        box-shadow: 
            0 15px 30px rgba(16, 185, 129, 0.4),
            0 0 25px rgba(16, 185, 129, 0.6);
    }
    
    .gaming-tab[data-app="1"].active .tab-name {
        color: var(--success-green);
        text-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
    }
    
    .gaming-tab[data-app="1"].active .tab-badge {
        background: var(--success-green);
    }
    
    .gaming-tab[data-app="2"].active {
        border-color: var(--primary-blue);
        box-shadow: 
            0 15px 30px rgba(14, 165, 233, 0.4),
            0 0 25px rgba(14, 165, 233, 0.6);
    }
    
    .gaming-tab[data-app="2"].active .tab-name {
        color: var(--primary-blue);
        text-shadow: 0 0 12px rgba(14, 165, 233, 0.8);
    }
    
    .gaming-tab[data-app="2"].active .tab-badge {
        background: var(--primary-blue);
    }
    
    /* =================================
       SNAP SCROLL CONTAINER MOBILE AMÉLIORÉ
       ================================= */
    
    .apps-snap-container {
        position: relative;
        width: 100%;
        overflow: hidden;
        border-radius: 20px;
        background: radial-gradient(circle at center, rgba(14, 165, 233, 0.08) 0%, transparent 70%);
        margin-bottom: 20px;
        box-shadow: inset 0 0 50px rgba(14, 165, 233, 0.1);
    }
    
    .apps-snap-scroll {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        gap: 16px;
        padding: 25px 15px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        transform: translateZ(0); /* Optimisation GPU */
    }
    
    .apps-snap-scroll::-webkit-scrollbar {
        display: none;
    }
    
    /* =================================
       MODERN APP CARDS MOBILE AMÉLIORÉES
       ================================= */
    
    .app-card-modern {
        flex: 0 0 88%;
        max-width: 320px;
        min-height: 460px;
        background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-mid) 100%);
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        padding: 20px;
        scroll-snap-align: center;
        position: relative;
        transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        transform-origin: center center;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        will-change: transform, opacity, filter, box-shadow;
        backface-visibility: hidden;
        transform: translateZ(0); /* Optimisation GPU */
    }
    
    /* États des cartes mobile avec transitions fluides */
    .app-card-modern.active {
        transform: scale(1) translateZ(0);
        opacity: 1;
        filter: brightness(1.1) contrast(1.05) saturate(1.1);
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.4),
            0 0 40px var(--primary-blue),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        z-index: 10;
    }
    
    .app-card-modern.preview {
        transform: scale(0.94) translateZ(0);
        opacity: 0.8;
        filter: brightness(0.9) contrast(0.95);
        z-index: 5;
    }
    
    .app-card-modern:not(.active):not(.preview) {
        transform: scale(0.85) translateZ(0);
        opacity: 0.5;
        filter: brightness(0.8);
        z-index: 1;
    }
    
    /* Couleurs spécifiques par app mobile avec glows améliorés */
    .app-card-modern[data-app="0"].active {
        border-color: var(--primary-gold);
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.4),
            0 0 40px rgba(245, 158, 11, 0.8),
            0 0 80px rgba(245, 158, 11, 0.4);
    }
    
    .app-card-modern[data-app="1"].active {
        border-color: var(--success-green);
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.4),
            0 0 40px rgba(16, 185, 129, 0.8),
            0 0 80px rgba(16, 185, 129, 0.4);
    }
    
    .app-card-modern[data-app="2"].active {
        border-color: var(--primary-blue);
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.4),
            0 0 40px rgba(14, 165, 233, 0.8),
            0 0 80px rgba(14, 165, 233, 0.4);
    }
    
    /* Contenu des cartes mobile optimisé avec micro-animations */
    .app-card-modern .app-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 16px;
    }
    
    .app-card-modern .app-icon {
        font-size: 2.5rem;
        opacity: 0.8;
        filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    
    .app-card-modern.active .app-icon {
        animation: iconPulse 2s ease-in-out infinite;
    }
    
    .app-card-modern .app-title {
        color: var(--text-light);
        margin-bottom: 12px;
        font-size: 1.2rem;
        font-weight: 700;
        line-height: 1.3;
        transition: all 0.3s ease;
    }
    
    .app-card-modern.active .app-title {
        text-shadow: 0 0 10px rgba(248, 250, 252, 0.3);
    }
    
    .app-card-modern .app-description {
        color: var(--text-muted);
        margin-bottom: 16px;
        font-size: 0.85rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        transition: color 0.3s ease;
    }
    
    .app-card-modern.active .app-description {
        color: var(--text-light);
    }
    
    .app-card-modern .app-features {
        margin-bottom: 16px;
    }
    
    .app-card-modern .feature-item {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
        color: var(--text-light);
        font-size: 0.8rem;
        padding: 4px 0;
        transition: all 0.3s ease;
    }
    
    .app-card-modern.active .feature-item {
        transform: translateX(2px);
    }
    
    .app-card-modern .feature-icon {
        font-size: 1rem;
        width: 18px;
        opacity: 0.9;
        transition: all 0.3s ease;
    }
    
    .app-card-modern.active .feature-icon {
        opacity: 1;
        filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.5));
    }
    
    /* ✅ CORRECTION : Sélecteur de compatibilité corrigé */
    .app-card-modern .app-compatibility {
        margin-bottom: 6px;
        padding: 4px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.75rem;
        transition: all 0.3s ease;
    }
    
    .app-card-modern.active .app-compatibility {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    /* =================================
       BOUTONS MOBILE - CORRECTION COULEURS
       ================================= */

    .app-card-modern .btn-app {
        background: linear-gradient(135deg, var(--primary-blue) 0%, #0284C7 100%);
        color: white;
        width: 100%;
        padding: 12px 20px;
        font-size: 0.85rem;
        font-weight: 600;
        border-radius: 12px;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        position: relative;
        overflow: hidden;
        border: none;
        cursor: pointer;
        text-decoration: none;
        display: inline-block;
        text-align: center;
        box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
    }

    /* Bouton premium pour Mogo Mys */
    .app-card-modern .btn-premium {
        background: linear-gradient(135deg, var(--primary-gold) 0%, #D97706 100%);
        box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    }

    /* Effets hover */
    .app-card-modern .btn-app:hover {
        transform: translateY(-2px);
        filter: brightness(1.1);
    }

    .app-card-modern .btn-premium:hover {
        box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
    }

    /* Animation pour carte active */
    .app-card-modern.active .btn-app {
        animation: buttonGlow 3s ease-in-out infinite;
    }

    .app-card-modern.active .btn-premium {
        animation: buttonGlowPremium 3s ease-in-out infinite;
    }

    .app-card-modern .btn-app::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
        transition: left 0.6s ease;
    }
    
    .app-card-modern .btn-app:active::before {
        left: 100%;
    }

    .app-card-modern .btn-app:active {
        transform: scale(0.95);
    }

    @keyframes buttonGlow {
        0%, 100% { 
            box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
        }
        50% { 
            box-shadow: 0 8px 30px rgba(14, 165, 233, 0.6);
        }
    }

    @keyframes buttonGlowPremium {
        0%, 100% { 
            box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
        }
        50% { 
            box-shadow: 0 8px 30px rgba(245, 158, 11, 0.6);
        }
    }
    
    /* Masquer le prix sur mobile pour Mogo Mys */
    .app-card-modern .app-pricing {
        display: none;
    }
    
    /* =================================
       SCROLL HINT MOBILE AMÉLIORÉ
       ================================= */
    
    .scroll-hint {
        text-align: center;
        margin-top: 15px;
        opacity: 0.6;
        animation: fadeInOut 4s ease-in-out infinite;
        transition: opacity 0.3s ease;
    }
    
    .scroll-hint span {
        color: var(--text-muted);
        font-size: 0.75rem;
        font-style: italic;
        background: linear-gradient(90deg, var(--primary-blue), var(--primary-gold));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-size: 200% auto;
        animation: textShimmer 2s ease-in-out infinite;
    }
    
    @keyframes fadeInOut {
        0%, 100% { opacity: 0.6; }
        50% { opacity: 0.3; }
    }
    
    @keyframes textShimmer {
        0% { background-position: 0% center; }
        100% { background-position: 200% center; }
    }
    
    /* =================================
       ANIMATIONS MOBILE AMÉLIORÉES
       ================================= */
    
    @keyframes cardEnterMobile {
        from {
            opacity: 0;
            transform: translateY(30px) scale(0.9);
            filter: blur(5px);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
            filter: blur(0);
        }
    }
    
    @keyframes iconPulse {
        0%, 100% { 
            transform: scale(1);
            filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
        }
        50% { 
            transform: scale(1.05);
            filter: drop-shadow(0 6px 12px rgba(245, 158, 11, 0.4));
        }
    }
    
    @keyframes tabActivePulse {
        0%, 100% { 
            transform: translateY(-4px) scale(1.08);
        }
        50% { 
            transform: translateY(-5px) scale(1.1);
        }
    }
    
    @keyframes tabGradientShift {
        0% { background-position: 0% center; }
        50% { background-position: 100% center; }
        100% { background-position: 0% center; }
    }
    
    @keyframes iconFloat {
        0%, 100% { 
            transform: scale(1.2) rotateY(10deg) translateY(0px);
        }
        50% { 
            transform: scale(1.2) rotateY(10deg) translateY(-2px);
        }
    }
    
    @keyframes gradientFlow {
        0% { background-position: 0% center; }
        100% { background-position: 200% center; }
    }
    
    /* Animation d'entrée séquencée améliorée */
    .app-card-modern {
        animation: cardEnterMobile 0.8s ease-out forwards;
    }
    
    .app-card-modern:nth-child(1) { animation-delay: 0.1s; }
    .app-card-modern:nth-child(2) { animation-delay: 0.3s; }
    .app-card-modern:nth-child(3) { animation-delay: 0.5s; }
}

/* =================================
   TRÈS PETITS ÉCRANS (480px-) AMÉLIORÉS
   ================================= */

@media (max-width: 480px) {
    .apps-gaming-snap {
        padding: 0 15px;
    }
    
    .gaming-tabs {
        gap: 6px;
        margin-bottom: 20px;
    }
    
    .gaming-tab {
        padding: 8px 12px;
        min-width: 80px;
    }
    
    .tab-icon {
        font-size: 1rem;
    }
    
    .tab-name {
        font-size: 0.7rem;
    }
    
    .apps-snap-scroll {
        padding: 20px 10px;
        gap: 12px;
    }
    
    .app-card-modern {
        flex: 0 0 92%;
        min-height: 420px;
        padding: 16px;
    }
    
    .app-card-modern .app-title {
        font-size: 1.1rem;
    }
    
    .app-card-modern .app-icon {
        font-size: 2.2rem;
    }
    
    /* Réduire les animations sur très petits écrans pour performance */
    .app-card-modern.active .app-icon {
        animation: none;
        transform: scale(1.05);
    }
    
    .app-card-modern.active .btn-app {
        animation: none;
    }
    
    .gaming-tab.active {
        animation: none;
    }
}

/* =================================
   OPTIMISATIONS PERFORMANCE
   ================================= */

@media (prefers-reduced-motion: reduce) {
    .app-card-modern,
    .gaming-tab,
    .app-icon,
    .btn-app {
        animation: none !important;
        transition-duration: 0.2s !important;
    }
}

/* Optimisation GPU pour appareils low-end */
@media (max-device-width: 768px) and (max-device-height: 1024px) {
    .app-card-modern {
        transform: translate3d(0, 0, 0);
        will-change: transform, opacity;
    }
    
    .gaming-tab {
        transform: translate3d(0, 0, 0);
        will-change: transform;
    }
}