/* =========================================================
   Global Loader (เหมือน mockup backend/apply-list.html)
   - แยกเฉพาะส่วน loader เพื่อ reuse ได้ทุกหน้า
   - อ้างอิง style/animation จาก mockup: html/assets/css/backend.css
   ========================================================= */

#loading {
  /* ม่านโปร่งมาก — เห็นหน้าเว็บด้านหลังชัด; สปินเนอร์ + ข้อความยังอยู่ตรงกลาง */
  background-color: rgba(255, 255, 255, 0.48);
  /* ตัด blur เพื่อให้ลื่น/ไม่หน่วงบนบางเครื่อง */
  transition: background-color 220ms ease, opacity 220ms ease;
  height: 100%;
  width: 100%;
  position: fixed;
  margin-top: 0px;
  top: 0px;
  left: 0px;
  bottom: 0px;
  overflow: hidden !important;
  right: 0px;
  z-index: 999999;
}

#loading-center {
  /* background removed: use inner content (e.g. .iq-loader-13) instead of loader.gif */
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#loading-center .text-muted {
  font-size: 0.8125rem;
  letter-spacing: 0.22em;
  opacity: 0.62;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 1px 2px rgba(255, 255, 255, 0.8);
}

.iq-loader-box {
  height: 120px;
  text-align: center;
  display: flex;
  align-items: center;
  vertical-align: middle;
  justify-content: center;
}

.iq-loader-box [class*="loader-"] {
  display: inline-block;
  width: 60px;
  height: 60px;
  color: inherit;
  vertical-align: middle;
  position: relative;
  border-radius: 50%;
}

.iq-loader-box .iq-loader-13 {
  border-top: 0.2em solid #a7a4ca;
  border-right: 0.2em solid transparent;
  -webkit-animation: loader13 1s linear infinite;
  animation: loader13 1s linear infinite;
  border-radius: 100%;
  position: relative;
}

@-webkit-keyframes loader13 {
  to {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes loader13 {
  to {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

/* dark mode (ถ้ามี class .dark จากธีมเดิม) */
.dark #loading {
  background-color: rgba(15, 23, 42, 0.22);
}

.dark #loading-center .text-muted {
  color: #e2e8f0 !important;
  opacity: 0.78;
  text-shadow: 0 0 10px rgba(15, 23, 42, 0.85), 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Reduced motion: หยุดสปินเนอร์เมื่อผู้ใช้ตั้งระบบให้ลดการเคลื่อนไหว (Task 022) */
@media (prefers-reduced-motion: reduce) {
  .iq-loader-box .iq-loader-13 {
    -webkit-animation: none;
    animation: none;
    border-color: rgba(99, 102, 241, 0.2);
    border-top-color: rgba(99, 102, 241, 0.55);
  }
}
