

/* Reduce animations on mobile and respect user preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile-specific performance optimizations */
@media (max-width: 768px) {
    /* Disable heavy background animations on mobile */
    body {
        animation: none !important;
        background: linear-gradient(-45deg, #0a1929, #132f4c, #1e3a5f, #0d2847);
        background-attachment: fixed;
    }
    
    body::before {
        animation: none !important;
        opacity: 0.5;
        transform: none !important;
    }
    
    /* Hide floating shapes on mobile - they're decorative and hurt performance */
    .floating-shape,
    .animated-bg .floating-shape {
        display: none !important;
    }
    
    /* Simplify all animations */
    * {
        will-change: auto !important; /* Remove will-change to reduce memory usage */
    }
    
    /* Reduce animation durations on mobile */
    @keyframes gradientShift {
        0%, 100% { background-position: 0% 50%; }
    }
    
    @keyframes pulseGlow {
        0%, 100% { opacity: 0.5; transform: scale(1); }
    }
    
    /* Optimize backdrop filters for mobile */
    nav,
    .modal,
    .card {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    /* Reduce box shadows on mobile */
    .card,
    .feature-card,
    .dashboard-card,
    .profile-card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    }
    
    /* Optimize transitions */
    * {
        transition-duration: 0.2s !important; /* Faster transitions */
    }
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    *:hover {
        transform: none !important;
    }
}

/* Image lazy loading optimization */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

img[loading="lazy"].loaded {
    animation: none;
    background: none;
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Prevent layout shift */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* GPU acceleration for transforms only */
.card,
.btn,
.nav-link {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Reduce repaints */
.container,
.page-container {
    contain: layout style;
}