/* Animation de fade-in */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

/* Basic Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Ensure content is visible by default */
body {
    opacity: 1 !important;
    visibility: visible !important;
}

.section {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Remove any hide classes */
.hide {
    display: none !important;
}

/* Grid Animation */
@keyframes gridMove {
  0% {
    transform: translateX(-50%) translateY(-50%) rotate(-45deg);
  }
  100% {
    transform: translateX(0%) translateY(0%) rotate(-45deg);
  }
}

/* Floating Animation for Tech Stack */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Skill Progress Animation */
@keyframes fillProgress {
  from {
    width: 0;
  }
  to {
    width: var(--progress);
  }
}

/* Text Gradient Animation */
@keyframes textGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Typing Animation */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

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

/* Card Hover Effects */
.project-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2);
}

/* Skill Item Hover Animation */
.skill-item:hover {
  transform: translateY(-5px) scale(1.05);
  background: rgba(255, 255, 255, 0.15);
}

/* Gradient Text Animation */
.gradient-text {
  background: linear-gradient(
    90deg,
    var(--gradient-start),
    var(--gradient-end),
    var(--gradient-start)
  );
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: textGradient 3s linear infinite;
}

/* Typing Effect */
.typing-text {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--accent-color);
  animation: typing 3.5s steps(40, end),
    blink 0.75s step-end infinite;
}

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

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

/* Progress Bar Animation */
.progress-bar {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-color);
  animation: fillProgress 1.5s ease-out forwards;
}

/* Particle Effect */
.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Animation */
@keyframes slideIn {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Gradient Text Animation */
@keyframes textGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Floating Animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* Grid Movement Animation */
@keyframes gridMove {
    0% {
        transform: translateX(-50%) translateY(-50%) rotate(-45deg);
    }
    100% {
        transform: translateX(0%) translateY(0%) rotate(-45deg);
    }
}

/* Typing Animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

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

/* Progress Bar Animation */
@keyframes progress {
    from {
        width: 0;
    }
}

/* Particle Movement */
@keyframes particleMove {
    0% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(10px, -10px);
    }
    100% {
        transform: translate(0, 0);
    }
}

/* Apply Animations */

/* Hero Section */
.hero-content {
    animation: fadeIn 1s ease-out;
}

.hero-subtitle {
    animation: slideIn 1s ease-out;
}

.hero-title {
    background-size: 200% auto;
    animation: textGradient 3s ease infinite;
}

.hero-image img {
    animation: float 6s ease-in-out infinite;
}

/* About Section */
.about-text {
    animation: fadeIn 1s ease-out 0.3s backwards;
}

/* Skills Section */
.skill-card {
    animation: fadeIn 0.6s ease-out backwards;
}

.skills-container .skill-card:nth-child(1) { animation-delay: 0.1s; }
.skills-container .skill-card:nth-child(2) { animation-delay: 0.2s; }
.skills-container .skill-card:nth-child(3) { animation-delay: 0.3s; }
.skills-container .skill-card:nth-child(4) { animation-delay: 0.4s; }

/* Projects Section */
.project-card {
    animation: fadeIn 0.6s ease-out backwards;
}

.project-filters button {
    animation: fadeIn 0.4s ease-out backwards;
}

.project-filters button:nth-child(1) { animation-delay: 0.1s; }
.project-filters button:nth-child(2) { animation-delay: 0.2s; }
.project-filters button:nth-child(3) { animation-delay: 0.3s; }
.project-filters button:nth-child(4) { animation-delay: 0.4s; }

/* Contact Section */
.contact-form {
    animation: fadeIn 0.8s ease-out;
}

.contact-info {
    animation: slideIn 0.8s ease-out;
}

/* Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

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

/* Loading Animation */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 3px solid var(--accent-primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Tech Stack Animation */
.tech-stack {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.tech-item {
    position: absolute;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.3);
    animation: float 6s ease-in-out infinite;
}

/* Hover Effects */
.nav-link,
.btn,
.project-card,
.skill-card {
    transition: all 0.3s ease;
}

.nav-link:hover,
.btn:hover {
    transform: translateY(-2px);
}

.project-card:hover,
.skill-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2);
}

/* Responsive Animations */
@media screen and (max-width: 768px) {
    /* Reduce animation distances for mobile */
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(10px); /* Reduced distance */
        }
    }

    @keyframes slideIn {
        from {
            transform: translateX(-50px); /* Reduced distance */
            opacity: 0;
        }
    }

    @keyframes float {
        0% {
            transform: translateY(0px);
        }
        50% {
            transform: translateY(-10px); /* Reduced floating height */
        }
        100% {
            transform: translateY(0px);
        }
    }

    /* Adjust tech stack sizing */
    .tech-item {
        font-size: 1rem;
    }

    /* Optimize hover effects for touch devices */
    .nav-link:hover,
    .btn:hover,
    .project-card:hover,
    .skill-card:hover {
        transform: translateY(-5px); /* Reduced hover lift */
    }

    /* Disable certain animations on mobile for better performance */
    .particle-animation {
        display: none;
    }
}

/* Tablet-specific adjustments */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    @keyframes float {
        0% {
            transform: translateY(0px);
        }
        50% {
            transform: translateY(-15px); /* Medium floating height */
        }
        100% {
            transform: translateY(0px);
        }
    }

    .tech-item {
        font-size: 1.1rem;
    }
}

/* Reduce animations for users who prefer 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;
    }

    .floating-animation,
    .tech-item,
    .particle-animation {
        animation: none !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Animation performance optimizations */
.animated-element {
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
    transform: translateZ(0);
}

/* Touch device optimizations */
@media (hover: none) {
    .nav-link:hover,
    .btn:hover,
    .project-card:hover,
    .skill-card:hover {
        transform: none;
        box-shadow: none;
    }

    /* Add active state for touch devices */
    .nav-link:active,
    .btn:active,
    .project-card:active,
    .skill-card:active {
        transform: translateY(-2px);
        transition: transform 0.1s;
    }
}

/* Low-end device optimizations */
@media screen and (max-width: 480px) {
    /* Further reduce animation complexity */
    .loading::after {
        width: 30px;
        height: 30px;
    }

    .reveal {
        transform: translateY(15px);
    }

    /* Optimize animations for better performance */
    .animated-element {
        transition: transform 0.2s ease-out, opacity 0.2s ease-out;
    }
}

/* High-end device enhancements */
@media screen and (min-width: 1920px) {
    /* Enhanced animations for powerful devices */
    .tech-item {
        font-size: 1.4rem;
    }

    @keyframes float {
        0% {
            transform: translateY(0px) rotate(0deg);
        }
        50% {
            transform: translateY(-25px) rotate(2deg);
        }
        100% {
            transform: translateY(0px) rotate(0deg);
        }
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Scroll Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.slide-in {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in.visible {
    opacity: 1;
    transform: translateX(0);
}

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

.hover-lift:hover {
    transform: translateY(-5px);
}

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

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(100, 255, 218, 0.3);
}

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(120deg, var(--accent-primary), var(--accent-secondary));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    color: transparent;
    animation: gradientMove 8s ease infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Loading Animation */
.loading {
    position: relative;
    width: 40px;
    height: 40px;
}

.loading::before,
.loading::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--accent-primary);
    opacity: 0.6;
    animation: pulse 2s ease-in-out infinite;
}

.loading::after {
    animation-delay: -1s;
}

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

/* Typing Animation */
.typing::after {
    content: '|';
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
