/* ==========================================================================
   Cairo — the single Arabic typeface for the whole product.
   ==========================================================================

   WHY THIS FILE EXISTS
   The vendor stylesheets that ship with the platform (main.css 254KB,
   style-main.css 348KB, AdminLTE, the six front themes, the RTL sheets)
   hard-code 'Roboto-Bold' / 'Roboto-Medium' / 'Roboto' on 114 distinct
   selectors. Roboto has no Arabic coverage at all, so every one of those
   rules silently fell through to whatever the browser picked — which is why
   the same screen could render in three different Arabic faces depending on
   the device. Editing 600KB of minified vendor CSS would be undone by the
   first upgrade, so the correction lives here instead, in one file that
   loads last and is re-applied by a single <link> per shell.

   SELF-HOSTED ON PURPOSE
   The eight places that already asked for Cairo pulled it from Google's CDN.
   Parents open this on Egyptian mobile networks; a third-party font host is
   an extra DNS + TLS handshake on the critical path and a hard dependency on
   a domain we do not control. The three .woff2 files next door are variable
   fonts covering weights 200-1000 in ~81KB total, served same-origin.

   WHAT THIS FILE DELIBERATELY DOES NOT TOUCH
   Icon fonts. Font Awesome 4 (portal), Font Awesome 6 (admin), Tabler,
   Lucide, Glyphicons and dropify all work by setting font-family on the
   glyph element itself. None of the 114 Roboto selectors is an icon
   selector — that was verified before this file was written — so the
   overrides below cannot reach an icon. There is no universal selector and
   no `*` rule here for exactly that reason: an over-broad !important would
   turn every icon in the product into a tofu box.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. The face itself — variable, three subsets, same-origin.
   unicode-range lets the browser download only the subset a page needs: an
   all-Arabic screen never fetches the 33KB latin file.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../fonts/cairo/cairo-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891,
                 U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011,
                 U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC,
                 U+102E0-102FB, U+10E60-10E7E, U+1EE00-1EE03;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../fonts/cairo/cairo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
                 U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
                 U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                 U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../fonts/cairo/cairo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                 U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
                 U+FFFD;
}

/* --------------------------------------------------------------------------
   2. Tokens.
   --font-primary was defined once, as "Roboto-Bold", and consumed by 28
   rules. Redefining it here corrects all 28 without touching any of them.
   -------------------------------------------------------------------------- */
:root {
  --font-ar: 'Cairo', 'Segoe UI', Tahoma, 'Noto Sans Arabic', Arial, sans-serif;
  --font-primary: var(--font-ar);
}

/* --------------------------------------------------------------------------
   3. The inheritance root.
   Everything that does not declare its own font-family inherits from here.
   -------------------------------------------------------------------------- */
html,
body {
  font-family: var(--font-ar) !important;
}

/* Form controls do not inherit font-family from their ancestors — the UA
   stylesheet gives them a platform default — so they have to be named. */
button,
input,
optgroup,
select,
textarea,
.form-control,
.btn,
.select2-container,
.select2-selection__rendered,
.bootstrap-select .dropdown-toggle,
.note-editable,
.dataTables_filter input,
.dataTables_length select {
  font-family: var(--font-ar) !important;
}

/* --------------------------------------------------------------------------
   4. The 114 vendor rules that hard-set a Roboto face.
   Grouped by what they are so this stays readable and greppable, rather than
   dumped as one 114-selector wall.
   -------------------------------------------------------------------------- */

/* Headings and generic text-weight utilities */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
b, strong, th, label,
.bmedium, .bolds, .fontbold, .fontmedium,
.font-light, .font-weight-bold,
.text-bold, .text-bold.table td, .text-bold.table th {
  font-family: var(--font-ar) !important;
}

/* AdminLTE shell: sidebar, control sidebar, user panel, small/info boxes */
.sidebar-menu,
.sidebar-menu .treeview-menu > li > a,
.skin-blue .treeview-menu > li.active > a,
.skin-blue .treeview-menu > li > a:hover,
.control-sidebar-heading,
.control-sidebar-subheading,
.user-panel > .info > p,
.user-block .username,
.small-box h3,
.info-box-number,
.description-block > .description-header,
.progress-group .progress-text,
.content-header > h1 > small,
.widget-user .widget-user-username,
.widget-user-2 .widget-user-username {
  font-family: var(--font-ar) !important;
}

/* Alerts, callouts, timelines, to-do lists, external events */
.alert h4,
.callout h4,
.timeline-title,
.timeline > .time-label > span,
.timeline > li > .timeline-item > .timeline-header > a,
.todo-list > li .text,
.todo-list > li.done .text,
.external-event,
.total-bg {
  font-family: var(--font-ar) !important;
}

/* Chat, direct chat, mailbox, contacts, users and products lists */
.chat .item > .message > .name,
.chat .item > .attachment > h4,
.chat .item > .attachment > p,
.chat .item > .attachment > .filename,
.direct-chat-name,
.contacts-list-name,
.users-list-name,
.products-list .product-title,
.mailbox-attachment-name,
.mailbox-date .btn-xs,
.attachment-block-normal b,
.box-comments .username,
.box-comments .text-muted {
  font-family: var(--font-ar) !important;
}

/* Login, lockscreen, register and payment-result screens */
.login-logo,
.register-logo,
.lockscreen-logo,
.lockscreen .lockscreen-name,
.successpayment h1,
.failedpayment h1,
.error-page > .headline,
.error-page > .error-content > h3 {
  font-family: var(--font-ar) !important;
}

/* Tables, DataTables chrome and the platform's own .table2 */
table.dataTable thead th,
table.dataTable tfoot th,
div.dataTables_wrapper div.dataTables_length select,
.table2 th,
.table2 td:first-child,
.list-header,
.dates,
.datenews,
.lastupdate span {
  font-family: var(--font-ar) !important;
}

/* Academics: courses, lessons, topics, exams, quizzes, marks, staff cards */
.classtopic h5,
.courseitext span,
.getcourse label,
.author-block-detail .authorname,
.topicstaus tr td h4,
.topictable tr td h4,
.tab-content .disblock h5,
.examinfo span,
.ques_marks,
.quesanslist.active,
.quizscroll,
.qrtitle,
.grade-2,
.staffprofile h5,
.studentname a.active,
.task-info h5 span,
.task-info label span,
#course_img_id h4.modal-title p {
  font-family: var(--font-ar) !important;
}

/* Navigation pills, report and tab lists, quick links, session list */
.nav-pills > li.active > a,
.reportlists li a.active,
.reportlists li.active,
.tablists li a.active,
.linkquick,
.sessionul,
.info-title2,
.update-list li h5,
.upgradeup h4,
.upgradeup h5,
.box__restart,
.btn-app > .badge,
.payrollbox input,
.dropify-wrapper,
.dropify-wrapper .dropify-clear {
  font-family: var(--font-ar) !important;
}

/* --------------------------------------------------------------------------
   4b. The second sweep.
   The list above came from grepping for Roboto, which missed every rule that
   reached for a different Latin face — AdminLTE's logo and tooltips ask for
   Helvetica Neue, the course pages ask for lowercase 'roboto-medium', and
   Bootstrap's blockquote asks for Georgia. None of those carry Arabic either.
   A second sweep over every non-icon font-family declaration in backend/
   turned up 123 more selectors; the ones that carry Arabic text are below.

   Deliberately left alone, and they must stay that way:
     pre, kbd, samp, code, .cke_source   — monospace is meaningful here
     .fc-icon, .fc-resizer               — FullCalendar draws glyphs with them
     .carousel-control .icon-prev/-next  — the serif chevrons
     .FontCourier/.FontTimes/.FontComic  — CKEditor's font picker offers these
                                           to the user; overriding them would
                                           make the dropdown lie
   -------------------------------------------------------------------------- */

/* AdminLTE chrome the first pass missed */
.main-header .logo,
.main-header .sidebar-session,
.skin-blue .sidebar-menu > li.active > a,
.skin-blue .sidebar-menu > li.active > a:hover,
.skin-blue .sidebar-menu > li:hover > a,
.sidebar-menu .treeview-menu > li > a,
.table > thead > tr > th,
.label,
.modal-header h4,
.dropdown-menu-large .dropdown-header,
.tooltip,
.popover,
.sweet-alert,
.daterangepicker .calendar td,
.daterangepicker .calendar th {
  font-family: var(--font-ar) !important;
}

/* Form controls addressed by attribute rather than by tag */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="date"],
textarea.form-control,
button.btn,
.radiocontainer label,
ul.clsradio input[type="radio"]:checked + label {
  font-family: var(--font-ar) !important;
}

/* The online-course front end — six themes share these class names */
.coursetitle,
.coursebox h4,
.cart-list ul li .course-name,
.sidecourse-title a,
.carttotal-price span,
.focarttotal-price,
.current-price,
.pricesell,
.catbold,
.cou-badge,
.panelh3,
.refinetext,
.lessonsblock li,
.coursebtnfull .btn-add-full,
.side-navbar-vertical h4,
.author-block .authorname,
.author-block-center .authornamebig,
.d-preview-count,
a.ratethis,
.listprofile li span,
.profile-discription h6,
.proinner h5 {
  font-family: var(--font-ar) !important;
}

/* Staff, attendance, QR and misc platform widgets */
.staffinfo-box h5,
.timeclock,
.qrcodediv span.title,
.list2 li,
.box__button,
.robo-normal,
.attachment-block-normal strong,
.block-b-noraml b,
.custom-processing,
#filetable,
table.marks,
blockquote,
p.text.text-danger,
p.text.text-info,
#frame #sidepanel #contacts ul li.contact .wrap .meta .name {
  font-family: var(--font-ar) !important;
}

/* What the user types into CKEditor — the editable area and its dialogs.
   .cke_source is excluded on purpose: raw HTML belongs in a monospace face. */
.cke_editable,
.cke_wysiwyg_frame body,
.cke_dialog,
.cke_dialog_title,
.cke_dialog_ui_labeled_label,
.cke_button__label,
.cke_combo__text {
  font-family: var(--font-ar) !important;
}

/* --------------------------------------------------------------------------
   5. Print.
   Receipts, ID cards, certificates, marksheets, timetables and payslips are
   standalone documents that reach parents on paper. Some of them set a font
   inline on <body>, which beats a stylesheet rule of equal specificity, so
   the print context gets its own !important pass.
   -------------------------------------------------------------------------- */
@media print {
  html, body, table, td, th, div, span, p, h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-ar) !important;
  }
}

/* --------------------------------------------------------------------------
   6. Arabic numerals stay Latin-shaped.
   Cairo ships Eastern Arabic-Indic digits (٠١٢٣) for some locales. Fee
   amounts, invoice numbers and admission numbers are read against bank
   statements and government portals that use 0123, so digits are pinned to
   the Latin forms rather than left to locale guesswork.
   -------------------------------------------------------------------------- */
body {
  font-feature-settings: 'lnum' 1;
  font-variant-numeric: lining-nums;
}
