/* Animation and Transition Classes */

/* Fade In Animation */
.animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Fade Out Animation */
.animate-fade-out {
    opacity: 1;
    animation: fadeOut 0.6s ease-out forwards;
}

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

/* Slide Up Animation */
.animate-slide-up {
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.6s ease-out forwards;
}

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

/* Slide Down Animation */
.animate-slide-down {
    transform: translateY(-20px);
    opacity: 0;
    animation: slideDown 0.6s ease-out forwards;
}

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

/* Slide In Left Animation */
.animate-slide-in-left {
    transform: translateX(-20px);
    opacity: 0;
    animation: slideInLeft 0.6s ease-out forwards;
}

@keyframes slideInLeft {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide In Right Animation */
.animate-slide-in-right {
    transform: translateX(20px);
    opacity: 0;
    animation: slideInRight 0.6s ease-out forwards;
}

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

/* Scale In Animation */
.animate-scale-in {
    transform: scale(0.9);
    opacity: 0;
    animation: scaleIn 0.4s ease-out forwards;
}

@keyframes scaleIn {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scale Out Animation */
.animate-scale-out {
    transform: scale(1);
    opacity: 1;
    animation: scaleOut 0.4s ease-out forwards;
}

@keyframes scaleOut {
    to {
        transform: scale(0.9);
        opacity: 0;
    }
}

/* Bounce Animation */
.animate-bounce {
    animation: bounce 0.6s ease infinite alternate;
}

@keyframes bounce {
    to {
        transform: translateY(-10px);
    }
}

/* Pulse Animation */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Spin Animation */
.animate-spin {
    animation: spin 1s linear infinite;
}

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

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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Hover Animations */
.hover-float:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.hover-pulse:hover {
    animation: pulse 0.5s ease;
}

.hover-scale:hover {
    transform: scale(1.03);
}

/* Button Animations */
.button-hover {
    transition: all 0.2s ease;
}

.button-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.button-click {
    transition: transform 0.1s ease;
}

.button-click:active {
    transform: translateY(1px);
}

/* Project Card Animations */
.project-card {
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

/* Image Animations */
.image-hover {
    transition: transform 0.3s ease;
}

.image-hover:hover {
    transform: scale(1.05);
}

/* Text Animations */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

/* Loading Animations */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(94, 53, 177, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Enhanced animations */
.animate-fade-in-delay {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.3s forwards;
}

.animate-slide-up-delay {
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.6s ease-out 0.3s forwards;
}

.animate-slide-in-delay {
    transform: translateX(20px);
    opacity: 0;
    animation: slideInRight 0.6s ease-out 0.3s forwards;
}

/* Staggered animations for grid items */
.animate-staggered .project-card {
    opacity: 0;
    transform: translateY(20px);
    animation: staggeredFadeIn 0.6s ease-out forwards;
}

.animate-staggered .project-card:nth-child(1) { animation-delay: 0.1s; }
.animate-staggered .project-card:nth-child(2) { animation-delay: 0.2s; }
.animate-staggered .project-card:nth-child(3) { animation-delay: 0.3s; }
.animate-staggered .project-card:nth-child(4) { animation-delay: 0.4s; }
.animate-staggered .project-card:nth-child(5) { animation-delay: 0.5s; }
.animate-staggered .project-card:nth-child(6) { animation-delay: 0.6s; }

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

/* Reveal animations for scroll-triggered effects */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced animation classes */
.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

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

.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 50%, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.slide-in-from-left {
    animation: slideInFromLeft 0.8s ease-out;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translate3d(-50%, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.slide-in-from-right {
    animation: slideInFromRight 0.8s ease-out;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translate3d(50%, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Glow effect */
.glow {
    box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.4);
    transition: box-shadow 0.3s ease;
}

.glow:hover {
    box-shadow: 0 0 25px rgba(var(--primary-color-rgb), 0.6);
}

/* Enhanced button animations */
.btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.btn:hover::before {
    left: 100%;
}

/* Theme transition animations */
[data-theme="dark"] *,
[data-theme="light"] *,
.dark-theme *,
.light-theme * {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Smooth scrolling enhancement */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar animations */
::-webkit-scrollbar {
    transition: all 0.3s ease;
}

/* Animation for notification popups */
.notification {
    animation: notificationSlideIn 0.3s ease-out;
}

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

/* Success and error state animations */
.success-animation {
    animation: successPulse 0.5s ease;
}

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Enhanced project card hover animation */
.project-card {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
                box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.project-image {
    transition: transform 0.3s ease;
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

/* Smooth theme transition */
* {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease;
}