/* Web3 Animations and Dynamic Effects for Dreamle Mining */
/* Web3动态交互效果系统 */

/* === Animation Variables === */
:root {
    --animation-duration-fast: 0.2s;
    --animation-duration-normal: 0.4s;
    --animation-duration-slow: 0.8s;
    
    --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --easing-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    --glow-primary: 0 0 20px rgba(0, 255, 136, 0.5);
    --glow-secondary: 0 0 30px rgba(0, 212, 170, 0.4);
    --glow-accent: 0 0 25px rgba(0, 153, 204, 0.3);
}

/* === Floating Particles Background === */
.web3-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 6s infinite linear;
}

.particle:nth-child(odd) {
    animation-duration: 8s;
    animation-delay: -2s;
}

.particle:nth-child(even) {
    animation-duration: 10s;
    animation-delay: -4s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* === Glowing Grid Background === */
.web3-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
    background-image: 
        linear-gradient(rgba(0, 255, 136, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* === Neon Glow Effects === */
.neon-glow {
    position: relative;
    overflow: hidden;
}

.neon-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--primary-gradient);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--animation-duration-normal) var(--easing-smooth);
}

.neon-glow:hover::before {
    opacity: 0.3;
    animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% {
        opacity: 0.3;
        filter: blur(2px);
    }
    50% {
        opacity: 0.6;
        filter: blur(4px);
    }
}

/* === Holographic Card Effect === */
.holographic-card {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: transform var(--animation-duration-normal) var(--easing-smooth);
}

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

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

.holographic-card:hover {
    transform: translateY(-8px) rotateX(5deg);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(0, 255, 136, 0.2);
}

/* === Morphing Button Effects === */
.morphing-button {
    position: relative;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    color: #000;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: all var(--animation-duration-normal) var(--easing-bounce);
}

.morphing-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.morphing-button:hover::before {
    width: 300px;
    height: 300px;
}

.morphing-button:hover {
    transform: scale(1.05);
    box-shadow: var(--glow-primary);
}

.morphing-button:active {
    transform: scale(0.95);
}

/* === Pulse Animation === */
.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 136, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
    }
}

/* === Typing Animation === */
.typing-animation {
    overflow: hidden;
    border-right: 2px solid var(--primary-gradient);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

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

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-gradient);
    }
}

/* === Floating Elements === */
.floating-element {
    animation: float-gentle 6s ease-in-out infinite;
}

.floating-element:nth-child(odd) {
    animation-delay: -2s;
}

.floating-element:nth-child(even) {
    animation-delay: -4s;
}

@keyframes float-gentle {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* === Glitch Effect === */
.glitch-effect {
    position: relative;
    color: var(--text-primary);
}

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

.glitch-effect::before {
    animation: glitch-1 0.5s infinite;
    color: #ff0040;
    z-index: -1;
}

.glitch-effect::after {
    animation: glitch-2 0.5s infinite;
    color: #00ffff;
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 14%, 15%, 49%, 50%, 99%, 100% {
        transform: translate(0);
    }
    15%, 49% {
        transform: translate(-2px, 2px);
    }
}

@keyframes glitch-2 {
    0%, 20%, 21%, 62%, 63%, 99%, 100% {
        transform: translate(0);
    }
    21%, 62% {
        transform: translate(2px, -2px);
    }
}

/* === Loading Spinner === */
.web3-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 255, 136, 0.3);
    border-top: 3px solid var(--primary-gradient);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* === Reveal Animation === */
.reveal-animation {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s var(--easing-smooth);
}

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

/* === Scale on Hover === */
.scale-hover {
    transition: transform var(--animation-duration-normal) var(--easing-smooth);
}

.scale-hover:hover {
    transform: scale(1.05);
}

/* === Slide In Animations === */
.slide-in-left {
    animation: slideInLeft 0.6s var(--easing-smooth);
}

.slide-in-right {
    animation: slideInRight 0.6s var(--easing-smooth);
}

.slide-in-up {
    animation: slideInUp 0.6s var(--easing-smooth);
}

.slide-in-down {
    animation: slideInDown 0.6s var(--easing-smooth);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === 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;
    }
    
    .web3-particles,
    .web3-grid,
    .floating-element {
        animation: none;
    }
}
