/* ===== ANIMATIONS CSS ===== */

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

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

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

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(110, 0, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(110, 0, 255, 0.8), 0 0 30px rgba(0, 229, 255, 0.5);
    }
    100% {
        box-shadow: 0 0 5px rgba(110, 0, 255, 0.5);
    }
}

@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 typing {
    from { width: 0 }
    to { width: 100% }
}

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

@keyframes wave {
    0% {
        transform: translateX(0) translateZ(0) scaleY(1)
    }
    50% {
        transform: translateX(-25%) translateZ(0) scaleY(0.55)
    }
    100% {
        transform: translateX(-50%) translateZ(0) scaleY(1)
    }
}

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

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

/* Glitch Effect */
@keyframes glitch-anim-1 {
    0% { 
        clip: rect(30px, 9999px, 10px, 0);
        transform: skew(0.5deg);
    }
    5% { 
        clip: rect(80px, 9999px, 95px, 0);
        transform: skew(0.2deg);
    }
    10% { 
        clip: rect(50px, 9999px, 5px, 0);
        transform: skew(0.1deg);
    }
    15% { 
        clip: rect(0, 9999px, 15px, 0);
        transform: skew(0.4deg);
    }
    20% { 
        clip: rect(40px, 9999px, 73px, 0);
        transform: skew(0.5deg);
    }
    25% { 
        clip: rect(80px, 9999px, 5px, 0);
        transform: skew(0.7deg);
    }
    30% { 
        clip: rect(10px, 9999px, 60px, 0);
        transform: skew(0.1deg);
    }
    35% { 
        clip: rect(30px, 9999px, 90px, 0);
        transform: skew(0.9deg);
    }
    40% { 
        clip: rect(50px, 9999px, 40px, 0);
        transform: skew(0.2deg);
    }
    45% { 
        clip: rect(70px, 9999px, 25px, 0);
        transform: skew(0.6deg);
    }
    50% { 
        clip: rect(90px, 9999px, 5px, 0);
        transform: skew(0.2deg);
    }
    55% { 
        clip: rect(10px, 9999px, 15px, 0);
        transform: skew(0.5deg);
    }
    60% { 
        clip: rect(30px, 9999px, 26px, 0);
        transform: skew(0.1deg);
    }
    65% { 
        clip: rect(50px, 9999px, 37px, 0);
        transform: skew(0.4deg);
    }
    70% { 
        clip: rect(70px, 9999px, 92px, 0);
        transform: skew(0.8deg);
    }
    75% { 
        clip: rect(90px, 9999px, 6px, 0);
        transform: skew(0.3deg);
    }
    80% { 
        clip: rect(10px, 9999px, 95px, 0);
        transform: skew(0.2deg);
    }
    85% { 
        clip: rect(30px, 9999px, 24px, 0);
        transform: skew(0.5deg);
    }
    90% { 
        clip: rect(50px, 9999px, 57px, 0);
        transform: skew(0.1deg);
    }
    95% { 
        clip: rect(70px, 9999px, 53px, 0);
        transform: skew(0.4deg);
    }
    100% { 
        clip: rect(90px, 9999px, 92px, 0);
        transform: skew(0.7deg);
    }
}

@keyframes glitch-anim-2 {
    0% { 
        clip: rect(65px, 9999px, 65px, 0);
        transform: skew(0.3deg);
    }
    5% { 
        clip: rect(95px, 9999px, 35px, 0);
        transform: skew(0.6deg);
    }
    10% { 
        clip: rect(25px, 9999px, 85px, 0);
        transform: skew(0.3deg);
    }
    15% { 
        clip: rect(55px, 9999px, 45px, 0);
        transform: skew(0.2deg);
    }
    20% { 
        clip: rect(85px, 9999px, 15px, 0);
        transform: skew(0.7deg);
    }
    25% { 
        clip: rect(15px, 9999px, 75px, 0);
        transform: skew(0.4deg);
    }
    30% { 
        clip: rect(45px, 9999px, 55px, 0);
        transform: skew(0.3deg);
    }
    35% { 
        clip: rect(75px, 9999px, 25px, 0);
        transform: skew(0.1deg);
    }
    40% { 
        clip: rect(15px, 9999px, 85px, 0);
        transform: skew(0.6deg);
    }
    45% { 
        clip: rect(45px, 9999px, 45px, 0);
        transform: skew(0.3deg);
    }
    50% { 
        clip: rect(75px, 9999px, 15px, 0);
        transform: skew(0.5deg);
    }
    55% { 
        clip: rect(15px, 9999px, 65px, 0);
        transform: skew(0.2deg);
    }
    60% { 
        clip: rect(45px, 9999px, 95px, 0);
        transform: skew(0.7deg);
    }
    65% { 
        clip: rect(75px, 9999px, 25px, 0);
        transform: skew(0.4deg);
    }
    70% { 
        clip: rect(15px, 9999px, 55px, 0);
        transform: skew(0.1deg);
    }
    75% { 
        clip: rect(45px, 9999px, 85px, 0);
        transform: skew(0.6deg);
    }
    80% { 
        clip: rect(75px, 9999px, 35px, 0);
        transform: skew(0.3deg);
    }
    85% { 
        clip: rect(15px, 9999px, 65px, 0);
        transform: skew(0.2deg);
    }
    90% { 
        clip: rect(45px, 9999px, 95px, 0);
        transform: skew(0.5deg);
    }
    95% { 
        clip: rect(75px, 9999px, 45px, 0);
        transform: skew(0.2deg);
    }
    100% { 
        clip: rect(15px, 9999px, 75px, 0);
        transform: skew(0.4deg);
    }
}

/* Apply Animations to Elements */

/* Glitch Text Effect */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip: rect(0, 0, 0, 0);
}

.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 var(--secondary-color);
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: 1px 0 var(--accent-color);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

/* Typing Effect */
.typing-text {
    display: inline-block;
    overflow: hidden;
    border-right: 0.15em solid var(--primary-color);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.15em;
    animation: 
        typing 3.5s steps(40, end),
        blink 0.75s step-end infinite;
}

/* Floating Animation */
.float {
    animation: float 6s ease-in-out infinite;
}

/* Rotating Animation */
.rotate {
    animation: rotate 10s linear infinite;
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Glow Animation */
.glow {
    animation: glow 2s ease-in-out infinite;
}

/* Fade In Animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
}

.fade-in-down {
    opacity: 0;
    transform: translateY(-30px);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
}

/* Animated classes that will be added via JavaScript */
.animated {
    animation-duration: 1s;
    animation-fill-mode: both;
}

.animated.fade-in-up {
    animation-name: fadeInUp;
}

.animated.fade-in-down {
    animation-name: fadeInDown;
}

.animated.fade-in-left {
    animation-name: fadeInLeft;
}

.animated.fade-in-right {
    animation-name: fadeInRight;
}

.animated.delay-1 {
    animation-delay: 0.2s;
}

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

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

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

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

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

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

/* Skill Icon Pulse Effect */
.skill-icon {
    position: relative;
}

.skill-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    z-index: -1;
}

.skill-item:hover .skill-icon::before {
    animation: ripple 1.5s ease-out;
}

/* Hover Glow Effect */
.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 15px rgba(110, 0, 255, 0.7), 0 0 30px rgba(0, 229, 255, 0.4);
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease-in-out;
}

/* Wave Animation */
.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%230a0a14" d="M0,192L48,197.3C96,203,192,213,288,229.3C384,245,480,267,576,250.7C672,235,768,181,864,181.3C960,181,1056,235,1152,234.7C1248,235,1344,181,1392,154.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
    background-size: 50% 100%;
    animation: wave 15s linear infinite;
}

/* Scroll Reveal Animations */
.reveal {
    position: relative;
    opacity: 0;
    transition: all 1s ease;
}

.reveal.active {
    opacity: 1;
}

.reveal.from-left {
    transform: translateX(-100px);
}

.reveal.from-right {
    transform: translateX(100px);
}

.reveal.from-top {
    transform: translateY(-100px);
}

.reveal.from-bottom {
    transform: translateY(100px);
}

.reveal.active.from-left,
.reveal.active.from-right,
.reveal.active.from-top,
.reveal.active.from-bottom {
    transform: translate(0);
}

/* Staggered Animation for Multiple Elements */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.stagger-item.active {
    opacity: 1;
    transform: translateY(0);
}

/* Animated Counter */
.counter-animation {
    display: inline-block;
    position: relative;
}

.counter-animation::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.5s ease-out;
}

.counter-animation.active::after {
    transform: scaleX(1);
}

/* Animated Progress Bars */
.skill-progress {
    position: relative;
    overflow: hidden;
}

.skill-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(110, 0, 255, 0.2), 
        rgba(0, 229, 255, 0.2), 
        rgba(110, 0, 255, 0.2));
    background-size: 200% 100%;
    animation: gradient-shift 3s linear infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 200% 0%;
    }
}

/* Animated Testimonial Quote */
.quote-icon {
    position: relative;
    z-index: 1;
}

.quote-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(110, 0, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    transition: all 0.5s ease;
}

.testimonial-slide.active .quote-icon::before {
    animation: pulse 2s ease-in-out infinite;
}

/* Animated Form Fields */
.form-group input:focus ~ .form-line::after,
.form-group textarea:focus ~ .form-line::after {
    animation: form-line 0.6s ease-out;
}

@keyframes form-line {
    0% {
        transform: scaleX(0);
        transform-origin: left;
    }
    100% {
        transform: scaleX(1);
        transform-origin: left;
    }
}

/* Button Hover Animation */
.btn::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    background: var(--gradient-primary);
    z-index: -2;
    border-radius: var(--radius-md);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::after {
    opacity: 1;
    animation: rotate-gradient 2s linear infinite;
}

@keyframes rotate-gradient {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

/* 3D Card Effect */
.card-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: all 0.3s ease;
}

.card-3d:hover {
    transform: rotateY(10deg) rotateX(5deg);
}

.card-3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        rgba(110, 0, 255, 0.1) 0%,
        rgba(0, 229, 255, 0.1) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-3d:hover::before {
    opacity: 1;
}

/* Animated Background Gradient */
.animated-bg {
    background: linear-gradient(
        -45deg, 
        var(--darker-bg), 
        var(--dark-bg), 
        rgba(110, 0, 255, 0.2), 
        rgba(0, 229, 255, 0.2)
    );
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

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

/* Animated Cursor */
.custom-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    transform: translate(-50%, -50%);
    pointer-events: none;
    mix-blend-mode: difference;
    z-index: 9999;
    transition: width 0.3s, height 0.3s, background 0.3s;
}

.cursor-dot {
    position: fixed;
    width: 5px;
    height: 5px;
    background: var(--secondary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10000;
    transition: transform 0.1s;
}

/* Animated Social Icons */
.social-link::before {
    transform: scale(0);
    transition: transform 0.3s ease;
}

.social-link:hover::before {
    transform: scale(1);
}

.social-link i {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.social-link:hover i {
    transform: rotate(360deg);
}

/* Animated Timeline */
.timeline::after {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    width: 2px;
    height: 0;
    background: var(--gradient-primary);
    transition: height 2s ease;
}

.timeline.animated::after {
    height: 100%;
}

.timeline-dot {
    transform: scale(0);
    transition: transform 0.5s ease;
}

.timeline-item.animated .timeline-dot {
    transform: scale(1);
}

.timeline-content {
    transform: translateX(50px);
    opacity: 0;
    transition: all 0.5s ease;
}

.timeline-item.animated .timeline-content {
    transform: translateX(0);
    opacity: 1;
}

/* Animated Project Cards */
.project-card {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.project-card:hover {
    transform: translateY(-15px) scale(1.03);
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(110, 0, 255, 0.2) 0%,
        rgba(0, 229, 255, 0.2) 100%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: var(--radius-md);
    pointer-events: none;
}

.project-card:hover::after {
    opacity: 1;
}

/* Animated Skill Icons */
.skill-icon i {
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.skill-svg-icon {
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.skill-item:hover .skill-icon i {
    transform: scale(1.2);
    color: var(--secondary-color);
}

.skill-item:hover .skill-svg-icon {
    transform: scale(1.2);
    filter: drop-shadow(0 0 20px var(--secondary-color));
}

/* Animated Testimonial Slider */
.testimonial-slide {
    transition: all 0.5s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.testimonial-slide.active {
    transform: scale(1.02);
}

/* Animated Contact Form Submit Button */
.submit-btn span {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.submit-btn i {
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

.submit-btn:hover span {
    transform: translateX(-10px);
}

.submit-btn:hover i {
    opacity: 1;
    transform: translateX(0);
}

/* Animated Back to Top Button */
.back-to-top {
    overflow: hidden;
}

.back-to-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.back-to-top:hover::before {
    transform: translateY(0);
}

.back-to-top i {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.back-to-top:hover i {
    transform: translateY(-5px);
}

/* Animated Section Backgrounds */
.section-bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.section-bg-animation span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: rgba(110, 0, 255, 0.1);
    animation: section-bg-move 25s linear infinite;
    bottom: -150px;
    border-radius: 50%;
}

.section-bg-animation span:nth-child(1) {
    left: 10%;
    width: 80px;
    height: 80px;
    animation-delay: 0s;
    animation-duration: 20s;
}

.section-bg-animation span:nth-child(2) {
    left: 20%;
    width: 30px;
    height: 30px;
    animation-delay: 2s;
    animation-duration: 25s;
}

.section-bg-animation span:nth-child(3) {
    left: 30%;
    width: 100px;
    height: 100px;
    animation-delay: 4s;
    animation-duration: 15s;
}

.section-bg-animation span:nth-child(4) {
    left: 40%;
    width: 60px;
    height: 60px;
    animation-delay: 0s;
    animation-duration: 18s;
}

.section-bg-animation span:nth-child(5) {
    left: 50%;
    width: 40px;
    height: 40px;
    animation-delay: 5s;
    animation-duration: 22s;
}

.section-bg-animation span:nth-child(6) {
    left: 60%;
    width: 90px;
    height: 90px;
    animation-delay: 3s;
    animation-duration: 17s;
}

.section-bg-animation span:nth-child(7) {
    left: 70%;
    width: 120px;
    height: 120px;
    animation-delay: 7s;
    animation-duration: 23s;
}

.section-bg-animation span:nth-child(8) {
    left: 80%;
    width: 50px;
    height: 50px;
    animation-delay: 1s;
    animation-duration: 19s;
}

.section-bg-animation span:nth-child(9) {
    left: 90%;
    width: 70px;
    height: 70px;
    animation-delay: 6s;
    animation-duration: 21s;
}

@keyframes section-bg-move {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
        border-radius: 0;
    }
    100% {
        transform: translateY(-1000px) rotate(720deg);
        opacity: 0;
        border-radius: 50%;
    }
}

/* Animated Menu Toggle */
.menu-toggle .bar {
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Animated Navbar Links */
.nav-link::after {
    transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Animated Logo */
.logo-text {
    background-size: 200% auto;
    animation: text-gradient 5s linear infinite;
}

@keyframes text-gradient {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Animated Scroll Indicator */
.scroll-indicator {
    animation-name: fadeIn;
    animation-duration: 2s;
    animation-delay: 1s;
    animation-fill-mode: forwards;
}

/* Animated Hero Content */
.hero-content h1,
.hero-content .subtitle,
.hero-content .hero-description,
.hero-content .cta-buttons {
    opacity: 0;
    animation: fadeInUp 1s ease-out forwards;
}

.hero-content .subtitle {
    animation-delay: 0.2s;
}

.hero-content .hero-description {
    animation-delay: 0.4s;
}

.hero-content .cta-buttons {
    animation-delay: 0.6s;
}

/* Animated Section Headers */
.section-header {
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s ease;
}

.section-header.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Animated Stats Counter */
.stat-number {
    display: inline-block;
    position: relative;
}

.stat-number::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.5s ease-out;
}

.stat-number.counted::after {
    transform: scaleX(1);
}