/* =====================================================================
   site.css — ธีมเว็บไซต์ (ต่อยอดจาก Bootstrap 5)
   โทน: ThaiEform.com — สดใส เย็น: หมึกน้ำเงินเข้ม + ฟ้าอมเขียวสดใส (ตราประทับ)
   ===================================================================== */
:root {
  --gf-ink: #14283d;
  --gf-ink-soft: #4a6378;
  --gf-paper: #eef6fb;
  --gf-card: #ffffff;
  --gf-line: #d7e8f0;
  --gf-seal: #0e7490;
  --gf-seal-soft: #dff5fa;
  --gf-ok: #108a4f;
  --gf-radius: 1rem;
  --gf-shadow-sm: 0 1px 2px rgba(20,40,61,.04), 0 2px 8px rgba(20,40,61,.06);
  --gf-shadow-md: 0 4px 10px rgba(20,40,61,.06), 0 14px 32px rgba(20,40,61,.12);
  --bs-body-font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-color: var(--gf-ink);
  --bs-body-bg: var(--gf-paper);
  --bs-link-color-rgb: 20, 40, 61;
  --bs-link-hover-color-rgb: 14, 116, 144;
  --bs-border-color: var(--gf-line);
}
body { font-size: 1.02rem; background: var(--gf-paper); color: var(--gf-ink); }
a { text-underline-offset: .2em; }

/* ---------- ปุ่ม ---------- */
.btn-seal { --bs-btn-color:#fff; --bs-btn-bg:var(--gf-seal); --bs-btn-border-color:var(--gf-seal);
  --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#0b5c73; --bs-btn-hover-border-color:#0b5c73;
  --bs-btn-active-bg:#094a5e; --bs-btn-focus-shadow-rgb:14,116,144; }
.btn-ink { --bs-btn-color:#fff; --bs-btn-bg:var(--gf-ink); --bs-btn-border-color:var(--gf-ink);
  --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#0b1a28; --bs-btn-hover-border-color:#0b1a28; }
.btn-outline-ink { --bs-btn-color:var(--gf-ink); --bs-btn-border-color:var(--gf-ink);
  --bs-btn-hover-color:#fff; --bs-btn-hover-bg:var(--gf-ink); --bs-btn-hover-border-color:var(--gf-ink); }

/* ---------- ส่วนหัว ---------- */
.gf-header { background: var(--gf-ink); color: #fff; }
.gf-header .navbar-brand { color: #fff; font-weight: 700; letter-spacing: .01em; display: flex; align-items: center; gap: .55rem; }
.gf-header .navbar-brand small { display:block; font-weight: 400; font-size: .72rem; opacity: .75; letter-spacing: .02em; }
.gf-header .nav-link { color: rgba(255,255,255,.82); }
.gf-header .nav-link:hover, .gf-header .nav-link.active { color: #fff; }
.gf-mark { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center;
  font-weight: 700; font-size: .95rem; color: #fff; background: var(--gf-seal); flex: 0 0 auto; }

/* ---------- Hero / ค้นหา ---------- */
.gf-hero { background: var(--gf-ink); color: #fff; padding: 2.5rem 0 3.25rem; position: relative; }
.gf-hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 6px;
  background: repeating-linear-gradient(90deg, var(--gf-seal) 0 18px, transparent 18px 26px); opacity: .9; }
.gf-hero h1 { font-weight: 700; font-size: clamp(1.6rem, 3.6vw, 2.4rem); line-height: 1.3; }
.gf-hero p.lead { color: rgba(255,255,255,.8); font-size: 1.08rem; }
.gf-search { background: #fff; border-radius: var(--gf-radius); padding: .35rem; display: flex; gap: .35rem; max-width: 640px; box-shadow: var(--gf-shadow-md); }
.gf-search input { border: 0; font-size: 1.08rem; padding: .55rem .8rem; flex: 1 1 auto; min-width: 0; color: var(--gf-ink); }
.gf-search input:focus { outline: none; box-shadow: none; }
.gf-search:focus-within { box-shadow: 0 0 0 .2rem rgba(14,116,144,.45); }
.gf-chips a { display: inline-block; margin: .5rem .35rem 0 0; padding: .15rem .7rem; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); color: #fff; text-decoration: none; font-size: .92rem; }
.gf-chips a:hover { background: rgba(255,255,255,.12); }

/* ---------- การ์ด ---------- */
.gf-section-title { font-weight: 700; font-size: 1.25rem; margin: 0; }
.gf-card { background: var(--gf-card); border: 1px solid transparent; border-radius: var(--gf-radius); height: 100%;
  display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease; position: relative;
  box-shadow: var(--gf-shadow-sm); overflow: hidden; }
.gf-card:hover { transform: translateY(-3px); box-shadow: var(--gf-shadow-md); }
.gf-card .body { padding: 1rem 1.1rem; flex: 1 1 auto; }
.gf-card .foot { padding: .65rem 1.1rem; border-top: 1px dashed var(--gf-line); display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--gf-ink-soft); }
.gf-card h3 { font-size: 1.08rem; font-weight: 700; margin: .2rem 0 .35rem; line-height: 1.45; }
.gf-card h3 a { color: var(--gf-ink); text-decoration: none; }
.gf-card h3 a::after { content: ""; position: absolute; inset: 0; }   /* ทั้งการ์ดคลิกได้ */
.gf-card p { color: var(--gf-ink-soft); font-size: .95rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gf-code { font-size: .8rem; font-weight: 600; color: var(--gf-seal); background: var(--gf-seal-soft); border-radius: .3rem; padding: .05rem .45rem; }
.gf-badge-fill { font-size: .78rem; font-weight: 600; color: var(--gf-ok); border: 1px solid currentColor; border-radius: 999px; padding: 0 .55rem; }
.gf-cat { display: flex; align-items: center; gap: .85rem; padding: 1rem 1.1rem; border: 1px solid #c5e6ef;
  background: linear-gradient(135deg, #e6f6fa 0%, #d3edf5 100%);
  border-radius: var(--gf-radius); text-decoration: none; color: var(--gf-ink); height: 100%;
  box-shadow: var(--gf-shadow-sm); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.gf-cat:hover { transform: translateY(-2px); box-shadow: var(--gf-shadow-md); border-color: var(--gf-seal); color: var(--gf-ink); }
.gf-cat .n { margin-left: auto; min-width: 2rem; text-align: center; font-size: .85rem; font-weight: 700; color: var(--gf-seal);
  background: #fff; border-radius: 999px; padding: .1rem .6rem; }
.gf-cat .ic { width: 44px; height: 44px; border-radius: .75rem; display: grid; place-items: center; background: var(--gf-seal); color: #fff;
  font-weight: 700; font-size: 1.1rem; flex: 0 0 auto; box-shadow: 0 3px 8px rgba(14,116,144,.3); }
.gf-cat .text-muted { color: var(--gf-ink-soft) !important; }

/* ---------- Infographic: ใช้งานอย่างไร ---------- */
.gf-how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.25rem; margin: 0 0 1.25rem; padding: 0; counter-reset: none; }
.gf-how-step { position: relative; text-align: center; background: #fff; border-radius: var(--gf-radius); padding: 2.4rem 1.25rem 1.5rem;
  box-shadow: var(--gf-shadow-sm); }
.gf-how-step:not(:last-child)::after { content: ""; position: absolute; top: 50%; right: -1.85rem; width: 1.45rem; height: 1.45rem;
  background: var(--gf-seal); opacity: .55; transform: translateY(-50%);
  clip-path: polygon(0 28%, 55% 28%, 55% 0, 100% 50%, 55% 100%, 55% 72%, 0 72%); }
.gf-how-no { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%;
  background: var(--gf-ink); color: #fff; font-weight: 700; display: grid; place-items: center; border: 3px solid var(--gf-paper); }
.gf-how-ic { width: 88px; height: 88px; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #14a3c4, var(--gf-seal)); box-shadow: 0 8px 18px rgba(14,116,144,.32), 0 0 0 8px var(--gf-seal-soft); }
.gf-how-step h3 { font-size: 1.1rem; font-weight: 700; margin: 0 0 .4rem; }
.gf-how-step p { margin: 0; color: var(--gf-ink-soft); font-size: .95rem; }
.gf-how-safe { display: flex; align-items: center; justify-content: center; gap: .65rem; padding: .85rem 1.25rem; border-radius: var(--gf-radius);
  background: linear-gradient(135deg, #e6f6fa, #d3edf5); border: 1px solid #c5e6ef; color: var(--gf-ink); text-align: left; }
.gf-how-safe svg { color: var(--gf-ok); flex: 0 0 auto; }
@media (max-width: 767.98px) {
  .gf-how { grid-template-columns: 1fr; gap: 1.9rem; }
  .gf-how-step:not(:last-child)::after { top: auto; bottom: -1.7rem; right: 50%; transform: translateX(50%) rotate(90deg); }
}

/* ---------- หน้ารายการ ---------- */
.gf-filter { background: #fff; border: 1px solid transparent; border-radius: var(--gf-radius); padding: 1rem; box-shadow: var(--gf-shadow-sm); }
.gf-filter .list-group-item { border: 0; padding: .3rem .5rem; border-radius: .35rem; color: var(--gf-ink); }
.gf-filter .list-group-item.active { background: var(--gf-ink); color: #fff; }

/* ---------- หน้ารายละเอียด ---------- */
.gf-panel { background: #fff; border: 1px solid transparent; border-radius: var(--gf-radius); padding: 1.25rem 1.35rem; box-shadow: var(--gf-shadow-sm); }
.gf-steps { white-space: pre-line; line-height: 1.85; }
.gf-file { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border: 1px solid var(--gf-line); border-radius: .5rem; background: #fff; text-decoration: none; color: var(--gf-ink); }
.gf-file:hover { border-color: var(--gf-ink); color: var(--gf-ink); }
.gf-file .ext { font-weight: 700; font-size: .78rem; width: 42px; height: 42px; display: grid; place-items: center; border-radius: .4rem; color: #fff; background: var(--gf-seal); flex: 0 0 auto; }
.gf-file .ext.docx, .gf-file .ext.doc { background: #2b5797; }
.gf-file .ext.xlsx { background: #1e7145; }
.gf-notice { border-left: 4px solid var(--gf-seal); background: #fff; padding: .75rem 1rem; border-radius: .35rem; font-size: .95rem; }

/* ---------- หน้ากรอกฟอร์ม ---------- */
.ff-layout { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 1.25rem; align-items: start; }
.ff-layout > * { min-width: 0; }   /* ไม่ให้คอลัมน์ขยายตามความกว้างกระดาษ A4 บนมือถือ */
@media (max-width: 991.98px) { .ff-layout { grid-template-columns: 1fr; } }
/* เดสก์ท็อป: ช่องกรอกอยู่ด้านขวา ตัวอย่างเอกสารอยู่ด้านซ้าย (ลำดับใน DOM ไม่เปลี่ยน) */
@media (min-width: 992px) {
  .ff-layout { grid-template-columns: minmax(0, 1fr) minmax(380px, 580px); max-width: 1480px; margin-inline: auto; }
  .ff-layout > .ff-side { order: 2; }
  .ff-layout > section { order: 1; }
}
.ff-side { background: #fff; border: 1px solid transparent; border-radius: var(--gf-radius); box-shadow: var(--gf-shadow-sm); }
@media (min-width: 992px) { .ff-side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem - 50px); display: flex; flex-direction: column; } }
.ff-side .ff-scroll { overflow: auto; padding: 1rem 1.1rem; flex: 1 1 auto; }
.ff-side .ff-actions { padding: .6rem 1.1rem; border-top: 1px solid var(--gf-line); background: #f7fbfd; border-radius: 0 0 var(--gf-radius) var(--gf-radius); }
.ff-group { border: 0; margin: 0 0 .9rem; padding: 0; }
.ff-group legend { font-size: .95rem; font-weight: 700; color: var(--gf-seal); margin-bottom: .35rem; padding-bottom: .2rem; border-bottom: 1px solid var(--gf-line); width: 100%; float: none; }
.ff-items table { font-size: .9rem; }
.ff-items td { padding: .15rem; }
#ff-stage { background: #e3edf2; border-radius: .6rem; padding: 8px; overflow: hidden; position: relative; }
#ff-scale .paper-page { box-shadow: 0 2px 12px rgba(0,0,0,.15); }
.ff-privacy { font-size: .76rem; line-height: 1.35; color: var(--gf-ok); display: flex; gap: .4rem; align-items: flex-start; }
.ff-actions .form-check { margin-bottom: .4rem !important; }
.ff-actions .form-check-label { font-size: .74rem; line-height: 1.3; }
.ff-actions #ff-draft-note, .ff-actions .ff-help { font-size: .74rem; line-height: 1.35; }

/* ---------- ส่วนท้าย ---------- */
.gf-footer { color: rgba(255,255,255,.78); font-size: .92rem; background: var(--gf-ink); }
.gf-footer strong { color: #fff; }
.gf-footer a { color: #fff; }
.gf-footer a:hover { color: var(--gf-seal-soft); }
.gf-footer .gf-copy { border-top: 1px solid rgba(255,255,255,.15); font-size: .85rem; color: rgba(255,255,255,.6); }

/* ---------- หลังบ้าน ---------- */
.ad-sidebar { background: var(--gf-ink); min-height: 100vh; }
.ad-sidebar a { color: rgba(255,255,255,.8); text-decoration: none; display: block; padding: .5rem 1rem; border-radius: .35rem; }
.ad-sidebar a:hover, .ad-sidebar a.active { background: rgba(255,255,255,.1); color: #fff; }
.ad-stat { background: #fff; border: 1px solid transparent; border-radius: var(--gf-radius); padding: 1rem 1.2rem; box-shadow: var(--gf-shadow-sm); }
.ad-stat .num { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.ad-stat .lbl { color: var(--gf-ink-soft); font-size: .9rem; }
.ad-bars { display: flex; align-items: flex-end; gap: .4rem; height: 150px; }
.ad-bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .2rem; }
.ad-bar .b { width: 100%; max-width: 34px; border-radius: .35rem .35rem 0 0; background: linear-gradient(180deg, #14a3c4, var(--gf-seal)); min-height: 2px; }
.ad-bar .v { font-size: .72rem; color: var(--gf-ink-soft); }
.ad-bar .d { font-size: .7rem; color: var(--gf-ink-soft); }
.table-gf { background: #fff; }
.table-gf th { font-weight: 600; background: #eaf2f6 !important; white-space: nowrap; }
textarea.code { font-family: Consolas, 'Courier New', monospace; font-size: .85rem; }

/* โฟกัสที่มองเห็นชัด (การเข้าถึง) */
:focus-visible { outline: 3px solid rgba(14,116,144,.55); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .no-print { display: none !important; } }

/* ช่องกรอกพื้นขาวเสมอ (ไม่รับสีพื้นกระดาษของหน้า) */
.form-control, .form-select { background-color: #fff; }
.form-control::placeholder { color: #8a99a6; }
