/* ============================================================
   AMT Machinery — RTL (Arabic) Override Stylesheet
   This file is loaded AFTER premium_b2b.css for /ar/ pages.
   It handles direction flipping, font, and layout adjustments.
   ============================================================ */

/* -- Google Noto Sans Arabic -- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700;800;900&display=swap');

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

html[lang="ar"] {
    --font-body: 'Noto Sans Arabic', 'Inter', sans-serif;
    --font-heading: 'Noto Sans Arabic', 'Montserrat', sans-serif;
}

html[lang="ar"] body {
    font-family: var(--font-body);
    font-size: 1.02em;
    line-height: 1.85;
    letter-spacing: 0;
}

html[lang="ar"] {
    --readable-max: 820px;
}

/* Arabic doesn't use italic — replace with underline */
html[lang="ar"] em,
html[lang="ar"] i:not(.fas):not(.fab):not(.far):not(.fa) {
    font-style: normal;
    text-decoration: underline;
}

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

html[dir="rtl"] .nav-links {
    direction: rtl;
    flex-direction: row-reverse;
    justify-content: center;
}

html[dir="rtl"] .nav-links a {
    direction: rtl;
}

html[dir="rtl"] .nav-actions {
    direction: ltr;
    flex-direction: row;
    margin-left: 20px;
    margin-right: 0;
}

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

html[lang="ar"] .logo {
    font-family: 'Montserrat', sans-serif;
    line-height: 1;
    display: flex;
    align-items: center;
    direction: ltr;
    unicode-bidi: isolate;
}

html[lang="ar"] .lang-dropdown-toggle {
    height: 38px;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

html[lang="ar"] .lang-label {
    line-height: 1;
}

/* Keep the Arabic homepage layout visually aligned with the English homepage. */
html[dir="rtl"] body.ar-home .navbar {
    direction: ltr;
    flex-direction: row;
}

html[dir="rtl"] body.ar-home .nav-links {
    direction: ltr;
    flex-direction: row;
}

html[dir="rtl"] body.ar-home .nav-actions {
    margin-left: 20px;
    margin-right: 0;
}

html[dir="rtl"] body.ar-home .hero,
html[dir="rtl"] body.ar-home .hero-content,
html[dir="rtl"] body.ar-home .cta-group {
    direction: rtl;
    text-align: right;
}

/* Mega Menu RTL */
html[dir="rtl"] .mega-menu {
    left: auto;
    right: 0;
}

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

html[dir="rtl"] .mega-col-title i {
    margin-right: 0;
    margin-left: 10px;
}

html[dir="rtl"] .mega-count {
    margin-left: 0;
    margin-right: 8px;
}

/* Mobile menu button */
html[dir="rtl"] .mobile-menu-btn {
    left: 20px;
    right: auto;
}

/* ===== Breadcrumb RTL ===== */
html[dir="rtl"] .breadcrumb {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .page-hero > .breadcrumb,
html[dir="rtl"] .cat-header > .breadcrumb,
html[dir="rtl"] .blog-hero > .breadcrumb,
html[dir="rtl"] .article-hero .breadcrumb,
html[dir="rtl"] .cat-page-hero .breadcrumb,
html[dir="rtl"] .detail-info > .breadcrumb {
    left: var(--section-x) !important;
    right: auto !important;
    text-align: left !important;
}

/* ===== Hero / Detail Page ===== */
html[dir="rtl"] .detail-hero {
    flex-direction: row-reverse;
}

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

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

html[dir="rtl"] .hero-meta-row span i {
    margin-right: 0;
    margin-left: 6px;
}

/* ===== Showcase Cards (Category/Sub pages) RTL ===== */
html[dir="rtl"] .showcase-card {
    flex-direction: row-reverse;
}

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

html[dir="rtl"] .showcase-img .img-badge {
    left: auto;
    right: 20px;
}

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

/* Feature tags */
html[dir="rtl"] .feature-tag i {
    order: 1;
    margin-left: 0;
    margin-right: 6px;
}

/* ===== Spec Grid ===== */
html[dir="rtl"] .spec-grid {
    direction: rtl;
}

html[dir="rtl"] .spec-item span,
html[dir="rtl"] .spec-item strong {
    text-align: right;
}

/* ===== Specs Table ===== */
html[dir="rtl"] .specs-table {
    direction: rtl;
}

html[dir="rtl"] .specs-table td,
html[dir="rtl"] .specs-table th {
    text-align: right;
}

/* ===== Section Titles ===== */
html[dir="rtl"] .section-title {
    text-align: center;
}

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

/* ===== Overview Section ===== */
html[dir="rtl"] .overview-container {
    direction: rtl;
}

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

/* ===== Feature Cards / B2B Grid ===== */
html[dir="rtl"] .feature-card {
    text-align: right;
}

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

/* ===== FAQ ===== */
html[dir="rtl"] .faq-grid {
    direction: rtl;
}

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

/* ===== Inquiry Form RTL ===== */
html[dir="rtl"] .inquiry-container {
    direction: rtl;
}

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

html[dir="rtl"] .inquiry-benefits li i {
    margin-right: 0;
    margin-left: 10px;
}

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

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

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

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

html[dir="rtl"] .footer-col ul {
    padding-right: 0;
}

html[dir="rtl"] .footer-bottom {
    text-align: center;
}

/* ===== Sticky CTA RTL ===== */
html[dir="rtl"] .sticky-cta {
    flex-direction: row-reverse;
}

/* ===== Trust Badges ===== */
html[dir="rtl"] .trust-badge i {
    margin-right: 0;
    margin-left: 8px;
}

/* ===== Manufacturer Stats ===== */
html[dir="rtl"] .manufacturer-container {
    direction: rtl;
}

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

/* ===== Thumbnail Slider ===== */
html[dir="rtl"] .thumbnail-slider-container {
    direction: ltr; /* Keep slider LTR for natural scroll */
}

/* ===== Buttons with arrows ===== */
html[dir="rtl"] .btn i.fa-arrow-right {
    transform: scaleX(-1);
}

html[dir="rtl"] .btn i.fa-chevron-right {
    transform: scaleX(-1);
}

/* ===== Category Filter Section ===== */
html[dir="rtl"] .filter-section {
    direction: rtl;
}

/* ===== App Grid (Samples/Applications) ===== */
html[dir="rtl"] .app-card-content {
    text-align: right;
}

/* ===== WhatsApp CTA Button (Arabic Specific) ===== */
.whatsapp-float-ar {
    position: fixed;
    bottom: 30px;
    left: 30px;
    right: auto;
    z-index: 9999;
    background: #25D366;
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: whatsappPulse 2s infinite;
}

.whatsapp-float-ar:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
}

@keyframes whatsappPulse {
    0% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(37, 211, 102, 0.7); }
    100% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4); }
}

/* ===== Language Switcher ===== */
html[dir="rtl"] .lang-dropdown-menu {
    right: auto;
    left: 0;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    margin-right: 15px;
}

.lang-switcher a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.lang-switcher a:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.lang-switcher a.active {
    color: var(--primary);
    background: rgba(0, 119, 182, 0.08);
    border-color: var(--primary);
}

/* ===== Mobile Overrides ===== */
@media (max-width: 900px) {
    html[dir="rtl"] .detail-hero {
        flex-direction: column;
    }
    
    html[dir="rtl"] .showcase-card {
        flex-direction: column;
    }
    
    html[dir="rtl"] .navbar {
        flex-direction: row;
    }
}

@media (max-width: 768px) {
    html[dir="rtl"] .mobile-menu-btn {
        left: 15px;
        right: auto;
    }
    
    html[lang="ar"] body {
        font-size: 0.98em;
    }
}
