/* Arabic Font Support for Entire Website */

/* Import Arabic Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&family=Tajawal:wght@200;300;400;500;700;800;900&family=Noto+Sans+Arabic:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* Arabic Font Variables */
:root {
    --arabic-font-family: 'Cairo', 'Tajawal', 'Noto Sans Arabic', ui-sans-serif, system-ui, sans-serif;
}

/* Apply Arabic fonts to all text elements when RTL */
[dir="rtl"] {
    font-family: var(--arabic-font-family) !important;
}

[dir="rtl"] * {
    font-family: var(--arabic-font-family) !important;
}

/* Specific text elements */
[dir="rtl"] body,
[dir="rtl"] html {
    font-family: var(--arabic-font-family) !important;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6 {
    font-family: var(--arabic-font-family) !important;
    font-weight: 600;
}

[dir="rtl"] p,
[dir="rtl"] span,
[dir="rtl"] div,
[dir="rtl"] a,
[dir="rtl"] label,
[dir="rtl"] button,
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select,
[dir="rtl"] option {
    font-family: var(--arabic-font-family) !important;
}

/* Navigation and menu items */
[dir="rtl"] .nav-link,
[dir="rtl"] .navbar-nav,
[dir="rtl"] .dropdown-item,
[dir="rtl"] .menu-item {
    font-family: var(--arabic-font-family) !important;
}

/* Bootstrap components */
[dir="rtl"] .btn,
[dir="rtl"] .form-control,
[dir="rtl"] .form-label,
[dir="rtl"] .card,
[dir="rtl"] .modal,
[dir="rtl"] .alert {
    font-family: var(--arabic-font-family) !important;
}

/* Flux UI components */
[dir="rtl"] [data-flux-heading],
[dir="rtl"] [data-flux-subheading],
[dir="rtl"] [data-flux-button],
[dir="rtl"] [data-flux-input],
[dir="rtl"] [data-flux-navlist-item],
[dir="rtl"] [data-flux-navbar-item],
[dir="rtl"] [data-flux-menu-item],
[dir="rtl"] [data-flux-label],
[dir="rtl"] [data-flux-text] {
    font-family: var(--arabic-font-family) !important;
}

/* Preserve FontAwesome icon fonts - IMPORTANT */
[dir="rtl"] i[class*="fa"],
[dir="rtl"] [class*="fa-"],
[dir="rtl"] [class*="fa "],
[dir="rtl"] .fa,
[dir="rtl"] .fas,
[dir="rtl"] .far,
[dir="rtl"] .fal,
[dir="rtl"] .fab,
[dir="rtl"] .fad {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands", "Font Awesome 5 Free", "Font Awesome 5 Pro" !important;
}

/* Ensure SVG elements don't inherit Arabic fonts */
[dir="rtl"] svg *,
[dir="rtl"] [data-flux-icon] *,
[dir="rtl"] i[class*="fa"] *,
[dir="rtl"] .fa * {
    font-family: inherit !important;
}

/* Override any conflicting styles */
[dir="rtl"] .fa-solid,
[dir="rtl"] .fa-regular,
[dir="rtl"] .fa-light,
[dir="rtl"] .fa-thin,
[dir="rtl"] .fa-duotone,
[dir="rtl"] .fa-brands {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
}

/* Specific overrides for common icon containers */
[dir="rtl"] .sidebar-toggle,
[dir="rtl"] .menu-toggle,
[dir="rtl"] .nav-icon,
[dir="rtl"] .btn-icon {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands", inherit !important;
}

/* Make sure text content uses Arabic fonts */
[dir="rtl"] .text-content,
[dir="rtl"] .main-content,
[dir="rtl"] .page-content,
[dir="rtl"] .article-content {
    font-family: var(--arabic-font-family) !important;
}

/* Ensure form elements use Arabic fonts */
[dir="rtl"] .form-group,
[dir="rtl"] .input-group,
[dir="rtl"] .form-text {
    font-family: var(--arabic-font-family) !important;
}

/* Table elements */
[dir="rtl"] table,
[dir="rtl"] th,
[dir="rtl"] td {
    font-family: var(--arabic-font-family) !important;
}

/* List elements */
[dir="rtl"] ul,
[dir="rtl"] ol,
[dir="rtl"] li {
    font-family: var(--arabic-font-family) !important;
}

/* Ensure proper font weight for Arabic text */
[dir="rtl"] .font-bold,
[dir="rtl"] .fw-bold,
[dir="rtl"] strong,
[dir="rtl"] b {
    font-family: var(--arabic-font-family) !important;
    font-weight: 700;
}

[dir="rtl"] .font-semibold,
[dir="rtl"] .fw-semibold {
    font-family: var(--arabic-font-family) !important;
    font-weight: 600;
}

[dir="rtl"] .font-medium,
[dir="rtl"] .fw-medium {
    font-family: var(--arabic-font-family) !important;
    font-weight: 500;
}

/* Responsive font sizes for Arabic */
@media (max-width: 768px) {
    [dir="rtl"] h1 {
        font-size: 1.8rem;
    }

    [dir="rtl"] h2 {
        font-size: 1.6rem;
    }

    [dir="rtl"] h3 {
        font-size: 1.4rem;
    }

    [dir="rtl"] h4 {
        font-size: 1.2rem;
    }

    [dir="rtl"] h5 {
        font-size: 1.1rem;
    }

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

/* Ensure Arabic text is properly aligned */
[dir="rtl"] {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .text-center {
    text-align: center !important;
}

[dir="rtl"] .text-left {
    text-align: right !important;
}

[dir="rtl"] .text-right {
    text-align: left !important;
}