/* Animation Definitions */

/* Slide In Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

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

/* Fade Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

/* Flash Animation */
@keyframes flash {
    0% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* Pulse Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulseScale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes pulseBorder {
    0%, 100% { border-color: var(--brand-primary, #b5231d); }
    50% { border-color: transparent; }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

/* Spin Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Glow Pulse Animation */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px var(--brand-primary, #b5231d);
    }
    50% {
        box-shadow: 0 0 20px var(--brand-primary, #b5231d), 0 0 40px var(--brand-primary, #b5231d);
    }
}

/* Number Count Animation */
@keyframes countUp {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* Progress Bar Fill Animation */
@keyframes fillBar {
    from { width: 0; }
}

/* Stagger Animation Classes */
.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; }

/* Apply Animations */
.animate-slide-in {
    animation: slideIn 0.3s ease forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease forwards;
}

.animate-slide-in-up {
    animation: slideInUp 0.3s ease forwards;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.animate-fade-in-scale {
    animation: fadeInScale 0.3s ease forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-pulse-scale {
    animation: pulseScale 1s infinite;
}

.animate-shake {
    animation: shake 0.5s ease;
}

.animate-bounce {
    animation: bounce 0.5s ease;
}

.animate-bounce-in {
    animation: bounceIn 0.5s ease forwards;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-glow {
    animation: glowPulse 2s infinite;
}

/* Screen Transitions */
.screen-enter {
    animation: fadeIn 0.2s ease;
}

.screen-exit {
    animation: fadeOut 0.2s ease forwards;
}

/* Deal Card Animations */
.deal-card {
    animation: slideInUp 0.3s ease;
    animation-fill-mode: both;
}

.deal-card:nth-child(1) { animation-delay: 0.05s; }
.deal-card:nth-child(2) { animation-delay: 0.1s; }
.deal-card:nth-child(3) { animation-delay: 0.15s; }
.deal-card:nth-child(4) { animation-delay: 0.2s; }
.deal-card:nth-child(5) { animation-delay: 0.25s; }

/* Choice Button Animations */
.choice-btn {
    animation: slideInLeft 0.3s ease;
    animation-fill-mode: both;
}

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

/* Notification Animations */
.notification {
    animation: slideIn 0.3s ease;
}

/* Modal Animations */
.modal.visible .modal-content {
    animation: fadeInScale 0.2s ease;
}

/* Achievement Badge Animation */
.achievement-badge {
    animation: bounceIn 0.5s ease;
}

.achievement-badge:hover {
    animation: pulseScale 0.5s ease;
}

/* Meter Fill Animation */
.meter-fill {
    animation: fillBar 0.5s ease forwards;
}

/* Score Counter Animation */
.stat-value,
.grade-score {
    animation: countUp 0.5s ease;
}

/* Training Module Cards */
.training-module {
    animation: slideInUp 0.3s ease;
    animation-fill-mode: both;
}

.training-module:nth-child(1) { animation-delay: 0.1s; }
.training-module:nth-child(2) { animation-delay: 0.15s; }
.training-module:nth-child(3) { animation-delay: 0.2s; }
.training-module:nth-child(4) { animation-delay: 0.25s; }
.training-module:nth-child(5) { animation-delay: 0.3s; }
.training-module:nth-child(6) { animation-delay: 0.35s; }

/* Pipeline Column Animation */
.pipeline-column {
    animation: slideInUp 0.3s ease;
    animation-fill-mode: both;
}

.pipeline-column:nth-child(1) { animation-delay: 0.05s; }
.pipeline-column:nth-child(2) { animation-delay: 0.1s; }
.pipeline-column:nth-child(3) { animation-delay: 0.15s; }
.pipeline-column:nth-child(4) { animation-delay: 0.2s; }
.pipeline-column:nth-child(5) { animation-delay: 0.25s; }
.pipeline-column:nth-child(6) { animation-delay: 0.3s; }

/* Level Up Celebration Animation */
.level-up-celebration h2 {
    animation: bounceIn 0.6s ease, glowPulse 1s infinite 0.6s;
}

/* Scorecard Metrics Animation */
.metric-row {
    animation: slideInRight 0.3s ease;
    animation-fill-mode: both;
}

.metric-row:nth-child(1) { animation-delay: 0.1s; }
.metric-row:nth-child(2) { animation-delay: 0.15s; }
.metric-row:nth-child(3) { animation-delay: 0.2s; }
.metric-row:nth-child(4) { animation-delay: 0.25s; }
.metric-row:nth-child(5) { animation-delay: 0.3s; }

/* Action Button Hover Animation */
.action-btn {
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(0);
}

/* Navigation Item Transition */
.nav-item {
    transition: all 0.2s ease;
}

/* XP Bar Animation */
.xp-fill {
    animation: fillBar 1s ease forwards;
}

/* Goal Progress Animation */
.goal-item {
    animation: slideInRight 0.3s ease;
    animation-fill-mode: both;
}

.goal-item:nth-child(1) { animation-delay: 0.1s; }
.goal-item:nth-child(2) { animation-delay: 0.15s; }
.goal-item:nth-child(3) { animation-delay: 0.2s; }

/* Skill Tag Animation */
.skill-tag {
    animation: fadeIn 0.3s ease;
    animation-fill-mode: both;
}

.skill-tag:nth-child(1) { animation-delay: 0.05s; }
.skill-tag:nth-child(2) { animation-delay: 0.1s; }
.skill-tag:nth-child(3) { animation-delay: 0.15s; }
.skill-tag:nth-child(4) { animation-delay: 0.2s; }
.skill-tag:nth-child(5) { animation-delay: 0.25s; }

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
