/* =====================================================================
   SmartCAD Icon Restore Patch
   Version: 2026-05-06-r3
   Purpose: แก้ปัญหา ui.css ทับ font-family ของ Font Awesome / Bootstrap Icons
   Important: ต้องโหลดไฟล์นี้หลัง ui.css และหลัง Font Awesome CSS เสมอ
   ===================================================================== */

/* 1) Font Awesome 6 */
.fa,
.fas,
.far,
.fal,
.fat,
.fad,
.fab,
.fa-solid,
.fa-regular,
.fa-light,
.fa-thin,
.fa-duotone,
.fa-brands,
.fa-classic,
[class^="fa-"],
[class*=" fa-"] {
  font-style: normal !important;
  font-variant: normal !important;
  text-rendering: auto !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  display: inline-block;
  speak: never;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

.fa,
.fas,
.fa-solid,
.fa-classic.fa-solid,
[class^="fa-solid"],
[class*=" fa-solid"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
}

.far,
.fa-regular,
.fa-classic.fa-regular,
[class^="fa-regular"],
[class*=" fa-regular"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free" !important;
  font-weight: 400 !important;
}

.fab,
.fa-brands,
[class^="fa-brands"],
[class*=" fa-brands"] {
  font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands" !important;
  font-weight: 400 !important;
}

/* 2) Font Awesome pseudo elements */
.fa::before,
.fas::before,
.far::before,
.fab::before,
.fa-solid::before,
.fa-regular::before,
.fa-brands::before,
[class^="fa-"]::before,
[class*=" fa-"]::before,
.fa::after,
.fas::after,
.far::after,
.fab::after,
.fa-solid::after,
.fa-regular::after,
.fa-brands::after,
[class^="fa-"]::after,
[class*=" fa-"]::after {
  font-style: normal !important;
  font-variant: normal !important;
  text-rendering: auto !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

.fa::before,
.fas::before,
.fa-solid::before,
[class*=" fa-solid"]::before,
[class^="fa-solid"]::before,
.fa::after,
.fas::after,
.fa-solid::after,
[class*=" fa-solid"]::after,
[class^="fa-solid"]::after {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
}

.far::before,
.fa-regular::before,
[class*=" fa-regular"]::before,
[class^="fa-regular"]::before,
.far::after,
.fa-regular::after,
[class*=" fa-regular"]::after,
[class^="fa-regular"]::after {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free" !important;
  font-weight: 400 !important;
}

.fab::before,
.fa-brands::before,
[class*=" fa-brands"]::before,
[class^="fa-brands"]::before,
.fab::after,
.fa-brands::after,
[class*=" fa-brands"]::after,
[class^="fa-brands"]::after {
  font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands" !important;
  font-weight: 400 !important;
}

/* 3) Bootstrap Icons */
.bi,
[class^="bi-"],
[class*=" bi-"] {
  font-family: "bootstrap-icons" !important;
  font-style: normal !important;
  font-weight: normal !important;
  font-variant: normal !important;
  text-transform: none !important;
  line-height: 1 !important;
  display: inline-block;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

.bi::before,
[class^="bi-"]::before,
[class*=" bi-"]::before {
  font-family: "bootstrap-icons" !important;
  font-style: normal !important;
  font-weight: normal !important;
  font-variant: normal !important;
  text-transform: none !important;
  line-height: 1 !important;
}

/* 4) Boxicons / Remix Icon / Material Symbols เผื่อระบบมีใช้ */
.bx,
[class^="bx-"],
[class*=" bx-"] {
  font-family: "boxicons" !important;
  font-weight: normal !important;
  font-style: normal !important;
  line-height: 1 !important;
}

.ri,
[class^="ri-"],
[class*=" ri-"] {
  font-family: "remixicon" !important;
  font-style: normal !important;
  font-weight: normal !important;
  line-height: 1 !important;
}

.material-icons,
.material-icons-outlined,
.material-icons-round,
.material-icons-sharp,
.material-icons-two-tone,
.material-symbols-outlined,
.material-symbols-rounded,
.material-symbols-sharp {
  font-family: "Material Symbols Outlined", "Material Icons" !important;
  font-weight: normal !important;
  font-style: normal !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  white-space: nowrap !important;
  word-wrap: normal !important;
  direction: ltr !important;
  -webkit-font-feature-settings: "liga" !important;
  -webkit-font-smoothing: antialiased !important;
}

/* 5) Sidebar icon wrappers: ให้ขนาด/ตำแหน่งกลับมาปกติ */
.sidebar i,
.sidebar .fa,
.sidebar .fas,
.sidebar .far,
.sidebar .fab,
.sidebar .fa-solid,
.sidebar .fa-regular,
.sidebar .fa-brands,
.sidebar .bi,
.side-nav i,
.sidenav i,
.nav-sidebar i,
.menu-icon,
.nav-icon,
.ud-hero-icon i,
.ud-panel-title i,
.ud-stat-icon i,
.ud-btn i,
.ud-tab i,
.ud-scope-chip i {
  width: 1.15em;
  min-width: 1.15em;
  text-align: center;
  flex: 0 0 auto;
}

/* 6) ป้องกัน CSS ภาษาไทยไปบังคับ icon อีกครั้ง */
body :where(.fa, .fas, .far, .fab, .fa-solid, .fa-regular, .fa-brands, .bi, [class^="bi-"], [class*=" bi-"]) {
  letter-spacing: normal !important;
}
