/**
 * Rule34dle Internationalization CSS
 * Styles for multi-language support and RTL languages
 */

/* Language Switcher Styles */
.language-switcher {
    position: relative;
    display: inline-block;
    margin-left: 15px;
}

.language-selector {
    position: relative;
}

.language-current {
    background: none;
    border: 2px solid var(--primary-color, #6366f1);
    color: var(--primary-color, #6366f1);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.language-current:hover {
    background: var(--primary-color, #6366f1);
    color: white;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

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

.language-option {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

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

.language-option:hover {
    background-color: #f9fafb;
}

.language-option.active {
    background-color: var(--primary-color, #6366f1);
    color: white;
}

.language-option.active:hover {
    background-color: var(--primary-dark, #4f46e5);
}

/* RTL Support */
html[dir="rtl"] {
    text-align: right;
}

html[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html[dir="rtl"] .nav-menu {
    flex-direction: row-reverse;
}

html[dir="rtl"] .language-switcher {
    margin-left: 0;
    margin-right: 15px;
}

html[dir="rtl"] .language-dropdown {
    right: auto;
    left: 0;
}

html[dir="rtl"] .language-option {
    text-align: right;
}

html[dir="rtl"] .hero-content {
    text-align: right;
}

html[dir="rtl"] .features-grid {
    direction: rtl;
}

html[dir="rtl"] .feature-card {
    text-align: right;
}

html[dir="rtl"] .step {
    flex-direction: row-reverse;
}

html[dir="rtl"] .step-content {
    text-align: right;
}

html[dir="rtl"] .footer-content {
    direction: rtl;
}

/* Language-specific font loading */
html[lang="ar"], html[lang="ur"] {
    font-family: 'Noto Sans Arabic', 'Amiri', 'Times New Roman', serif;
}


html[lang="ja"] {
    font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic Pro', 'Meiryo', sans-serif;
}

html[lang="ko"] {
    font-family: 'Noto Sans KR', 'Malgun Gothic', 'Apple Gothic', sans-serif;
}

html[lang="hi"] {
    font-family: 'Noto Sans Devanagari', 'Mangal', 'Kokila', serif;
}

html[lang="bn"] {
    font-family: 'Noto Sans Bengali', 'SolaimanLipi', 'Mukti Narrow', sans-serif;
}

html[lang="th"] {
    font-family: 'Noto Sans Thai', 'Leelawadee UI', 'Thonburi', sans-serif;
}

html[lang="ru"] {
    font-family: 'Noto Sans', 'Segoe UI', 'Roboto', 'Arial', sans-serif;
}

/* Responsive Language Switcher */
@media (max-width: 768px) {
    .language-switcher {
        margin: 10px 0;
        width: 100%;
    }
    
    .language-current {
        width: 100%;
        justify-content: space-between;
    }
    
    .language-current::after {
        content: '▼';
        font-size: 0.8rem;
    }
    
    .language-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 16px 16px 0 0;
        max-height: 50vh;
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.2);
    }
    
    .language-dropdown.show {
        transform: translateY(0);
    }
    
    .language-dropdown:not(.show) {
        transform: translateY(100%);
    }
    
    .language-option {
        padding: 16px 20px;
        font-size: 1rem;
        border-bottom: 1px solid #e5e7eb;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-current {
        border-width: 3px;
    }
    
    .language-dropdown {
        border-width: 2px;
    }
    
    .language-option {
        border-bottom-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .language-dropdown,
    .language-current,
    .language-option {
        transition: none;
    }
}

/* Print styles */
@media print {
    .language-switcher {
        display: none;
    }
}

/* Language loading state */
.i18n-loading {
    opacity: 0.6;
    pointer-events: none;
}

.i18n-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary-color, #6366f1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Language-specific text adjustments */
html[lang="ar"] .hero-title,
html[lang="ur"] .hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.3;
}

html[lang="ja"] .hero-title,
html[lang="ko"] .hero-title {
    font-size: clamp(1.8rem, 4.5vw, 3.2rem);
    line-height: 1.4;
}

html[lang="hi"] .hero-title,
html[lang="bn"] .hero-title,
html[lang="th"] .hero-title {
    font-size: clamp(1.9rem, 4.8vw, 3.3rem);
    line-height: 1.35;
}

/* Ensure proper text rendering for all scripts */
.i18n-text {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Language indicator for debugging */
.debug-lang::before {
    content: attr(lang);
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 9999;
    pointer-events: none;
}

/* Accessibility improvements */
.language-current:focus,
.language-option:focus {
    outline: 2px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
}

/* Screen reader support */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
