/* RTL Typography System for Arabic Blog Content */

/* Root Variables for Arabic Typography */
[dir="rtl"] {
    --rtl-heading-line-height: 1.8;
    --rtl-paragraph-line-height: 2;
    --rtl-heading-spacing: 1.75em;
    --rtl-paragraph-spacing: 1.25em;
}

/* Entry Content Container - Arabic Optimized */
[dir="rtl"] .entry-content {
    font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", "Amiri",
        "Noto Sans Arabic", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.125rem;
    line-height: var(--rtl-paragraph-line-height);
    letter-spacing: normal;
    word-spacing: 0.05em;
}

/* Paragraph Spacing - RTL Only */
[dir="rtl"] .entry-content p {
    line-height: var(--rtl-paragraph-line-height);
    margin-top: 0;
    margin-bottom: var(--rtl-paragraph-spacing);
    text-align: justify;
    hyphens: none;
}

[dir="rtl"] .entry-content p:last-child {
    margin-bottom: 0;
}

/* H1 - Main Heading */
[dir="rtl"] .entry-content h1 {
    font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", "Amiri", sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    line-height: var(--rtl-heading-line-height);
    margin-top: 2em;
    margin-bottom: 0.75em;
    letter-spacing: -0.01em;
}

[dir="rtl"] .entry-content h1:first-child {
    margin-top: 0;
}

/* H2 - Section Heading */
[dir="rtl"] .entry-content h2 {
    font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", "Amiri", sans-serif;
    font-size: 1.875rem;
    font-weight: 700;
    line-height: var(--rtl-heading-line-height);
    margin-top: var(--rtl-heading-spacing);
    margin-bottom: 0.65em;
    letter-spacing: -0.01em;
}

[dir="rtl"] .entry-content h2:first-child {
    margin-top: 0;
}

/* H3 - Subsection Heading */
[dir="rtl"] .entry-content h3 {
    font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", "Amiri", sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: var(--rtl-heading-line-height);
    margin-top: 1.5em;
    margin-bottom: 0.6em;
    letter-spacing: -0.005em;
}

[dir="rtl"] .entry-content h3:first-child {
    margin-top: 0;
}

/* H4 - Minor Heading */
[dir="rtl"] .entry-content h4 {
    font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: var(--rtl-heading-line-height);
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}

/* H5 & H6 */
[dir="rtl"] .entry-content h5,
[dir="rtl"] .entry-content h6 {
    font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", sans-serif;
    font-weight: 600;
    line-height: var(--rtl-heading-line-height);
    margin-top: 1em;
    margin-bottom: 0.5em;
}

[dir="rtl"] .entry-content h5 {
    font-size: 1.125rem;
}

[dir="rtl"] .entry-content h6 {
    font-size: 1rem;
}

/* Lists - RTL Spacing */
[dir="rtl"] .entry-content ul,
[dir="rtl"] .entry-content ol {
    line-height: var(--rtl-paragraph-line-height);
    margin-top: 0;
    margin-bottom: var(--rtl-paragraph-spacing);
    padding-right: 1.5em;
    padding-left: 0;
}

[dir="rtl"] .entry-content li {
    margin-bottom: 0.5em;
}

[dir="rtl"] .entry-content li:last-child {
    margin-bottom: 0;
}

/* Blockquote - RTL */
[dir="rtl"] .entry-content blockquote {
    line-height: var(--rtl-paragraph-line-height);
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    padding-right: 1.5em;
    padding-left: 0;
    border-right: 4px solid currentColor;
    border-left: none;
}

[dir="rtl"] .entry-content blockquote p {
    margin-bottom: 0.75em;
}

/* Code & Pre - RTL */
[dir="rtl"] .entry-content pre,
[dir="rtl"] .entry-content code {
    direction: ltr;
    text-align: left;
}

[dir="rtl"] .entry-content pre {
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    padding: 1em;
    overflow-x: auto;
}

/* Tables - RTL */
[dir="rtl"] .entry-content table {
    margin-top: 1.5em;
    margin-bottom: 1.5em;
}

/* Heading + Paragraph Combinations */
[dir="rtl"] .entry-content h1 + p,
[dir="rtl"] .entry-content h2 + p,
[dir="rtl"] .entry-content h3 + p {
    margin-top: 0;
}

/* Mobile Optimization - RTL */
@media (max-width: 768px) {
    [dir="rtl"] .entry-content {
        font-size: 1rem;
        line-height: 1.9;
    }

    [dir="rtl"] .entry-content h1 {
        font-size: 1.75rem;
        margin-top: 1.5em;
        margin-bottom: 0.65em;
    }

    [dir="rtl"] .entry-content h2 {
        font-size: 1.5rem;
        margin-top: 1.4em;
        margin-bottom: 0.6em;
    }

    [dir="rtl"] .entry-content h3 {
        font-size: 1.25rem;
        margin-top: 1.25em;
        margin-bottom: 0.55em;
    }

    [dir="rtl"] .entry-content h4 {
        font-size: 1.125rem;
        margin-top: 1.15em;
    }

    [dir="rtl"] .entry-content p {
        margin-bottom: 1.15em;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    [dir="rtl"] .entry-content {
        font-size: 0.9375rem;
        line-height: 1.85;
    }

    [dir="rtl"] .entry-content h1 {
        font-size: 1.5rem;
        line-height: 1.7;
    }

    [dir="rtl"] .entry-content h2 {
        font-size: 1.3125rem;
        line-height: 1.7;
    }

    [dir="rtl"] .entry-content h3 {
        font-size: 1.125rem;
        line-height: 1.7;
    }
}

/* Print Optimization - RTL */
@media print {
    [dir="rtl"] .entry-content {
        font-size: 11pt;
        line-height: 1.6;
    }

    [dir="rtl"] .entry-content h1,
    [dir="rtl"] .entry-content h2,
    [dir="rtl"] .entry-content h3 {
        page-break-after: avoid;
        line-height: 1.4;
    }

    [dir="rtl"] .entry-content p {
        orphans: 3;
        widows: 3;
    }
}

/* ============================================= */
/* RTL Breadcrumb System – FIXED & CLEAN */
/* ============================================= */

[dir="rtl"] .optech-breadcrumb {
    direction: rtl;
}

/* Breadcrumb Wrapper */
[dir="rtl"] .breadcrumbs ul {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 0;
    margin: 0;
    list-style: none;
    text-align: right;
}

/* Breadcrumb Item */
[dir="rtl"] .breadcrumbs ul li {
    position: relative;
    padding: 0;
    font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", "Amiri", sans-serif;
    white-space: nowrap;
}

/* Breadcrumb Separator */
[dir="rtl"] .breadcrumbs ul li:not(:last-child)::after {
    content: "›";
    font-size: 20px;
    display: inline-block;
    opacity: 0.8;
    font-weight: 500;
    margin-right: 15px;
}

/* Remove any ::before usage */
[dir="rtl"] .breadcrumbs ul li::before {
    content: none !important;
}

/* Breadcrumb Links */
[dir="rtl"] .breadcrumbs ul li a {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

/* Current Page */
[dir="rtl"] .breadcrumbs ul li span,
[dir="rtl"] .breadcrumbs ul li:last-child {
    font-weight: 600;
}

/* ============================= */
/* Mobile Optimization */
/* ============================= */

@media (max-width: 768px) {
    [dir="rtl"] .breadcrumbs ul {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 0.9rem;
    }

    [dir="rtl"] .breadcrumbs ul li:not(:last-child)::after {
        font-size: 16px;
        margin: 0 6px;
    }
}

@media (max-width: 480px) {
    [dir="rtl"] .breadcrumbs ul {
        font-size: 0.85rem;
    }

    [dir="rtl"] .breadcrumbs ul li:not(:last-child)::after {
        font-size: 14px;
        margin: 0 5px;
    }
}

/* ============================================= */
/* RTL Progress Circle (Scroll to Top Button)   */
/* ============================================= */

/* Progress Circle - RTL Position (Left Side) */
[dir="rtl"] .progress-wrap {
    right: auto;
    left: 30px;
}

/* Mobile - Progress Circle RTL */
@media (max-width: 768px) {
    [dir="rtl"] .progress-wrap {
        left: 20px;
    }
}

/* ============================================= */
/* RTL Service Cards Slider                     */
/* ============================================= */

/* Service Card - RTL Text Alignment */
[dir="rtl"] .optech-iconbox-wrap {
    text-align: right;
}

[dir="rtl"] .optech-iconbox-data {
    text-align: right;
}

[dir="rtl"] .optech-iconbox-data p,
[dir="rtl"] .optech-iconbox-data .service-title-text {
    text-align: right;
}

/* RTL Icon Button Alignment */
[dir="rtl"] .optech-iconbox-data .optech-icon-btn {
    justify-content: flex-start;
}

[dir="rtl"] .optech-icon-btn .icon-show {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .optech-icon-btn .icon-hide {
    margin-left: 0;
    margin-right: 8px;
}

/* ============================================= */
/* RTL Key Features Section (extra-padding-tb)  */
/* ============================================= */

/* Icon Box Data 2 - RTL Text Alignment */
[dir="rtl"] .optech-iconbox-data2 {
    text-align: right;
}

[dir="rtl"] .optech-iconbox-data2 h3,
[dir="rtl"] .optech-iconbox-data2 h5,
[dir="rtl"] .optech-iconbox-data2 p {
    text-align: right;
}

/* ============================================= */
/* RTL Hero Banner Controls                     */
/* ============================================= */

/* Move hero controls to left side in RTL (override inline styles) */
[dir="rtl"] .hero-controls {
    right: auto !important;
    left: 6vw !important;
}

/* Mobile - adjust position */
@media (max-width: 768px) {
    [dir="rtl"] .hero-controls {
        left: 4vw !important;
    }
}

/* ============================================= */
/* RTL Header Info (Top Bar)                    */
/* ============================================= */

/* Fix spacing and RTL layout for header info */
[dir="rtl"] .optech-header-info ul li {
    padding-left: 0;
    padding-right: 24px;
    margin-right: 0;
    margin-left: 48px;
}

[dir="rtl"] .optech-header-info ul li:last-child {
    margin-left: 0;
}

[dir="rtl"] .optech-header-info ul li i {
    left: auto;
    right: 0;
}

/* Fix phone number direction (keep LTR for numbers) */
[dir="rtl"] .optech-header-info ul li a {
    direction: ltr;
    justify-content: flex-end;
}

/* ============================================= */
/* RTL Footer Contact List                      */
/* ============================================= */

/* Fix phone number RTL in footer */
[dir="rtl"] .footer-contact-list li a {
    direction: ltr;
    justify-content: flex-start;
    text-align: right;
}

[dir="rtl"] .footer-contact-list i {
    margin-right: 0;
    margin-left: 8px;
}

/* ============================================= */
/* RTL Mobile Menu (Phone Mode)                 */
/* ============================================= */

/* Fix mobile menu for RTL */
@media (max-width: 991px) {
    /* Mobile menu positioning */
    [dir="rtl"] .site-header .menu-block {
        left: auto;
        right: 0;
        transform: translate(100%);
    }

    [dir="rtl"] .site-header .menu-block.active {
        transform: translate(0%);
    }

    /* Menu item icon positioning */
    [dir="rtl"] .site-menu-main > li > a i {
        right: auto;
        left: 0;
    }

    /* Menu item padding */
    [dir="rtl"] .site-menu-main > li > a {
        padding: 0 15px 0 50px;
    }

    /* Mobile menu head buttons */
    [dir="rtl"] .site-header .menu-block .mobile-menu-head .go-back {
        border-right: 0;
        border-left: 1px solid rgba(0, 0, 0, 0.1);
    }

    [dir="rtl"] .site-header .menu-block .mobile-menu-head .mobile-menu-close {
        border-left: 0;
        border-right: 1px solid rgba(0, 0, 0, 0.1);
    }

    /* Submenu arrow rotation for RTL */
    [dir="rtl"] li.sub-menu--item.nav-item-has-children i {
        transform: rotate(90deg) !important;
    }

    [dir="rtl"] li.sub-menu--item.nav-item-has-children:hover i {
        transform: rotate(90deg) !important;
    }

    /* Services dropdown - make scrollable with visible scrollbar */
    .services-dropdown {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        position: relative;
    }

    /* Visible scrollbar for better UX */
    .services-dropdown::-webkit-scrollbar {
        width: 8px;
    }

    .services-dropdown::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 4px;
    }

    .services-dropdown::-webkit-scrollbar-thumb {
        background: rgba(0, 195, 255, 0.6);
        border-radius: 4px;
    }

    .services-dropdown::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 195, 255, 0.8);
    }

    /* Firefox scrollbar */
    .services-dropdown {
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 195, 255, 0.6) rgba(0, 0, 0, 0.05);
    }

    /* Ensure All Services item is always visible */
    .services-dropdown .all-services-item {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative;
        z-index: 10;
    }

    /* Add visual separator after All Services */
    .services-dropdown .dropdown-divider {
        display: block !important;
        height: 1px;
        background: rgba(0, 0, 0, 0.1);
        margin: 8px 15px;
    }
}
