/* PERFORMANCE OPTIMIZATION FOR ALL APPS */

/* GPU Acceleration */
* {
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    -o-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Reduce Repaints */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* Optimize Animations */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Remove will-change on mobile */
@media (max-width: 768px) {
    * {
        will-change: auto !important;
    }
}

/* Optimize Images */
img, video {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Contain Layout */
.container, .main-grid, .feature-card {
    contain: layout style paint;
}

/* Reduce Shadow Complexity on Mobile */
@media (max-width: 768px) {
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .cta-btn, .download-btn, .feature-card {
        box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
    }
}

/* Optimize Backdrop Filter */
@media (max-width: 768px) {
    nav, .app-preview, .feature-card {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* Lazy Load Offscreen Content */
.feature-card:not(.visible) {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

/* Reduce Gradient Complexity */
@media (max-width: 768px) {
    .cta-btn, .login-btn, .download-btn {
        background: #667eea !important;
    }
}

/* Optimize Transitions */
button, a, .checkbox-cell {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Remove Expensive Filters on Low-End */
@media (max-width: 480px) {
    .stars {
        display: none !important;
    }
    
    * {
        filter: none !important;
        backdrop-filter: none !important;
    }
}

/* Optimize Scrolling */
html {
    scroll-behavior: auto;
}

@media (min-width: 769px) {
    html {
        scroll-behavior: smooth;
    }
}

/* Reduce Animation Complexity */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Optimize Video Performance */
video {
    object-fit: cover;
    will-change: auto;
}

/* Contain Repaint Areas */
.habit-item, .task-item, .note-card, .transaction-item {
    contain: layout paint;
}

/* Optimize Font Loading */
@font-face {
    font-display: swap;
}

/* Reduce Blur Effects on Mobile */
@media (max-width: 768px) {
    nav {
        background: rgba(0, 0, 0, 0.95) !important;
    }
}

/* Hardware Acceleration for Specific Elements */
.cta-btn, .download-btn, .checkbox-cell, .habit-item {
    transform: translate3d(0, 0, 0);
}

/* Optimize Grid Performance */
.checkbox-grid, .movies-grid, .notes-grid {
    contain: layout;
}

/* Reduce Complexity on Low-End Devices */
@media (max-width: 768px) and (max-resolution: 1dppx) {
    .feature-card {
        border-radius: 15px !important;
    }
    
    .app-preview {
        border-radius: 10px !important;
    }
}
