/**
 * I18N Styles
 * Language Selector & Notifications
 */

/* Language Selector Container */
.language-selector {
    position: relative;
    display: inline-block;
    z-index: 1000;
}

/* Current Language Button */
.current-language {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
}

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

.current-language .flag {
    font-size: 20px;
    line-height: 1;
}

.current-language .lang-name {
    min-width: 80px;
    text-align: left;
}

.current-language i.fa-chevron-down {
    font-size: 12px;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.language-selector.active .current-language i.fa-chevron-down {
    transform: rotate(180deg);
}

/* Language Dropdown */
.language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: #1a1f3a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

/* Language Option */
.lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

.lang-option.active {
    background: rgba(243, 156, 18, 0.15);
    border-left-color: #f39c12;
}

.lang-option.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: auto;
    color: #f39c12;
    font-size: 12px;
}

.lang-option .flag {
    font-size: 24px;
    line-height: 1;
}

.lang-option .lang-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.lang-option .lang-name {
    font-size: 14px;
    font-weight: 500;
}

.lang-option .lang-code {
    font-size: 11px;
    opacity: 0.6;
    text-transform: uppercase;
}

/* Language Change Notification */
.language-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(39, 174, 96, 0.3);
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.language-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.language-notification i {
    font-size: 18px;
}

/* Language Selector in Header */
.header .language-selector .current-language {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
}

.header .language-selector .current-language:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Language Selector in Sidebar */
.sidebar .language-selector {
    width: 100%;
    margin-top: auto;
    padding: 16px;
}

.sidebar .language-selector .current-language {
    width: 100%;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar .language-dropdown {
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(100% + 8px);
}

/* Compact Language Selector */
.language-selector.compact .current-language {
    padding: 6px 10px;
    gap: 6px;
}

.language-selector.compact .lang-name {
    display: none;
}

.language-selector.compact .flag {
    font-size: 18px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .language-selector {
        width: 100%;
    }
    
    .current-language {
        width: 100%;
        justify-content: space-between;
    }
    
    .language-dropdown {
        left: 0;
        right: 0;
        min-width: 100%;
    }
    
    .language-notification {
        left: 20px;
        right: 20px;
        top: auto;
        bottom: 20px;
    }
}

/* RTL Support (for future languages) */
[dir="rtl"] .language-dropdown {
    left: 0;
    right: auto;
}

[dir="rtl"] .lang-option {
    border-left: none;
    border-right: 3px solid transparent;
}

[dir="rtl"] .lang-option.active {
    border-right-color: #f39c12;
}

[dir="rtl"] .lang-option:hover {
    padding-left: 16px;
    padding-right: 20px;
}

/* Animation for language change */
@keyframes languageChange {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-changing {
    animation: languageChange 0.3s ease;
}

/* Loading state */
.language-selector.loading .current-language {
    opacity: 0.6;
    pointer-events: none;
}

.language-selector.loading .current-language::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 16px;
    height: 16px;
    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: rotate(360deg);
    }
}

/* Language Badge (for showing current language) */
.language-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(243, 156, 18, 0.15);
    border: 1px solid rgba(243, 156, 18, 0.3);
    border-radius: 6px;
    color: #f39c12;
    font-size: 12px;
    font-weight: 500;
}

.language-badge .flag {
    font-size: 16px;
}

/* Multilingual Text Support */
.multilingual-text {
    direction: ltr;
    unicode-bidi: embed;
}

[lang="vi"] {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[lang="en"] {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Language Hint */
.language-hint {
    position: absolute;
    top: -30px;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.language-selector:hover .language-hint {
    opacity: 1;
}

.language-hint::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.8);
}
