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

.language-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0 auto;
    z-index: 1000;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 2px solid rgba(210, 105, 30, 0.3);
    border-radius: 25px;
    color: var(--text-light);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(210, 105, 30, 0.1);
    border-color: var(--primary-orange);
    transform: translateY(-2px);
}

.lang-btn .fa-globe {
    font-size: 16px;
    color: var(--primary-orange);
}

.lang-btn .fa-chevron-down {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.lang-dropdown.show + .lang-btn .fa-chevron-down,
.lang-btn:hover .fa-chevron-down {
    transform: rotate(180deg);
}

.lang-text {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--dark-bg);
    border: 1px solid rgba(210, 105, 30, 0.2);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.lang-option:hover {
    background: rgba(210, 105, 30, 0.1);
    color: var(--primary-orange);
}

.lang-option.active {
    background: rgba(210, 105, 30, 0.15);
    color: var(--primary-orange);
    font-weight: 600;
}

.flag-icon {
    font-size: 20px;
    min-width: 24px;
}

.lang-option .fa-check {
    margin-left: auto;
    color: var(--primary-orange);
    font-size: 14px;
}

/* Hide desktop switcher on mobile, show mobile switcher */
@media (max-width: 768px) {
    #language-switcher-desktop {
        display: none !important;
    }
    
    /* Position mobile language switcher inside menu, at top next to hamburger */
    .nav-menu #language-switcher {
        display: flex !important;
        position: absolute;
        top: 50px;
        left: 20px;
        z-index: 1003;
    }

    .nav-menu .lang-btn {
        width: auto;
        justify-content: center;
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 8px;
        background: rgba(210, 105, 30, 0.1);
        border-color: rgba(210, 105, 30, 0.5);
        transition: all 0.3s ease;
        gap: 6px;
    }
    
    .nav-menu .lang-btn:active {
        background: rgba(210, 105, 30, 0.2);
        transform: scale(0.95);
    }

    .nav-menu .lang-text {
        display: none; /* Hide text on mobile to save space */
    }
    
    .nav-menu .lang-btn .fa-globe {
        font-size: 16px;
    }
    
    .nav-menu .lang-btn .fa-chevron-down {
        font-size: 11px;
    }

    .nav-menu .lang-dropdown {
        width: 180px;
        left: 0;
        right: auto;
        transform: translateY(-10px);
        background: rgba(26, 26, 46, 0.98);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(210, 105, 30, 0.3);
    }

    .nav-menu .lang-dropdown.show {
        transform: translateY(0);
    }
    
    /* Style language options for mobile */
    .nav-menu .lang-option {
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 500;
    }
    
    .nav-menu .lang-option:active {
        background: rgba(210, 105, 30, 0.2);
    }
    
    .nav-menu .flag-icon {
        font-size: 20px;
    }
}

/* Navigation adjustments when language switcher is present */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
}

.logo {
    position: absolute;
    left: 0;
}

.nav-menu {
    margin: 0 auto;
}

.hamburger {
    position: absolute;
    right: 10px;
    top: 10px;
}

/* Desktop: Show desktop switcher, hide mobile switcher */
@media (min-width: 769px) {
    /* Hide mobile version in desktop nav menu */
    .nav-menu #language-switcher {
        display: none !important;
    }
    
    /* Show desktop version */
    #language-switcher-desktop {
        display: inline-flex !important;
        position: absolute;
        right: 50px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .nav-container {
        justify-content: space-between;
        position: relative;
    }
    
    .logo {
        position: static;
    }
    
    .nav-menu {
        margin: 0 auto;
    }
    
    .hamburger {
        position: static;
    }
}

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

/* HTML dir="rtl" */
html[dir="rtl"] {
    direction: rtl;
}

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

/* RTL Desktop Layout - Swap logo and hamburger on desktop */
@media (min-width: 769px) {
    html[dir="rtl"] .navbar .nav-container {
        flex-direction: row-reverse !important;
    }
    
    html[dir="rtl"] .navbar .logo {
        order: 999 !important;
    }
    
    html[dir="rtl"] .navbar .hamburger {
        order: -1 !important;
    }
    
    html[dir="rtl"] #language-switcher-desktop {
        right: auto !important;
        left: 50px !important;
    }
}

/* RTL Typography - Exclude Font Awesome icons */
html[dir="rtl"] *:not([class*="fa-"]):not(.fa):not(.fas):not(.far):not(.fab):not(.fal):not(.fad):not(.fat) {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* RTL Navigation */
html[dir="rtl"] .nav-menu {
    margin: 0 auto;
}

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

/* Swap logo and hamburger positions in RTL (for absolute positioned elements) */
html[dir="rtl"] .navbar .logo {
    left: auto !important;
    right: 0 !important;
}

html[dir="rtl"] .navbar .hamburger {
    left: 10px !important;
    right: auto !important;
}

/* RTL Hero Section */
html[dir="rtl"] .hero-content {
    text-align: right;
}

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

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

html[dir="rtl"] .hero-service-item i {
    margin-right: 0;
    margin-left: 12px;
}

html[dir="rtl"] .hero-buttons {
    justify-content: flex-end;
}

/* RTL Buttons */
html[dir="rtl"] .btn i {
    margin-left: 0;
    margin-right: 10px;
    order: -1;
}

/* RTL Features & Cards */
html[dir="rtl"] .home-feature-card,
html[dir="rtl"] .service-card,
html[dir="rtl"] .contact-item {
    text-align: right;
}

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

html[dir="rtl"] .feature-icon,
html[dir="rtl"] .contact-icon {
    margin-right: 0;
    margin-left: 20px;
}

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

/* RTL Section Numbers */
html[dir="rtl"] .section-number {
    left: auto;
    right: 0;
}

/* RTL About Section */
html[dir="rtl"] .about-content {
    flex-direction: row-reverse;
}

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

/* RTL Services Grid */
html[dir="rtl"] .services-grid {
    direction: rtl;
}

/* RTL Portfolio */
html[dir="rtl"] .portfolio-grid {
    direction: rtl;
}

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

html[dir="rtl"] .view-btn {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

/* RTL Contact Section */
html[dir="rtl"] .contact-content {
    flex-direction: row-reverse;
}

html[dir="rtl"] .contact-info,
html[dir="rtl"] .contact-form-container {
    text-align: right;
}

html[dir="rtl"] .form-group input,
html[dir="rtl"] .form-group textarea,
html[dir="rtl"] .form-group select {
    text-align: right;
}

html[dir="rtl"] .form-group label {
    left: auto;
    right: 0;
}

html[dir="rtl"] .form-group input:focus + label,
html[dir="rtl"] .form-group textarea:focus + label,
html[dir="rtl"] .form-group select:focus + label,
html[dir="rtl"] .form-group input.filled + label,
html[dir="rtl"] .form-group textarea.filled + label,
html[dir="rtl"] .form-group select.filled + label {
    right: 10px;
}

/* RTL Newsletter */
html[dir="rtl"] .newsletter-content {
    flex-direction: row-reverse;
}

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

html[dir="rtl"] .newsletter-icon {
    margin-right: 0;
    margin-left: 20px;
}

html[dir="rtl"] .newsletter-privacy i {
    margin-right: 0;
    margin-left: 8px;
}

/* RTL Footer */
html[dir="rtl"] .footer-grid {
    direction: rtl;
}

html[dir="rtl"] .footer-about,
html[dir="rtl"] .footer-links,
html[dir="rtl"] .footer-services,
html[dir="rtl"] .footer-contact {
    text-align: right;
}

html[dir="rtl"] .footer-menu li a i,
html[dir="rtl"] .footer-contact-list li i {
    margin-right: 0;
    margin-left: 12px;
}

html[dir="rtl"] .footer-social {
    justify-content: flex-end;
}

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

/* RTL WhatsApp Button */
html[dir="rtl"] .whatsapp-float {
    left: auto;
    right: 30px;
}

html[dir="rtl"] .whatsapp-tooltip {
    left: auto;
    right: calc(100% + 15px);
}

html[dir="rtl"] .whatsapp-tooltip::after {
    left: auto;
    right: -8px;
    border-left: 8px solid var(--dark-bg);
    border-right: none;
}

/* RTL Lightbox */
html[dir="rtl"] .lightbox-prev {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .lightbox-next {
    right: auto;
    left: 20px;
}

/* RTL Animations - Reverse slide directions */
html[dir="rtl"] .slide-in-left {
    animation-name: slideInRight;
}

html[dir="rtl"] .slide-in-right {
    animation-name: slideInLeft;
}

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

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

/* RTL Mobile Menu */
@media (max-width: 768px) {
    html[dir="rtl"] .navbar .logo {
        left: auto !important;
        right: 0 !important;
    }
    
    html[dir="rtl"] .navbar .hamburger {
        left: 10px !important;
        right: auto !important;
    }
    
    /* RTL Language switcher positioning - opposite side in menu */
    html[dir="rtl"] .nav-menu #language-switcher {
        left: auto;
        right: 20px; /* Position on right side in RTL */
    }

    html[dir="rtl"] .nav-menu {
        align-items: flex-end;
        text-align: right;
    }

    html[dir="rtl"] .nav-menu.active {
        right: auto;
        left: 0;
    }
    
    /* RTL Dropdown positioning */
    html[dir="rtl"] .nav-menu .lang-dropdown {
        left: auto;
        right: 0;
    }
}

/* Smooth language transition */
.language-transition * {
    transition: all 0.3s ease !important;
}

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

/* Loading state for language switch */
body.switching-language {
    pointer-events: none;
    opacity: 0.95;
}

/* Ensure proper font for Arabic */
html[lang="ar"] {
    font-family: 'Poppins', 'Segoe UI', 'Arial', 'Tahoma', sans-serif;
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] h5,
html[lang="ar"] h6 {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-weight: 700;
}

/* Navbar on light/dark backgrounds - language switcher */
.navbar.on-light .lang-btn {
    border-color: rgba(26, 26, 46, 0.3);
    color: var(--dark-bg);
}

.navbar.on-light .lang-btn:hover {
    background: rgba(210, 105, 30, 0.1);
    border-color: var(--primary-orange);
}

.navbar.scrolled .lang-btn {
    border-color: rgba(210, 105, 30, 0.3);
    color: var(--text-light);
}

/* Fade in animation for language switch */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-transition {
    animation: fadeIn 0.3s ease;
}

