/* Modern UI Framework - Advanced Animations & Interactions */

:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --primary-light: #a78bfa;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --dark: #0f0f0f;
    --dark-card: #1a1a1a;
    --dark-overlay: rgba(0, 0, 0, 0.7);
    --light: #ffffff;
    --gray: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --gradient-dark: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.3);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--dark);
    color: var(--light);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Animated Background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: var(--gradient-dark);
    overflow: hidden;
}

.animated-bg::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    opacity: 0.05;
    animation: rotate 30s linear infinite;
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

.particle:nth-child(1) { width: 3px; height: 3px; left: 10%; animation-delay: 0s; animation-duration: 25s; }
.particle:nth-child(2) { width: 2px; height: 2px; left: 20%; animation-delay: 2s; animation-duration: 20s; }
.particle:nth-child(3) { width: 4px; height: 4px; left: 30%; animation-delay: 4s; animation-duration: 30s; }
.particle:nth-child(4) { width: 3px; height: 3px; left: 40%; animation-delay: 1s; animation-duration: 22s; }
.particle:nth-child(5) { width: 2px; height: 2px; left: 50%; animation-delay: 3s; animation-duration: 28s; }
.particle:nth-child(6) { width: 5px; height: 5px; left: 60%; animation-delay: 5s; animation-duration: 25s; }
.particle:nth-child(7) { width: 3px; height: 3px; left: 70%; animation-delay: 2s; animation-duration: 20s; }
.particle:nth-child(8) { width: 4px; height: 4px; left: 80%; animation-delay: 6s; animation-duration: 35s; }
.particle:nth-child(9) { width: 2px; height: 2px; left: 90%; animation-delay: 4s; animation-duration: 30s; }
.particle:nth-child(10) { width: 3px; height: 3px; left: 95%; animation-delay: 7s; animation-duration: 25s; }

@keyframes float {
    0%, 100% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
        transform: translateY(90vh) translateX(-10px) scale(1);
    }
    90% {
        opacity: 0.3;
        transform: translateY(-10vh) translateX(10px) scale(1);
    }
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modern Navigation Bar */
.modern-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    transition: all var(--transition-base);
}

.modern-nav.scrolled {
    background: rgba(15, 15, 15, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    transition: transform var(--transition-base);
}

.nav-logo:hover {
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
    list-style: none;
}

.nav-link {
    color: var(--light);
    text-decoration: none;
    position: relative;
    padding: 0.5rem 1rem;
    transition: color var(--transition-base);
    font-weight: 500;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: all var(--transition-base);
    transform: translateX(-50%);
}

.nav-link:hover {
    color: var(--primary-light);
}

.nav-link:hover::after {
    width: 100%;
}

/* Hero Section with Advanced Animations */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

.hero-content {
    text-align: center;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--light) 0%, var(--primary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 5s ease infinite;
    background-size: 200% 200%;
    letter-spacing: -0.02em;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-subtitle {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 3rem;
    animation: fade-slide-up 1s ease-out 0.3s both;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

@keyframes fade-slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern Buttons with Ripple Effect */
.btn-modern {
    position: relative;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-base);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    text-decoration: none;
}

.btn-primary-modern {
    background: var(--gradient-primary);
    color: var(--light);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.btn-secondary-modern {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary-modern:hover {
    background: var(--primary);
    color: var(--light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.btn-modern .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Interactive Cards with 3D Effects */
.card-3d {
    background: var(--gradient-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    padding: 2rem;
    transition: all var(--transition-base);
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
}

.card-3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(139, 92, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card-3d:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.3);
    border-color: var(--primary);
}

.card-3d:hover::before {
    opacity: 1;
}

/* Glassmorphism Elements */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Animated Progress Bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::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%); }
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1) 25%, rgba(139, 92, 246, 0.2) 50%, rgba(139, 92, 246, 0.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Smooth Scroll Reveal */
.reveal {
    opacity: 1; /* Changed from 0 to 1 for immediate visibility */
    transform: translateY(0); /* Start at final position */
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation: revealAnimation 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 1;
    transform: translateX(0);
    animation: revealLeftAnimation 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.reveal-left.active {
    transform: translateX(0);
}

.reveal-right {
    opacity: 1;
    transform: translateX(0);
    animation: revealRightAnimation 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.reveal-right.active {
    transform: translateX(0);
}

/* Reveal animations that run on page load */
@keyframes revealAnimation {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes revealLeftAnimation {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes revealRightAnimation {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Floating Animation */
.float-animation {
    animation: float-updown 3s ease-in-out infinite;
}

@keyframes float-updown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Pulse Animation */
.pulse {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
    }
}

/* Interactive Form Elements */
.form-group-modern {
    position: relative;
    margin-bottom: 2rem;
}

.form-input-modern {
    width: 100%;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    color: var(--light);
    font-size: 1rem;
    transition: all var(--transition-base);
    outline: none;
}

.form-input-modern:focus {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.form-label-modern {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    transition: all var(--transition-base);
    pointer-events: none;
    background: var(--dark);
    padding: 0 0.5rem;
}

.form-input-modern:focus + .form-label-modern,
.form-input-modern:not(:placeholder-shown) + .form-label-modern {
    top: 0;
    font-size: 0.85rem;
    color: var(--primary);
}

/* Animated Counters */
.counter {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tooltip */
.tooltip-modern {
    position: relative;
}

.tooltip-content {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: var(--dark-card);
    color: var(--light);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.tooltip-modern:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* Page Transitions */
.page-transition {
    animation: page-enter 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Grid */
.grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .hero-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--dark-card);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.3);
        padding: 2rem 0;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .hamburger {
        display: block;
        cursor: pointer;
    }
    
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}