/* Language Switcher Component */
.language-switcher {
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-switcher-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: background 0.3s ease;
}

.language-switcher-container:hover {
    background: rgba(255, 255, 255, 0.15);
}

.language-switcher-icon {
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.language-switcher-container:hover .language-switcher-icon {
    opacity: 1;
}

.language-switcher-links {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 19px !important; /* increased for both modes */
    font-weight: 600;
}

.language-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    position: relative;
    font-size: 19px !important; /* increased for both modes */
}

.language-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.language-link:focus {
    outline: 2px solid #64b5f6;
    outline-offset: 2px;
}

.language-link-active {
    color: #ffffff;
    font-weight: 600;
}

.language-link-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

/* Ensure Arabic label in EN mode uses Arabic font stack (shaping + spacing) */
html[lang="en"] .language-switcher .language-link:last-child,
html[lang="en"] .language-switcher .language-link:last-child .language-label-full,
html[lang="en"] .language-switcher .language-link:last-child .language-label-short {
    font-family: 'Noto Sans Arabic', 'Cairo', 'Segoe UI Arabic', 'Tahoma', 'Arial', sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    font-kerning: normal;
    font-feature-settings: 'liga' 1, 'calt' 1, 'kern' 1;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.language-separator {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
    user-select: none;
}

/* Show short labels by default */
.language-label-full {
    display: none;
}

.language-label-short {
    display: inline;
}

/* Show full labels on larger screens */
@media (min-width: 768px) {
    .language-label-full {
        display: inline;
    }
    
    .language-label-short {
        display: none;
    }
    
    .language-switcher-links {
        font-size: 20px !important;
    }
    
    .language-link {
        font-size: 20px !important;
        padding: 6px 12px;
    }
}

/* RTL Support */
html[dir="rtl"] .language-switcher-container {
    flex-direction: row-reverse;
}

html[dir="rtl"] .language-switcher-links {
    flex-direction: row-reverse;
}

/* Accessibility: High Contrast Mode */
@media (prefers-contrast: high) {
    .language-switcher-container {
        border: 2px solid currentColor;
    }
    
    .language-link {
        color: #ffffff;
    }
    
    .language-link-active {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .language-switcher-container,
    .language-switcher-icon,
    .language-link {
        transition: none;
    }
}

/* Dark background variant (for use in header) */
.enterprise-header .language-switcher-container {
    background: rgba(255, 255, 255, 0.08);
}

.enterprise-header .language-switcher-container:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Mobile optimization */
@media (max-width: 767px) {
    .language-switcher-container {
        padding: 6px 12px;
        gap: 8px;
    }
    
    .language-switcher-icon {
        width: 18px;
        height: 18px;
    }
    
    .language-switcher-links {
        font-size: 17px !important;
        gap: 6px;
    }
    
    .language-link {
        padding: 5px 8px;
        font-size: 17px !important;
    }
}

/* Print: Hide language switcher */
@media print {
    .language-switcher {
        display: none;
    }
}

/* Arabic text enhancement - make it more readable */
html[lang="ar"] .language-switcher-links,
html[dir="rtl"] .language-switcher-links {
    font-size: 18px !important;
}

html[lang="ar"] .language-link,
html[dir="rtl"] .language-link {
    font-size: 18px !important;
    padding: 5px 10px !important;
    font-weight: 500 !important;
}

html[lang="ar"] .language-link-active,
html[dir="rtl"] .language-link-active {
    font-weight: 600 !important;
}

html[lang="ar"] .language-label-full,
html[lang="ar"] .language-label-short,
html[dir="rtl"] .language-label-full,
html[dir="rtl"] .language-label-short {
    font-size: 18px !important;
}

@media (min-width: 768px) {
    html[lang="ar"] .language-switcher-links,
    html[dir="rtl"] .language-switcher-links {
        font-size: 19px !important;
    }
    
    html[lang="ar"] .language-link,
    html[dir="rtl"] .language-link {
        font-size: 19px !important;
        padding: 6px 12px !important;
    }
}

@media (max-width: 767px) {
    html[lang="ar"] .language-switcher-links,
    html[dir="rtl"] .language-switcher-links {
        font-size: 16px !important;
    }
    
    html[lang="ar"] .language-link,
    html[dir="rtl"] .language-link {
        font-size: 16px !important;
        padding: 5px 8px !important;
    }
}

