/* ==========================================
   Animations & Transitions - Enhanced
   ========================================== */

/* ========== Keyframes ========== */

/* Gradient Background Animation - Enhanced with multiple colors */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }

    25% {
        background-position: 50% 100%;
    }

    50% {
        background-position: 100% 50%;
        filter: hue-rotate(15deg);
    }

    75% {
        background-position: 50% 0%;
    }

    100% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }
}

/* Floating Animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-5px) rotate(0.5deg);
    }

    50% {
        transform: translateY(-10px) rotate(0deg);
    }

    75% {
        transform: translateY(-5px) rotate(-0.5deg);
    }
}

/* Bounce Arrow - Smoother */
@keyframes bounceArrow {

    0%,
    100% {
        transform: translateY(0);
        opacity: 1;
    }

    50% {
        transform: translateY(12px);
        opacity: 0.7;
    }
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fade In Up - Enhanced */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale In - Bounce effect */
@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse - Glow effect */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }

    50% {
        opacity: 0.9;
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

/* Heart Beat - More dramatic */
@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.35);
    }

    30% {
        transform: scale(0.95);
    }

    45% {
        transform: scale(1.25);
    }

    60% {
        transform: scale(1);
    }
}

/* Spin */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Shimmer - Enhanced */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Ripple */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide In Left */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* NEW: Glow Pulse */
@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.3),
            0 0 20px rgba(102, 126, 234, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
            0 0 40px rgba(102, 126, 234, 0.4);
    }
}

/* NEW: Text Shine */
@keyframes textShine {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* NEW: Float with glow */
@keyframes floatGlow {

    0%,
    100% {
        transform: translateY(0);
        filter: drop-shadow(0 5px 15px rgba(102, 126, 234, 0.2));
    }

    50% {
        transform: translateY(-15px);
        filter: drop-shadow(0 25px 25px rgba(102, 126, 234, 0.3));
    }
}

/* NEW: Morphing blob for background */
@keyframes morphBlob {

    0%,
    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }

    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }

    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }

    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

/* NEW: Appear from blur */
@keyframes appearFromBlur {
    from {
        opacity: 0;
        filter: blur(10px);
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        filter: blur(0);
        transform: scale(1);
    }
}

/* NEW: Wiggle */
@keyframes wiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-3deg);
    }

    75% {
        transform: rotate(3deg);
    }
}

/* NEW: Success checkmark */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 50;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

/* ========== Animation Classes ========== */

.animate-gradient {
    background-size: 300% 300%;
    animation: gradientShift 12s ease infinite;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-glow {
    animation: floatGlow 4s ease-in-out infinite;
}

.animate-bounce-arrow {
    animation: bounceArrow 1.5s ease-in-out infinite;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.animate-fade-in-down {
    animation: fadeInDown 0.5s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

.animate-heart-beat {
    animation: heartBeat 0.8s ease-in-out;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-slide-in-right {
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-appear-blur {
    animation: appearFromBlur 0.6s ease forwards;
}

.animate-wiggle {
    animation: wiggle 0.5s ease-in-out;
}

.animate-morph-blob {
    animation: morphBlob 8s ease-in-out infinite;
}

/* Text with shine effect */
.text-shine {
    background: linear-gradient(120deg,
            var(--text) 0%,
            var(--text) 40%,
            var(--primary-400) 50%,
            var(--text) 60%,
            var(--text) 100%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShine 3s linear infinite;
}

/* ========== Staggered Animations ========== */

.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

.stagger-5 {
    animation-delay: 0.25s;
}

.stagger-6 {
    animation-delay: 0.3s;
}

.stagger-7 {
    animation-delay: 0.35s;
}

.stagger-8 {
    animation-delay: 0.4s;
}

/* ========== Hover Animations ========== */

.hover-lift {
    transition: transform var(--transition-smooth),
        box-shadow var(--transition-smooth);
}

.hover-lift:hover {
    transform: translateY(-6px);
}

.hover-scale {
    transition: transform var(--transition-smooth);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow var(--transition-smooth);
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

/* Button press effect */
.hover-press {
    transition: transform 0.1s ease;
}

.hover-press:active {
    transform: scale(0.95);
}

/* Magnetic effect simulation */
.hover-tilt {
    transition: transform var(--transition-smooth);
    transform-style: preserve-3d;
}

.hover-tilt:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(-2deg) translateZ(10px);
}

/* ========== Loading States ========== */

.loading-shimmer {
    background: linear-gradient(90deg,
            var(--surface) 0%,
            rgba(255, 255, 255, 0.4) 20%,
            rgba(255, 255, 255, 0.6) 50%,
            rgba(255, 255, 255, 0.4) 80%,
            var(--surface) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg,
            var(--surface) 25%,
            rgba(128, 128, 128, 0.1) 50%,
            var(--surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* ========== Page Transitions ========== */

.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

/* App loaded state */
.app-loaded {
    animation: fadeIn 0.3s ease;
}

/* ========== Interactive Feedback ========== */

/* Button click ripple */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple-effect:active::after {
    width: 300px;
    height: 300px;
}

/* Focus ring animation */
.focus-ring:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ========== Decorative Elements ========== */

/* Floating orbs for background */
.floating-orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
            rgba(102, 126, 234, 0.4),
            rgba(118, 75, 162, 0.2));
    filter: blur(40px);
    animation: float 8s ease-in-out infinite;
    pointer-events: none;
}

.floating-orb:nth-child(1) {
    width: 300px;
    height: 300px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.floating-orb:nth-child(2) {
    width: 200px;
    height: 200px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.floating-orb:nth-child(3) {
    width: 150px;
    height: 150px;
    bottom: 20%;
    left: 30%;
    animation-delay: 4s;
}

/* ========== Reduced Motion ========== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-gradient {
        animation: none;
    }

    .floating-orb {
        animation: none;
    }
}