/**
 * Language Selector Styles
 */

.language-switcher {
    position: relative;
    perspective: 1000px;
    margin-left: auto; /* Push to the far right */
    z-index: 100;
}

/* Current language button styles */
.current-lang {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.65rem 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: space-between;
}

.current-lang:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.current-lang:focus {
    outline: 2px solid #f7b731;
    outline-offset: 2px;
}

.current-lang i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.current-lang[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Language dropdown styles */
.language-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 180px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Language option styles */
.lang-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #ffffff;
    text-decoration: none;
    border: none;
    background: transparent;
    width: 100%;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-option:last-child {
    border-bottom: none;
}

.lang-option:hover {
    background: #2a2a2a;
    color: #f7b731;
    transform: translateX(4px);
}

.lang-option:focus {
    background: #2a2a2a;
    color: #f7b731;
    outline: none;
}

.lang-option.active {
    background: #f7b731;
    color: #1a1a1a;
    font-weight: 600;
}

.lang-option.active:hover {
    background: #f39c12;
    transform: translateX(0);
}

.lang-option .flag {
    font-size: 1.2rem;
    width: 20px;
    display: flex;
    justify-content: center;
}

.lang-option .name {
    flex: 1;
    text-align: left;
}

/* Enhanced animation for dropdown appearance */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.language-dropdown.show {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .language-switcher {
        position: relative;
    }
    
    .current-lang {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
        min-width: 100px;
    }
    
    .language-dropdown {
        right: 0;
        left: auto;
        min-width: 160px;
    }
    
    .lang-option {
        padding: 0.65rem 0.85rem;
        font-size: 0.85rem;
    }
}

/* Dark theme specific enhancements */
.language-dropdown::before {
    content: '';
    position: absolute;
    top: -5px;
    right: 20px;
    width: 10px;
    height: 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    z-index: -1;
}

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

.lang-option.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #f7b731;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: auto;
}

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

/* Accessibility improvements */
.language-switcher:focus-within .language-dropdown {
    outline: 2px solid #f7b731;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-dropdown {
        background: #000000;
        border-color: #ffffff;
    }
    
    .lang-option {
        color: #ffffff;
        border-color: #ffffff;
    }
    
    .lang-option:hover {
        background: #ffffff;
        color: #000000;
    }
}

/* Legacy support for old class names */
.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-toggle i {
    font-size: 1rem;
}

.lang-options {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.language-switcher:hover .lang-options,
.lang-toggle[aria-expanded="true"] + .lang-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-options li {
    padding: 0;
    margin: 0;
}

.lang-options a {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.lang-options a:hover,
.lang-options a.active {
    background-color: rgba(0, 0, 0, 0.05);
    color: #f59e0b;
}

/* Mobile Language Menu */
.mobile-lang-menu {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

.mobile-lang-menu .menu-title {
    display: block;
    color: #fff;
    opacity: 0.7;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    padding: 0 1.5rem;
}

.mobile-lang-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0 1rem;
}

.mobile-lang-options a {
    display: block;
    padding: 0.5rem;
    text-align: center;
    border-radius: 4px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.mobile-lang-options a:hover,
.mobile-lang-options a.active {
    background: rgba(255, 255, 255, 0.2);
    color: #f59e0b;
}

@media (max-width: 992px) {
    .language-switcher {
        display: none; /* Hide on mobile, shown in mobile menu instead */
    }
} 