/* ============================================================
   Font Configuration for SLDB System
   ການຕັ້ງຄ່າຟອນສໍາລັບລະບົບ SLDB

   Strategy:
   - Lao characters (U+0E80–0EFF) → Phetsarath OT (local only)
   - English / Latin + Numbers      → Times New Roman (local only)
   - Both applied automatically via unicode-range composite font
   ============================================================ */

/* ----------------------------------------------------------
   1. Composite font via unicode-range (Local fonts only)
   ---------------------------------------------------------- */

/* Lao range → Phetsarath OT / Phetsarath / Saysettha OT */
@font-face {
  font-family: 'SLDB System';
  src: local('Phetsarath OT'), local('Phetsarath'),
       local('Saysettha OT'), local('Saysettha'),
       local('Noto Sans Lao'), local('Phetsarath New');
  font-display: swap;
  font-weight: 100 900;
  font-style: normal;
  unicode-range: U+0E80-0EFF;
}

/* Latin / numbers / symbols → Times New Roman */
@font-face {
  font-family: 'SLDB System';
  src: local('Times New Roman'), local('Times'),
       local('Georgia'), local('Arial');
  font-display: swap;
  font-weight: 100 900;
  font-style: normal;
  unicode-range: U+0000-0E7F, U+0F00-10FFFF;
}

/* Italic variants */
@font-face {
  font-family: 'SLDB System';
  src: local('Phetsarath OT'), local('Phetsarath'),
       local('Saysettha OT'), local('Saysettha'),
       local('Noto Sans Lao');
  font-display: swap;
  font-weight: 100 900;
  font-style: italic;
  unicode-range: U+0E80-0EFF;
}

@font-face {
  font-family: 'SLDB System';
  src: local('Times New Roman'), local('Times'),
       local('Georgia'), local('Arial');
  font-display: swap;
  font-weight: 100 900;
  font-style: italic;
  unicode-range: U+0000-0E7F, U+0F00-10FFFF;
}

/* ----------------------------------------------------------
   2. CSS Custom Properties
   ---------------------------------------------------------- */
:root {
  --font-system: 'Phetsarath OT', 'Phetsarath', 'Saysettha OT', 'Saysettha', 'Noto Sans Lao', 'SLDB System', 'Times New Roman', serif;
  --font-lao: 'Phetsarath OT', 'Phetsarath', 'Saysettha OT', 'Saysettha', 'Noto Sans Lao', 'Phetsarath New', sans-serif;
  --font-english: 'Times New Roman', 'Georgia', 'Arial', Times, serif;
  --font-number: 'Times New Roman', 'Georgia', 'Arial', Times, serif;
  --font-code: 'Courier New', 'Monaco', 'Consolas', monospace;
  --font-heading: 'Phetsarath OT', 'Phetsarath', 'Saysettha OT', 'SLDB System', 'Times New Roman', serif;

  /* Backward compatibility aliases */
  --lao-font: var(--font-system);
  --english-font: var(--font-english);
  --number-font: var(--font-number);
  --code-font: var(--font-code);
  --heading-font: var(--font-heading);
  --mixed-font: var(--font-system);
}

/* ----------------------------------------------------------
   3. Global base – applies to everything
   ---------------------------------------------------------- */
body {
  font-family: var(--font-system);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----------------------------------------------------------
   4. Override AdminLTE / Bootstrap defaults
   ---------------------------------------------------------- */

/* Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-system) !important;
}

/* Navigation */
.main-header .navbar-brand,
.main-sidebar .brand-link,
.content-wrapper .content-header h1,
.navbar-nav .nav-link,
.sidebar-menu .nav-link,
.dropdown-menu .dropdown-item,
.nav-tabs .nav-link,
.nav-pills .nav-link {
  font-family: var(--font-system) !important;
}

/* Cards */
.card .card-header .card-title,
.card .card-body,
.card .card-footer {
  font-family: var(--font-system) !important;
}

/* Forms */
.form-group label,
.form-control,
.custom-select,
.custom-file-label,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="search"],
textarea,
select {
  font-family: var(--font-system) !important;
}

/* Buttons */
.btn,
.btn-group .btn {
  font-family: var(--font-system) !important;
}

/* Tables */
.table,
.table th,
.table td {
  font-family: var(--font-system) !important;
}

/* Modals */
.modal .modal-title,
.modal .modal-body,
.modal .modal-footer {
  font-family: var(--font-system) !important;
}

/* Alerts & badges */
.alert {
  font-family: var(--font-system) !important;
}

.badge {
  font-family: var(--font-system) !important;
  font-variant-numeric: tabular-nums;
}

/* Breadcrumbs */
.breadcrumb,
.breadcrumb-item {
  font-family: var(--font-system) !important;
}

/* DataTables */
.dataTables_wrapper,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate,
.dataTables_wrapper .dataTables_processing {
  font-family: var(--font-system) !important;
}

/* Pagination */
.pagination {
  font-family: var(--font-system) !important;
}

/* SweetAlert2 */
.swal2-title,
.swal2-content,
.swal2-html-container {
  font-family: var(--font-system) !important;
}

/* Control sidebar */
.control-sidebar .control-sidebar-heading,
.control-sidebar .control-sidebar-subheading,
.control-sidebar .nav-tabs .nav-link,
.control-sidebar .form-group label,
.control-sidebar .info-box {
  font-family: var(--font-system) !important;
}

/* ----------------------------------------------------------
   5. Code / monospace elements
   ---------------------------------------------------------- */
pre,
code,
kbd,
samp,
.code,
.terminal,
.console,
.log {
  font-family: var(--font-code) !important;
  font-size: 0.9em;
  line-height: 1.4;
}

/* ----------------------------------------------------------
   6. Explicit override classes (optional, for edge cases)
   ---------------------------------------------------------- */

/* Force Lao font only */
.lao-text,
.lao-label,
.lao-title,
.lao-heading,
.lao-characters {
  font-family: var(--font-system) !important;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

/* Force English / Times New Roman only */
.english-text,
.english-label,
.english-title,
.english-heading,
.english-characters {
  font-family: var(--font-english) !important;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

/* Force number font */
.number,
.amount,
.quantity,
.price,
.phone,
.id-number,
.number-characters {
  font-family: var(--font-number) !important;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

/* ----------------------------------------------------------
   7. Print styles
   ---------------------------------------------------------- */
@media print {
  body {
    font-family: var(--font-system) !important;
  }
}

/* ----------------------------------------------------------
   8. Responsive font adjustments
   ---------------------------------------------------------- */
@media (max-width: 768px) {
  body {
    font-size: 0.95em;
    line-height: 1.5;
  }
}

/* ----------------------------------------------------------
   9. High DPI / Retina optimization
   ---------------------------------------------------------- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ----------------------------------------------------------
   10. Legacy @font-face declarations (local loading hints)
   ---------------------------------------------------------- */
@font-face {
  font-family: 'Phetsarath OT';
  src: local('Phetsarath OT'), local('Phetsarath');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Saysettha OT';
  src: local('Saysettha OT'), local('Saysettha');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Times New Roman';
  src: local('Times New Roman'), local('Times');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Courier New';
  src: local('Courier New'), local('Courier');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

/* ----------------------------------------------------------
   11. Font size utilities
   ---------------------------------------------------------- */
.font-xs { font-size: 0.75rem !important; }
.font-sm { font-size: 0.875rem !important; }
.font-base { font-size: 1rem !important; }
.font-lg { font-size: 1.125rem !important; }
.font-xl { font-size: 1.25rem !important; }
.font-2xl { font-size: 1.5rem !important; }
.font-3xl { font-size: 1.875rem !important; }

/* ----------------------------------------------------------
   12. Font weight utilities
   ---------------------------------------------------------- */
.font-light { font-weight: 300 !important; }
.font-normal { font-weight: 400 !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }

/* ----------------------------------------------------------
   13. Line height utilities
   ---------------------------------------------------------- */
.leading-tight { line-height: 1.25 !important; }
.leading-normal { line-height: 1.5 !important; }
.leading-relaxed { line-height: 1.75 !important; }
.leading-loose { line-height: 2 !important; }
