/* ============================================
   DOLLARHUB — MODERN & INTERACTIVE ANIMATIONS
   ============================================ */

/* ---------------------------------------------------
   1. CORE KEYFRAMES
--------------------------------------------------- */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary-color); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes float-rotate {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(3deg); }
}

@keyframes scroll {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes glow-pulse {
    0% { box-shadow: 0 0 5px rgba(139, 92, 246, 0.2), 0 0 10px rgba(139, 92, 246, 0.1); }
    50% { box-shadow: 0 0 15px rgba(139, 92, 246, 0.6), 0 0 30px rgba(139, 92, 246, 0.3); }
    100% { box-shadow: 0 0 5px rgba(139, 92, 246, 0.2), 0 0 10px rgba(139, 92, 246, 0.1); }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---------------------------------------------------
   2. PREMIUM SCROLL REVEAL CLASSES
   (Add these classes to HTML elements for smooth scroll entry)
--------------------------------------------------- */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

.fade-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.fade-in-left.visible { opacity: 1; transform: translateX(0); }

.fade-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.fade-in-right.visible { opacity: 1; transform: translateX(0); }

.slide-up {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.slide-up.visible { opacity: 1; transform: translateY(0); }

/* Staggered Slide Up (For grids) */
.slide-up:nth-child(1) { transition-delay: 0.1s; }
.slide-up:nth-child(2) { transition-delay: 0.2s; }
.slide-up:nth-child(3) { transition-delay: 0.3s; }
.slide-up:nth-child(4) { transition-delay: 0.4s; }
.slide-up:nth-child(5) { transition-delay: 0.5s; }
.slide-up:nth-child(6) { transition-delay: 0.6s; }

.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.scale-in.visible { opacity: 1; transform: scale(1); }

/* ---------------------------------------------------
   3. INTERACTIVE HOVER EFFECTS
--------------------------------------------------- */

/* Magnetic Lift & Glow for Cards */
.market-card, .feature-card, .showcase-card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.4s ease, 
                border-color 0.4s ease !important;
}
.market-card:hover, .feature-card:hover, .showcase-card:hover {
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15), 
                0 0 20px rgba(139, 92, 246, 0.1) !important;
}

/* Animated Glow Border for Calculator Card */
.calculator-card {
    position: relative;
}
.calculator-card::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, #8b5cf6, #3b82f6, #10b981, #8b5cf6);
    background-size: 300% 300%;
    border-radius: 30px;
    z-index: -1;
    animation: gradient-shift 4s ease infinite;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.calculator-card:hover::after {
    opacity: 1;
}

/* Button Pulse & Hover */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary::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.5s ease;
}
.btn-primary:hover::before {
    left: 100%;
}
.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.5);
}
.pulse-btn {
    animation: pulse 2s infinite;
}
.bounce-btn {
    animation: bounce 2s infinite;
}

/* Icon Rotate on Hover */
.rotate-icon {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.feature-card:hover .rotate-icon,
.contact-info-card:hover .rotate-icon {
    transform: rotate(360deg) scale(1.2);
    color: var(--primary-color);
}

/* Social Icon Bounce */
.social-link:hover svg {
    animation: bounce 0.6s ease;
}

/* ---------------------------------------------------
   4. TEXT & GLOW EFFECTS
--------------------------------------------------- */
.glow-text {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 10px rgba(255, 255, 255, 0.2), 0 0 20px rgba(255, 255, 255, 0.1); }
    to { text-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px rgba(255, 255, 255, 0.4); }
}

/* Gradient Text Flow */
.animated-gradient-text {
    background: linear-gradient(270deg, #8b5cf6, #3b82f6, #ec4899, #8b5cf6);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 4s ease infinite;
}

/* ---------------------------------------------------
   5. LOADING ANIMATIONS
--------------------------------------------------- */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

/* ---------------------------------------------------
   6. LIVE PULSE (For Tickers / Status)
--------------------------------------------------- */
@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ---------------------------------------------------
   7. 3D TILT EFFECT (JS Required for full effect, CSS fallback)
--------------------------------------------------- */
.tilt-card {
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}
.tilt-card:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg) scale3d(1.02, 1.02, 1.02);
}

/* ---------------------------------------------------
   8. FLOATING ELEMENTS
--------------------------------------------------- */
.floating-element {
    animation: float-rotate 6s ease-in-out infinite;
}

/* ---------------------------------------------------
   9. PARTICLE FLOAT
--------------------------------------------------- */
@keyframes particle-float {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

@keyframes floatAndSpin {
    0% {
        /* Start at bottom, no rotation */
        transform: translateY(0) rotate(0deg) scale(1);
    }
    25% {
        /* Float up, rotate 90 degrees */
        transform: translateY(-20px) rotate(90deg) scale(1.02);
    }
    50% {
        /* Float highest, rotate 180 degrees (image is upside down) */
        transform: translateY(-35px) rotate(180deg) scale(1.05);
    }
    75% {
        /* Float down, rotate 270 degrees */
        transform: translateY(-20px) rotate(270deg) scale(1.02);
    }
    100% {
        /* Return to start, complete 360 rotation */
        transform: translateY(0) rotate(360deg) scale(1);
    }
}

/* Sparkle twinkling */
@keyframes sparkle-anim {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(45deg);
    }
}

/* Glow breathing effect */
@keyframes pulse-glow {
    0% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}
