/*==================================================
ADVANCED ANIMATIONS & INTERACTIONS
==================================================*/

/* ===== KEYFRAME ANIMATIONS ===== */

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

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

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

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

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(108, 99, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(108, 99, 255, 0.5);
    }
}

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

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

@keyframes flipIn {
    from {
        opacity: 0;
        transform: rotateY(90deg);
    }
    to {
        opacity: 1;
        transform: rotateY(0deg);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* ===== HERO SECTION ANIMATIONS ===== */

.hero-left {
    animation: slideInLeft 0.8s ease;
}

.hero-right {
    animation: slideInRight 0.8s ease;
    animation-delay: 0.2s;
}

.welcome {
    animation: fadeIn 0.6s ease 0.3s both;
}

.hero h1 {
    animation: slideInUp 0.8s ease 0.4s both;
    font-size: 4.5rem;
}

.hero h2 {
    animation: slideInUp 0.8s ease 0.5s both;
}

.hero-text {
    animation: fadeIn 0.8s ease 0.6s both;
}

.hero-buttons {
    animation: fadeInScale 0.8s ease 0.7s both;
}

.social-icons {
    animation: slideInUp 0.8s ease 0.8s both;
}

.social-icons a {
    transition: all 0.35s ease;
}

.social-icons a:hover {
    transform: translateY(-8px) scale(1.2);
    filter: drop-shadow(0 0 15px rgba(108, 99, 255, 0.6));
}

.profile-card {
    animation: slideInRight 0.8s ease 0.3s both;
    position: relative;
    transition: transform 0.35s ease;
}

.profile-card:hover {
    transform: translateY(-15px);
}

.profile-card .glow {
    animation: glow 3s ease infinite;
}

/* ===== SECTION ANIMATIONS ===== */

.section-title {
    animation: slideInUp 0.8s ease;
}

.section-title span {
    animation: fadeIn 0.6s ease;
}

.section-title h2 {
    animation: slideInUp 0.8s ease 0.2s both;
}

.section-title p {
    animation: fadeIn 0.8s ease 0.3s both;
}

/* ===== ABOUT SECTION ANIMATIONS ===== */

.about-image {
    animation: slideInLeft 0.8s ease;
}

.about-image .about-card {
    transition: transform 0.35s ease;
    position: relative;
}

.about-image .about-card:hover {
    transform: scale(1.05) rotate(2deg);
}

.about-image img {
    animation: rotateIn 0.8s ease;
}

.about-content {
    animation: slideInRight 0.8s ease;
}

.about-content h3 {
    animation: slideInUp 0.6s ease 0.2s both;
}

.about-content p {
    animation: fadeIn 0.6s ease;
}

.about-info {
    animation: fadeInScale 0.6s ease 0.4s both;
}

.info-box {
    transition: all 0.35s ease;
    animation: slideInUp 0.6s ease;
}

.info-box:nth-child(1) { animation-delay: 0.2s; }
.info-box:nth-child(2) { animation-delay: 0.3s; }
.info-box:nth-child(3) { animation-delay: 0.4s; }
.info-box:nth-child(4) { animation-delay: 0.5s; }

.info-box:hover {
    transform: translateY(-8px);
    background: rgba(108, 99, 255, 0.15) !important;
    border-color: rgba(108, 99, 255, 0.4) !important;
}

/* ===== SERVICES ANIMATIONS ===== */

.service-card {
    animation: slideInUp 0.6s ease;
    transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.service-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 
        0 30px 60px rgba(108, 99, 255, 0.3),
        0 0 40px rgba(0, 212, 255, 0.15);
}

.service-card i {
    transition: all 0.35s ease;
    display: inline-block;
}

.service-card:hover i {
    transform: rotateY(360deg) scale(1.2);
}

/* ===== SKILLS ANIMATIONS ===== */

.skill-box {
    animation: slideInUp 0.6s ease;
}

.skill-box:nth-child(1) { animation-delay: 0.1s; }
.skill-box:nth-child(2) { animation-delay: 0.15s; }
.skill-box:nth-child(3) { animation-delay: 0.2s; }
.skill-box:nth-child(4) { animation-delay: 0.25s; }
.skill-box:nth-child(5) { animation-delay: 0.3s; }
.skill-box:nth-child(6) { animation-delay: 0.35s; }
.skill-box:nth-child(7) { animation-delay: 0.4s; }
.skill-box:nth-child(8) { animation-delay: 0.45s; }

.progress span {
    animation: slideInLeft 1.2s ease forwards;
    opacity: 0;
}

.skill-box:nth-child(1) .progress span { animation-delay: 0.1s; }
.skill-box:nth-child(2) .progress span { animation-delay: 0.15s; }
.skill-box:nth-child(3) .progress span { animation-delay: 0.2s; }
.skill-box:nth-child(4) .progress span { animation-delay: 0.25s; }
.skill-box:nth-child(5) .progress span { animation-delay: 0.3s; }
.skill-box:nth-child(6) .progress span { animation-delay: 0.35s; }
.skill-box:nth-child(7) .progress span { animation-delay: 0.4s; }
.skill-box:nth-child(8) .progress span { animation-delay: 0.45s; }

/* ===== PORTFOLIO ANIMATIONS ===== */

.filter-btn {
    animation: slideInUp 0.6s ease;
    transition: all 0.35s ease;
}

.project-image img {
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-card:hover .project-image img {
    transform: scale(1.12) rotate(2deg) skewY(1deg);
}

/* ===== MODAL ANIMATIONS ===== */

.portfolio-modal.active {
    animation: fadeInModal 0.4s ease forwards;
}

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

.modal-content {
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-image {
    animation: slideInLeft 0.6s ease;
}

.modal-info {
    animation: slideInRight 0.6s ease;
}

.modal-info h2 {
    animation: slideInUp 0.6s ease 0.2s both;
}

.tech-badge {
    animation: scaleIn 0.4s ease;
}

.tech-badge:nth-child(1) { animation-delay: 0.1s; }
.tech-badge:nth-child(2) { animation-delay: 0.15s; }
.tech-badge:nth-child(3) { animation-delay: 0.2s; }
.tech-badge:nth-child(4) { animation-delay: 0.25s; }
.tech-badge:nth-child(5) { animation-delay: 0.3s; }

/* ===== TESTIMONIALS ANIMATIONS ===== */

.testimonial-card {
    animation: slideInUp 0.6s ease;
    transition: all 0.35s ease;
}

.testimonial-card:nth-child(1) { animation-delay: 0.1s; }
.testimonial-card:nth-child(2) { animation-delay: 0.2s; }
.testimonial-card:nth-child(3) { animation-delay: 0.3s; }

.testimonial-card:hover {
    transform: translateY(-10px);
    box-shadow: 
        0 20px 50px rgba(108, 99, 255, 0.25),
        0 0 30px rgba(0, 212, 255, 0.1);
}

.testimonial-card i {
    animation: rotateIn 0.6s ease;
}

/* ===== BUTTONS ANIMATIONS ===== */

.primary-btn,
.secondary-btn,
.hire-btn,
.submit-btn,
.cta-button {
    position: relative;
    overflow: hidden;
    transition: all 0.35s ease;
}

.primary-btn::before,
.secondary-btn::before,
.hire-btn::before,
.submit-btn::before,
.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.6s ease;
    z-index: -1;
}

.primary-btn:hover::before,
.secondary-btn:hover::before,
.hire-btn:hover::before,
.submit-btn:hover::before,
.cta-button:hover::before {
    left: 100%;
}

/* ===== TIMELINE ANIMATIONS ===== */

.timeline-item {
    animation: slideInUp 0.6s ease;
    opacity: 0;
}

.timeline-item:nth-child(1) { 
    animation-delay: 0.1s;
    animation-fill-mode: forwards;
}
.timeline-item:nth-child(2) { 
    animation-delay: 0.2s;
    animation-fill-mode: forwards;
}
.timeline-item:nth-child(3) { 
    animation-delay: 0.3s;
    animation-fill-mode: forwards;
}

.timeline-dot {
    animation: pulse 2s ease infinite;
}

.timeline-item:hover .timeline-dot {
    animation: glow 1s ease infinite;
}

/* ===== STATS ANIMATIONS ===== */

.stat-box {
    animation: slideInUp 0.6s ease;
}

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

.counter {
    animation: slideInUp 0.6s ease;
}

/* ===== FORM ANIMATIONS ===== */

.form-group {
    animation: slideInUp 0.6s ease;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.15s; }
.form-group:nth-child(3) { animation-delay: 0.2s; }
.form-group:nth-child(4) { animation-delay: 0.25s; }

.form-group input:focus,
.form-group textarea:focus {
    animation: pulse 0.6s ease;
}

/* ===== SCROLL REVEAL ANIMATIONS ===== */

.scroll-reveal {
    animation: slideInUp 0.8s ease both;
}

.scroll-reveal-left {
    animation: slideInLeft 0.8s ease both;
}

.scroll-reveal-right {
    animation: slideInRight 0.8s ease both;
}

/* ===== LOADING ANIMATION ===== */

.loader-circle {
    animation: rotate 2s linear infinite, glow 2s ease infinite;
}

/* ===== FAQ ANIMATIONS ===== */

.faq-item {
    animation: slideInUp 0.6s ease;
}

.faq-item:nth-child(1) { animation-delay: 0.1s; }
.faq-item:nth-child(2) { animation-delay: 0.2s; }
.faq-item:nth-child(3) { animation-delay: 0.3s; }

.faq-answer {
    animation: slideDown 0.4s ease;
}

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

.faq-question i {
    transition: transform 0.35s ease;
}

.faq-question.active i {
    transform: rotate(45deg);
}

/* ===== CONTACT SECTION ANIMATIONS ===== */

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

.contact-form {
    animation: slideInRight 0.8s ease;
}

.contact-box {
    animation: slideInUp 0.6s ease;
}

.contact-box:nth-child(1) { animation-delay: 0.15s; }
.contact-box:nth-child(2) { animation-delay: 0.25s; }
.contact-box:nth-child(3) { animation-delay: 0.35s; }
.contact-box:nth-child(4) { animation-delay: 0.45s; }

/* ===== MICRO-INTERACTIONS ===== */

.back-to-top {
    animation: slideInUp 0.6s ease;
    transition: all 0.35s ease;
}

.back-to-top:hover {
    transform: translateY(-5px) scale(1.15);
    animation: bounce 1s ease infinite;
}

.floating-mail {
    animation: float 3s ease infinite;
    transition: all 0.35s ease;
}

.floating-mail:hover {
    transform: scale(1.2);
    animation: glow 1s ease infinite;
}

/* ===== NAVBAR ANIMATIONS ===== */

header {
    animation: slideInDown 0.6s ease;
}

.navbar {
    transition: all 0.35s ease;
}

.navbar.scrolled {
    animation: slideInDown 0.4s ease;
}

.nav-links a {
    position: relative;
    animation: slideInUp 0.6s ease;
}

.nav-links a:nth-child(1) { animation-delay: 0.1s; }
.nav-links a:nth-child(2) { animation-delay: 0.15s; }
.nav-links a:nth-child(3) { animation-delay: 0.2s; }
.nav-links a:nth-child(4) { animation-delay: 0.25s; }
.nav-links a:nth-child(5) { animation-delay: 0.3s; }
.nav-links a:nth-child(6) { animation-delay: 0.35s; }

/* ===== RIPPLE EFFECT ===== */

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===== TOOLTIP ANIMATIONS ===== */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    background: rgba(108, 99, 255, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== PARALLAX EFFECT ===== */

.parallax {
    position: relative;
    overflow: hidden;
}

.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    background-size: cover;
    background-position: center;
    transform: translateZ(0);
    will-change: transform;
}

/* ===== PERFORMANCE ===== */

* {
    will-change: auto;
}

.animation-on-scroll {
    will-change: transform;
}

button, a {
    will-change: transform;
}

/* ===== REDUCE MOTION ===== */

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

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero-left,
    .hero-right {
        animation: slideInUp 0.8s ease !important;
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .contact-info,
    .contact-form {
        animation: slideInUp 0.8s ease !important;
    }
}
