/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

/* Enhanced glow animation for dark theme */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(249, 115, 22, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(249, 115, 22, 0.8);
    }
}

/* Card hover lift animation */
@keyframes cardHover {
    from {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
    to {
        transform: translateY(-10px) scale(1.02);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    }
}
    to {
        opacity: 1;
        transform: scale(1);
    }


@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-15px);
    }
    70% {
        transform: translateY(-7px);
    }
    90% {
        transform: translateY(-3px);
    }
}

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 149, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 149, 0, 0.6);
    }
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* Animation Classes */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in-down {
    animation: fadeInDown 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
    opacity: 0;
}

.scale-in {
    animation: scaleIn 0.6s ease-out forwards;
    opacity: 0;
}

.slide-in-up {
    animation: slideInUp 0.8s ease-out forwards;
}

.bounce {
    animation: bounce 2s infinite;
}

.pulse {
    animation: pulse 2s infinite;
}

.float {
    animation: float 3s ease-in-out infinite;
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

/* Animation Delays */
.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

.delay-4 {
    animation-delay: 0.8s;
}

.delay-5 {
    animation-delay: 1s;
}

/* Text Animations */
.typewriter {
    overflow: hidden;
    border-right: 2px solid #333;
    white-space: nowrap;
    animation: typewriter 3s steps(40, end), blink 0.75s infinite;
}

.text-glow {
    text-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.text-gradient {
    background: linear-gradient(135deg, #4a90e2 0%, #ff9500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hover Animations */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

/* Loading Animations */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Progress Bar Animation */
.progress-bar-animated {
    position: relative;
    overflow: hidden;
}

.progress-bar-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Scroll Animations */
.scroll-fade {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-fade.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Button Animations */
.btn-animate {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-animate::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 ease;
}

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

/* Card Flip Animation */
.flip-card {
    perspective: 1000px;
    width: 100%;
    height: 300px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.flip-card-back {
    transform: rotateY(180deg);
    background: var(--gradient-primary);
    color: white;
}

/* Parallax Effect */
.parallax {
    transform: translateZ(0);
    transition: transform 0.1s ease-out;
}

/* Stagger Animation */
.stagger-item {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

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

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

/* Flying Send Icon Animation */
@keyframes flyAway {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
        scale: 1;
    }
    50% {
        transform: translate(100px, -50px) rotate(15deg);
        opacity: 0.8;
        scale: 1.2;
    }
    100% {
        transform: translate(300px, -150px) rotate(45deg);
        opacity: 0;
        scale: 0.5;
    }
}

@keyframes buttonSuccess {
    0% {
        background-color: var(--primary-color);
        transform: scale(1);
    }
    50% {
        background-color: #28a745;
        transform: scale(1.05);
    }
    100% {
        background-color: #28a745;
        transform: scale(1);
    }
}

@keyframes successPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

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

/* Flying Send Icon Classes */
.send-icon.flying {
    animation: flyAway 1.5s ease-out forwards;
    position: relative;
    z-index: 10;
}

.submit-btn.success {
    animation: buttonSuccess 0.6s ease-in-out, successPulse 2s infinite;
    background-color: #28a745 !important;
    border-color: #28a745 !important;
}

.success-message {
    display: none;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    animation: slideInUp 0.5s ease-out;
}

.success-message i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

/* Loading state */
.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-content,
.btn-loading {
    transition: all 0.3s ease;
}

/* Mobile Animation Adjustments */
@media (max-width: 768px) {
    .fade-in-up,
    .fade-in-down,
    .fade-in-left,
    .fade-in-right,
    .scale-in {
        animation-duration: 0.6s;
    }
    
    .hover-lift:hover {
        transform: translateY(-5px);
    }
    
    .typewriter {
        animation: typewriter 2s steps(30, end), blink 0.75s infinite;
    }
    
    /* Mobile flying animation adjustment */
    @keyframes flyAway {
        0% {
            transform: translate(0, 0) rotate(0deg);
            opacity: 1;
            scale: 1;
        }
        50% {
            transform: translate(50px, -30px) rotate(15deg);
            opacity: 0.8;
            scale: 1.1;
        }
        100% {
            transform: translate(150px, -80px) rotate(45deg);
            opacity: 0;
            scale: 0.5;
        }
    }
}
