/* Smooth scrolling for the entire page */
html {
    scroll-behavior: smooth;
}

/* Loading Animation */
.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Menu Slide Animation */
.mobile-menu-hidden {
    transform: translateX(-100%);
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

.mobile-menu-visible {
    transform: translateX(0);
    opacity: 1;
    transition: all 0.3s ease-in-out;
}

/* Active Navigation Link */
.nav-link.active {
    color: #4f46e5;
    font-weight: 600;
}

.nav-link.active::after {
    width: 100%;
}

.nav-link-mobile.active {
    color: #4f46e5;
    background-color: rgba(79, 70, 229, 0.1);
    font-weight: 600;
}

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

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }

/* Enhanced project card hover animations */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Project card image hover effect */
.card-hover:hover .h-48 {
    transform: scale(1.05);
}

.card-hover .h-48 {
    transition: transform 0.3s ease;
    overflow: hidden;
}

/* Project card content animation */
.card-hover:hover .p-6 {
    transform: translateY(-2px);
}

.card-hover .p-6 {
    transition: transform 0.3s ease;
}

/* Icon animation on hover */
.card-hover:hover i {
    transform: scale(1.1) rotate(5deg);
}

.card-hover i {
    transition: transform 0.3s ease;
}

.gradient-text {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Better Mobile Experience */
@media (max-width: 768px) {
    .card-hover {
        transform: none;
        transition: box-shadow 0.3s ease;
    }
    
    .card-hover:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    }
    
    /* Optimize card layouts for mobile */
    .grid.md\\:grid-cols-2.lg\\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .grid.grid-cols-2.md\\:grid-cols-4 {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    /* Mobile-friendly hero section */
    .flex.flex-col.md\\:flex-row {
        text-align: center;
    }
    
    /* Better mobile navigation */
    #mobile-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        z-index: 40;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }
    
    /* Mobile typography adjustments */
    h1 {
        font-size: 2.5rem !important;
        line-height: 1.2;
    }
    
    .text-xl {
        font-size: 1.125rem;
    }
    
    /* Mobile padding adjustments */
    .py-20 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    .pt-32 {
        padding-top: 6rem;
    }
    
    /* Mobile button improvements */
    .flex.flex-col.sm\\:flex-row {
        gap: 0.75rem;
    }
    
    .px-6.py-3 {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .grid.md\\:grid-cols-2.lg\\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .grid.grid-cols-2.md\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}
/* Per
formance optimizations */
* {
    box-sizing: border-box;
}

/* Smooth transitions for all interactive elements */
a, button, .card-hover, .nav-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced focus states for accessibility */
a:focus, button:focus, input:focus, textarea:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Improved loading state */
#loader {
    transition: opacity 0.5s ease-out;
}

/* Better scroll indicator */
.nav-link::after {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced mobile menu animation */
@media (max-width: 768px) {
    #mobile-menu {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    #mobile-menu.mobile-menu-visible {
        transform: translateX(0);
    }
}

/* Scroll-based animations */
@media (prefers-reduced-motion: no-preference) {
    .fade-in {
        opacity: 0;
        transform: translateY(30px);
        transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    }
    
    .fade-in.visible {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}