/* =====================================================
   EFECTOS AVANZADOS Y MICRO-INTERACCIONES
   ===================================================== */


/* ======================= */
/* Loading Screen */
/* ======================= */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: all 0.8s ease;
}

.loading-screen.loading-complete {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.loading-logo {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color), var(--secondary-color));
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 2s ease-in-out infinite;
    margin-bottom: 2rem;
}

.loading-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--secondary-color));
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s ease-in-out infinite;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-text {
    color: var(--text-color);
    font-size: 1.1rem;
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

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



/* ======================= */
/* Ripple Effect */
/* ======================= */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    animation: ripple-animation 0.6s linear;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ======================= */
/* Mouse Effects */
/* ======================= */
.mouse-star {
    position: fixed;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    animation: star-twinkle 1s ease-out forwards;
}

@keyframes star-twinkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.click-particle {
    position: fixed;
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9996;
    animation: particle-burst 0.8s ease-out forwards;
}

@keyframes particle-burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--vx), var(--vy)) scale(0);
        opacity: 0;
    }
}


/* ======================= */
/* Mobile Optimizations */
/* ======================= */
@media (max-width: 768px) {

    .loading-logo {
        font-size: 2rem;
    }

}

/* ======================= */
/* Performance Optimizations */
/* ======================= */
.animate-on-scroll {
    will-change: transform, opacity;
}

.project-card,
.about-card,
.skill-category {
    will-change: transform;
}

/* Lazy loading para imágenes */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

img.lazy.loaded {
    opacity: 1;
}

/* ======================= */
/* Scrollbar Styling */
/* ======================= */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, var(--accent-color), var(--secondary-color));
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-secondary);
}

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

    .loading-screen {
        display: none;
    }

    .mouse-star,
    .click-particle {
        display: none;
    }
}

/* Focus styles para navegación por teclado */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ======================= */
/* Print Styles */
/* ======================= */
@media print {
    .loading-screen,
    #particles {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}