/* ===================================
   ANIMATIONS.CSS
   All animation styles and effects
   =================================== */

/* ===================================
   1. FADE IN ANIMATIONS
   =================================== */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.fade-in-delay {
    opacity: 0;
    animation: fadeIn 1s ease 0.3s forwards;
}

.fade-in-delay-2 {
    opacity: 0;
    animation: fadeIn 1s ease 0.6s forwards;
}

.fade-in-delay-3 {
    opacity: 0;
    animation: fadeIn 1s ease 0.9s forwards;
}

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

/* ===================================
   2. SCROLL REVEAL ANIMATIONS
   =================================== */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease;
}

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

/* Staggered reveal for multiple items */
.reveal:nth-child(1) { transition-delay: 0s; }
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }
.reveal:nth-child(4) { transition-delay: 0.3s; }
.reveal:nth-child(5) { transition-delay: 0.4s; }
.reveal:nth-child(6) { transition-delay: 0.5s; }

/* ===================================
   3. BOUNCE ANIMATION (Scroll Indicator)
   =================================== */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* ===================================
   4. TYPING ANIMATION
   =================================== */
.typing-text {
    position: relative;
    display: inline-block;
}

.typing-text::after {
    content: '|';
    position: absolute;
    right: -10px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* ===================================
   5. SKILL BAR ANIMATIONS
   =================================== */
.skill-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.skill-progress {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0;
    transition: width 1.5s ease;
    border-radius: 10px;
    position: relative;
}

.skill-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Animate skill bars when visible */
.skill-progress.animate {
    animation: fillBar 1.5s ease forwards;
}

/* ===================================
   6. COUNTER ANIMATION
   =================================== */
.counter {
    display: inline-block;
    transition: transform 0.3s ease;
}

.counter.counting {
    animation: pulse 0.5s ease;
}

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

/* ===================================
   7. CARD HOVER EFFECTS
   =================================== */
.stat-card,
.skill-card,
.cert-card,
.project-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before,
.skill-card::before,
.cert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(102, 126, 234, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

.stat-card:hover::before,
.skill-card:hover::before,
.cert-card:hover::before {
    left: 100%;
}

/* ===================================
   8. BUTTON ANIMATIONS
   =================================== */
.btn {
    position: relative;
    overflow: hidden;
}

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

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* ===================================
   9. GRADIENT ANIMATION
   =================================== */
.gradient-animate {
    background: linear-gradient(
        45deg,
        #667eea,
        #764ba2,
        #06b6d4,
        #667eea
    );
    background-size: 300% 300%;
    animation: gradientShift 8s ease infinite;
}

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

/* ===================================
   10. FLOATING ANIMATION
   =================================== */
.float {
    animation: float 3s ease-in-out infinite;
}

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

/* ===================================
   11. ROTATE ANIMATION
   =================================== */
.rotate {
    animation: rotate 20s linear infinite;
}

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

/* ===================================
   12. SLIDE IN ANIMATIONS
   =================================== */
.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    animation: slideInLeft 0.8s ease forwards;
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    animation: slideInRight 0.8s ease forwards;
}

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

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

/* ===================================
   13. SCALE ANIMATIONS
   =================================== */
.scale-in {
    opacity: 0;
    transform: scale(0.8);
    animation: scaleIn 0.6s ease forwards;
}

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

/* ===================================
   14. GLOW EFFECT
   =================================== */
.glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
    }
}

/* ===================================
   15. HAMBURGER MENU ANIMATION
   =================================== */
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ===================================
   16. MOBILE MENU SLIDE IN
   =================================== */
.nav-links.mobile-active {
    animation: slideDown 0.3s ease forwards;
}

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

/* ===================================
   17. TEXT GRADIENT ANIMATION
   =================================== */
.text-gradient-animate {
    background: linear-gradient(
        45deg,
        #667eea,
        #764ba2,
        #06b6d4,
        #667eea
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
}

/* ===================================
   18. LOADING SPINNER
   =================================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===================================
   19. RIPPLE EFFECT
   =================================== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* ===================================
   20. SHAKE ANIMATION (for errors)
   =================================== */
.shake {
    animation: shake 0.5s ease;
}

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

/* ===================================
   21. PROGRESS BAR ANIMATION
   =================================== */
.progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0;
    animation: progressFill 2s ease forwards;
}

@keyframes progressFill {
    to {
        width: 100%;
    }
}

/* ===================================
   22. HOVER LIFT EFFECT
   =================================== */
.lift-on-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lift-on-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

/* ===================================
   23. BLUR IN ANIMATION
   =================================== */
.blur-in {
    opacity: 0;
    filter: blur(10px);
    animation: blurIn 0.8s ease forwards;
}

@keyframes blurIn {
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* ===================================
   24. TYPEWRITER EFFECT (for hero)
   =================================== */
.typewriter {
    overflow: hidden;
    border-right: 2px solid #667eea;
    white-space: nowrap;
    animation: typing 3s steps(40) 1s forwards, blink 0.75s step-end infinite;
}

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

/* ===================================
   25. ATTENTION SEEKER
   =================================== */
.attention {
    animation: attention 1s ease infinite;
}

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

/* ===================================
   26. CARD FLIP ANIMATION
   =================================== */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
}

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

/* ===================================
   27. FADE IN UP (Alternative)
   =================================== */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

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

/* ===================================
   28. ZOOM IN ON HOVER
   =================================== */
.zoom-on-hover {
    transition: transform 0.3s ease;
    overflow: hidden;
}

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

.zoom-on-hover img {
    transition: transform 0.3s ease;
}

.zoom-on-hover:hover img {
    transform: scale(1.1);
}

/* ===================================
   29. BORDER ANIMATION
   =================================== */
.border-animate {
    position: relative;
    border: 2px solid transparent;
}

.border-animate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #667eea;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.border-animate:hover::before {
    opacity: 1;
    animation: borderPulse 1.5s infinite;
}

@keyframes borderPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.5;
    }
}

/* ===================================
   30. SLOW REVEAL (for text)
   =================================== */
.slow-reveal {
    opacity: 0;
    animation: slowReveal 2s ease forwards;
}

@keyframes slowReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   31. PAGE TRANSITION
   =================================== */
.page-transition {
    animation: pageTransition 0.5s ease;
}

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

/* ===================================
   32. SMOOTH COLOR TRANSITION
   =================================== */
.color-transition {
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* ===================================
   33. PERFORMANCE OPTIMIZATIONS
   =================================== */
/* Use GPU acceleration for smooth animations */
.gpu-accelerate {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}