/* Arabic Theme for BCMS */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&family=Tajawal:wght@300;400;500;700&display=swap');

body {
    font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    color: #000000;
}

[dir="rtl"] {
    text-align: right;
}

/* Arabic Cursive Typography Integrity (Preserve connected ligatures) */
[dir="rtl"],
[dir="rtl"] *,
[lang="ar"],
[lang="ar"] * {
    letter-spacing: normal !important;
}

/* Fix Bootstrap Utility Classes for RTL */
[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

[dir="rtl"] .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

[dir="rtl"] .me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .ms-2 {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

[dir="rtl"] .ms-3 {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}

[dir="rtl"] .ms-lg-3 {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}

[dir="rtl"] .me-1 {
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .me-3 {
    margin-left: 1rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .me-4 {
    margin-left: 1.5rem !important;
    margin-right: 0 !important;
}

[dir="rtl"] .ms-1 {
    margin-right: 0.25rem !important;
    margin-left: 0 !important;
}

[dir="rtl"] .ms-4 {
    margin-right: 1.5rem !important;
    margin-left: 0 !important;
}

[dir="rtl"] .ps-1 { padding-right: 0.25rem !important; padding-left: 0 !important; }
[dir="rtl"] .ps-2 { padding-right: 0.5rem !important; padding-left: 0 !important; }
[dir="rtl"] .ps-3 { padding-right: 1rem !important; padding-left: 0 !important; }
[dir="rtl"] .pe-1 { padding-left: 0.25rem !important; padding-right: 0 !important; }
[dir="rtl"] .pe-2 { padding-left: 0.5rem !important; padding-right: 0 !important; }
[dir="rtl"] .pe-3 { padding-left: 1rem !important; padding-right: 0 !important; }

/* Ensure icons placed before text always face towards the text on their left in RTL */
[dir="rtl"] i.ms-1, [dir="rtl"] i.ms-2, [dir="rtl"] i.ms-3,
[dir="rtl"] span.ms-1, [dir="rtl"] span.ms-2, [dir="rtl"] span.ms-3,
[dir="rtl"] .fa.ms-1, [dir="rtl"] .fas.ms-1, [dir="rtl"] .far.ms-1, [dir="rtl"] .fab.ms-1,
[dir="rtl"] .fa.ms-2, [dir="rtl"] .fas.ms-2, [dir="rtl"] .far.ms-2, [dir="rtl"] .fab.ms-2,
[dir="rtl"] .bi.ms-1, [dir="rtl"] .bi.ms-2, [dir="rtl"] .bi.ms-3 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

/* Navbar Adjustments for Arabic RTL */
[dir="rtl"] .navbar-nav {
    padding-right: 0;
    padding-left: 0;
    margin-right: 0 !important;
    margin-left: auto !important; /* Push navbar items to the right in Arabic */
}

[dir="rtl"] .navbar-collapse {
    flex-direction: row-reverse;
}

[dir="rtl"] .navbar-brand {
    margin-left: 1rem;
    margin-right: 0;
}

/* Submenu Flyout for RTL (Fly out to the left) */
[dir="rtl"] .dropdown-submenu > .dropdown-menu {
    left: auto !important;
    right: 100% !important;
}

[dir="rtl"] .dropdown-menu {
    text-align: right;
}

/* Search suggestions box */
[dir="rtl"] #nav-search-suggestions {
    right: 0 !important;
    left: auto !important;
}

/* Icons */
[dir="rtl"] .bi-translate {
    margin-left: 0.25rem;
}

/* Breadcrumb logic */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item {
    padding-right: 0.5rem;
    padding-left: 0;
}

[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: 0.5rem;
    padding-right: 0;
    content: var(--bs-breadcrumb-divider, "/");
}

/* General Layout - Page Details Body on the Right, Sidebar Modules on the Left */
[dir="rtl"] .row.gx-5 {
    display: flex;
    flex-wrap: wrap;
}

@media (min-width: 992px) {
    /* Main body column (col-lg-9) on the RIGHT, Sidebar (col-lg-3) on the LEFT */
    [dir="rtl"] .row > .col-lg-9 {
        order: 1;
    }
    [dir="rtl"] .row > .col-lg-3 {
        order: 2;
    }
}

[dir="rtl"] .col-lg-9, [dir="rtl"] .col-lg-3 {
    text-align: right;
}

/* Cards, Titles & Windows Content in RTL */
[dir="rtl"] .card,
[dir="rtl"] .card-body,
[dir="rtl"] .card-title,
[dir="rtl"] .card-text,
[dir="rtl"] .card-header,
[dir="rtl"] .card-footer,
[dir="rtl"] .card h1,
[dir="rtl"] .card h2,
[dir="rtl"] .card h3,
[dir="rtl"] .card h4,
[dir="rtl"] .card h5,
[dir="rtl"] .card h6,
[dir="rtl"] .card p,
[dir="rtl"] .bcms-showcase-section,
[dir="rtl"] .bcms-carousel-item,
[dir="rtl"] .bcms-glow-card,
[dir="rtl"] .bcms-glass-tilt-card,
[dir="rtl"] .bcms-stagger-card,
[dir="rtl"] .bcms-flip-front,
[dir="rtl"] .bcms-flip-back,
[dir="rtl"] .bcms-flip-inner {
    direction: rtl !important;
    text-align: right !important;
}

[dir="rtl"] .text-start,
[dir="rtl"] .text-xl-start,
[dir="rtl"] .text-lg-start,
[dir="rtl"] .text-md-start,
[dir="rtl"] .text-sm-start {
    text-align: right !important;
}

[dir="rtl"] .justify-content-xl-start,
[dir="rtl"] .justify-content-lg-start,
[dir="rtl"] .justify-content-md-start,
[dir="rtl"] .justify-content-start {
    justify-content: flex-start !important;
}

[dir="rtl"] .justify-content-xl-end,
[dir="rtl"] .justify-content-lg-end,
[dir="rtl"] .justify-content-md-end,
[dir="rtl"] .justify-content-end {
    justify-content: flex-end !important;
}

/* Voice Reader position */
[dir="rtl"] #tts-player {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] #tts-player .tts-controls {
    direction: rtl;
}

[dir="rtl"] #tts-player .btn {
    direction: rtl;
    text-align: center;
}

/* Arabic Typography Scaling - Proportional Reduction for Balanced Page Headers & Titles */
[dir="rtl"] h1, [dir="rtl"] .h1 {
    font-size: calc(1.35rem + 1.2vw) !important;
    line-height: 1.45 !important;
}

[dir="rtl"] h2, [dir="rtl"] .h2 {
    font-size: calc(1.2rem + 0.7vw) !important;
    line-height: 1.45 !important;
}

[dir="rtl"] h3, [dir="rtl"] .h3 {
    font-size: calc(1.1rem + 0.4vw) !important;
    line-height: 1.45 !important;
}

[dir="rtl"] h4, [dir="rtl"] .h4 {
    font-size: 1.2rem !important;
    line-height: 1.45 !important;
}

[dir="rtl"] h5, [dir="rtl"] .h5 {
    font-size: 1.05rem !important;
    line-height: 1.45 !important;
}

[dir="rtl"] h6, [dir="rtl"] .h6 {
    font-size: 0.92rem !important;
    line-height: 1.45 !important;
}

[dir="rtl"] .display-1 { font-size: calc(1.75rem + 2.5vw) !important; line-height: 1.3 !important; }
[dir="rtl"] .display-2 { font-size: calc(1.65rem + 2vw) !important; line-height: 1.3 !important; }
[dir="rtl"] .display-3 { font-size: calc(1.55rem + 1.6vw) !important; line-height: 1.35 !important; }
[dir="rtl"] .display-4 { font-size: calc(1.45rem + 1.2vw) !important; line-height: 1.35 !important; }
[dir="rtl"] .display-5 { font-size: calc(1.35rem + 1vw) !important; line-height: 1.35 !important; }
[dir="rtl"] .display-6 { font-size: calc(1.25rem + 0.6vw) !important; line-height: 1.4 !important; }

/* Page title banner in bdata.php */
[dir="rtl"] section.bg-dark-banner h1,
[dir="rtl"] .bg-dark-banner h1 {
    font-size: 1.85rem !important;
    line-height: 1.4 !important;
}

/* Hero section title & subtitle in index.php */
[dir="rtl"] header.spotlight-active h1 {
    font-size: calc(1.5rem + 1.2vw) !important;
    line-height: 1.35 !important;
}

[dir="rtl"] header.spotlight-active p.lead {
    font-size: 1.1rem !important;
    line-height: 1.7 !important;
}

/* Main Image Header Height in RTL */
[dir="rtl"] .header-main {
    min-height: 220px;
}

[dir="rtl"] header.spotlight-active {
    min-height: 480px;
}

/* Fix CKEditor Table Centering & Resized Table Alignment in RTL Layouts (v5.89.83) */
[dir="rtl"] figure.table:not([style*="float: left"]):not([style*="float:left"]):not([style*="float: right"]):not([style*="float:right"]) {
    display: table;
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
}
[dir="rtl"] figure.table[style*="float: none"]:not([style*="width"]),
[dir="rtl"] figure.table[style*="float:none"]:not([style*="width"]) {
    width: auto;
}
[dir="rtl"] figure.table table,
[dir="rtl"] figure.table > table.ck-table-resized,
[dir="rtl"] .content-body table.ck-table-resized:not([style*="float: left"]):not([style*="float:left"]):not([style*="float: right"]):not([style*="float:right"]),
[dir="rtl"] .page-text-article table.ck-table-resized:not([style*="float: left"]):not([style*="float:left"]):not([style*="float: right"]):not([style*="float:right"]) {
    margin-left: auto !important;
    margin-right: auto !important;
}
[dir="rtl"] figure.table > table.ck-table-resized,
[dir="rtl"] .content-body table.ck-table-resized,
[dir="rtl"] .page-text-article table.ck-table-resized {
    table-layout: fixed;
}
@media (max-width: 767.98px) {
    [dir="rtl"] figure.table:not([style*="float: left"]):not([style*="float:left"]):not([style*="float: right"]):not([style*="float:right"]) {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
