/* ===== หน้าลืมรหัสผ่าน + หน้าจอกำลังออกจากระบบ ให้เข้าชุดกับหน้าเข้าสู่ระบบ (owner 2026-10-14:
   "หน้าลืมรหัสผ่านมันไม่เปลี่ยนตามหรือ ควรเปลี่ยนตาม พร้อมหน้าออกจากระบบแล้ว")
   พื้นหลัง (สีฟ้าเข้ม + เส้นแสง) คัดลอกจาก css/login-split.css บล็อกแรก ถ้าแก้พื้นหลังหน้าเข้าสู่ระบบ ให้แก้ที่นี่ด้วย
   (tools/button-system-contract.cjs ตรวจว่าสองไฟล์ใช้พื้นหลังเดียวกัน)  ไม่แตะ HTML / การทำงานของหน้า */
body.pp5-public-auth-page:not(.pp5-login-page),
#logoutOverlay {
  --pp5-lg-primary: #2786ee;
  --pp5-lg-accent: #39c6ea;
  --pp5-lg-ink: #f2fbff;
  --pp5-lg-muted: #d3edf8;
  --pp5-lg-line: rgba(233, 251, 255, .5);
  --pp5-lg-curves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='light' x1='0' x2='1'%3E%3Cstop stop-color='%233de4ff' stop-opacity='0'/%3E%3Cstop offset='.28' stop-color='%23b7faff' stop-opacity='.8'/%3E%3Cstop offset='.58' stop-color='%23ffffff' stop-opacity='.95'/%3E%3Cstop offset='.83' stop-color='%235bedff' stop-opacity='.75'/%3E%3Cstop offset='1' stop-color='%2369eeff' stop-opacity='0'/%3E%3C/linearGradient%3E%3Cfilter id='glow' x='-20%25' y='-50%25' width='140%25' height='200%25'%3E%3CfeGaussianBlur stdDeviation='9'/%3E%3C/filter%3E%3C/defs%3E%3Cg fill='none' stroke='url(%23light)' stroke-linecap='round'%3E%3Cpath d='M-100 540 C220 375 370 895 735 765 S1230 270 1740 390' stroke-width='22' opacity='.38' filter='url(%23glow)'/%3E%3Cpath d='M-100 540 C220 375 370 895 735 765 S1230 270 1740 390' stroke-width='2.8' opacity='.8'/%3E%3Cpath d='M-80 585 C260 465 365 930 820 765 S1290 290 1710 355' stroke-width='1.3' opacity='.48'/%3E%3Cpath d='M-100 670 C260 840 590 920 990 680 S1390 485 1740 590' stroke-width='18' opacity='.24' filter='url(%23glow)'/%3E%3Cpath d='M-100 670 C260 840 590 920 990 680 S1390 485 1740 590' stroke-width='1.7' opacity='.68'/%3E%3C/g%3E%3C/svg%3E");
  background:
    radial-gradient(circle at 8% 22%, rgba(195, 250, 255, .1) 0 22px, rgba(209, 255, 255, .42) 23px, transparent 25px),
    radial-gradient(circle at 89% 18%, rgba(195, 250, 255, .1) 0 13px, rgba(209, 255, 255, .36) 14px, transparent 16px),
    radial-gradient(circle at 92% 77%, rgba(195, 250, 255, .09) 0 27px, rgba(209, 255, 255, .34) 28px, transparent 30px),
    radial-gradient(circle at 16% 82%, rgba(195, 250, 255, .08) 0 11px, rgba(209, 255, 255, .3) 12px, transparent 14px),
    var(--pp5-lg-curves) center / 100% 100% no-repeat,
    radial-gradient(ellipse at 52% 0%, rgba(77, 237, 247, .64), transparent 46%),
    radial-gradient(ellipse at 98% 45%, rgba(41, 220, 235, .55), transparent 52%),
    radial-gradient(ellipse at 0% 100%, rgba(3, 31, 105, .7), transparent 64%),
    linear-gradient(145deg, #097bc3 0%, #056bab 43%, #078bb4 72%, #095789 100%) !important;
  background-attachment: fixed !important;
}

/* ---------- ลืมรหัสผ่าน: การ์ดกระจก ตัวหนังสือขาว ---------- */
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) {
  max-width: 460px !important;
  margin: 0 auto !important;
  padding: 30px 32px 24px !important;
  background: linear-gradient(130deg, rgba(231, 252, 255, .19), rgba(222, 247, 255, .07)) !important;
  border: 1px solid rgba(239, 255, 255, .56) !important;
  border-radius: 28px !important;
  box-shadow: 0 22px 65px rgba(0, 35, 82, .25), inset 0 1px 0 rgba(255, 255, 255, .5) !important;
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  color: var(--pp5-lg-ink) !important;
  text-align: center;
}
/* โลโก้โปรแกรมเหนือหัวข้อ */
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm)::before {
  content: "";
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: url("../assets/brand/pp5smart-icon-192.png?v=1") center / contain no-repeat;
  box-shadow: 0 0 0 6px rgba(240, 254, 255, .2), 0 0 34px rgba(112, 247, 255, .3);
}
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) h1 {
  color: var(--pp5-lg-ink) !important; font-size: 1.55rem !important; font-weight: 700 !important; margin: 0 0 8px !important;
}
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) .sub,
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) .muted {
  color: var(--pp5-lg-muted) !important; font-size: .92rem !important;
}
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) .form-group { text-align: left; }
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) label { color: var(--pp5-lg-ink) !important; font-weight: 600 !important; }
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpUsername,
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpEmail {
  height: 48px; padding: 0 18px !important;
  border-radius: 999px !important; border: 1px solid rgba(217, 249, 255, .62) !important;
  background: rgba(220, 249, 255, .13) !important; color: var(--pp5-lg-ink) !important;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .15) !important;
}
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpUsername::placeholder,
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpEmail::placeholder { color: rgba(220, 245, 255, .6) !important; }
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpUsername:focus,
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpEmail:focus {
  outline: none; border-color: #9af5ff !important; background: rgba(220, 249, 255, .2) !important;
  box-shadow: 0 0 0 3px rgba(131, 245, 255, .2), 0 0 22px rgba(131, 245, 255, .14) !important;
}
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpUsername:-webkit-autofill,
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpEmail:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #d3edf7 inset !important; -webkit-text-fill-color: #173451 !important;
}
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpBtn {
  width: 100%; min-height: 50px; border: 1px solid rgba(209, 255, 255, .65) !important;
  border-radius: 999px !important;
  background: linear-gradient(100deg, #69f5f5, #31e5ed 52%, #35d4ee) !important;
  color: #073b5f !important; font-size: 1.02rem !important; font-weight: 800 !important;
  box-shadow: 0 0 20px rgba(62, 238, 249, .27), 0 8px 22px rgba(0, 44, 83, .16) !important;
}
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame #fpBtn:hover:not(:disabled) { filter: brightness(1.06); }
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) .link { color: #e3fbff !important; font-weight: 600; }
body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) .loading { color: var(--pp5-lg-muted) !important; }
@media (max-width: 480px) {
  body.pp5-public-auth-page:not(.pp5-login-page) #contentFrame .container:has(#fpForm) { padding: 24px 20px 18px !important; border-radius: 24px !important; }
}

/* ---------- กำลังออกจากระบบ (#logoutOverlay ใน js/spa-main.js ใช้ style ในบรรทัด จึงต้อง !important) ---------- */
#logoutOverlay { background-color: #075f96 !important; backdrop-filter: none !important; }
#logoutOverlay > div {
  min-width: 280px;
  padding: 34px 40px 28px !important;
  background: linear-gradient(130deg, rgba(231, 252, 255, .19), rgba(222, 247, 255, .07)) !important;
  border: 1px solid rgba(239, 255, 255, .56) !important;
  border-radius: 28px !important;
  box-shadow: 0 22px 65px rgba(0, 35, 82, .25), inset 0 1px 0 rgba(255, 255, 255, .5) !important;
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
}
#logoutOverlay > div::before {
  content: "";
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 16px;
  background: url("../assets/brand/pp5smart-icon-192.png?v=1") center / contain no-repeat;
  box-shadow: 0 0 0 6px rgba(240, 254, 255, .2), 0 0 34px rgba(112, 247, 255, .3);
}
#logoutOverlay .spinner-border { width: 2.2rem !important; height: 2.2rem !important; margin-bottom: 14px !important; color: #9af5ff !important; }
#logoutOverlay h4 { color: #f2fbff !important; font-weight: 700; }
#logoutOverlay p { color: #d3edf8 !important; }

/* ---------- หน้าเข้าสู่ระบบ: สังกัด (เขตพื้นที่) ตัวเล็กใต้ชื่อโรงเรียน (js/login-layout.js) ---------- */
body.pp5-login-page .login-container .header .pp5-login-affiliation {
  margin: 6px auto 0 !important;
  max-width: 340px;
  color: var(--pp5-lg-muted) !important;
  font-size: .84rem !important;
  line-height: 1.45;
  opacity: .92;
}
@media (max-width: 899.98px) {
  body.pp5-login-page .login-container .header .pp5-login-affiliation { font-size: .78rem !important; }
}

/* ---------- "กำลังเข้าสู่ระบบ..." (#pp5LoginTransition จาก spa-main.js) ----------
   owner 2026-10-14: "ไม่ต้องการให้แสดงหน้าขาว ๆ" — การ์ด 2 ฝั่งเป็น grid กฎ "> :not(.header)" ทำให้กล่องนี้กลายเป็นกล่องขาว
   ในคอลัมน์ขวา: ให้คลุมทั้งการ์ดเป็นกระจกฟ้าโปร่ง ตัวหนังสือขาว */
body.pp5-login-page .login-container > #pp5LoginTransition {
  position: absolute !important;
  inset: 0 !important;
  grid-column: auto !important;
  grid-row: auto !important;
  margin: 0 !important;
  z-index: 30 !important;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(9, 110, 180, .9), rgba(7, 128, 170, .86)) !important;
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  color: #f2fbff !important;
}
body.pp5-login-page .login-container > #pp5LoginTransition strong { color: #f2fbff; font-size: 1.15rem; }
body.pp5-login-page .login-container > #pp5LoginTransition small { color: #d3edf8 !important; }
body.pp5-login-page .login-container > #pp5LoginTransition .pp5-login-transition-spinner {
  border-color: rgba(220, 249, 255, .3) !important;
  border-top-color: #9af5ff !important;
}

/* รูปมือเมื่อชี้ปุ่มและลิงก์ (owner 2026-10-14: "เอาเมาส์ไปชี้ไม่ขึ้นรูปมือ") */
body.pp5-public-auth-page #loginBtn:not(:disabled),
body.pp5-public-auth-page .toggle-pass,
body.pp5-public-auth-page .forgot-password-link a,
body.pp5-public-auth-page #fpBtn:not(:disabled),
body.pp5-public-auth-page .container:has(#fpForm) .link { cursor: pointer !important; }

/* ---------- ลงทะเบียนบุคลากรใหม่ (js/self-register.js) ---------- */
body.pp5-login-page .login-container .pp5-register-link { text-align: center; margin-top: 6px; color: #d3edf8; font-size: .9rem; }
body.pp5-login-page .login-container .pp5-register-link a { color: #9af5ff !important; font-weight: 700; cursor: pointer; }
#pp5RegisterOverlay {
  position: fixed; inset: 0; z-index: 10060; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(3, 40, 80, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow-y: auto;
}
#pp5RegisterOverlay .pp5-reg-card {
  position: relative; width: 100%; max-width: 560px; margin: auto; padding: 26px 26px 20px; border-radius: 24px;
  background: linear-gradient(140deg, rgba(9, 110, 180, .92), rgba(7, 128, 170, .9));
  border: 1px solid rgba(239, 255, 255, .56); box-shadow: 0 22px 65px rgba(0, 35, 82, .35); color: #f2fbff;
}
#pp5RegisterOverlay h2 { margin: 0 0 4px; font-size: 1.45rem; font-weight: 800; text-align: center; color: #f2fbff; }
#pp5RegisterOverlay .pp5-reg-sub { margin: 0 0 16px; text-align: center; color: #d3edf8; font-size: .9rem; }
#pp5RegisterOverlay .pp5-reg-close { position: absolute; top: 10px; right: 14px; border: 0; background: none; color: #e3fbff; font-size: 1.6rem; cursor: pointer; }
#pp5RegisterOverlay .pp5-reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
#pp5RegisterOverlay .pp5-reg-wide { grid-column: 1 / -1; }
#pp5RegisterOverlay label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .88rem; color: #f2fbff; }
#pp5RegisterOverlay input {
  height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(217, 249, 255, .62);
  background: rgba(220, 249, 255, .15); color: #f2fbff; font-size: .95rem;
}
#pp5RegisterOverlay input::placeholder { color: rgba(220, 245, 255, .6); }
#pp5RegisterOverlay input:focus { outline: none; border-color: #9af5ff; box-shadow: 0 0 0 3px rgba(131, 245, 255, .2); }
#pp5RegisterOverlay .pp5-reg-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#pp5RegisterOverlay .pp5-reg-msg { margin-top: 12px; padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: .9rem; }
#pp5RegisterOverlay .pp5-reg-msg.err { background: rgba(254, 226, 226, .95); color: #b91c1c; }
#pp5RegisterOverlay .pp5-reg-msg.info { background: rgba(220, 249, 255, .2); color: #f2fbff; }
#pp5RegisterOverlay .pp5-reg-submit {
  width: 100%; min-height: 48px; margin-top: 14px; border-radius: 999px; border: 1px solid rgba(209, 255, 255, .65);
  background: linear-gradient(100deg, #69f5f5, #31e5ed 52%, #35d4ee); color: #073b5f; font-weight: 800; font-size: 1rem; cursor: pointer;
}
#pp5RegisterOverlay .pp5-reg-submit:disabled { opacity: .6; cursor: wait; }
#pp5RegisterOverlay .pp5-reg-back { display: block; margin: 10px auto 0; border: 0; background: none; color: #e3fbff; font-weight: 600; cursor: pointer; }
#pp5RegisterOverlay .pp5-reg-done { text-align: center; padding: 10px 4px; }
#pp5RegisterOverlay .pp5-reg-done-icon {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(154, 245, 255, .25); color: #9af5ff; font-size: 2rem; font-weight: 800;
}
#pp5RegisterOverlay .pp5-reg-done p { color: #d3edf8; line-height: 1.6; }
@media (max-width: 560px) {
  #pp5RegisterOverlay .pp5-reg-grid { grid-template-columns: 1fr; }
  #pp5RegisterOverlay .pp5-reg-card { padding: 22px 18px 16px; }
}

/* ---------- นักเรียน: ลงทะเบียนชุมนุม (js/clubs.js) ---------- */
body.pp5-login-page .login-container .pp5-club-link { text-align: center; margin-top: 8px; }
body.pp5-login-page .login-container .pp5-club-link a {
  display: inline-block; padding: 7px 16px; border-radius: 999px; border: 1px solid rgba(154, 245, 255, .6);
  background: rgba(154, 245, 255, .14); color: #e3fbff !important; font-weight: 700; cursor: pointer; text-decoration: none;
}
#pp5ClubOverlay {
  position: fixed; inset: 0; z-index: 10060; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(3, 40, 80, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow-y: auto;
}
#pp5ClubOverlay .pp5-cs-card {
  position: relative; width: 100%; max-width: 560px; margin: auto; padding: 24px 24px 18px; border-radius: 24px;
  background: linear-gradient(140deg, rgba(9, 110, 180, .94), rgba(7, 128, 170, .92));
  border: 1px solid rgba(239, 255, 255, .56); box-shadow: 0 22px 65px rgba(0, 35, 82, .35); color: #f2fbff;
}
#pp5ClubOverlay h2 { margin: 0 0 6px; text-align: center; font-size: 1.45rem; font-weight: 800; color: #f2fbff; }
#pp5ClubOverlay .pp5-cs-sub { text-align: center; color: #d3edf8; margin: 0 0 14px; line-height: 1.6; }
#pp5ClubOverlay .pp5-cs-close { position: absolute; top: 10px; right: 14px; border: 0; background: none; color: #e3fbff; font-size: 1.6rem; cursor: pointer; }
#pp5ClubOverlay label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
#pp5ClubOverlay input, #pp5ClubOverlay select {
  height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(217, 249, 255, .62);
  background: rgba(220, 249, 255, .15); color: #f2fbff; font-size: 1rem;
}
#pp5ClubOverlay select option { color: #173451; }
#pp5ClubOverlay .pp5-cs-birth { display: grid; grid-template-columns: .8fr 1.4fr 1fr; gap: 8px; }
#pp5ClubOverlay .pp5-cs-btn, #pp5ClubOverlay .pp5-cs-back {
  width: 100%; min-height: 48px; margin-top: 8px; border-radius: 999px; border: 1px solid rgba(209, 255, 255, .65);
  background: linear-gradient(100deg, #69f5f5, #31e5ed 52%, #35d4ee); color: #073b5f; font-weight: 800; font-size: 1rem; cursor: pointer;
}
#pp5ClubOverlay .pp5-cs-msg { margin: 8px 0; padding: 9px 12px; border-radius: 10px; font-weight: 600; }
#pp5ClubOverlay .pp5-cs-msg.err { background: rgba(254, 226, 226, .95); color: #b91c1c; }
#pp5ClubOverlay .pp5-cs-msg.ok { background: rgba(220, 252, 231, .95); color: #047857; }
#pp5ClubOverlay .pp5-cs-msg.info { background: rgba(220, 249, 255, .2); color: #f2fbff; }
#pp5ClubOverlay .pp5-cs-list { display: grid; gap: 8px; max-height: 52vh; overflow-y: auto; padding-right: 2px; }
#pp5ClubOverlay .pp5-cs-club {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: 14px;
  background: rgba(220, 249, 255, .12); border: 1px solid rgba(217, 249, 255, .35);
}
#pp5ClubOverlay .pp5-cs-club.mine { background: rgba(154, 245, 255, .25); border-color: #9af5ff; }
#pp5ClubOverlay .pp5-cs-club small { display: block; color: #d3edf8; font-size: .82rem; }
#pp5ClubOverlay .pp5-cs-pick {
  flex: none; min-width: 72px; height: 38px; border-radius: 999px; border: 0; cursor: pointer;
  background: #9af5ff; color: #073b5f; font-weight: 800;
}
#pp5ClubOverlay .pp5-cs-pick:disabled { opacity: .45; cursor: not-allowed; }
#pp5ClubOverlay .pp5-cs-mine { flex: none; font-weight: 800; color: #9af5ff; }
