/* ==================== ANIMATIONS ==================== */

/* Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(37, 99, 235, 0.6);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-10px) rotate(2deg);
    }

    50% {
        transform: translateY(-5px) rotate(-1deg);
    }

    75% {
        transform: translateY(-15px) rotate(1deg);
    }
}

/* Floating Particles */
.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    animation: float-particle 15s infinite ease-in-out;
}

@keyframes float-particle {

    0%,
    100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

/* Glowing Orbs for Auth Background */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: orb-float 20s infinite ease-in-out;
}

.glow-orb.orb-1 {
    width: 300px;
    height: 300px;
    background: #2563eb;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.glow-orb.orb-2 {
    width: 400px;
    height: 400px;
    background: #7c3aed;
    top: 50%;
    right: 10%;
    animation-delay: -5s;
}

.glow-orb.orb-3 {
    width: 250px;
    height: 250px;
    background: #3b82f6;
    bottom: 10%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes orb-float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -30px) scale(1.1);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(-30px, -20px) scale(1.05);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out forwards;
}

.animate-slide-down {
    animation: slideDown 0.3s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Page Transitions */
.page-enter {
    animation: slideUp 0.3s ease-out forwards;
}

.page-exit {
    animation: fadeOut 0.2s ease-out forwards;
}

/* Staggered Animations */
.stagger-item {
    opacity: 0;
    animation: slideUp 0.3s ease-out forwards;
}

.stagger-item:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-item:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-item:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-item:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger-item:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-item:nth-child(6) {
    animation-delay: 0.3s;
}

.stagger-item:nth-child(7) {
    animation-delay: 0.35s;
}

.stagger-item:nth-child(8) {
    animation-delay: 0.4s;
}

.stagger-item:nth-child(9) {
    animation-delay: 0.45s;
}

.stagger-item:nth-child(10) {
    animation-delay: 0.5s;
}

/* Button Ripple Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-tertiary) 25%,
            var(--bg-glass-light) 50%,
            var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: var(--space-sm);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: var(--space-md);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
}

/* Counter Animation */
.counter {
    display: inline-block;
    transition: transform 0.3s ease-out;
}

.counter.counting {
    animation: counter-pulse 0.3s ease-out;
}

@keyframes counter-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Success Checkmark */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    position: relative;
}

.success-checkmark .check-icon {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    box-sizing: content-box;
    border: 4px solid var(--success);
}

.success-checkmark .check-icon::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 25px;
    height: 12px;
    border-left: 4px solid var(--success);
    border-bottom: 4px solid var(--success);
    transform: translate(-50%, -60%) rotate(-45deg);
    animation: checkmark-draw 0.4s ease-out forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

@keyframes checkmark-draw {
    0% {
        opacity: 0;
        transform: translate(-50%, -60%) rotate(-45deg) scale(0);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -60%) rotate(-45deg) scale(1);
    }
}

/* Confetti */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Theme Transition */
body.theme-transitioning * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}