/* ===== INTERNATIONALIZATION (I18N) STYLES ===== */

/* ===== LANGUAGE SWITCHER ===== */

.language-switcher {
    position: relative;
    margin-left: var(--space-3);
}

.lang-dropdown {
    position: relative;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-text-white);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    min-height: 44px; /* Touch-friendly */
}

.lang-current:hover {
    border-color: var(--color-accent-magenta);
    background: rgba(233, 69, 96, 0.1);
}

.lang-flag {
    font-size: 1.2em;
    line-height: 1;
}

.lang-name {
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.lang-arrow {
    font-size: 0.8em;
    transition: transform var(--transition-normal);
}

.lang-dropdown.active .lang-arrow {
    transform: rotate(180deg);
}

.lang-options {
    position: absolute;
    top: calc(100% + var(--space-1));
    right: 0;
    min-width: 150px;
    background: var(--color-bg-primary);
    border: 2px solid var(--color-accent-magenta);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: var(--z-dropdown);
}

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

.lang-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    color: var(--color-text-dark);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    text-align: left;
    min-height: 44px; /* Touch-friendly */
}

.lang-btn:hover {
    background: var(--color-neutral-grey);
    color: var(--color-accent-magenta);
}

.lang-btn:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.lang-btn:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ===== RTL (RIGHT-TO-LEFT) SUPPORT ===== */

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

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

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

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

[dir="rtl"] .about-content {
    grid-template-columns: 1fr 1fr;
    direction: rtl;
}

[dir="rtl"] .about-text {
    text-align: right;
}

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

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

[dir="rtl"] .contact-content {
    grid-template-columns: 1fr 1fr;
    direction: rtl;
}

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

[dir="rtl"] .footer-section {
    text-align: right;
}

/* RTL Typography */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6 {
    text-align: right;
}

[dir="rtl"] p {
    text-align: right;
}

/* RTL Form adjustments */
[dir="rtl"] .form-input,
[dir="rtl"] .form-textarea,
[dir="rtl"] .form-select {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .form-label {
    text-align: right;
}

/* RTL Navigation adjustments */
[dir="rtl"] .nav-toggle {
    order: -1;
}

[dir="rtl"] .language-switcher {
    margin-left: 0;
    margin-right: var(--space-3);
}

[dir="rtl"] .lang-options {
    right: auto;
    left: 0;
}

/* RTL Scroll indicator */
[dir="rtl"] .scroll-indicator {
    transform: translateX(50%);
}

[dir="rtl"] .scroll-indicator:hover {
    transform: translateX(50%) scale(1.15) translateY(-3px);
}

/* RTL Lightbox adjustments */
[dir="rtl"] .lightbox-prev {
    right: 1rem;
    left: auto;
}

[dir="rtl"] .lightbox-next {
    left: 1rem;
    right: auto;
}

[dir="rtl"] .lightbox-prev::before {
    content: '›';
}

[dir="rtl"] .lightbox-next::before {
    content: '‹';
}

/* ===== ARABIC FONT SUPPORT ===== */

/* Arabic typography improvements */
[lang="ar"] {
    font-family: 'Noto Sans Arabic', 'Amiri', 'Scheherazade New', 'Arial Unicode MS', sans-serif;
    line-height: 1.8; /* Better line height for Arabic */
}

[lang="ar"] h1,
[lang="ar"] h2,
[lang="ar"] h3,
[lang="ar"] h4,
[lang="ar"] h5,
[lang="ar"] h6 {
    font-family: 'Noto Sans Arabic', 'Amiri', 'Scheherazade New', 'Arial Unicode MS', sans-serif;
    font-weight: 600;
    line-height: 1.6;
}

[lang="ar"] .hero-title {
    font-size: 2.5rem;
    line-height: 1.4;
}

[lang="ar"] .section-title {
    font-size: 2rem;
    line-height: 1.5;
}

/* Arabic button adjustments */
[lang="ar"] .btn {
    font-weight: 500;
    letter-spacing: 0;
}

/* Arabic form adjustments */
[lang="ar"] .form-input,
[lang="ar"] .form-textarea,
[lang="ar"] .form-select {
    font-family: 'Noto Sans Arabic', 'Arial Unicode MS', sans-serif;
}

/* ===== RESPONSIVE I18N ADJUSTMENTS ===== */

@media (max-width: 767px) {
    .language-switcher {
        margin-left: 0;
        margin-right: 0;
        order: -1;
    }
    
    [dir="rtl"] .language-switcher {
        margin-right: 0;
        margin-left: 0;
    }
    
    .lang-current {
        padding: var(--space-1);
        min-width: 60px;
    }
    
    .lang-name {
        display: none; /* Hide text on mobile, show only flag */
    }
    
    .lang-options {
        right: 0;
        min-width: 120px;
    }
    
    [dir="rtl"] .lang-options {
        left: 0;
        right: auto;
    }
    
    /* Arabic mobile adjustments */
    [lang="ar"] .hero-title {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    [lang="ar"] .section-title {
        font-size: 1.5rem;
        line-height: 1.4;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .lang-current {
        padding: var(--space-1) var(--space-2);
    }
    
    .lang-options {
        min-width: 140px;
    }
}

/* ===== LANGUAGE-SPECIFIC ADJUSTMENTS ===== */

/* French typography */
[lang="fr"] {
    /* French uses standard Latin typography */
}

/* English typography */
[lang="en"] {
    /* English uses standard Latin typography */
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lang-current {
        border-width: 3px;
    }
    
    .lang-options {
        border-width: 3px;
    }
    
    .lang-btn:hover {
        outline: 2px solid currentColor;
        outline-offset: 2px;
    }
}

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

/* Focus states for keyboard navigation */
.lang-current:focus,
.lang-btn:focus {
    outline: 3px solid var(--color-accent-magenta);
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */

@media print {
    .language-switcher {
        display: none;
    }
}

/* ===== LANGUAGE TRANSITION ANIMATIONS ===== */

/* Base transition styles for all translatable elements */
[data-i18n] {
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Transitioning state during language change */
.i18n-transitioning {
    will-change: opacity, transform;
}

/* Smooth transitions for different element types */
h1[data-i18n], h2[data-i18n], h3[data-i18n] {
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn[data-i18n] {
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link[data-i18n] {
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Staggered animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Language switching loading overlay */
.language-switching {
    position: relative;
}

.language-switching::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    z-index: 1;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}

.language-switching::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(--color-accent-magenta);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* RTL-specific animations */
[dir="rtl"] .nav-link[data-i18n] {
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="rtl"] @keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] @keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Enhanced transitions for specific sections */
.hero-title[data-i18n] {
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-subtitle[data-i18n] {
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-title[data-i18n] {
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-subtitle[data-i18n] {
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Service tiles animation */
.service-title[data-i18n] {
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-description[data-i18n] {
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Form elements animation */
.form-label[data-i18n] {
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== LOADING STATES ===== */

.i18n-loading {
    opacity: 0.7;
    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(--color-accent-magenta);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Reduce animations on low-performance devices */
@media (prefers-reduced-motion: reduce) {
    [data-i18n] {
        transition: none !important;
    }
    
    .i18n-transitioning {
        transition: none !important;
    }
    
    .language-switching::before,
    .language-switching::after {
        display: none !important;
    }
}