/* Modern Animation Library for Horus Dashboard */

/* Keyframe Animations */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: 200px 0;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(37, 99, 235, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
    }
}

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

/* Consolidated spinner styles */
.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-medium {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

/* Enhanced Tree Node Animations */
.topology-tree.tree-animate .tree-node {
    animation: slideInLeft 0.35s ease-out;
}

.topology-tree.tree-animate .tree-node:nth-child(1) { animation-delay: 0.08s; }
.topology-tree.tree-animate .tree-node:nth-child(2) { animation-delay: 0.12s; }
.topology-tree.tree-animate .tree-node:nth-child(3) { animation-delay: 0.16s; }
.topology-tree.tree-animate .tree-node:nth-child(4) { animation-delay: 0.2s; }
.topology-tree.tree-animate .tree-node:nth-child(5) { animation-delay: 0.24s; }

/* Loading State Enhancements */
.loading-state {
    animation: fadeInScale 0.6s ease-out;
}

.network-icon {
    animation: rotate 3s linear infinite;
}

/* Error State Animations */
.error-state {
    animation: slideInUp 0.6s ease-out;
}

.error-icon {
    animation: wiggle 2s ease-in-out infinite;
}

/* Sidebar Animations */
.sidebar {
    animation: slideInLeft 0.5s ease-out;
}

.control-section:nth-child(1) { animation-delay: 0.1s; }
.control-section:nth-child(2) { animation-delay: 0.2s; }
.control-section:nth-child(3) { animation-delay: 0.3s; }
.control-section:nth-child(4) { animation-delay: 0.4s; }

/* Search Enhancement Animations */
.search-input-wrapper.typing {
    animation: glow 0.5s ease-out;
}

.search-suggestions {
    animation: slideInUp 0.3s ease-out;
}

/* Topology Header Animations */
.topology-header {
    animation: slideInUp 0.6s ease-out;
}

.topology-title h2 {
    animation: fadeInScale 0.8s ease-out 0.2s both;
}

/* Countdown Timer Animation */
.countdown-time {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Responsive Animation Adjustments */
@media (max-width: 768px) {
    /* Reduce animations on mobile for performance */
    .tree-node,
    .control-section {
        animation-duration: 0.2s;
    }

    .loading-animation,
    .error-animation,
    .empty-animation {
        animation-duration: 1s;
    }
}

/* Reduced motion preferences */
@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;
    }
}

/* Utility Animation Classes */
.animate-fadeIn {
    animation: fadeInScale 0.5s ease-out;
}

.animate-slideInLeft {
    animation: slideInLeft 0.5s ease-out;
}

.animate-slideInRight {
    animation: slideInRight 0.5s ease-out;
}

.animate-slideInUp {
    animation: slideInUp 0.5s ease-out;
}

.animate-bounceIn {
    animation: bounceIn 0.6s ease-out;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-wiggle {
    animation: wiggle 1s ease-in-out;
}
