/* ═══════════════════════════════════════════════════════════════
   board.css — เว็บบอร์ด Q&A (QA.php · ShowBoard.php) ใช้ร่วมกับ site.css + detail.css + list.css
   ไม่พึ่งไลบรารี/CDN ภายนอก
   ═══════════════════════════════════════════════════════════════ */

/* ── รายการกระทู้ ─────────────────────────────────────────── */
.bd-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.bd-item { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px 16px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.bd-item:hover { border-color: var(--blue-2); box-shadow: var(--shadow); }
.bd-item.is-answered { border-left-color: #15803d; }
.bd-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--sky); color: var(--blue); }
.bd-item.is-answered .bd-ico { background: #dcfce7; color: #15803d; }
.bd-body { min-width: 0; }
.bd-body h2 { margin: 0 0 2px; font-size: 1.02rem; line-height: 1.5; font-weight: 600; }
.bd-body h2 a { color: var(--navy); overflow-wrap: anywhere; }
.bd-body h2 a:hover { color: var(--blue); text-decoration: none; }
.bd-body h2 a::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }   /* คลิกได้ทั้งแถว */
.bd-body h2 a:focus-visible { outline: none; }
.bd-body h2 a:focus-visible::after { outline: 3px solid var(--gold); outline-offset: 2px; }
.bd-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: center; color: var(--muted); font-size: .82rem; }
.bd-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.bd-badge { padding: 1px 10px; border-radius: 99px; background: #fef3c7; color: #92400e; font-weight: 600; font-size: .72rem; }
.bd-badge-ans { background: #dcfce7; color: #15803d; }
.ls-bar .bd-new { margin-left: auto; }

/* ── ข้อความแจ้ง ─────────────────────────────────────────── */
.bd-alert { margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; font-size: .95rem; line-height: 1.6; }
.bd-alert ul { margin: 0; padding-left: 1.2em; }
.bd-alert-ok  { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.bd-alert-err { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }

/* ── ฟอร์มตั้งกระทู้ ───────────────────────────────────── */
.bd-form { display: grid; gap: 16px; max-width: 760px; }
.bd-field { display: grid; gap: 6px; min-width: 0; }
.bd-field label { font-weight: 600; color: var(--navy); }
.bd-field .req { color: var(--red); }
.bd-field input[type="text"], .bd-field input[type="email"], .bd-field input[type="tel"], .bd-field textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font: 400 1rem/1.6 var(--font); background: #fff; color: var(--ink);
}
.bd-field textarea { resize: vertical; min-height: 150px; }
.bd-field input:focus-visible, .bd-field textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.bd-field small, .bd-note { color: var(--muted); font-size: .85rem; margin: 0; }
.bd-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bd-cap input { max-width: 120px; }
.bd-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
/* honeypot — คนมองไม่เห็น/โฟกัสไม่ได้ (บอตมักกรอก) */
.bd-hp { position: absolute !important; left: -9999px !important; top: auto !important; width: 1px; height: 1px; overflow: hidden; }

/* ── หน้ากระทู้ (ShowBoard.php) ───────────────────────────── */
.bd-thread { display: grid; gap: 18px; }
.bd-post { padding: clamp(16px, 2.4vw, 26px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.bd-post header { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); color: var(--muted); font-size: .88rem; }
.bd-post header b { color: var(--navy); font-size: 1rem; }
.bd-post header span { display: inline-flex; align-items: center; gap: 5px; }
.bd-text { margin: 0; line-height: 1.85; overflow-wrap: anywhere; color: #243350; }
.bd-answer { border-color: #86efac; background: #f0fdf4; }
.bd-answer .bd-tag { display: inline-block; margin-bottom: 8px; padding: 2px 12px; border-radius: 99px; background: #15803d; color: #fff; font-weight: 600; font-size: .78rem; }
.bd-wait { padding: 14px 18px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: #fafbfe; }

/* ไฟล์แนบของคำตอบ */
.bd-files { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed #86efac; }
.bd-file-img img { display: block; max-width: min(100%, 420px); max-height: 320px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.bd-file-pdf { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--navy); font-weight: 600; overflow-wrap: anywhere; }
.bd-file-pdf:hover { border-color: var(--blue-2); text-decoration: none; }
.bd-file-pdf small { color: var(--muted); font-weight: 400; }

@media (max-width: 760px) {
  .bd-row { grid-template-columns: 1fr; }
  .bd-item { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; padding: 10px 12px; }
  .bd-ico { width: 38px; height: 38px; }
  .ls-bar .bd-new { margin-left: 0; width: 100%; text-align: center; justify-content: center; }
}
@media print { .bd-actions, .ls-bar { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .bd-item { transition: none; } }
