/* Sistema de Mudança Invisível de Idioma */

/* Transições suaves para mudanças de texto */
[data-i18n] {
    transition: opacity 0.15s ease-in-out;
}

/* Indicador micro discreto */
#micro-lang-indicator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

/* Prevenção de FOUC (Flash of Unstyled Content) */
.lang-switching {
    opacity: 0.98 !important;
}

/* Melhoria de performance para transições */
[data-i18n] {
    will-change: contents;
}

/* Suporte para idiomas RTL */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .navbar-nav {
    flex-direction: row-reverse;
}

[dir="rtl"] .dropdown-menu {
    left: auto;
    right: 0;
}

/* Animação quase imperceptível para mudanças */
@keyframes micro-fade {
    0% { opacity: 1; }
    50% { opacity: 0.98; }
    100% { opacity: 1; }
}

.text-changing {
    animation: micro-fade 0.2s ease-in-out;
}

/* Estados de carregamento invisíveis */
.translation-loading {
    position: relative;
}

.translation-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
}

/* Otimizações de performance */
.invisible-lang-switcher {
    contain: layout style paint;
    will-change: transform;
}

/* Responsividade do indicador micro */
@media (max-width: 768px) {
    #micro-lang-indicator {
        top: 10px !important;
        right: 10px !important;
        font-size: 11px !important;
        padding: 6px 10px !important;
    }
}

/* Modo escuro automático */
@media (prefers-color-scheme: dark) {
    #micro-lang-indicator > div {
        background: rgba(255,255,255,0.9) !important;
        color: #333 !important;
    }
}

/* Acessibilidade: reduzir movimento se solicitado */
@media (prefers-reduced-motion: reduce) {
    [data-i18n],
    .text-changing,
    #micro-lang-indicator * {
        transition: none !important;
        animation: none !important;
    }
}
