/* =====================================================
   BCVR - World-Class Animations & Effects
   Premium visual effects for the best FiveM experience
   ===================================================== */

/* =====================================================
   Advanced Keyframe Animations
   ===================================================== */

/* Floating animation for elements */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(1deg); }
    50% { transform: translateY(-5px) rotate(0deg); }
    75% { transform: translateY(-15px) rotate(-1deg); }
}

/* Pulse glow effect */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3),
                    0 0 40px rgba(99, 102, 241, 0.2),
                    0 0 60px rgba(99, 102, 241, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.5),
                    0 0 60px rgba(99, 102, 241, 0.3),
                    0 0 90px rgba(99, 102, 241, 0.2);
    }
}

/* Shimmer effect */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Gradient rotation */
@keyframes gradientRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Text reveal animation */
@keyframes textReveal {
    0% {
        clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
        opacity: 0;
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
        opacity: 1;
    }
}

/* Slide up with fade */
@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale in with bounce */
@keyframes scaleInBounce {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate in */
@keyframes rotateIn {
    0% {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* Neon flicker */
@keyframes neonFlicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow:
            0 0 5px var(--primary),
            0 0 10px var(--primary),
            0 0 20px var(--primary),
            0 0 40px var(--primary-light);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* Morph blob */
@keyframes morphBlob {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

/* Scan line effect */
@keyframes scanLine {
    0% { top: -10%; }
    100% { top: 110%; }
}

/* Typewriter cursor blink */
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* =====================================================
   Hero Section Enhancements
   ===================================================== */

/* Animated gradient background */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
    animation: gradientRotate 15s ease infinite;
    background-size: 200% 200%;
    z-index: 0;
}

/* Animated grid overlay */
.hero-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

/* Scanning line effect */
.hero-scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(99, 102, 241, 0.5) 50%,
        transparent 100%);
    animation: scanLine 8s linear infinite;
    pointer-events: none;
    z-index: 2;
}

/* Hero title with glitch effect */
.hero-title-glitch {
    position: relative;
}

.hero-title-glitch::before,
.hero-title-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.hero-title-glitch::before {
    color: #ff00ff;
    animation: glitch1 2s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.hero-title-glitch::after {
    color: #00ffff;
    animation: glitch2 2s infinite;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch1 {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-2px, -2px); }
    80% { transform: translate(2px, 2px); }
}

@keyframes glitch2 {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(2px, -2px); }
    40% { transform: translate(-2px, 2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(-2px, -2px); }
}

/* Animated blob shapes */
.hero-blob {
    position: absolute;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.3) 0%,
        rgba(139, 92, 246, 0.2) 50%,
        rgba(59, 130, 246, 0.1) 100%);
    filter: blur(60px);
    animation: morphBlob 15s ease-in-out infinite;
    z-index: 0;
    opacity: 0.6;
}

.hero-blob-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.hero-blob-2 {
    bottom: 10%;
    right: 10%;
    animation-delay: -5s;
    background: linear-gradient(135deg,
        rgba(239, 68, 68, 0.2) 0%,
        rgba(249, 115, 22, 0.15) 100%);
}

/* =====================================================
   Card Effects - 3D & Glassmorphism
   ===================================================== */

/* 3D Card container */
.card-3d {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.card-3d-inner {
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
    transform: rotateY(5deg) rotateX(5deg);
}

/* Premium glass card */
.glass-card-premium {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.glass-card-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%);
    transition: left 0.7s ease;
}

.glass-card-premium:hover::before {
    left: 100%;
}

.glass-card-premium:hover {
    transform: translateY(-10px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(99, 102, 241, 0.2);
}

/* Glowing border effect */
.glow-border {
    position: relative;
}

.glow-border::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        var(--primary),
        var(--accent-purple),
        var(--accent-cyan),
        var(--primary));
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: gradientRotate 5s ease infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow-border:hover::after {
    opacity: 1;
}

/* =====================================================
   Button Enhancements
   ===================================================== */

/* Magnetic button effect */
.btn-magnetic {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.btn-ripple:active::after {
    transform: scale(2);
    opacity: 1;
    transition: transform 0s, opacity 0s;
}

/* Animated gradient button */
.btn-gradient-animated {
    background: linear-gradient(90deg,
        var(--primary),
        var(--accent-purple),
        var(--accent-cyan),
        var(--primary));
    background-size: 300% 100%;
    animation: gradientRotate 4s ease infinite;
    border: none;
    color: white;
}

/* =====================================================
   Text Animations
   ===================================================== */

/* Animated gradient text */
.text-gradient-animated {
    background: linear-gradient(90deg,
        var(--primary),
        var(--accent-purple),
        var(--accent-cyan),
        var(--accent-pink),
        var(--primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
}

/* Typewriter effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--primary);
    white-space: nowrap;
    animation:
        typing 3.5s steps(40, end),
        cursorBlink 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

/* Character reveal */
.char-reveal span {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) rotateX(-90deg);
    animation: charReveal 0.5s ease forwards;
}

@keyframes charReveal {
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

/* =====================================================
   Scroll Animations
   ===================================================== */

/* Parallax layers */
.parallax-layer {
    transition: transform 0.1s linear;
    will-change: transform;
}

/* Reveal on scroll */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children animation */
.stagger-children > * {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.stagger-children.animate > *:nth-child(1) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.stagger-children.animate > *:nth-child(2) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.stagger-children.animate > *:nth-child(3) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.stagger-children.animate > *:nth-child(4) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
.stagger-children.animate > *:nth-child(5) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }
.stagger-children.animate > *:nth-child(6) { transition-delay: 0.6s; opacity: 1; transform: translateY(0); }

/* =====================================================
   Loading & Transition Effects
   ===================================================== */

/* Premium preloader */
.preloader-premium {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader-premium.loaded {
    opacity: 0;
    visibility: hidden;
}

/* Animated logo loader */
.loader-logo {
    width: 100px;
    height: 100px;
    animation: pulseGlow 2s ease-in-out infinite;
    border-radius: 50%;
}

/* Loading bar */
.loader-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 30px;
    overflow: hidden;
}

.loader-bar-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-purple));
    border-radius: 3px;
    animation: loadingProgress 2s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% { width: 0%; transform: translateX(0); }
    50% { width: 100%; transform: translateX(0); }
    100% { width: 100%; transform: translateX(100%); }
}

/* Page transition overlay */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.page-transition.active {
    transform: translateY(0);
}

/* =====================================================
   Cursor Effects
   ===================================================== */

/* Cursor trail */
.cursor-trail {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* Interactive cursor states */
.cursor-dot.hovering {
    transform: translate(-50%, -50%) scale(0.5);
    background: var(--primary);
}

.cursor-outline.hovering {
    width: 80px;
    height: 80px;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.cursor-outline.clicking {
    transform: translate(-50%, -50%) scale(0.8);
}

/* =====================================================
   Interactive Elements
   ===================================================== */

/* Hover tilt effect */
.tilt-effect {
    transform-style: preserve-3d;
    transform: perspective(1000px);
}

.tilt-effect:hover {
    transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg));
}

/* Magnetic hover */
.magnetic-element {
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Focus ring animation */
.focus-ring:focus {
    outline: none;
    box-shadow:
        0 0 0 3px var(--bg-dark),
        0 0 0 5px var(--primary);
    animation: focusRing 0.3s ease;
}

@keyframes focusRing {
    0% { box-shadow: 0 0 0 0 var(--bg-dark), 0 0 0 0 var(--primary); }
    100% { box-shadow: 0 0 0 3px var(--bg-dark), 0 0 0 5px var(--primary); }
}

/* =====================================================
   Section Dividers
   ===================================================== */

/* Animated wave divider */
.wave-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.wave-divider svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
}

.wave-divider svg path {
    fill: var(--bg-dark);
    animation: waveMove 10s ease-in-out infinite;
}

@keyframes waveMove {
    0%, 100% { d: path('M0,30 C150,60 350,0 500,30 C650,60 850,0 1000,30 L1000,60 L0,60 Z'); }
    50% { d: path('M0,30 C150,0 350,60 500,30 C650,0 850,60 1000,30 L1000,60 L0,60 Z'); }
}

/* =====================================================
   Stats Counter Animation
   ===================================================== */

.counter-animated {
    display: inline-block;
    position: relative;
}

.counter-animated::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 1s ease;
}

.counter-animated.counted::after {
    width: 100%;
}

/* =====================================================
   Special Effects
   ===================================================== */

/* Noise texture overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Vignette effect */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9997;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
}

/* =====================================================
   Responsive Adjustments
   ===================================================== */

@media (max-width: 768px) {
    .hero-blob {
        width: 200px;
        height: 200px;
    }

    .parallax-layer {
        transform: none !important;
    }

    .tilt-effect:hover {
        transform: none;
    }

    /* Disable cursor trail on mobile */
    .cursor-trail,
    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }

    /* Optimize glass cards for mobile */
    .glass-card-premium {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .glass-card-premium:hover {
        transform: translateY(-5px);
    }

    /* Reduce animation complexity on mobile */
    .hero-scan-line {
        display: none;
    }

    .hero-grid-overlay {
        animation: none;
    }

    /* Touch-friendly button sizes */
    .btn-magnetic {
        min-height: 48px;
        min-width: 48px;
    }

    /* Disable hover effects that don't work on touch */
    .glass-card-premium::before {
        display: none;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover-dependent animations */
    .tilt-effect,
    [data-tilt] {
        transform: none !important;
    }

    /* Remove cursor effects */
    .cursor-trail,
    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }

    /* Disable magnetic effect */
    .btn-magnetic {
        transform: none !important;
    }

    /* Simplify card hover states for touch */
    .glass-card-premium:hover {
        transform: none;
    }

    .glass-card-premium:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Touch feedback for buttons */
    .btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }

    /* Disable parallax on touch */
    [data-parallax] {
        transform: none !important;
    }

    /* Optimize scroll reveal for touch */
    .reveal-on-scroll {
        transition-duration: 0.5s;
    }

    /* Improve scrolling performance */
    .stagger-children > * {
        will-change: auto;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .hero-blob {
        width: 150px;
        height: 150px;
        filter: blur(40px);
    }

    .hero-float {
        display: none;
    }

    /* Simpler transitions */
    .glass-card-premium {
        transition: box-shadow 0.3s ease;
    }

    .glass-card-premium:active {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    }

    /* Reduce animation load */
    @keyframes morphBlob {
        0%, 100% {
            border-radius: 50%;
        }
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-blob {
        width: 300px;
        height: 300px;
    }

    .glass-card-premium:hover {
        transform: translateY(-8px);
    }
}

/* High performance mode for older devices */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    /* Use GPU acceleration wisely */
    .glass-card-premium,
    .btn,
    .reveal-on-scroll {
        will-change: auto;
        transform: translateZ(0);
    }
}

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

    .hero-blob,
    .hero-scan-line,
    .hero-grid-overlay {
        display: none;
    }

    .glass-card-premium::before {
        display: none;
    }
}
