/* Modern Language Switcher */
.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(26, 29, 41, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-switcher:hover {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 
        0 8px 32px rgba(139, 92, 246, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    transform: translateY(-1px);
}

.lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, SF Pro Display, Segoe UI, sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.lang-btn::before {
    content: ;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 9px;
}

.lang-btn:hover::before {
    opacity: 1;
}

.lang-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.02);
}

.lang-btn:active {
    transform: scale(0.98);
}

.lang-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #ffffff;
    box-shadow: 
        0 4px 12px rgba(139, 92, 246, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.lang-btn.active::before {
    display: none;
}

.lang-btn .flag {
    font-size: 16px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lang-btn:hover .flag {
    transform: scale(1.1) rotate(5deg);
}

.lang-btn.active .flag {
    animation: flagWave 0.6s ease;
}

@keyframes flagWave {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-10deg) scale(1.1); }
    75% { transform: rotate(10deg) scale(1.1); }
}

/* Ripple effect */
.lang-btn::after {
    content: ;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.lang-btn:active::after {
    width: 100px;
    height: 100px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .language-switcher {
        padding: 3px;
        border-radius: 10px;
    }
    
    .lang-btn {
        padding: 7px 12px;
        font-size: 12px;
        gap: 5px;
    }
    
    .lang-btn .flag {
        font-size: 14px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .language-switcher,
    .lang-btn,
    .lang-btn .flag,
    .lang-btn::before,
    .lang-btn::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus styles for keyboard navigation */
.lang-btn:focus-visible {
    outline: 2px solid rgba(139, 92, 246, 0.6);
    outline-offset: 2px;
}

/* Loading state */
.lang-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.lang-btn.loading::after {
    content: ;
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
