/**
 * Internationalization Styles
 * Language picker and RTL support
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

/* Language Picker - Modern iOS Style */
.language-picker {
    position: relative;
    display: inline-block;
}

.language-picker-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f5f5f5;
    border: 0.5px solid #e5e5e5;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s;
}

.language-picker-button:hover {
    background: #ffffff;
    border-color: #d1d1d6;
}

.language-picker-button:active {
    transform: scale(0.98);
}

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

.lang-name {
    font-size: 15px;
}

.language-picker-button i {
    font-size: 12px;
    color: #8e8e93;
    transition: transform 0.2s;
}

.language-picker-button.active i {
    transform: rotate(180deg);
}

/* Language Picker Dropdown - Modern Design */
.language-picker-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 0.5px solid #e5e5e5;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

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

.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: none;
    border-bottom: 0.5px solid #f5f5f5;
    font-size: 15px;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
}

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

.language-option:hover {
    background: #f5f5f5;
}

.language-option:active {
    background: #e5e5e5;
}

.language-option.active {
    background: #f9fafb;
    font-weight: 600;
    color: #000000;
}

/* Hide any check icons in language picker (safety measure) */
.language-option .fa-check,
.language-option i.fa-check,
.language-option .fas.fa-check {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Modern indicator dot instead of check icon */
.language-option .lang-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #000000;
    margin-left: auto;
    flex-shrink: 0;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* RTL Support */
.rtl {
    direction: rtl;
    text-align: right;
}

.rtl .language-picker-dropdown {
    right: auto;
    left: 0;
}

.rtl .language-option {
    text-align: right;
}

.rtl .language-option .lang-indicator {
    margin-left: 0;
    margin-right: auto;
}

/* RTL Navigation adjustments */
.rtl .nav-back {
    /* In RTL, icon should come first (from right), then text */
    /* Don't reverse - keep natural order for RTL reading */
}

.rtl .nav-back i {
    transform: scaleX(-1); /* Flip chevron to point right */
    order: -1; /* Make icon appear first in flex order */
}

.rtl .native-button i {
    order: 2;
}

.rtl .list-arrow {
    transform: scaleX(-1);
}

/* RTL Form adjustments */
.rtl .form-input-native,
.rtl .form-textarea-native,
.rtl .form-select {
    text-align: right;
}

/* RTL Flex adjustments */
.rtl .flex {
    direction: rtl;
}

/* RTL specific spacing */
.rtl [style*="margin-right"] {
    margin-right: 0 !important;
    margin-left: var(--space-value, 12px);
}

.rtl [style*="margin-left"] {
    margin-left: 0 !important;
    margin-right: var(--space-value, 12px);
}

/* Language Picker in Navigation Bar */
.nav-bar .language-picker {
    margin-left: auto;
}

.rtl .nav-bar .language-picker {
    margin-left: 0;
    margin-right: auto;
}

/* Language Picker - Compact Mode for Mobile */
@media (max-width: 480px) {
    .language-picker-button .lang-name {
        display: none;
    }
    
    .language-picker-button {
        padding: 6px 8px;
    }
    
    .lang-flag {
        font-size: 18px;
    }
}

/* RTL Carousel */
.rtl .carousel-indicators {
    right: auto;
    left: 16px;
}

/* RTL Toast */
.rtl .toast {
    left: 20px;
    right: 20px;
}

/* RTL Contact Method */
.rtl .contact-method {
    direction: rtl;
}

.rtl .contact-icon {
    margin-right: 0;
    margin-left: 12px;
}

/* RTL List Items */
.rtl .list-item {
    direction: rtl;
}

.rtl .list-icon {
    margin-right: 0;
    margin-left: 12px;
}

/* RTL Service Icons */
.rtl .service-icon {
    margin-right: 0;
    margin-left: 12px;
}

.rtl .service-header {
    direction: rtl;
}

/* RTL Table */
.rtl table {
    direction: rtl;
}

.rtl th,
.rtl td {
    text-align: right;
}

/* RTL Modal */
.rtl .modal-header .close-btn {
    left: 16px;
    right: auto;
}

/* Smooth transitions for RTL switching */
* {
    transition: margin 0.3s ease, padding 0.3s ease;
}

/* Prevent transition on direction change */
[dir="rtl"] *,
[dir="ltr"] * {
    transition: none !important;
}

/* Re-enable transitions after direction change */
[dir="rtl"].transitions-enabled *,
[dir="ltr"].transitions-enabled * {
    transition: all 0.3s ease !important;
}

/* Font optimization per language */

/* Arabic - Cairo font */
html[lang="ar"],
html[lang="ar"] body,
html[lang="ar"] *:not(i):not([class*="fa"]):not([class^="fa-"]):not([class*=" fa-"]) {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 
                 'Tahoma', 'Arial', sans-serif !important;
}

/* Specifically target common elements in Arabic */
html[lang="ar"] button,
html[lang="ar"] .native-button,
html[lang="ar"] .select-button,
html[lang="ar"] .btn,
html[lang="ar"] .btn-native,
html[lang="ar"] input,
html[lang="ar"] textarea,
html[lang="ar"] select,
html[lang="ar"] .form-input-native,
html[lang="ar"] .form-label-native,
html[lang="ar"] .service-name,
html[lang="ar"] .service-description,
html[lang="ar"] .service-price-label,
html[lang="ar"] .section-title,
html[lang="ar"] .section-subtitle,
html[lang="ar"] .nav-title,
html[lang="ar"] .nav-back,
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, 
html[lang="ar"] h4, html[lang="ar"] h5, html[lang="ar"] h6,
html[lang="ar"] p, html[lang="ar"] span:not([class*="fa"]),
html[lang="ar"] div:not([class*="fa"]) {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 
                 'Tahoma', 'Arial', sans-serif !important;
}

/* Hebrew - Rubik font */
html[lang="he"],
html[lang="he"] body,
html[lang="he"] *:not(i):not([class*="fa"]):not([class^="fa-"]):not([class*=" fa-"]) {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 
                 'Arial Hebrew', 'Tahoma', sans-serif !important;
}

/* Specifically target common elements in Hebrew */
html[lang="he"] button,
html[lang="he"] .native-button,
html[lang="he"] .select-button,
html[lang="he"] .btn,
html[lang="he"] .btn-native,
html[lang="he"] input,
html[lang="he"] textarea,
html[lang="he"] select,
html[lang="he"] h1, html[lang="he"] h2, html[lang="he"] h3,
html[lang="he"] h4, html[lang="he"] h5, html[lang="he"] h6 {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 
                 'Arial Hebrew', 'Tahoma', sans-serif !important;
}

/* English - Rubik font */
html[lang="en"],
html[lang="en"] body,
html[lang="en"] *:not(i):not([class*="fa"]):not([class^="fa-"]):not([class*=" fa-"]) {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 
                 'Helvetica Neue', 'Arial', sans-serif !important;
}

/* English button specifics */
html[lang="en"] button,
html[lang="en"] .native-button,
html[lang="en"] .select-button,
html[lang="en"] .btn,
html[lang="en"] .btn-native {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 
                 'Helvetica Neue', 'Arial', sans-serif !important;
}

/* RTL general styles */
.rtl {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

/* Explicitly preserve FontAwesome icons */
i[class*="fa"],
.fa,
.fas,
.far,
.fal,
.fab,
[class^="fa-"],
[class*=" fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", "FontAwesome" !important;
    font-style: normal;
}

