/* Language Switcher Styles */
.language-switcher {
    position: relative;
}

.language-switcher .dropdown {
    position: relative;
}

.language-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 14px;
    min-width: 120px;
    justify-content: center;
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.language-toggle i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.language-toggle.active i {
    transform: rotate(180deg);
}

.language-flag {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    margin-right: 5px;
    background-size: cover;
    background-position: center;
    display: inline-block;
}

.language-flag.flag-vi {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cmVjdCB3aWR0aD0iMzAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iI2RhMDUxZCIvPgogIDxwb2x5Z29uIGZpbGw9IiNmZmZmMDAiIHBvaW50cz0iMTUwLDUwIDEzNS45LDk4LjQgODcuMyw5OC40IDEyNi4yLDEyNS45IDExMi4xLDE3NC4zIDE1MCwxNDcgMTg3LjksMTc0LjMgMTczLjgsMTI1LjkgMjEyLjcsOTguNAogMTY0LjEsOTguNCIvPgo8L3N2Zz4=');
}

.language-flag.flag-en {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iMzAiIHZpZXdCb3g9IjAgMCA2MCAzMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cmVjdCB3aWR0aD0iNjAiIGhlaWdodD0iMzAiIGZpbGw9IiMwMTJiNjkiLz4KICA8cGF0aCBkPSJNMCwwTDIwLDBMMjAsMTBMMCwxMFoiIGZpbGw9IiNmZmZmZmYiLz4KICA8cGF0aCBkPSJNMCwyMEwyMCwyMEwyMCwzMEwwLDMwWiIgZmlsbD0iI2ZmZmZmZiIvPgogIDxwYXRoIGQ9Ik0wLDBMMjAsMTBNMjAsMEwwLDEwIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=');
}

.language-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(8px);
}

/* Bootstrap integration */
.language-dropdown.dropdown-menu {
    display: block !important;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    visibility: hidden;
}

.language-dropdown.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(8px);
}

.language-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: none;
    border-right: none;
    transform: translateX(-50%) rotate(45deg);
}

.language-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #333 !important;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

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

.language-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    transition: width 0.3s ease;
    z-index: 0;
}

.language-option:hover::before {
    width: 100%;
}

.language-option:hover {
    color: white !important;
    text-decoration: none;
    transform: translateX(5px);
}

.language-option * {
    position: relative;
    z-index: 1;
}

.language-option.active {
    background: #f8f9fa;
    font-weight: 600;
}

.language-option.active::after {
    content: '✓';
    margin-left: auto;
    color: #28a745;
    font-weight: bold;
}

.language-name {
    margin-left: 10px;
    font-size: 14px;
}

.language-native {
    margin-left: auto;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.language-option:hover .language-native {
    color: rgba(255, 255, 255, 0.8);
}

/* Translation Loading Indicator */
.translation-loading {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #007bff;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.translation-loading.show {
    transform: translateX(0);
}

.translation-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Translation Success/Error Messages */
.translation-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    min-width: 300px;
}

.translation-message.show {
    transform: translateX(0);
}

.translation-message.success {
    background: #28a745;
    color: white;
}

.translation-message.error {
    background: #dc3545;
    color: white;
}

.translation-message i {
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .language-toggle {
        min-width: 100px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .language-dropdown {
        min-width: 180px;
        left: auto;
        right: 0;
        transform: none;
    }
    
    .language-dropdown.show {
        transform: translateY(8px);
    }
    
    .language-dropdown::before {
        left: auto;
        right: 20px;
        transform: rotate(45deg);
    }
    
    .translation-loading,
    .translation-message {
        left: 20px;
        right: 20px;
        min-width: auto;
        max-width: calc(100vw - 40px);
    }
}

/* Animation for translating elements */
.translating {
    position: relative;
    overflow: hidden;
}

.translating::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.2), transparent);
    animation: translateWave 1.5s infinite;
}

@keyframes translateWave {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Page fade during translation */
.page-translating {
    transition: opacity 0.3s ease;
    opacity: 0.7;
}

.page-translating * {
    pointer-events: none;
}
