/* Keyframes for smooth animations */
@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 float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(139, 115, 85, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(139, 115, 85, 0.4);
    }
}

@keyframes drawLine {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation Classes */
.animate-fadeInUp {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-scaleIn {
    animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slideInFromBottom {
    animation: slideInFromBottom 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-wiggle {
    animation: wiggle 1s ease-in-out;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Scroll-triggered animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate.animate {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-left.animate {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-right.animate {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-scale.animate {
    opacity: 1;
    transform: scale(1);
}

/* Staggered animations */
.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; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }

/* Hover animations */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
}

.hover-scale {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(139, 115, 85, 0.3);
}

.hover-wobble:hover {
    animation: wiggle 0.8s ease-in-out;
}

/* Button animations */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-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;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Loading states */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--cream-3) 25%,
        var(--cream-4) 50%,
        var(--cream-3) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-bounce {
    animation: bounce 1.4s ease-in-out infinite both;
}

/* Text animations */
.typewriter-effect {
    overflow: hidden;
    border-right: 2px solid var(--accent);
    white-space: nowrap;
    animation: 
        typewriter 3.5s steps(40, end),
        blink 0.75s step-end infinite;
}

.gradient-text {
    background: linear-gradient(
        45deg,
        var(--accent),
        var(--accent-light),
        var(--accent-dark)
    );
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Specific component animations */
.nav {
    animation: slideInFromTop 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-name .name-part:first-child {
    animation: fadeInLeft 1s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.hero-name .name-part:last-child {
    animation: fadeInRight 1s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
}

.barcode-container {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both;
}

.hero-description {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.8s both;
}

.hero-badges {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 1s both;
}

.badge {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge:hover {
    animation: wiggle 0.6s ease-in-out;
}

.profile-card {
    animation: scaleIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
}

.float-element:nth-child(1) {
    animation: float 6s ease-in-out infinite;
}

.float-element:nth-child(2) {
    animation: float 6s ease-in-out infinite 2s;
}

.float-element:nth-child(3) {
    animation: float 6s ease-in-out infinite 4s;
}

/* Barcode animation */
.barcode-line {
    animation: fadeIn 0.1s ease-in-out both;
}

.barcode-line:nth-child(1) { animation-delay: 0.1s; }
.barcode-line:nth-child(2) { animation-delay: 0.15s; }
.barcode-line:nth-child(3) { animation-delay: 0.2s; }
.barcode-line:nth-child(4) { animation-delay: 0.25s; }
.barcode-line:nth-child(5) { animation-delay: 0.3s; }
.barcode-line:nth-child(6) { animation-delay: 0.35s; }
.barcode-line:nth-child(7) { animation-delay: 0.4s; }
.barcode-line:nth-child(8) { animation-delay: 0.45s; }
.barcode-line:nth-child(9) { animation-delay: 0.5s; }
.barcode-line:nth-child(10) { animation-delay: 0.55s; }

/* Form animations */
.form-group {
    position: relative;
}

.form-group input,
.form-group textarea {
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    transform: translateY(-2px);
}

.form-group label {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.submit-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.submit-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;
}

.submit-btn:hover::before {
    left: 100%;
}

/* Modal animations */
.modal-overlay {
    backdrop-filter: blur(10px);
}

.modal-overlay.show {
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.show .modal-content {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Timeline animations */
.timeline-item {
    animation: fadeInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }
.timeline-item:nth-child(4) { animation-delay: 0.4s; }

/* Skill tag animations */
.skill-tag {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeIn 0.5s ease-out both;
}

.skill-tag:nth-child(1) { animation-delay: 0.1s; }
.skill-tag:nth-child(2) { animation-delay: 0.15s; }
.skill-tag:nth-child(3) { animation-delay: 0.2s; }
.skill-tag:nth-child(4) { animation-delay: 0.25s; }
.skill-tag:nth-child(5) { animation-delay: 0.3s; }

.skill-tag:hover {
    animation: pulse 0.6s ease-in-out;
}

/* Project card animations */
.project-card {
    animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }

.project-card:hover .project-image {
    animation: pulse 0.6s ease-in-out;
}

/* Scroll indicator animation */
.scroll-indicator {
    animation: bounce 2s infinite;
}

/* Contact method hover animations */
.contact-method:hover .method-icon {
    animation: heartbeat 0.8s ease-in-out;
}

.social-link:hover .social-icon {
    animation: wiggle 0.6s ease-in-out;
}

/* Education card animations */
.edu-card:hover .edu-icon {
    animation: pulse 0.6s ease-in-out;
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-float,
    .animate-bounce,
    .animate-pulse,
    .animate-wiggle,
    .animate-heartbeat {
        animation: none !important;
    }
}

/* Page load animations */
body.loaded .hero-name .name-part:first-child {
    animation-play-state: running;
}

body.loaded .hero-name .name-part:last-child {
    animation-play-state: running;
}

body.loaded .barcode-container {
    animation-play-state: running;
}

body.loaded .hero-description {
    animation-play-state: running;
}

body.loaded .hero-badges {
    animation-play-state: running;
}

body.loaded .profile-card {
    animation-play-state: running;
}

/* Custom easing functions */
.ease-bounce {
    transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ease-smooth {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.ease-swift {
    transition-timing-function: cubic-bezier(0.55, 0, 0.1, 1);
}

/* Fun micro-interactions */
.cursor-pointer {
    cursor: pointer;
}

.select-none {
    user-select: none;
}

.interactive:active {
    transform: scale(0.98);
}

/* Loading overlay */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cream-1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loading.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--cream-4);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
