/**
 * ADAPTIVE FPS CSS
 * Uses CSS variables set by adaptive-fps.js for optimal animation performance
 */

/* Default CSS Variables (overridden by JS) */
:root {
    --refresh-rate: 60;
    --frame-time: 16.67ms;
    --animation-speed: 1;
    --transition-fast: 150ms;
    --transition-normal: 300ms;
    --transition-slow: 500ms;
}

/* Adaptive Transitions */
* {
    transition-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Smooth Scroll Behavior (respects refresh rate) */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Button Animations - Adaptive */
.btn, button, a.btn {
    transition: all var(--transition-fast) ease;
    will-change: transform;
}

.btn:hover, button:hover {
    transform: translateY(-2px) scale(1.02);
    transition-duration: calc(var(--transition-fast) * 0.8);
}

.btn:active, button:active {
    transform: translateY(0) scale(0.98);
    transition-duration: calc(var(--transition-fast) * 0.5);
}

/* Product Card Animations - Adaptive */
.product-card {
    transition: all var(--transition-normal) ease;
    will-change: transform, box-shadow;
}

.product-card:hover {
    transform: translateY(-8px);
    transition-duration: calc(var(--transition-normal) * 0.9);
}

/* Modal Animations - Adaptive */
.modal {
    transition: opacity var(--transition-normal) ease,
                transform var(--transition-normal) ease;
}

.modal.visible {
    animation: modalFadeIn calc(var(--transition-normal) * 1.2) cubic-bezier(0.4, 0.0, 0.2, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Smooth Scrollbar (60Hz+) */
body.fps-120, body.fps-144 {
    --scrollbar-smooth: smooth;
}

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00ffc8, #00d4ff);
    border-radius: 6px;
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
}

/* High Refresh Rate Enhancements (120Hz+) */
body.fps-120, body.fps-144 {
    /* Smoother micro-interactions */
    --micro-animation-duration: calc(var(--transition-fast) * 0.7);
}

body.fps-120 .product-card:hover,
body.fps-144 .product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 40px rgba(0, 255, 200, 0.2);
}

/* Particle Effects - Adaptive Performance */
.particle {
    animation-duration: calc(1000ms * var(--animation-speed));
    animation-timing-function: linear;
    will-change: transform, opacity;
}

/* Loading Animations - Adaptive */
.loading-spinner {
    animation: spin calc(800ms / var(--animation-speed)) linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Parallax Effects - Performance Optimized */
.parallax {
    will-change: transform;
    transform: translateZ(0); /* Force GPU acceleration */
}

body.fps-60 .parallax {
    /* Reduced parallax on 60Hz for smoothness */
    --parallax-strength: 0.3;
}

body.fps-120 .parallax,
body.fps-144 .parallax {
    /* Enhanced parallax on high refresh rates */
    --parallax-strength: 0.5;
}

/* Hover Effects - Adaptive Speed */
.card-hover-effect {
    transition: transform var(--transition-normal),
                box-shadow var(--transition-normal);
}

.card-hover-effect:hover {
    transform: translateY(-6px) rotateX(2deg);
}

body.fps-120 .card-hover-effect:hover,
body.fps-144 .card-hover-effect:hover {
    transform: translateY(-8px) rotateX(3deg);
}

/* Glassmorphism Effects - Adaptive Blur */
.glass {
    backdrop-filter: blur(10px);
    transition: backdrop-filter var(--transition-normal);
}

body.fps-120 .glass:hover,
body.fps-144 .glass:hover {
    backdrop-filter: blur(15px);
}

/* Text Animations - Adaptive */
.text-shimmer {
    background-size: 200% auto;
    animation: shimmer calc(2000ms * var(--animation-speed)) linear infinite;
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .parallax {
        transform: none !important;
    }
    
    .particle {
        display: none !important;
    }
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Smooth Font Rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Optimize Animations for High Refresh Rates */
@media (min-resolution: 120dpi) {
    body.fps-120, body.fps-144 {
        /* Enable additional visual enhancements */
        --enhanced-shadows: drop-shadow(0 8px 32px rgba(0, 255, 200, 0.15));
    }
}

/* Container Smooth Scroll */
.smooth-scroll-container {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Adaptive Grid Animations */
.grid-item {
    animation: fadeInUp calc(400ms * var(--animation-speed)) cubic-bezier(0.4, 0.0, 0.2, 1) backwards;
}

.grid-item:nth-child(1) { animation-delay: calc(50ms * var(--animation-speed)); }
.grid-item:nth-child(2) { animation-delay: calc(100ms * var(--animation-speed)); }
.grid-item:nth-child(3) { animation-delay: calc(150ms * var(--animation-speed)); }
.grid-item:nth-child(4) { animation-delay: calc(200ms * var(--animation-speed)); }
.grid-item:nth-child(5) { animation-delay: calc(250ms * var(--animation-speed)); }
.grid-item:nth-child(6) { animation-delay: calc(300ms * var(--animation-speed)); }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Debug Info (removed after 2 seconds by JS) */
#fps-indicator {
    font-family: 'Courier New', monospace;
    user-select: none;
}
