/* ==========================================================================
   WEBSITE MASTERS - ARABIC RTL STYLESHEET (حقوق النشر © ويب سايت ماسترز)
   Applied automatically when <html lang="ar" dir="rtl">
   Preserves 100% of the Website Masters visual identity, colors (#92C83E, #161616),
   spacing, glassmorphism, animations, and typography hierarchy.
   ========================================================================== */

/* 1. Global Typography, Direction & Viewport Overflow Containment */
html[dir="rtl"] {
    direction: rtl;
    text-align: right;
    overflow-x: clip;
}

html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    letter-spacing: 0;
    overflow-x: clip;
    position: relative;
    width: 100%;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] .hero-title,
html[dir="rtl"] .section-title {
    font-family: 'Cairo', 'Outfit', system-ui, -apple-system, sans-serif;
    letter-spacing: 0;
    line-height: 1.35;
}

html[dir="rtl"] p,
html[dir="rtl"] .hero-subtitle,
html[dir="rtl"] .section-subtitle {
    line-height: 1.75;
}

/* 2. Header & Navigation */
html[dir="rtl"] .header-nav {
    transform: none !important;
    -webkit-transform: none !important;
}

html[dir="rtl"] .header-nav.scrolled {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background-color: rgba(15, 20, 28, 0.98) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}

html[dir="rtl"][data-theme="light"] .header-nav.scrolled {
    background-color: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08) !important;
}

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

html[dir="rtl"] .theme-toggle-btn {
    direction: ltr !important;
}

html[dir="rtl"] .nav-menu {
    gap: 2.25rem;
}

html[dir="rtl"] .nav-link::after {
    left: auto;
    right: 0;
}

html[dir="rtl"] .nav-item-dropdown .dropdown-arrow {
    margin-left: 0;
    margin-right: 0.35rem;
}

html[dir="rtl"] .dropdown-menu {
    left: auto;
    right: 50%;
    transform: translateX(50%) translateY(12px);
    text-align: right;
}

html[dir="rtl"] .nav-item-dropdown:hover .dropdown-menu {
    transform: translateX(50%) translateY(0);
}

html[dir="rtl"] .dropdown-menu li a:hover {
    padding-left: 1.25rem;
    padding-right: 0.95rem;
}

html[dir="rtl"] .dropdown-item {
    gap: 0.65rem;
}

html[dir="rtl"] .dropdown-item:hover {
    padding-left: 0.75rem;
    padding-right: 1rem;
}

/* 3. Offcanvas Mobile Menu (Contained within Viewport Bounds to Prevent Horizontal Displacement) */
html[dir="rtl"] .offcanvas-menu {
    right: 0;
    left: 0;
    width: 100%;
    text-align: right;
}

html[dir="rtl"] .offcanvas-menu.active {
    right: 0;
    left: 0;
}

html[dir="rtl"] .offcanvas-close {
    right: auto;
    left: 1.5rem;
}

html[dir="rtl"] .offcanvas-links {
    text-align: right;
    align-items: flex-start;
}

html[dir="rtl"] .offcanvas-lang-wrapper {
    flex-direction: row;
    direction: rtl;
    text-align: right;
}

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

html[dir="rtl"] .offcanvas-sublink:hover {
    transform: translateX(-4px);
}

/* 4. Directional Buttons & Icons */
html[dir="rtl"] .btn svg,
html[dir="rtl"] .btn i {
    transform: scaleX(-1);
}

html[dir="rtl"] .btn-arrow-icon {
    transform: scaleX(-1);
}

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

/* 5. Process Steps & Timeline */
html[dir="rtl"] .process-step-num,
html[dir="rtl"] .step-number {
    margin-right: 0;
    margin-left: 1rem;
}

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

/* 6. Form Elements */
html[dir="rtl"] input[type="text"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] select,
html[dir="rtl"] textarea {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="tel"] {
    direction: ltr;
    text-align: right;
}

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

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

/* 7. Floating Widgets (WhatsApp & FAQ Chatbot) */
html[dir="rtl"] .floating-widgets-container {
    right: auto;
    left: 24px;
    align-items: flex-start;
}

html[dir="rtl"] .faq-chat-drawer {
    right: auto;
    left: 0;
    text-align: right;
}

html[dir="rtl"] .whatsapp-drawer,
html[dir="rtl"] .whatsapp-chat-drawer {
    right: auto;
    left: 0;
    text-align: right;
}

html[dir="rtl"] .faq-chat-header-profile {
    flex-direction: row;
}

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

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

html[dir="rtl"] .faq-option-btn {
    text-align: right;
    flex-direction: row;
}

html[dir="rtl"] .faq-option-btn .opt-arrow {
    margin-left: 0;
    margin-right: auto;
    transform: scaleX(-1);
}

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

html[dir="rtl"] .faq-chat-send-btn svg {
    transform: scaleX(-1);
}

html[dir="rtl"] .chat-msg.bot-msg {
    margin-right: 0;
    margin-left: auto;
    text-align: right;
}

html[dir="rtl"] .chat-msg.user-msg {
    margin-left: 0;
    margin-right: auto;
    text-align: right;
}

html[dir="rtl"] .chat-action-link svg {
    transform: scaleX(-1);
}

/* 8. Mobile App Bottom Navigation Bar */
html[dir="rtl"] .mobile-app-bottom-bar {
    direction: rtl;
}

/* 9. Testimonials & Sliders */
html[dir="rtl"] .slider-nav-btn.prev i,
html[dir="rtl"] .slider-nav-btn.prev svg {
    transform: rotate(180deg);
}

html[dir="rtl"] .slider-nav-btn.next i,
html[dir="rtl"] .slider-nav-btn.next svg {
    transform: rotate(180deg);
}

/* 10. Footer Alignment */
html[dir="rtl"] .footer-col {
    text-align: right;
}

html[dir="rtl"] .footer-links li a:hover {
    padding-left: 0;
    padding-right: 0.5rem;
}

html[dir="rtl"] .footer-links li a:hover::before {
    left: auto;
    right: 0;
}

/* 11. Breadcrumbs */
html[dir="rtl"] .breadcrumb-list {
    flex-direction: row;
}

html[dir="rtl"] .breadcrumb-separator {
    transform: rotate(180deg);
}

/* 12. Accordions (FAQs) */
html[dir="rtl"] .faq-question {
    text-align: right;
}

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

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

/* 13. Service Details & Portfolio Details */
html[dir="rtl"] .service-sidebar,
html[dir="rtl"] .project-sidebar {
    text-align: right;
}

html[dir="rtl"] .service-nav-item,
html[dir="rtl"] .project-meta-item {
    text-align: right;
}

html[dir="rtl"] .service-nav-item i {
    margin-left: 0.75rem;
    margin-right: 0;
}

/* 14. Section & Element Overflow Containment */
html[dir="rtl"] .section,
html[dir="rtl"] .hero-section,
html[dir="rtl"] .index-hero-section,
html[dir="rtl"] .landing-hero-grid,
html[dir="rtl"] .portfolio-slider-section {
    overflow-x: clip;
}

html[dir="rtl"] .hero-bg-glow {
    right: auto;
    left: 0;
}

html[dir="rtl"] .hero-floating-reviews {
    left: auto;
    right: 0;
}

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

/* 15. RTL Marquee Animations */
html[dir="rtl"] .marquee-content {
    animation-name: marquee-rtl;
}

@keyframes marquee-rtl {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

html[dir="rtl"] .tech-marquee-track {
    animation-name: tech-marquee-scroll-rtl;
}

@keyframes tech-marquee-scroll-rtl {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

/* 16. Responsive Rules */
@media (max-width: 1024px) {
    html[dir="rtl"] .header-nav .lang-switcher {
        display: none !important;
    }
    html[dir="rtl"] .nav-actions {
        margin-left: 0;
        margin-right: auto;
        margin-inline-start: auto;
        margin-inline-end: 1rem;
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    html[dir="rtl"] .floating-widgets-container {
        left: 16px;
        right: auto;
        bottom: 80px; /* Above mobile bottom bar */
    }
}
