/* ============================================
   NOTO KUFI ARABIC FONT CONFIGURATION
   ============================================ */

/* Font Face Declarations - Noto Kufi Arabic */
/* Supports multiple file naming conventions */

/* Regular Weight (400) */
@font-face {
    font-family: 'Noto Kufi Arabic';
    src: url('../fonts/NotoKufiArabic-Regular.ttf') format('truetype'),
         url('../fonts/NotoKufiArabic-Regular.woff') format('woff'),
         url('../fonts/NotoKufiArabic-Regular.woff2') format('woff2'),
         url('../fonts/NotoKufiArabic-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Bold Weight (700) */
@font-face {
    font-family: 'Noto Kufi Arabic';
    src: url('../fonts/NotoKufiArabic-Bold.ttf') format('truetype'),
         url('../fonts/NotoKufiArabic-Bold.woff') format('woff'),
         url('../fonts/NotoKufiArabic-Bold.woff2') format('woff2'),
         url('../fonts/NotoKufiArabic-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Medium Weight (500) */
@font-face {
    font-family: 'Noto Kufi Arabic';
    src: url('../fonts/NotoKufiArabic-Medium.ttf') format('truetype'),
         url('../fonts/NotoKufiArabic-Medium.woff') format('woff'),
         url('../fonts/NotoKufiArabic-Medium.woff2') format('woff2'),
         url('../fonts/NotoKufiArabic-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* SemiBold Weight (600) */
@font-face {
    font-family: 'Noto Kufi Arabic';
    src: url('../fonts/NotoKufiArabic-SemiBold.ttf') format('truetype'),
         url('../fonts/NotoKufiArabic-SemiBold.woff') format('woff'),
         url('../fonts/NotoKufiArabic-SemiBold.woff2') format('woff2'),
         url('../fonts/NotoKufiArabic-SemiBold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* Light Weight (300) - if available */
@font-face {
    font-family: 'Noto Kufi Arabic';
    src: url('../fonts/NotoKufiArabic-Light.ttf') format('truetype'),
         url('../fonts/NotoKufiArabic-Light.woff') format('woff'),
         url('../fonts/NotoKufiArabic-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

/* Alternative naming patterns (common variations) */
/* If files are named differently, add them here */
@font-face {
    font-family: 'Noto Kufi Arabic';
    src: url('../fonts/NotoKufiArabic-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Global Font Application */
:root {
    --font-family-primary: 'Noto Kufi Arabic', 'Amiri', 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* Apply font to body and html */
body,
html {
    font-family: var(--font-family-primary) !important;
}

/* Apply font to common text elements - but NOT icons */
p:not(i):not([class*="fa"]):not([class*="mdi"]),
div:not(i):not([class*="fa"]):not([class*="mdi"]):not(.fa):not(.mdi),
span:not(i):not([class*="fa"]):not([class*="mdi"]):not(.fa):not(.mdi),
a:not(i):not([class*="fa"]):not([class*="mdi"]),
h1, h2, h3, h4, h5, h6, 
label:not([class*="fa"]):not([class*="mdi"]),
input:not([class*="fa"]):not([class*="mdi"]),
textarea:not([class*="fa"]):not([class*="mdi"]),
select:not([class*="fa"]):not([class*="mdi"]),
button:not([class*="fa"]):not([class*="mdi"]),
td, th, li, ul, ol, table, form,
.card, .card-body, .card-title,
.nav:not([class*="fa"]):not([class*="mdi"]),
.nav-link:not([class*="fa"]):not([class*="mdi"]),
.navbar, .sidebar,
.btn:not([class*="fa"]):not([class*="mdi"]),
.form-control:not([class*="fa"]):not([class*="mdi"]),
.form-group {
    font-family: var(--font-family-primary) !important;
}

/* CRITICAL: Preserve icon fonts with highest priority */
/* Support FontAwesome 4/5/6 */
.fa,
.fas,
.far,
.fal,
.fab,
[class*="fa-"],
[class^="fa-"],
i.fa,
i[class*="fa-"],
.mdi,
[class^="mdi-"],
[class*=" mdi-"],
i.mdi,
i[class^="mdi-"],
i[class*=" mdi-"],
.menu-icon {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome", "FontAwesome5Free", "FontAwesome6Free", "Material Design Icons" !important;
    font-style: normal !important;
    font-weight: 900 !important;
}

/* Menu Arrow - Uses FontAwesome since Material Design Icons font is missing */
.menu-arrow,
.sidebar .nav .nav-item .nav-link i.menu-arrow {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome" !important;
    font-style: normal !important;
    font-weight: 900 !important;
    font-size: 1.125rem !important;
    line-height: 1 !important;
    margin-left: auto !important;
    color: #9e9da0 !important;
}

.menu-arrow:before,
.sidebar .nav .nav-item .nav-link i.menu-arrow:before {
    content: "\f078" !important; /* FontAwesome chevron-down */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome" !important;
    font-weight: 900 !important;
}

.sidebar .nav .nav-item .nav-link[aria-expanded="true"] .menu-arrow:before {
    content: "\f077" !important; /* FontAwesome chevron-up */
}

.far {
    font-weight: 400 !important;
}

.fal {
    font-weight: 300 !important;
}

/* Ensure icon elements preserve their font - HIGHEST PRIORITY */
i.fa,
i.fas,
i.far,
i.fal,
i.fab,
i.mdi,
span.fa,
span.fas,
span.mdi,
i[class*="fa-"],
i[class^="fa-"],
span[class*="fa-"],
span[class^="fa-"],
i[class*="mdi-"],
i[class^="mdi-"],
span[class*="mdi-"],
span[class^="mdi-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome", "FontAwesome5Free", "FontAwesome6Free", "Material Design Icons" !important;
    font-style: normal !important;
    font-weight: 900 !important;
}

i.far,
span.far {
    font-weight: 400 !important;
}

i.fal,
span.fal {
    font-weight: 300 !important;
}

/* Exclude icon elements from general font rules */
p:not([class*="fa"]):not([class*="mdi"]),
div:not([class*="fa"]):not([class*="mdi"]):not(.fa):not(.mdi),
span:not([class*="fa"]):not([class*="mdi"]):not(.fa):not(.mdi):not(i):not([class*="icon"]) {
    font-family: var(--font-family-primary) !important;
}

/* Preserve monospace fonts for code */
code,
pre,
kbd,
samp,
.monospace,
textarea.code,
input[type="text"].code {
    font-family: 'Courier New', Courier, monospace !important;
}

/* Ensure proper font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* RTL Support */
[dir="rtl"] {
    font-family: var(--font-family-primary) !important;
}

[dir="ltr"] {
    font-family: var(--font-family-primary) !important;
}
