/* ==========================================================================
   Page Transitions CSS
   Sistema de transiciones suaves entre páginas
   
    (\___/)
    (='.'=)
    (")_(")
      " "
   
   ========================================================================== */

/* Animación de fade-in para la página que carga */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación de fade-out para la página que sale */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Clase para el body durante la carga */
body {
    animation: fadeIn 0.5s ease-in-out;
}

/* Overlay de transición */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(76, 17, 134, 0.95) 0%, rgba(162, 75, 145, 0.95) 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Loader dentro del overlay */
.transition-loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animación del contenido principal */
.content-wrapper {
    animation: fadeIn 0.6s ease-in-out;
}

/* Clase para ocultar la página antes de la transición */
body.page-transitioning .content-wrapper {
    animation: fadeOut 0.3s ease-in-out forwards;
}

/* Prevenir scroll durante la transición */
body.page-transitioning {
    overflow: hidden;
}

/* Transiciones más rápidas para navegación móvil */
@media (max-width: 768px) {
    body {
        animation-duration: 0.4s;
    }
    
    .content-wrapper {
        animation-duration: 0.4s;
    }
    
    .page-transition-overlay {
        transition-duration: 0.3s;
    }
    
    body.page-transitioning .content-wrapper {
        animation-duration: 0.2s;
    }
}

/* Optimización para dispositivos con preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    body,
    .content-wrapper,
    .page-transition-overlay {
        animation: none !important;
        transition: opacity 0.2s ease-in-out !important;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    @keyframes fadeOut {
        from { opacity: 1; }
        to { opacity: 0; }
    }
}
