/* ============================================
   Language-Specific Fonts
   ============================================
   English: Arial
   Pashto (ps): Bahij Zar
   Dari (fa-AF): Bahij Zar
   ============================================ */

/* Bahij Zar Font - For Pashto and Dari */
/* Option 1: Using local font files (if downloaded) */
@font-face {
    font-family: 'Bahij Zar';
    src: url('../fonts/BahijZar-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Bahij Zar';
    src: url('../fonts/BahijZar-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* Fallback to system fonts if local files not found */
@supports not (font-display: swap) {
    @font-face {
        font-family: 'Bahij Zar';
        src: local('Bahij Zar'), local('BahijZar-Regular');
        font-weight: normal;
        font-style: normal;
    }
}

/* Language-specific font application */
/* Exclude icon fonts and special elements from font-family rules */
html[lang="en"] body,
html[lang="en"] p,
html[lang="en"] div,
html[lang="en"] span,
html[lang="en"] h1,
html[lang="en"] h2,
html[lang="en"] h3,
html[lang="en"] h4,
html[lang="en"] h5,
html[lang="en"] h6,
html[lang="en"] a,
html[lang="en"] li,
html[lang="en"] td,
html[lang="en"] th,
html[lang="en"] label,
html[lang="en"] input:not([type="checkbox"]):not([type="radio"]),
html[lang="en"] textarea,
html[lang="en"] select,
html[lang="en"] button:not(.fa):not(.fas):not(.far):not(.fab):not(.fal) {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
}

/* Pashto - Bahij Zar with fallbacks */
html[lang="ps"] body,
html[lang="ps"] p,
html[lang="ps"] div,
html[lang="ps"] span,
html[lang="ps"] h1,
html[lang="ps"] h2,
html[lang="ps"] h3,
html[lang="ps"] h4,
html[lang="ps"] h5,
html[lang="ps"] h6,
html[lang="ps"] a,
html[lang="ps"] li,
html[lang="ps"] td,
html[lang="ps"] th,
html[lang="ps"] label,
html[lang="ps"] input:not([type="checkbox"]):not([type="radio"]),
html[lang="ps"] textarea,
html[lang="ps"] select,
html[lang="ps"] button:not(.fa):not(.fas):not(.far):not(.fab):not(.fal) {
    font-family: 'Bahij Zar', 'Noto Sans Arabic', 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif !important;
}

/* Dari/Persian - Bahij Zar with fallbacks */
html[lang="fa-AF"] body,
html[lang="fa-AF"] p,
html[lang="fa-AF"] div,
html[lang="fa-AF"] span,
html[lang="fa-AF"] h1,
html[lang="fa-AF"] h2,
html[lang="fa-AF"] h3,
html[lang="fa-AF"] h4,
html[lang="fa-AF"] h5,
html[lang="fa-AF"] h6,
html[lang="fa-AF"] a,
html[lang="fa-AF"] li,
html[lang="fa-AF"] td,
html[lang="fa-AF"] th,
html[lang="fa-AF"] label,
html[lang="fa-AF"] input:not([type="checkbox"]):not([type="radio"]),
html[lang="fa-AF"] textarea,
html[lang="fa-AF"] select,
html[lang="fa-AF"] button:not(.fa):not(.fas):not(.far):not(.fab):not(.fal),
html[lang="fa"] body,
html[lang="fa"] p,
html[lang="fa"] div,
html[lang="fa"] span,
html[lang="fa"] h1,
html[lang="fa"] h2,
html[lang="fa"] h3,
html[lang="fa"] h4,
html[lang="fa"] h5,
html[lang="fa"] h6,
html[lang="fa"] a,
html[lang="fa"] li,
html[lang="fa"] td,
html[lang="fa"] th,
html[lang="fa"] label,
html[lang="fa"] input:not([type="checkbox"]):not([type="radio"]),
html[lang="fa"] textarea,
html[lang="fa"] select,
html[lang="fa"] button:not(.fa):not(.fas):not(.far):not(.fab):not(.fal) {
    font-family: 'Bahij Zar', 'Noto Sans Arabic', 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif !important;
}

/* Preserve Font Awesome icons - CRITICAL - Must be after language rules */
/* This ensures icons display correctly regardless of parent element language */
html[lang="en"] .fa,
html[lang="en"] .fas,
html[lang="en"] .far,
html[lang="en"] .fab,
html[lang="en"] .fal,
html[lang="en"] .fad,
html[lang="en"] [class*="fa-"],
html[lang="en"] [class^="fa-"],
html[lang="en"] i[class*="fa"],
html[lang="en"] i[class^="fa"],
html[lang="ps"] .fa,
html[lang="ps"] .fas,
html[lang="ps"] .far,
html[lang="ps"] .fab,
html[lang="ps"] .fal,
html[lang="ps"] .fad,
html[lang="ps"] [class*="fa-"],
html[lang="ps"] [class^="fa-"],
html[lang="ps"] i[class*="fa"],
html[lang="ps"] i[class^="fa"],
html[lang="fa-AF"] .fa,
html[lang="fa-AF"] .fas,
html[lang="fa-AF"] .far,
html[lang="fa-AF"] .fab,
html[lang="fa-AF"] .fal,
html[lang="fa-AF"] .fad,
html[lang="fa-AF"] [class*="fa-"],
html[lang="fa-AF"] [class^="fa-"],
html[lang="fa-AF"] i[class*="fa"],
html[lang="fa-AF"] i[class^="fa"],
html[lang="fa"] .fa,
html[lang="fa"] .fas,
html[lang="fa"] .far,
html[lang="fa"] .fab,
html[lang="fa"] .fal,
html[lang="fa"] .fad,
html[lang="fa"] [class*="fa-"],
html[lang="fa"] [class^="fa-"],
html[lang="fa"] i[class*="fa"],
html[lang="fa"] i[class^="fa"],
.fa,
.fas,
.far,
.fab,
.fal,
.fad,
[class*="fa-"],
[class^="fa-"],
i[class*="fa"],
i[class^="fa"],
i.fa,
i.fas,
i.far,
i.fab,
i.fal,
.fa-solid,
.fa-regular,
.fa-brands,
.fa-light,
.fa-duotone {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 5 Free", "Font Awesome 5 Pro", "FontAwesome" !important;
    font-weight: 900 !important;
    font-style: normal !important;
}

.far,
.fa-regular,
i.far,
i.fa-regular {
    font-weight: 400 !important;
}

.fab,
.fa-brands,
i.fab,
i.fa-brands {
    font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", "FontAwesome" !important;
    font-weight: 400 !important;
}

/* Preserve form elements that use system fonts */
input[type="checkbox"],
input[type="radio"],
input[type="checkbox"] *,
input[type="radio"] * {
    font-family: initial !important;
}

/* Preserve Bootstrap icons and other icon fonts */
.bi,
[class*="bi-"],
[class^="bi-"],
.glyphicon,
[class*="glyphicon"] {
    font-family: initial !important;
}

/* Ensure proper font rendering for Arabic script */
html[lang="ps"],
html[lang="fa-AF"],
html[lang="fa"] {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "liga" 1, "kern" 1;
}

/* Fallback for elements without lang attribute */
body {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

