/* 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;
}

[dir="rtl"] {
    text-align: right;
}

/* 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;
}

/* 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 */
[dir="rtl"] .card {
    text-align: right;
}

/* Voice Reader position */
[dir="rtl"] #tts-player {
    direction: ltr; /* Keep player controls LTR for standard seekbar behavior */
    text-align: left;
}

[dir="rtl"] #tts-player .btn {
    direction: rtl;
    text-align: right;
}

/* 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: 180px;
}

[dir="rtl"] header.spotlight-active {
    min-height: 480px;
}
