/* ===========================
   Animation Definitions
   =========================== */

/* Page Load Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@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);
    }
}

/* Pulse Animation */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Glow Animation */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
    }
}

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

/* Bounce Animation */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Float Animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ===========================
   Animation Classes
   =========================== */

/* Initial State - Hidden */
.animate-on-load {
    opacity: 0;
}

/* Header Animation */
.dashboard-header {
    animation: fadeIn 0.8s ease-out forwards;
}

/* KPI Cards Animation */
.kpi-card {
    animation: slideUp 0.6s ease-out forwards;
}

.kpi-card:nth-child(1) {
    animation-delay: 0.1s;
}

.kpi-card:nth-child(2) {
    animation-delay: 0.2s;
}

.kpi-card:nth-child(3) {
    animation-delay: 0.3s;
}

.kpi-card:nth-child(4) {
    animation-delay: 0.4s;
}

.kpi-card:nth-child(5) {
    animation-delay: 0.5s;
}

/* Chart Container Animation */
.chart-container {
    animation: scaleIn 0.6s ease-out forwards;
}

.chart-container:nth-child(1) {
    animation-delay: 0.6s;
}

.chart-container:nth-child(2) {
    animation-delay: 0.7s;
}

.chart-container:nth-child(3) {
    animation-delay: 0.8s;
}

.chart-container:nth-child(4) {
    animation-delay: 0.9s;
}

.chart-container:nth-child(5) {
    animation-delay: 1s;
}

.chart-container:nth-child(6) {
    animation-delay: 1.1s;
}

.chart-container:nth-child(7) {
    animation-delay: 1.2s;
}

/* Hover Animations */
.kpi-card:hover .kpi-icon {
    animation: bounce 0.6s ease-in-out;
}

.kpi-card:hover {
    animation: pulse 0.3s ease-in-out;
}

/* Chart Element Animations */
.chart-element-enter {
    animation: fadeIn 0.4s ease-out forwards;
}

.chart-element-exit {
    animation: fadeIn 0.3s ease-in reverse forwards;
}

/* Tooltip Animation */
.chart-tooltip {
    animation: fadeIn 0.2s ease-out;
}

/* Loading Animation */
.loading-spinner {
    animation: rotate 1s linear infinite;
}

/* Shimmer Effect for Loading States */
.shimmer {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Transition Classes */
.transition-all {
    transition: all var(--transition-base);
}

.transition-fast {
    transition: all var(--transition-fast);
}

.transition-slow {
    transition: all var(--transition-slow);
}

/* Transform Classes */
.scale-on-hover:hover {
    transform: scale(1.05);
}

.lift-on-hover:hover {
    transform: translateY(-4px);
}

/* Glow Effect */
.glow-on-hover:hover {
    animation: glow 1.5s ease-in-out infinite;
}

/* Float Effect */
.float {
    animation: float 3s ease-in-out infinite;
}

/* Stagger Animation Utility */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

.stagger-6 {
    animation-delay: 0.6s;
}

.stagger-7 {
    animation-delay: 0.7s;
}

.stagger-8 {
    animation-delay: 0.8s;
}

.stagger-9 {
    animation-delay: 0.9s;
}

.stagger-10 {
    animation-delay: 1s;
}

/* 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;
    }
}