/* Enhanced Animations and Micro-interactions */

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

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

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

/* Gradient background animation */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animated gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(-45deg, #f0f9ff, #e0f2fe, #bae6fd, #7dd3fc);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
    opacity: 0.3;
}

/* Page load animations */
header {
    animation: fadeInUp 0.6s ease-out;
}

.profile-image {
    animation: fadeIn 0.8s ease-out;
    position: relative;
    overflow: visible;
}

.profile-image::after {
    content: '';
    position: absolute;
    inset: -5px;
    background: conic-gradient(from 180deg at 50% 50%, #0066cc 0deg, #00a6ff 120deg, #0066cc 360deg);
    border-radius: 50%;
    animation: rotate 3s linear infinite;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-image:hover::after {
    opacity: 0.8;
}

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

/* Stagger animations for sections */
section {
    animation: fadeInUp 0.6s ease-out both;
}

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

/* Enhanced button hover effects */
.filter-btn, .btn, button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Removed white sphere hover effect - kept clean button hover */

/* Card hover effects with 3D transform */
.project-card, .cert-card, .timeline-content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
}

.project-card:hover, .cert-card:hover {
    transform: perspective(1000px) rotateX(-2deg) rotateY(2deg) translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Enhanced tag animations */
.tag {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tag::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 102, 204, 0.2);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tag:hover::before {
    transform: scaleX(1);
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.2);
}

/* Social links enhanced hover */
.social-links a {
    position: relative;
    transition: all 0.3s ease;
}

.social-links a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-color);
    border-radius: 50%;
    transform: scale(0);
    opacity: 0.2;
    transition: transform 0.3s ease;
}

.social-links a:hover::before {
    transform: scale(1.2);
}

/* Timeline enhancements */
.timeline-item {
    opacity: 0;
    animation: slideInLeft 0.6s ease-out forwards;
}

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

.timeline-item::before {
    transition: all 0.3s ease;
}

.timeline-item:hover::before {
    transform: scale(1.5);
    box-shadow: 0 0 20px rgba(0, 102, 204, 0.6);
}

/* Skill tags floating animation */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.skill-tags .tag:hover {
    animation: float 0.6s ease-in-out;
}

/* Loading skeleton animation */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.loading {
    background: linear-gradient(
        to right,
        #f6f7f8 0%,
        #edeef1 20%,
        #f6f7f8 40%,
        #f6f7f8 100%
    );
    background-size: 468px 104px;
    animation: shimmer 1s linear infinite;
}

/* Smooth scroll indicator */
.scroll-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.3);
}

.scroll-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-indicator:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 102, 204, 0.4);
}

/* Text selection styling */
::selection {
    background: var(--accent-color);
    color: white;
}

::-moz-selection {
    background: var(--accent-color);
    color: white;
}

/* Focus visible improvements */
*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
    transition: outline-offset 0.2s ease;
}

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Typography enhancements */
h1, h2, h3 {
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

section:hover h2::after {
    width: 100px;
}

/* Responsive animations */
@media (max-width: 768px) {
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .project-card:hover, .cert-card:hover {
        transform: translateY(-3px);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}