/* ============================================
   custom.css — tpl_govcore
   ============================================ */

/* ขยายความกว้างเนื้อหา (เดิม 1240px ดูแคบ) */
:root { --container: 1400px !important; }


/* ══════════════════════════════════════════════
   1. FLEXIcontent — ฟอร์มเขียนข่าว
   ══════════════════════════════════════════════ */

#adminForm input[type="text"],
#adminForm textarea,
#adminForm select {
  width:100% !important; max-width:100% !important;
  padding:10px 13px !important; border:1.5px solid #dde1e7 !important;
  border-radius:8px !important; font-size: 0.9375rem !important;
  color:#1a2a4a !important; background:#fbfcfd !important;
  box-sizing:border-box !important;
}
#adminForm input[type="text"]:focus,
#adminForm textarea:focus,
#adminForm select:focus {
  outline:none !important; border-color:#1a2a4a !important; background:#f3f7fd !important;
}
#adminForm label { font-weight:600 !important; color:#1a2a4a !important; }
#adminForm .nav-tabs > li > a { color:#1a2a4a !important; font-weight:600 !important; }
#adminForm .nav-tabs > li.active > a {
  background:#1a2a4a !important; color:#e8bc3a !important; border-color:#1a2a4a !important;
}
#adminForm .fields_tabset ul.tabbernav > li:nth-child(n+3) { display:none !important; }
#adminForm .btn-primary,
#adminForm button[type="submit"],
#adminForm input[type="submit"] {
  background:#1a2a4a !important; color:#e8bc3a !important;
  border:2px solid #1a2a4a !important; padding:9px 22px !important;
  border-radius:8px !important; font-weight:600 !important;
}
#adminForm .alert,
#adminForm .fc-mssg-inline { display:none !important; }
.alert-message { display:none !important; }


/* ══════════════════════════════════════════════
   2. JCE Editor
   ══════════════════════════════════════════════ */

#adminForm .mce-statusbar,
#adminForm .mceStatusbar,
#adminForm .wf-editor-footer,
#adminForm .wf-editor-buttons,
#adminForm .fcfield-text-buttons,
#adminForm #editor-xtd-buttons { display:none !important; }


/* ══════════════════════════════════════════════
   3. Google Translate — แก้ font เฉพาะ front-end
   ══════════════════════════════════════════════ */

/* ใช้ scope .site-header .site-content .site-footer แทน body *
   เพื่อไม่ให้ทับ icon font ใน admin/editor */
.site-header, .site-header *,
.site-content, .site-content *,
.site-footer, .site-footer *,
.topbar, .topbar *,
.translated-ltr .site-header *,
.translated-ltr .site-content *,
.translated-ltr .site-footer * {
  font-family: 'Sarabun', 'Noto Sans Thai', sans-serif !important;
}

body { top:0 !important; margin-top:0 !important; }
.goog-text-highlight { background:none !important; box-shadow:none !important; }


/* ══════════════════════════════════════════════
   4. FLEXIcontent carousel — สีหัวข้อข่าว
   ══════════════════════════════════════════════ */

.carousel.mod_flexicontent_wrapper .fcitem_title,
.carousel.mod_flexicontent_wrapper .fcitem_title a { color:#1a2a4a !important; }


/* ══════════════════════════════════════════════
   5. FAB ช่องทางสอบถามข้อมูล
   ══════════════════════════════════════════════ */

#tmc-fab { bottom:100px !important; pointer-events:none !important; }
#tmc-fab .fab-trigger,
#tmc-fab.is-open .fab-item,
#tmc-fab.is-open .fab-btn,
#tmc-fab.is-open .fab-label { pointer-events:auto !important; }
#tmc-fab .fab-tooltip { display:none !important; }
#tmc-fab.is-open .fab-tooltip { display:block !important; pointer-events:auto !important; }

@media (max-width:600px) {
  #tmc-fab { bottom:70px !important; }
}


/* ══════════════════════════════════════════════
   เพิ่ม override อื่นๆ ได้ด้านล่างนี้
   ══════════════════════════════════════════════ */

/* ----- ขนาดตัวอักษรทั้งเว็บ (เดิม 17px → 15px) ----- */
.site-header, .site-content, .site-footer {
  font-size: 0.9375rem;
}

/* ----- หัวข้อข่าว FLEXIcontent ย่อเหลือ 90% ----- */
.news.mod_flexicontent_wrapper .fcitem_title_box .fcitem_title,
.news.mod_flexicontent_wrapper .fcitem_title_box .fcitem_title a,
.news.mod_flexicontent_wrapper .fcitem_title,
.news.mod_flexicontent_wrapper .fcitem_title a {
  font-size: 90% !important;
  line-height: 1.45 !important;
}

/* ----- ดันเมนูรายการสุดท้าย ("ติดต่อเรา") ไปชิดขวา -----
   govcore: <ul class="nav menu"> อยู่ใน .nav-collapse */
.mainnav .nav-collapse > ul > li:last-child {
  margin-left: auto;
}
.mainnav .nav-collapse > ul > li:last-child > a {
  border-left: 1px solid rgba(255,255,255,0.08);
}
@media (max-width: 980px) {
  .mainnav .nav-collapse > ul > li:last-child {
    margin-left: 0;
  }
}

/* ============================================
   Mobile menu fix — responsive nav
   ============================================ */
@media (max-width: 980px) {
  .mainnav.is-stuck .container,
  .mainnav .container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  .nav-collapse {
    width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
  }
  .mainnav .nav-collapse a {
    white-space: nowrap !important;
    padding: 14px 24px !important;
  }
}

/* ============================================
   แก้หน้าล้นแนวนอนบนมือถือ (เหมือนสบปราบ)
   - แถบบน (ปรับขนาดอักษร/โหมด/ไทย-EN) ให้ห่อบรรทัด ไม่ดันจอ
   - กันไม่ให้อะไรก็ตามกว้างเกินจอ
   ============================================ */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
}
@media (max-width: 980px) {
  .topbar .container {
    flex-wrap: wrap !important;
    justify-content: center !important;
    row-gap: 4px;
  }
  .topbar .right {
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
}

/* ============================================
   ซ่อนกล่อง ads-top ถ้าเนื้อหาข้างในว่างเปล่าจริงๆ
   (โมดูล publish อยู่แต่ไม่มีรูป/ข้อความ)
   ============================================ */
.ads-top-guard .container:empty,
.ads-top-guard:has(.container:empty) {
  display: none !important;
}
.ads-top-guard .container:blank {
  display: none !important;
}

/* ----- รูปในเนื้อหาไม่ให้ล้นกรอบ (เหมือนสบปราบ) ----- */
.item-page img,
.article-content img {
  max-width: 100% !important;
  height: auto !important;
}

/* ============================================
   footer-4: บังคับกล่องตัวนับให้เต็มความกว้าง
   (โมดูลนับเรนเดอร์เป็นกล่องกว้างครึ่งเดียว — ดันให้เต็ม 2-3 ชั้น)
   ============================================ */
.footer-staff-bar .fsb-public,
.footer-staff-bar .fsb-public > *:not(style):not(script):not(link),
.footer-staff-bar .fsb-public > * > *:not(style):not(script):not(link) {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
/* แถวตัวเลข (ตาราง/flex) ให้กระจายเต็มความกว้าง */
.footer-staff-bar .fsb-public table {
  width: 100% !important;
  table-layout: fixed !important;
}
.footer-staff-bar .fsb-public ul {
  display: flex !important;
  width: 100% !important;
  justify-content: space-between !important;
  margin: 0 !important;
  padding: 0 !important;
}
/* ตัวนับ #vcwj + ทุก wrapper แม่ ยืดเต็ม (กล่องนับกว้างครึ่งเดียวเพราะ wrapper หด) */
.footer-staff-bar .fsb-public #vcwj {
  width: 100% !important;
  display: flex !important;
}
.footer-staff-bar :is(.moduletable, .custom, [class*="module"]) {
  width: 100% !important;
}

/* ============================================
   ฟุตเตอร์: พินพื้นหลังเขียวเข้ม + ตัวอักษรอ่านชัด
   (กันปัญหาตัวหนังสือกลืนพื้น เมื่อสีหลัก-เข้มถูกตั้งเป็นสีอ่อน)
   ============================================ */
.site-footer {
  background: #004b28 !important;
  color: #cfe8da !important;
}
.site-footer .name,
.site-footer h4 {
  color: #fff !important;
}
.site-footer p,
.site-footer li,
.site-footer .colophon {
  color: #bfe0cd !important;
}
.site-footer a,
.site-footer .colophon a {
  color: #d9f2e5 !important;
}
.site-footer a:hover { color: #fff !important; }

/* แถบบนสุด (topbar): พินเขียวเข้ม + ตัวอักษรอ่านชัด */
.topbar {
  background: #004b28 !important;
  color: #cfe8da !important;
}
.topbar a { color: #d9f2e5 !important; }
.topbar a:hover { color: #fff !important; }
.topbar .pill { color: #fff !important; }
.topbar button {
  color: #e0f3e9 !important;
  border-color: rgba(255,255,255,.35) !important;
}


/* ============================================
   DARKMODE-OVERRIDE
   custom.css โหลดหลัง template.css และตั้ง .topbar/.site-footer
   ด้วย !important ทำให้ body.dark-mode ใน template.css แพ้
   จึงประกาศซ้ำที่นี่พร้อม !important
   ============================================ */
body.dark-mode .topbar,
body.dark-mode .site-footer { background: #05121f !important; }

body.dark-mode .topbar,
body.dark-mode .topbar a,
body.dark-mode .site-footer,
body.dark-mode .site-footer p,
body.dark-mode .site-footer li,
body.dark-mode .site-footer a,
body.dark-mode .site-footer .colophon,
body.dark-mode .site-footer .colophon a { color: #e4e8f2 !important; }

body.dark-mode .site-footer .name,
body.dark-mode .site-footer h4 { color: #ffffff !important; }

body.dark-mode .topbar a:hover,
body.dark-mode .site-footer a:hover { color: #ffffff !important; }


/* HIDE-RAW-TAGS — กัน <style>/<script> ในโมดูลโผล่เป็นข้อความ */
.site-footer style, .site-footer script,
.footer-staff-bar style, .footer-staff-bar script,
.mod-custom style, .mod-custom script,
.custom style, .custom script { display: none !important; }


/* ============================================
   ANNOUNCE-DARK-CONTRAST
   โหมดมืด: แถบประกาศพื้นเป็นน้ำเงินเข้ม แต่ตัวอักษรยังเขียวเข้ม
   -> contrast 1.52:1 (WCAG AA ต้อง >= 4.5:1)
   ============================================ */
body.dark-mode .announce,
body.dark-mode .announce .container,
body.dark-mode .announce .marquee,
body.dark-mode .announce .mod-custom,
body.dark-mode .announce .custom,
body.dark-mode .announce a { color: #f0d894 !important; }

body.dark-mode .announce .label {
  background: #f0d894 !important;
  color: #14203a !important;
}


/* ============================================
   HC-LABEL-FIX
   high-contrast: ป้าย "ประกาศ" หลุดจากกฎดำ/ขาว (4.45:1)
   ============================================ */
body.high-contrast .announce .label {
  background: #ffffff !important;
  color: #000000 !important;
  border: 1px solid #ffffff !important;
}


/* ============================================
   VISUALLY-HIDDEN-J5
   J4 ใช้คลาส .sr-only แต่ J5 เปลี่ยนเป็น .visually-hidden
   เทมเพลตมีแต่ .sr-only ทำให้ข้อความที่ควรซ่อน (เช่นชื่อเมนู
   ที่แสดงเป็นไอคอน) โผล่ออกมาหลังอัป J5
   ============================================ */
.visually-hidden:not(:focus):not(:focus-within),
.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
