/* ==================== PAGE TRANSITIONS ==================== */

/* Animação de entrada da página */
body {
    animation: fadeInPage 0.5s ease-in-out;
}

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

/* Animação de saída da página */
body.page-exit {
    animation: fadeOutPage 0.4s ease-in-out forwards;
}

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

/* ==================== TRANSIÇÕES DE LINKS ==================== */

/* Todos os links que navegam entre páginas */
a[href]:not([href^="#"]):not([href^="http"]):not([href^="mailto"]):not([href^="tel"]):not([target="_blank"]) {
    position: relative;
    overflow: hidden;
}

/* Efeito ripple nos links */
a[href]:not([href^="#"]):not([href^="http"]):not([href^="mailto"]):not([href^="tel"]):not([target="_blank"])::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(249, 165, 5, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

a[href]:not([href^="#"]):not([href^="http"]):not([href^="mailto"]):not([href^="tel"]):not([target="_blank"]):active::before {
    width: 300px;
    height: 300px;
}

/* ==================== LOADING OVERLAY ==================== */

/* Overlay de transição entre páginas */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #090909 0%, #1a1a1a 100%);
    z-index: 999999;
    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;
}

/* Spinner de loading */
.page-transition-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(249, 165, 5, 0.2);
    border-top: 4px solid #F9A505;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== PROGRESS BAR ==================== */

/* Barra de progresso no topo */
.page-transition-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #F9A505 0%, #FCCB6D 100%);
    z-index: 1000000;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(249, 165, 5, 0.5);
}

.page-transition-progress.active {
    width: 100%;
}

/* ==================== SMOOTH SCROLL BEHAVIOR ==================== */

/* Scroll suave para todas as páginas */
html {
    scroll-behavior: smooth;
}

/* ==================== CARD HOVER TRANSITIONS ==================== */

/* Melhorar transições dos cards de serviço */
.service-card,
.client-card,
.feature-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover,
.client-card:hover,
.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
}

/* ==================== BUTTON PRESS EFFECT ==================== */

/* Efeito de pressionar em botões */
.btn,
button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active,
button:active {
    transform: scale(0.95);
}

/* ==================== PREFETCH OPTIMIZATION ==================== */

/* Prefetch automático de links ao hover */
a[href]:not([href^="#"]):not([href^="http"]):not([href^="mailto"]):not([href^="tel"]):hover {
    /* O JavaScript vai adicionar prefetch */
}

/* ==================== MOBILE OPTIMIZATIONS ==================== */

@media (max-width: 768px) {
    /* Reduzir animações em mobile para performance */
    body {
        animation-duration: 0.3s;
    }

    body.page-exit {
        animation-duration: 0.2s;
    }

    .page-transition-overlay {
        transition-duration: 0.3s;
    }
}

/* ==================== REDUCED MOTION ==================== */

/* Respeitar preferência de redução de movimento */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body {
        animation: none;
    }

    .page-transition-overlay {
        transition: none;
    }
}

/* ==================== BACK NAVIGATION ==================== */

/* Animação diferente para navegação de volta */
body.page-back {
    animation: fadeInFromLeft 0.5s ease-in-out;
}

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

/* ==================== FORWARD NAVIGATION ==================== */

/* Animação para navegação para frente */
body.page-forward {
    animation: fadeInFromRight 0.5s ease-in-out;
}

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