/* ==========================================================================
   หน้าเข้าสู่ระบบใน app.html และหน้าต่างยืนยัน/สลับอุปกรณ์ (PUBLIC_REDESIGN_PLAN.md ขั้นที่ 5)
   ชิ้นส่วนหลักอยู่ใน public-site-kit.css ไฟล์นี้มีเฉพาะส่วนที่ผูกกับ app.html
   app.html ใช้ body ร่วมกับหน้าแชท จึงตั้ง site-page ที่ #login-container และกล่องนอกสุดของหน้าต่างอุปกรณ์แทน
   ประวัติ: Frontend/LOGIN_DEVICE_UX_BUG_HISTORY.md
   ========================================================================== */

/* จอเข้าสู่ระบบเต็มจอ เลื่อนในตัวเอง script.js สลับ display: flex / none เอง */
.site-auth-screen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* กล่องข้างในต้องสูงตามเนื้อหา ถ้าถูกยืดให้สูงเท่าจอ (flex stretch) หัวแบรนด์บนมือถือจะถูกบีบจนการ์ดทับ */
.site-auth-screen > .site-auth {
  flex: none;
  align-self: flex-start;
}

/* PWA บน iPhone ใช้แถบสถานะแบบโปร่ง (black-translucent) เนื้อหาบนสุดต้องหลบรอยบาก */
.site-auth-screen .site-auth-brand {
  padding-top: calc(40px + env(safe-area-inset-top, 0px));
}

/* หน้าแชทซ่อนอยู่ระหว่างแสดงหน้าเข้าสู่ระบบ ไม่ให้ body มีแถบเลื่อนซ้อนอีกชั้น */
body:has(> #login-container.site-auth-screen:not([style*="display:none"]):not([style*="display: none"])) {
  overflow: hidden;
}

/* styles.css ของหน้าแชทตั้งสีหัวข้อทั้งหน้า ให้หัวข้อในหน้าเข้าสู่ระบบใช้สีของชุดกลาง */
.site-auth-screen :where(h1, h2, h3),
.site-auth-overlay :where(h1, h2, h3) {
  color: var(--site-ink);
}

/* ระหว่างกำลังเข้าสู่ระบบ ช่องกรอกถูกปิด (script.js ตั้ง disabled) ให้เห็นว่ากำลังทำงาน */
#login-form.is-submitting .site-input input {
  cursor: wait;
  opacity: 0.75;
}

.login-submit .fa-spinner {
  margin-right: 2px;
}

/* หน้าต่างสลับอุปกรณ์: ป้ายและจำนวนเครื่องตาม mockup */
.device-switch-kicker {
  color: var(--site-amber);
}

.device-switch-limit {
  color: var(--site-ink);
  font-weight: 600;
}

@media (max-width: 960px) {
  .site-auth-screen .site-auth-brand {
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
  }

  .site-auth-screen .site-auth-main {
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  }
}

/* Recovery uses the existing loading surface; normal loading/login stays unchanged. */
#loading-screen.is-auth-recovery {
  padding: 24px;
  box-sizing: border-box;
  overflow-y: auto;
}

#loading-screen.is-auth-recovery .loader-ring {
  display: none;
}

#loading-screen.is-auth-recovery .loader-logo,
#loading-screen.is-auth-recovery .loading-subtext {
  animation: none;
}

#loading-screen.is-auth-recovery .loading-text-container {
  width: 100%;
  max-width: 440px;
  text-align: center;
}

#loading-screen.is-auth-recovery .loading-text {
  font-size: clamp(20px, 4vw, 26px);
  letter-spacing: 0;
}

#loading-screen.is-auth-recovery .loading-subtext {
  line-height: 1.7;
  letter-spacing: 0;
  text-transform: none;
}

.auth-recovery-actions:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.auth-recovery-actions .site-btn {
  min-width: 128px;
}
