/* Animations CSS for Mega Utility Hub */

/* Tool Icon Animations */
.tool-icon {
    position: relative;
    transition: transform 0.5s ease;
}

.tool-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(107, 255, 184, 0.2) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.5s ease;
}

.tool-card:hover .tool-icon {
    transform: translateY(-10px) scale(1.1);
}

.tool-card:hover .tool-icon::after {
    opacity: 1;
    transform: scale(1.5);
}

/* Floating Animation for Cards */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

.tool-card:hover {
    animation: float 3s ease-in-out infinite;
}

/* Gradient Text Animation */
@keyframes gradientText {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.logo h1, .hero h1, .tool-header h1, .page-header h1 {
    background-size: 200% auto;
    animation: gradientText 5s ease infinite;
}

/* Button Hover Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
    transition: all 0.5s ease;
}

.btn:hover::after {
    left: 100%;
}

/* Page Transition */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

main {
    animation: fadeIn 0.5s ease-out;
}

/* 3D Card Effect */
.tool-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.tool-card:hover {
    transform: rotateX(5deg) rotateY(5deg) translateY(-10px);
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

/* Pulse Animation for Buttons */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 107, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(74, 107, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 107, 255, 0);
    }
}

.btn:active {
    animation: pulse 1s;
}

/* Background Animation Script Support */
#background-canvas {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
}

/* Tool Icon 3D Effect */
.tool-icon {
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.tool-card:hover .tool-icon {
    transform: translateZ(20px);
}

/* Shimmer Effect for Cards */
@keyframes shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

.tool-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
    background-size: 200% 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-card:hover::after {
    opacity: 1;
    animation: shimmer 1.5s infinite;
}

/* Responsive Animations */
@media (prefers-reduced-motion: reduce) {
    .tool-card, .tool-icon, .btn, .logo h1, .hero h1, .tool-header h1, .page-header h1 {
        animation: none !important;
        transition: none !important;
    }
    
    .tool-card:hover, .tool-card:hover .tool-icon {
        transform: none !important;
    }
}