/**
 * Internationalization (i18n) CSS styles for Secreto Mio - Refactored Version
 * 
 * This file contains lightweight CSS styles for the translation system:
 * - Subtle loading states without heavy overlays
 * - Smooth transitions for language changes
 * - Minimal UI disruption during translation loading
 * - Prevention of flash of untranslated content (FOUC)
 */

/* Prevent flash of untranslated content without hiding elements */
body:not(.i18n-ready) [data-i18n]:empty {
    visibility: hidden;
}

/* Show empty elements once translations are ready */
body.i18n-ready [data-i18n]:empty {
    visibility: visible;
    transition: visibility 0s, opacity 0.2s ease-in;
}

/* For elements with existing content, just ensure smooth transitions */
body.i18n-ready [data-i18n] {
    transition: opacity 0.2s ease-in;
}

/* Subtle loading indicator for language switching */
.i18n-switching {
    position: relative;
}

.i18n-switching::before {
    content: '';
    position: fixed;
    top: 20px;
    right: 20px;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top: 2px solid var(--accent-color, #007bff);
    border-radius: 50%;
    animation: i18n-spin 0.8s linear infinite;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Smooth spin animation */
@keyframes i18n-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Optional: Subtle fade effect during language change */
.i18n-switching [data-i18n] {
    transition: opacity 0.15s ease-out;
    opacity: 0.7;
}

/* Language switcher button states */
.language-switcher button,
.language-switcher a {
    transition: all 0.2s ease;
}

.language-switcher button:hover,
.language-switcher a:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.language-switcher button:active,
.language-switcher a:active {
    transform: translateY(0);
}

/* Flag icon transitions */
.current-language-flag,
.language-flag {
    transition: all 0.2s ease;
}

/* Form validation error messages */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .i18n-switching::before {
        top: 10px;
        right: 10px;
        width: 20px;
        height: 20px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .i18n-switching::before {
        border-color: rgba(255, 255, 255, 0.2);
        border-top-color: var(--accent-color, #007bff);
        background: #333;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .error-message {
        color: #ff6b6b;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .i18n-switching::before {
        animation: none;
    }
    
    .i18n-switching [data-i18n] {
        transition: none;
    }
    
    .language-switcher button,
    .language-switcher a {
        transition: none;
    }
}

/* Focus states for accessibility */
.language-switcher button:focus,
.language-switcher a:focus {
    outline: 2px solid var(--accent-color, #007bff);
    outline-offset: 2px;
}