/* ══════════════════════════════════════════════════════════════════════
   MemberForm ORG2 — สไตล์ฟอร์มธรรมดา (กรอกแล้วดาวน์โหลด/พิมพ์ PDF)
   คู่กับ member-form-org2.js และ member-form-org2.html (Custom HTML page)
   ══════════════════════════════════════════════════════════════════════ */

#cjn-org2{
  --f-main:var(--color-navy-500,#0f5499);
  --f-dark:var(--color-navy-700,#0b3a68);
  --f-accent:var(--color-secondary,#0b3d6e);
  --f-soft:var(--color-navy-50,#eff6fc);
  --f-soft-border:var(--color-navy-100,#d8e8f6);
  --f-text:#17324d;
  --f-muted:#718397;
  --f-border:#e3e8ef;
  max-width:56rem;
  margin:0 auto;
  padding:2.75rem 1.5rem 4.5rem;
  color:var(--f-text);
}
#cjn-org2 *{box-sizing:border-box}

/* หัวข้อหน้า */
#cjn-org2 .cjn-page-head{text-align:center;margin:0 auto 1.75rem}
#cjn-org2 .cjn-kicker{
  display:inline-flex;align-items:center;gap:.4rem;
  padding:.375rem .8rem;border:1px solid var(--f-soft-border);border-radius:999px;
  background:var(--f-soft);color:var(--f-main);font-size:.75rem;font-weight:800;
}
#cjn-org2 .cjn-kicker:before{content:"✦";color:var(--f-accent)}
#cjn-org2 .cjn-title{
  margin:.75rem 0 .3rem;font-family:var(--font-heading,inherit);
  font-size:1.75rem;line-height:1.35;font-weight:800;color:#123c65;
}
@media(min-width:640px){#cjn-org2 .cjn-title{font-size:1.9rem}}
#cjn-org2 .cjn-lead{max-width:560px;margin:0 auto;color:var(--f-muted);font-size:.875rem;line-height:1.9}
#cjn-org2 .cjn-title-rule{
  width:64px;height:3px;margin:.9rem auto 0;border-radius:99px;
  background:linear-gradient(90deg,var(--f-dark),var(--f-main),var(--f-accent));
}

/* เลย์เอาต์ 2 คอลัมน์ — ฟอร์มซ้าย / พรีวิวขวา (sticky) */
#cjn-org2 .cjn-layout{display:block}

/* การ์ดฟอร์ม */
#cjn-org2 .cjn-card{
  background:#fff;border:1px solid var(--f-border);border-radius:1.125rem;
  box-shadow:0 8px 30px rgba(18,60,101,.07);overflow:hidden;
}
#cjn-org2 .cjn-card-top{height:5px;background:linear-gradient(90deg,var(--f-dark),var(--f-main),var(--f-accent))}
#cjn-org2 .cjn-form-body{padding:1.75rem 1.75rem 2rem}
@media(max-width:640px){#cjn-org2 .cjn-form-body{padding:1.125rem}}

#cjn-org2 .cjn-section{margin:0 0 1.125rem;padding:1.25rem;border:1px solid #e6ebf1;border-radius:.875rem;background:#fff}
#cjn-org2 .cjn-section:last-child{margin-bottom:0}
#cjn-org2 .cjn-section-title{
  display:flex;align-items:center;gap:.625rem;margin:0 0 1rem;
  font-family:var(--font-heading,inherit);color:#173f65;font-size:.9375rem;font-weight:700;
}
#cjn-org2 .cjn-section-no{
  width:1.8rem;height:1.8rem;border-radius:.5rem;display:grid;place-items:center;flex:none;
  background:var(--f-soft);color:var(--f-main);font-size:.75rem;font-weight:800;border:1px solid var(--f-soft-border);
}

#cjn-org2 .cjn-grid{display:grid;gap:1rem;margin-top:0}
@media(min-width:560px){#cjn-org2 .cjn-grid{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}}
#cjn-org2 .cjn-full{grid-column:1/-1}
#cjn-org2 .cjn-row3{display:grid;gap:.5rem;grid-template-columns:4.5rem 1fr 5.5rem}
#cjn-org2 label{display:block;font-size:.8125rem;font-weight:700;color:#3d5870}
#cjn-org2 .cjn-req{color:#d64b4b}
#cjn-org2 .cjn-hint{display:block;margin-top:.2rem;font-size:.6875rem;line-height:1.5;font-weight:400;color:#8291a0}
#cjn-org2 input[type=text],#cjn-org2 input[type=number],#cjn-org2 input[type=tel],#cjn-org2 input[type=email],
#cjn-org2 select{
  width:100%;margin-top:.375rem;padding:.625rem .75rem;font:inherit;font-size:.875rem;color:#243e55;
  background:#fff;border:1px solid #d5dfe8;border-radius:.5625rem;outline:none;
  transition:border-color .18s,box-shadow .18s;
}
#cjn-org2 input:focus,#cjn-org2 select:focus{
  border-color:var(--f-main);box-shadow:0 0 0 3px color-mix(in srgb,var(--f-main) 16%,transparent);
}
#cjn-org2 input[aria-invalid=true],#cjn-org2 select[aria-invalid=true]{border-color:#d64545;background:#fff9f9}
#cjn-org2 input[readonly]{background:var(--f-soft);color:var(--f-main);font-weight:700}
#cjn-org2 .cjn-err{display:none;margin-top:.25rem;font-size:.6875rem;color:#d64545}
#cjn-org2 [aria-invalid=true]~.cjn-err{display:block}

/* ตัวเลือกค่าบำรุง */
#cjn-org2 .cjn-fee{display:flex;flex-wrap:wrap;gap:.75rem;margin-top:.375rem}
#cjn-org2 .cjn-fee label{
  display:flex;align-items:center;gap:.5rem;padding:.625rem .875rem;border:1px solid #d5dfe8;border-radius:.625rem;
  font-weight:600;font-size:.8125rem;cursor:pointer;flex:1 1 12rem;transition:border-color .15s,background .15s;
  min-height:2.75rem;   /* 44px — ขนาดขั้นต่ำที่นิ้วกดไม่พลาดบนมือถือ */
}
#cjn-org2 .cjn-fee input{width:1rem;height:1rem;accent-color:var(--f-main);margin:0}
#cjn-org2 .cjn-fee label:has(input:checked){border-color:var(--f-main);background:var(--f-soft)}

#cjn-org2 .cjn-total{
  margin-top:.75rem;display:flex;align-items:center;gap:.625rem;padding:.75rem .875rem;
  border:1px dashed var(--f-soft-border);border-radius:.625rem;background:var(--f-soft);
}
#cjn-org2 .cjn-total b{color:var(--f-main);font-size:1rem}

/* ปุ่ม/สถานะ */
#cjn-org2 .cjn-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;margin-top:.25rem}
#cjn-org2 button{
  min-height:2.6875rem;padding:.625rem 1.5625rem;display:inline-flex;align-items:center;justify-content:center;
  gap:.5rem;border:0;border-radius:.5rem;font:inherit;font-size:.8125rem;font-weight:800;cursor:pointer;
  transition:transform .15s,opacity .15s;
}
#cjn-org2 .cjn-btn-primary{
  background:linear-gradient(135deg,var(--f-main),var(--f-dark));color:#fff;
  box-shadow:0 6px 15px color-mix(in srgb,var(--f-main) 30%,transparent);
}
#cjn-org2 .cjn-btn-primary:hover{transform:translateY(-1px)}
#cjn-org2 .cjn-btn-ghost{background:#fff;border:1px solid var(--f-soft-border);color:var(--f-main)}
#cjn-org2 button:disabled{opacity:.55;cursor:not-allowed;transform:none}
#cjn-org2 .cjn-spin{width:.9375rem;height:.9375rem;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:cjn-spin .7s linear infinite}
@keyframes cjn-spin{to{transform:rotate(360deg)}}
#cjn-org2 .cjn-msg{margin:0;font-size:.75rem;font-weight:700}
#cjn-org2 .cjn-msg.is-wait{color:#728394}
#cjn-org2 .cjn-msg.is-bad{color:#d64545}
#cjn-org2 .cjn-msg.is-ok{color:#159b7d}

/* ขั้นตอนหลังพิมพ์ — แนบไฟล์เซ็นแล้วส่งกลับ */
#cjn-org2 .cjn-step2{
  margin-top:1.75rem;padding-top:1.5rem;border-top:1px dashed var(--f-soft-border);
  opacity:.45;pointer-events:none;filter:grayscale(.4);transition:opacity .25s,filter .25s;
}
#cjn-org2 .cjn-step2.is-ready{opacity:1;pointer-events:auto;filter:none}
#cjn-org2 input[type=file]{
  width:100%;margin-top:.375rem;font:inherit;font-size:.8125rem;color:#5e7181;
  background:#fff;border:1px dashed #cbd7e1;border-radius:.5625rem;padding:.625rem;
}
#cjn-org2 input[type=file]::file-selector-button{
  padding:.44rem .75rem;margin-right:.5rem;border:0;border-radius:.4375rem;
  background:var(--f-main);color:#fff;font:inherit;font-size:.75rem;font-weight:700;cursor:pointer;
}
#cjn-org2 .cjn-files{margin-top:.4375rem;display:flex;flex-direction:column;gap:.2rem}
#cjn-org2 .cjn-file{margin:0;font-size:.6875rem;color:#637687;word-break:break-all}

/* ── หัวฟอร์มแบบย่อ/ขยาย ────────────────────────────────────────────────
   คำอธิบายวิธีใช้กินพื้นที่บนสุดของจอมือถือไปมาก ทั้งที่อ่านครั้งเดียวก็พอ
   → ยุบเป็นปุ่ม "ดูวิธีใช้งาน" (ย่อไว้บนมือถือ, กางไว้บนจอกว้าง) */
#cjn-org2 .cjn-intro{margin:.75rem auto 0;text-align:center}
#cjn-org2 .cjn-intro summary{
  list-style:none;cursor:pointer;display:inline-flex;align-items:center;gap:.35rem;
  padding:.45rem .85rem;border:1px solid var(--f-soft-border);border-radius:999px;
  background:var(--f-soft);color:var(--f-main);font-size:.75rem;font-weight:700;
  min-height:2.75rem;box-sizing:border-box;   /* 44px — ขนาดขั้นต่ำที่นิ้วกดไม่พลาด */
}
#cjn-org2 .cjn-intro summary::-webkit-details-marker{display:none}
#cjn-org2 .cjn-intro summary::after{content:"▾";font-size:.65rem;line-height:1}
#cjn-org2 .cjn-intro[open] summary::after{content:"▴"}
#cjn-org2 .cjn-intro-body{
  max-width:34rem;margin:.75rem auto 0;padding:.875rem 1rem;
  border:1px solid var(--f-border);border-radius:.75rem;background:#fff;
  color:var(--f-muted);font-size:.8125rem;line-height:1.9;text-align:left;
}
#cjn-org2 .cjn-intro-body p{margin:0}
/* ปุ่มแบบลิงก์ — ต้องกัน #cjn-org2 button{width:100%} ของมือถือไม่ให้ดันเต็มบรรทัด
   (เดิมปุ่มนี้ฝังอยู่กลางย่อหน้าแล้วโดนดันจนวงเล็บแตกคนละบรรทัด) */
#cjn-org2 .cjn-linkbtn{
  display:inline;width:auto;min-height:0;padding:0;margin:0;
  background:none;border:0;box-shadow:none;border-radius:0;
  color:var(--f-main);font:inherit;font-weight:700;text-decoration:underline;cursor:pointer;
}
#cjn-org2 .cjn-linkbtn:hover{transform:none;opacity:.8}

/* honeypot */
#cjn-org2 .cjn-hp{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}

/* มือถือ */
@media(max-width:640px){
  #cjn-org2{padding:1.75rem .75rem 3.25rem}
  #cjn-org2 .cjn-title{font-size:1.5rem}
  #cjn-org2 .cjn-lead{font-size:.75rem}
  #cjn-org2 input[type=text],#cjn-org2 input[type=number],#cjn-org2 input[type=tel],#cjn-org2 input[type=email],
  #cjn-org2 select{min-height:2.875rem;font-size:16px}
  #cjn-org2 .cjn-actions{display:block}
  #cjn-org2 button{width:100%;min-height:2.9375rem}
}

/* มือถือทุกขนาด — แถว วัน/เดือน/พ.ศ. 3 ช่องเรียงกันจะบีบช่อง "เดือน" จนอ่านชื่อเดือนไทยไม่ออก
   (ที่ 425px ยังโชว์แค่ "— เ") → ให้ พ.ศ. ตกไปบรรทัดล่างเต็มความกว้าง เดือนจะได้พื้นที่พอ */
@media(max-width:480px){
  #cjn-org2 .cjn-row3{grid-template-columns:4.5rem 1fr}
  #cjn-org2 .cjn-row3 > :nth-child(3){grid-column:1/-1}
}

/* ═══ ช่องเลือกตำบลแบบค้นหาได้ ═══
   เดิมใช้ <datalist> ซึ่งบนมือถือเปิดเป็น native overlay ยาวทะลุจอ (บางรหัสมีถึง 33 ตำบล)
   กดยาก อ่านยาก และล้นออกนอกการ์ดฟอร์ม → ทำแผงของตัวเองที่คุมความสูงและมีช่องค้นหาได้ */
#cjn-org2 .cjn-combo{position:relative}
#cjn-org2 .cjn-combo-input-wrap{position:relative}
#cjn-org2 .cjn-combo-panel{
  position:absolute;left:0;right:0;top:calc(100% + .25rem);z-index:60;
  background:#fff;border:1px solid var(--f-main);border-radius:.625rem;
  box-shadow:0 12px 28px rgba(18,60,101,.18);overflow:hidden;
}
#cjn-org2 .cjn-combo-search{
  width:100%;margin:0;border:0;border-bottom:1px solid #e6ebf1;border-radius:0;
  padding:.6875rem .75rem;font-size:16px;   /* 16px กัน iOS ซูมตอนโฟกัส */
}
#cjn-org2 .cjn-combo-search:focus{box-shadow:none;border-bottom-color:var(--f-main)}
#cjn-org2 .cjn-combo-list{max-height:min(45vh,15rem);overflow-y:auto;-webkit-overflow-scrolling:touch}
#cjn-org2 .cjn-combo-item{
  display:block;width:100%;text-align:left;padding:.75rem;border:0;background:none;
  font:inherit;font-size:.875rem;color:#243e55;cursor:pointer;min-height:2.75rem;
  border-bottom:1px solid #f1f5f9;
}
#cjn-org2 .cjn-combo-item:last-child{border-bottom:0}
#cjn-org2 .cjn-combo-item:hover,#cjn-org2 .cjn-combo-item.is-active{background:var(--f-soft);color:var(--f-main)}
#cjn-org2 .cjn-combo-item small{display:block;margin-top:.1rem;font-size:.6875rem;color:var(--f-muted)}
#cjn-org2 .cjn-combo-item:hover small,#cjn-org2 .cjn-combo-item.is-active small{color:var(--f-main);opacity:.8}
#cjn-org2 .cjn-combo-empty{margin:0;padding:.875rem .75rem;font-size:.8125rem;color:var(--f-muted);text-align:center}
