/* assets/multilingual.css */

/* Language Switcher Styles */
.language-switcher-list {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.lang-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    text-decoration: none;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.lang-link:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    text-decoration: none;
    color: #1f2937;
}

.lang-link.active {
    background: #1e3a8a;
    color: white;
    border-color: #1e3a8a;
}

.lang-link .flag {
    margin-right: 6px;
    font-size: 16px;
}

/* Dropdown Language Switcher */
#language-switcher {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    min-width: 120px;
}

#language-switcher:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Mobile responsive language switcher */
@media (max-width: 768px) {
    .language-switcher-list {
        justify-content: center;
        margin: 10px 0;
    }
    
    .lang-link {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    #language-switcher {
        width: 100%;
        max-width: 200px;
    }
}

/* Translation mode indicators (for development) */
[data-translatable="true"] {
    position: relative;
}

[data-translatable="true"]:hover::after {
    content: "🌐";
    position: absolute;
    top: -20px;
    right: -10px;
    background: #1e3a8a;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
}

/* Language indicator for pages */
.page-language-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(30, 58, 138, 0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

/* Elementor integration styles */
.elementor-widget-html [data-translate] {
    position: relative;
}

.elementor-widget-html [data-translate]:hover {
    background: rgba(30, 58, 138, 0.05);
    border-radius: 2px;
}

/* Language switcher in header/menu integration */
.header-language-switcher {
    display: inline-flex;
    align-items: center;
    margin-left: 20px;
}

.header-language-switcher .lang-link {
    padding: 5px 8px;
    margin: 0 2px;
    font-size: 13px;
}

/* Language switcher in footer */
.footer-language-switcher {
    text-align: center;
    margin: 20px 0;
}

.footer-language-switcher .language-switcher-list {
    justify-content: center;
}

/* RTL language support */
[dir="rtl"] .language-switcher-list {
    direction: rtl;
}

[dir="rtl"] .lang-link .flag {
    margin-right: 0;
    margin-left: 6px;
}

/* Language-specific font adjustments */
html[lang="ar"] {
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
}

html[lang="zh"] {
    font-family: 'Noto Sans SC', Arial, sans-serif;
}

html[lang="ja"] {
    font-family: 'Noto Sans JP', Arial, sans-serif;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lang-link {
        border-width: 2px;
    }
    
    .lang-link.active {
        background: #000;
        color: #fff;
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .lang-link {
        transition: none;
    }
}

/* Print styles - hide language switcher */
@media print {
    .language-switcher-list,
    #language-switcher,
    .page-language-indicator {
        display: none !important;
    }
}

/* Language switcher animation styles */
.language-switcher-fade-in {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state for language switching */
.language-switching {
    position: relative;
    pointer-events: none;
}

.language-switching::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-switching::after {
    content: "Loading...";
    font-size: 14px;
    color: #1e3a8a;
}

/* Sidebar language switcher */
.sidebar-language-switcher .language-switcher-list {
    flex-direction: column;
    gap: 5px;
}

.sidebar-language-switcher .lang-link {
    width: 100%;
    justify-content: center;
}

/* Mega menu language switcher */
.mega-menu-language-switcher {
    padding: 15px;
    border-top: 1px solid #e5e7eb;
}

.mega-menu-language-switcher .language-switcher-list {
    justify-content: space-around;
}

/* Accessibility improvements */
.lang-link:focus {
    outline: 2px solid #1e3a8a;
    outline-offset: 2px;
}

.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Language detection notice */
.language-detection-notice {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 15px 0;
    color: #0c4a6e;
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-detection-notice button {
    background: #0ea5e9;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.language-detection-notice button:hover {
    background: #0284c7;
}

.language-detection-notice .close {
    background: transparent;
    color: #0c4a6e;
    font-size: 18px;
    margin-left: auto;
}

/* Integration with popular themes */

/* Astra theme */
.ast-header-break-point .header-language-switcher {
    margin: 10px 0;
}

/* OceanWP theme */
.oceanwp-mobile-menu-icon .header-language-switcher {
    display: none;
}

/* GeneratePress theme */
.main-navigation .header-language-switcher {
    margin-left: 15px;
}

/* Storefront theme */
.storefront-header-cart .header-language-switcher {
    margin-right: 15px;
}

/* Twenty Twenty-One theme */
.site-header .header-language-switcher {
    margin-left: auto;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .lang-link {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .lang-link:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
    
    .lang-link.active {
        background: #3b82f6;
        border-color: #3b82f6;
    }
    
    #language-switcher {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .page-language-indicator {
        background: rgba(59, 130, 246, 0.9);
    }
}

/* Custom properties for easy theming */
:root {
    --ml-primary-color: #1e3a8a;
    --ml-secondary-color: #f9fafb;
    --ml-border-color: #e5e7eb;
    --ml-text-color: #374151;
    --ml-hover-color: #f3f4f6;
    --ml-radius: 6px;
    --ml-transition: all 0.2s ease;
}

/* Use custom properties */
.lang-link {
    background: var(--ml-secondary-color);
    color: var(--ml-text-color);
    border-color: var(--ml-border-color);
    border-radius: var(--ml-radius);
    transition: var(--ml-transition);
}

.lang-link:hover {
    background: var(--ml-hover-color);
}

.lang-link.active {
    background: var(--ml-primary-color);
    color: white;
    border-color: var(--ml-primary-color);
}