/**
 * Tagoals - Cosmic Effects Styling
 * Beautiful animations and interactive effects
 */

/* ========== 1. WELCOME OVERLAY ========== */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: welcomeFadeIn 0.5s ease;
}

.welcome-overlay.fade-out {
    animation: welcomeFadeOut 0.8s ease forwards;
}

.welcome-content {
    text-align: center;
}

.cosmic-logo {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 30px;
}

.logo-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(91, 79, 255, 0.5);
    border-radius: 50%;
    animation: logoRingPulse 2s ease-in-out infinite;
}

.logo-ring:nth-child(1) {
    width: 60px;
    height: 60px;
    animation-delay: 0s;
}

.logo-ring:nth-child(2) {
    width: 90px;
    height: 90px;
    animation-delay: 0.3s;
}

.logo-ring:nth-child(3) {
    width: 120px;
    height: 120px;
    animation-delay: 0.6s;
}

.logo-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: logoTextGlow 2s ease-in-out infinite;
}

.welcome-text {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    letter-spacing: 3px;
    animation: welcomeTextFloat 3s ease-in-out infinite;
}

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

@keyframes welcomeFadeOut {
    to {
        opacity: 0;
        transform: scale(1.5);
    }
}

@keyframes logoRingPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

@keyframes logoTextGlow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(91, 79, 255, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(91, 79, 255, 1));
    }
}

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

/* Page loaded state */
body.page-loaded .landing-content,
body.page-loaded .form-section {
    animation: contentSlideIn 0.8s ease forwards;
}

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

/* ========== 2. CURSOR TRAIL PARTICLES ========== */
.cursor-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, rgba(91, 79, 255, 0.8), transparent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: cursorParticleFade 0.8s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes cursorParticleFade {
    from {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    to {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

/* ========== 3. CLICK RIPPLE EFFECT ========== */
.click-ripple {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(91, 79, 255, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: rippleExpand 0.6s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes rippleExpand {
    from {
        width: 20px;
        height: 20px;
        opacity: 1;
    }
    to {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}

/* ========== 4. PARTICLE BURST ========== */
.burst-particle {
    position: fixed;
    width: 4px;
    height: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    animation: burstParticle 1s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes burstParticle {
    from {
        transform: translate(-50%, -50%) translate(0, 0) scale(1);
        opacity: 1;
    }
    to {
        transform: translate(-50%, -50%) translate(var(--vx), var(--vy)) scale(0);
        opacity: 0;
    }
}

/* ========== 5. SCROLL REVEAL ANIMATIONS ========== */
.reveal-element {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation for multiple elements */
.form-section-group:nth-child(1).revealed {
    transition-delay: 0.1s;
}

.form-section-group:nth-child(2).revealed {
    transition-delay: 0.2s;
}

.form-section-group:nth-child(3).revealed {
    transition-delay: 0.3s;
}

.form-section-group:nth-child(4).revealed {
    transition-delay: 0.4s;
}

/* ========== 6. FLOATING PARTICLES ========== */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.floating-particle {
    position: absolute;
    background: radial-gradient(circle, rgba(91, 79, 255, 0.6), transparent);
    border-radius: 50%;
    opacity: 0.6;
    animation: floatParticle 20s linear infinite;
    pointer-events: all;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

@keyframes floatParticle {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    25% {
        transform: translateY(-100px) translateX(50px) rotate(90deg);
    }
    50% {
        transform: translateY(-50px) translateX(-50px) rotate(180deg);
    }
    75% {
        transform: translateY(-150px) translateX(25px) rotate(270deg);
    }
    100% {
        transform: translateY(0) translateX(0) rotate(360deg);
    }
}

/* ========== 7. BUTTON GLOW EFFECT ========== */
.cta-button,
.submit-button {
    position: relative;
    overflow: hidden;
}

.button-glow {
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: all 0.2s ease;
}

/* ========== 8. INPUT FOCUS PARTICLES ========== */
.input-focus-particle {
    position: fixed;
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9996;
    animation: inputParticleRise 1s ease-out forwards;
}

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

/* ========== 9. COSMIC GLOW ON HOVER ========== */
.cosmic-glow-active {
    animation: cosmicGlowPulse 2s ease-in-out infinite;
}

@keyframes cosmicGlowPulse {
    0%, 100% {
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.4),
            0 0 80px rgba(91, 79, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.4),
            0 0 120px rgba(91, 79, 255, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

/* ========== 10. ENHANCED FORM INTERACTIONS ========== */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    animation: inputFocusGlow 0.5s ease;
}

@keyframes inputFocusGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(91, 79, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(91, 79, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(91, 79, 255, 0.15);
    }
}

/* ========== 11. SMOOTH TRANSITIONS ========== */
* {
    transition: background-color 0.3s ease, 
                border-color 0.3s ease,
                color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Exception for animations and transforms */
.cursor-particle,
.click-ripple,
.burst-particle,
.floating-particle,
.button-glow,
.input-focus-particle {
    transition: none !important;
}

/* ========== 12. LOADING STATES ========== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spinnerRotate 0.8s linear infinite;
}

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

/* ========== 13. COSMIC STARS TWINKLING ========== */
.cosmic-bg .star {
    animation: starTwinkle 3s ease-in-out infinite;
}

.cosmic-bg .star:nth-child(2n) {
    animation-delay: 1s;
    animation-duration: 4s;
}

.cosmic-bg .star:nth-child(3n) {
    animation-delay: 2s;
    animation-duration: 5s;
}

@keyframes starTwinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

/* ========== 14. MOBILE OPTIMIZATIONS ========== */
@media (max-width: 768px) {
    /* Reduce particle count on mobile */
    .floating-particle:nth-child(n+15) {
        display: none;
    }
    
    /* Simplify some effects */
    .cursor-particle {
        display: none; /* Disable cursor trail on mobile */
    }
    
    .welcome-overlay {
        padding: 20px;
    }
    
    .cosmic-logo {
        width: 100px;
        height: 100px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    .welcome-text {
        font-size: 1rem;
    }
}

/* ========== 15. REDUCE MOTION FOR ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .cursor-particle,
    .click-ripple,
    .burst-particle,
    .floating-particle {
        display: none;
    }
}

/* ========== 16. PERFORMANCE OPTIMIZATIONS ========== */
.cursor-particle,
.click-ripple,
.burst-particle,
.floating-particle,
.button-glow,
.input-focus-particle {
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}
