/**
 * Kurdish Font Declarations
 * Using Rabar_021 (Bold) and Rabar_040 (Regular)
 * 
 * IMPORTANT: Icons are preserved FIRST, then Rabar fonts are applied to text
 */

/* ==========================================
   STEP 1: Load Rabar Font Files
   ========================================== */

/* Rabar 040 - Regular (Normal weight) */
@font-face {
    font-family: 'Rabar';
    src: url('../fonts/rabar_040.woff2') format('woff2'),
         url('../fonts/rabar_040.woff') format('woff'),
         url('../fonts/rabar_040.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Rabar 021 - Bold */
@font-face {
    font-family: 'Rabar';
    src: url('../fonts/rabar_021.woff2') format('woff2'),
         url('../fonts/rabar_021.woff') format('woff'),
         url('../fonts/rabar_021.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ==========================================
   STEP 2: PRESERVE ALL ICONS FIRST (Highest Priority)
   This MUST come before any Rabar declarations
   ========================================== */

/* Font Awesome - ALL VARIATIONS */
.fa, .fas, .far, .fab, .fal, .fad,
.fa-solid, .fa-regular, .fa-light, .fa-thin, .fa-duotone, .fa-brands,
i[class^="fa-"], i[class*=" fa-"],
[dir="rtl"] .fa, [dir="rtl"] .fas, [dir="rtl"] .far, [dir="rtl"] .fab,
[dir="rtl"] .fal, [dir="rtl"] .fad, [dir="rtl"] .fa-solid,
[dir="rtl"] .fa-regular, [dir="rtl"] .fa-light, [dir="rtl"] .fa-thin,
[dir="rtl"] .fa-duotone, [dir="rtl"] .fa-brands,
[dir="rtl"] i[class^="fa-"], [dir="rtl"] i[class*=" fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-transform: none !important;
    line-height: 1 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Material Icons - ALL VARIATIONS */
.material-icons, .material-icons-outlined, .material-icons-round,
.material-icons-sharp, .material-icons-two-tone,
[dir="rtl"] .material-icons, [dir="rtl"] .material-icons-outlined,
[dir="rtl"] .material-icons-round, [dir="rtl"] .material-icons-sharp,
[dir="rtl"] .material-icons-two-tone {
    font-family: 'Material Icons', 'Material Icons Outlined', 'Material Icons Round', 'Material Icons Sharp' !important;
    font-weight: normal !important;
    font-style: normal !important;
    font-size: 24px !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    display: inline-block !important;
    white-space: nowrap !important;
    word-wrap: normal !important;
    direction: ltr !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* ALL <i> tags (most icons use this) */
i, [dir="rtl"] i {
    font-family: inherit !important;
}

/* Ionicons */
.ion, .ionicons, i[class^="ion-"], i[class*=" ion-"],
[dir="rtl"] .ion, [dir="rtl"] .ionicons,
[dir="rtl"] i[class^="ion-"], [dir="rtl"] i[class*=" ion-"] {
    font-family: "Ionicons" !important;
    font-weight: normal !important;
    font-style: normal !important;
}

/* Generic icon classes */
.icon, .icons, [class*="icon-"], [class*="Icon-"],
[dir="rtl"] .icon, [dir="rtl"] .icons,
[dir="rtl"] [class*="icon-"], [dir="rtl"] [class*="Icon-"] {
    font-family: inherit !important;
}

/* ==========================================
   STEP 3: Apply Rabar Fonts to Kurdish Text
   ========================================== */

/* Base RTL font */
[dir="rtl"] body,
[dir="rtl"] p,
[dir="rtl"] div,
[dir="rtl"] span,
[dir="rtl"] a,
[dir="rtl"] li,
[dir="rtl"] td,
[dir="rtl"] th,
[dir="rtl"] label,
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
    font-weight: 400; /* Uses Rabar_040 */
}

/* Headings - Bold */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6,
[dir="rtl"] strong,
[dir="rtl"] b,
[dir="rtl"] .font-weight-bold,
[dir="rtl"] .fw-bold {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
    font-weight: 700; /* Uses Rabar_021 */
}

/* Buttons - Bold */
[dir="rtl"] .btn,
[dir="rtl"] button {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
    font-weight: 700;
}

/* Forms */
[dir="rtl"] .form-control,
[dir="rtl"] .form-select,
[dir="rtl"] .form-label,
[dir="rtl"] .input-group-text {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
}

/* Navigation */
[dir="rtl"] .nav,
[dir="rtl"] .sidebar,
[dir="rtl"] .navbar {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
}

/* Cards */
[dir="rtl"] .card,
[dir="rtl"] .card-title,
[dir="rtl"] .card-text {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
}

/* Modals */
[dir="rtl"] .modal,
[dir="rtl"] .modal-title,
[dir="rtl"] .modal-body {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
}

/* Dropdowns */
[dir="rtl"] .dropdown-menu,
[dir="rtl"] .dropdown-item {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
}

/* Tables */
[dir="rtl"] table,
[dir="rtl"] thead,
[dir="rtl"] tbody,
[dir="rtl"] tfoot {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
}

/* Alerts */
[dir="rtl"] .alert,
[dir="rtl"] .toast,
[dir="rtl"] .notification {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
}

/* Language Switcher */
[dir="rtl"] .language-switcher {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
}

[dir="rtl"] .language-switcher .dropdown-item.active[data-lang="ku"] {
    font-weight: 700;
}

/* Badges and Tags */
[dir="rtl"] .badge,
[dir="rtl"] .chip,
[dir="rtl"] .tag {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
    font-weight: 500;
}

/* Page Titles */
[dir="rtl"] .page-title,
[dir="rtl"] .card-title,
[dir="rtl"] .modal-title {
    font-family: 'Rabar', 'Noto Sans Arabic', 'Noto Sans', 'Roboto', sans-serif;
    font-weight: 700;
}

/* ==========================================
   STEP 4: Text Rendering Improvements
   ========================================== */

[dir="rtl"] {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Better line height for Kurdish text */
[dir="rtl"] p {
    line-height: 1.8;
}

/* Adjust letter spacing for better readability */
[dir="rtl"] {
    letter-spacing: 0.01em;
}

/* ==========================================
   STEP 5: Print Styles
   ========================================== */

@media print {
    [dir="rtl"] {
        font-family: 'Rabar', 'Noto Sans Arabic', sans-serif;
    }
}
