/*
 * Pali Help Desk layout contract v1.4.54
 * This file intentionally loads after frontend.css.
 * It is the single authority for the site-header gold rule and support-page edges.
 */

:root {
  --phdui-contract-gold: #ffc000;
  --phdui-contract-green: #005a57;
}

/*
 * v1.4.54 — Keep Astra's primary navigation/dropdown outside the Help Desk
 * layout layer. Help Desk content must never clip or cover the site submenu.
 */
html body.phdui-support-ui #masthead,
html body.phdui-support-ui #masthead .ast-primary-header-bar,
html body.phdui-support-ui #masthead .main-header-bar,
html body.phdui-support-ui #masthead nav,
html body.phdui-support-ui #masthead .main-header-menu,
html body.phdui-support-ui #masthead .menu-item-has-children {
  overflow: visible !important;
}

html body.phdui-support-ui #masthead {
  position: relative !important;
  z-index: 99999 !important;
}

html body.phdui-support-ui #masthead .sub-menu,
html body.phdui-support-ui #masthead .children,
html body.phdui-support-ui #masthead [class*="dropdown"] {
  z-index: 100000 !important;
}

/* Sarabun is the visual contract for every support screen. */
html body.phdui-support-ui,
html body.phdui-support-ui :is(h1,h2,h3,h4,h5,h6,p,a,span,li,label,button,input,select,textarea,th,td,strong,small) {
  font-family: "Sarabun", Arial, sans-serif !important;
}

/*
 * The ONLY top gold rule: attach it to the bottom edge of Astra's complete header.
 * Never draw this line on #content or on a shortcode root.
 */
html body.phdui-support-ui #masthead,
html body.phdui-support-ui header#masthead,
html body.phdui-support-ui .site-header#masthead {
  border-bottom: 4px solid var(--phdui-contract-gold) !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Remove every legacy/content line that caused the detached gold stripe. */
html body.phdui-support-ui #page #content,
html body.phdui-support-ui #content.site-content,
html body.phdui-support-ui .site-content,
html body.phdui-support-ui #primary,
html body.phdui-support-ui .content-area,
html body.phdui-support-ui main.site-main,
html body.phdui-support-ui article,
html body.phdui-support-ui .entry-content,
html body.phdui-support-ui #content > .ast-container,
html body.phdui-support-ui #content .ast-container,
html body.phdui-support-ui .ast-article-single,
html body.phdui-support-ui .entry-content > .elementor,
html body.phdui-support-ui .entry-content > .e-con,
html body.phdui-support-ui .entry-content > .elementor > .elementor-element,
html body.phdui-support-ui #content .elementor-section-wrap,
html body.phdui-support-ui #content .e-con.e-parent {
  border-top: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Disable all former pseudo-elements which drew a second/detached top line. */
html body.phdui-support-ui .phdui-helpdesk-page::before,
html body.phdui-support-ui .phdui-helpdesk-page::after,
html body.phdui-support-ui .phdui-root.phdui-ticket-root::before,
html body.phdui-support-ui .phdui-track-page::before,
html body.phdui-support-ui .phdui-faq-page::before,
html body.phdui-support-ui .phdui-kb-landing::before {
  content: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Shortcodes own content only; the theme header owns the top gold edge. */
html body.phdui-support-ui .phdui-helpdesk-page,
html body.phdui-support-ui .phdui-root.phdui-ticket-root,
html body.phdui-support-ui .phdui-track-page,
html body.phdui-support-ui .phdui-faq-page,
html body.phdui-support-ui .phdui-kb-landing {
  border-top: 0 !important;
  margin-top: 0 !important;
}

/* =====================================================================
 * ขอบทองล่าง — กฎเดียว ใช้ทุกหน้า (v1.4.50)
 * ---------------------------------------------------------------------
 * หลักการเดียวกับขอบบน (ที่ผูกกับ #masthead จุดเดียวใช้ทุกหน้า):
 * เส้นทองล่าง = ขอบบนของ "แถบ social สีขาว" ซึ่งเป็นรอยต่อจริง เขียว->ขาว
 * ในทุกหน้าศูนย์ช่วยเหลือ. แถบขาวมี 2 คลาสตามที่มาของหน้า:
 *   .phdui-social-white-band  (แจ้งปัญหา/ติดตาม/คำถามพบบ่อย/helpdesk)
 *   .phdui-kb-social-band     (ฐานความรู้)
 * วิธี: (1) ล้างเส้นทองแบบเก่าทุกจุด (2) ทำแถบขาวให้ไม่มีเส้นของตัวเอง
 * (3) วาดเส้นทองจุดเดียวที่ "ขอบบน footer (#colophon)" ซึ่งมีทุกหน้า
 * (4) ยุบพื้นเขียวที่โผล่คั่นระหว่างแถบขาวกับ footer.
 * ===================================================================== */

/* ยกเลิกเส้น/ขอบทองแบบเก่าทุกจุด กันไม่ให้ซ้อนหรือร่วงตำแหน่ง */
html body.phdui-support-ui .phdui-faq-page,
html body.phdui-support-ui .phdui-track-page,
html body.phdui-support-ui .phdui-kb-landing,
html body.phdui-support-ui .phdui-root.phdui-ticket-root {
  border-bottom: 0 !important;
}
html body.phdui-support-ui .phdui-root.phdui-ticket-root::after,
html body.phdui-support-ui .phdui-helpdesk-page > .phdui-root.phdui-ticket-root::after {
  content: none !important;
  display: none !important;
}

/* แถบ social ขาว: พื้นขาว + เส้นทองที่ "ขอบบน" = รอยต่อ เขียว->ขาว (จุดเดียว ทุกหน้า) */
html body.phdui-support-ui .phdui-social-white-band,
html body.phdui-support-ui .phdui-kb-social-band {
  position: relative !important;
  z-index: 3 !important;
  background: #ffffff !important;
  border-bottom: 0 !important;
  margin-bottom: 0 !important;
}

/* เส้นทองเต็มจอที่ขอบบนแถบขาว — วาดด้วย ::before pin ไว้บนสุดของแถบ
 * (ใช้ ::before แทน border-top เพราะแถบ helpdesk มี border-top:72px ขาวเป็น breathing space อยู่แล้ว)
 * v1.4.96 — พบจริงจาก DevTools: หน้า KB มีปุ่มแชร์จาก <ul class="seed-social">
 * ของปลั๊กอิน/ธีมอื่น (ไม่ใช่ #phdui-kb-social-band ของเรา) และ JS ไปติด
 * class phdui-social-white-band ให้ตัวนั้นก่อน เพราะเจอลิงก์ Facebook ก่อน
 * เพิ่ม :not(.seed-social) กันเส้นนี้ไปวาดทับปุ่มแชร์ตัวจริงบนหน้า KB ด้วย */
html body.phdui-support-ui .phdui-social-white-band:not(.phdui-kb-social-band):not(.seed-social)::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 100vw !important;
  height: 4px !important;
  background: var(--phdui-contract-gold) !important;
  z-index: 5 !important;
  pointer-events: none !important;
}

/* KB band: ไม่มี border breathing → เส้นอยู่ที่ top:0 พอดี */
/* หน้า Knowledge Base ไม่ต้องมีเส้นคั่นเหนือปุ่มแชร์ */
html body.phdui-support-ui .phdui-kb-social-band::before,
html body.phdui-support-ui .phdui-kb-social-band::after,
html body.phdui-kb-page .phdui-kb-social-band::before,
html body.phdui-kb-page .phdui-kb-social-band::after {
  content: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* v1.4.92 — frontend.js เติม .phdui-social-white-band ให้แถบ KB หลังหน้าโหลด
 * selector วาดเส้นทั่วไปด้านบนจึงเคยชนะ selector ลบเส้นเดิมด้วย specificity
 * ที่สูงกว่า กฎนี้เจาะจง KB และชนะตัววาดเส้นโดยตรง */
html body.phdui-support-ui .phdui-kb-landing .phdui-social-white-band::before,
html body.phdui-support-ui .phdui-kb-landing .phdui-social-white-band::after,
html body.phdui-support-ui .phdui-kb-social-band.phdui-social-white-band::before,
html body.phdui-support-ui .phdui-kb-social-band.phdui-social-white-band::after,
html body.phdui-kb-page .phdui-kb-landing .phdui-social-white-band::before,
html body.phdui-kb-page .phdui-kb-landing .phdui-social-white-band::after {
  content: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* helpdesk band: มี border-top:72px ขาว → absolute วัดจาก padding box (ในเส้นขอบ)
 * ต้องเลื่อนขึ้น -72px ให้เส้นทองไปอยู่ขอบบนสุดจริงของแถบ (รอยต่อเขียว->ขาว) */
html body.phdui-support-ui .phdui-social-white-band:not(.phdui-kb-social-band)::before {
  top: -72px !important;
}

/* v1.4.94: KB ไม่ใช้เส้นคั่นเต็ม viewport ไม่ว่ากฎหรือ JavaScript จะเติมคลาสใด */
html body #phdui-kb-social-band,
html body #phdui-kb-social-band::before,
html body #phdui-kb-social-band::after {
  border-top: 0 !important;
  border-bottom: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
html body #phdui-kb-social-band::before,
html body #phdui-kb-social-band::after {
  content: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

/* v1.4.96 — ตัวการจริงที่พบจาก DevTools: <ul class="seed-social"> ของปลั๊กอิน
 * แชร์อีกตัว (ไม่ใช่ของเรา) ถูก JS ติด class phdui-social-white-band ให้ก่อน
 * #phdui-kb-social-band เพราะเจอปุ่ม Facebook ในนั้นก่อนตามลำดับ DOM ปิดเส้น
 * ทุกจุด (::before/::after + border/box-shadow) โดยตรงที่ .seed-social เลย
 * ใช้ specificity สูงสุดเท่าที่ทำได้ (ไม่มี id เพราะ .seed-social เป็น class
 * จาก plugin อื่น) และวางไว้ท้ายไฟล์เพื่อชนะลำดับโหลด */
html body .seed-social,
html body .seed-social::before,
html body .seed-social::after,
html body .seed-social.phdui-social-white-band,
html body .seed-social.phdui-social-white-band::before,
html body .seed-social.phdui-social-white-band::after {
  border-top: 0 !important;
  border-bottom: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
html body .seed-social::before,
html body .seed-social::after,
html body .seed-social.phdui-social-white-band::before,
html body .seed-social.phdui-social-white-band::after {
  content: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

/* footer: ไม่ต้องมีเส้นทองของตัวเอง (เส้นเดียวอยู่ที่ขอบบนแถบขาวแล้ว) */
html body.phdui-support-ui #colophon,
html body.phdui-support-ui footer.site-footer,
html body.phdui-support-ui footer[id="colophon"] {
  border-top: 0 !important;
  margin-top: 0 !important;
}

/* กันแถบเขียวโผล่คั่นระหว่างแถบขาวกับ footer:
 * element ใด ๆ ที่ตามหลังแถบ social ขาว (ก่อนถึง footer) ยุบพื้นเขียว/ระยะห่างทิ้ง
 * ให้แถบขาวต่อชิด footer ทันที ไม่มีเขียวโผล่คั่น
 *
 * v1.4.52: จำกัดขอบเขตให้ปลอดภัย — ยกเว้น header/เมนู/ทุกอย่างที่มีเมนูย่อย
 * เพราะ ~ * (general sibling) เดิมเหมารวม dropdown ของ Astra ที่ถูก render
 * เป็น sibling ในหน้า support ทำให้เมนูย่อยถูกยัด height:0 + overflow:hidden
 * แล้วกางไม่ออก. เพิ่ม :not() กันทุก element ที่เป็น/มี navigation ไว้. */
html body.phdui-support-ui .phdui-social-white-band ~ *:not(#colophon):not(footer):not(.site-footer):not(#masthead):not(header):not(.site-header):not(.ast-primary-header-bar):not([class*="header"]):not([class*="menu"]):not(nav):not([role="navigation"]),
html body.phdui-support-ui .phdui-kb-social-band ~ *:not(#colophon):not(footer):not(.site-footer):not(#masthead):not(header):not(.site-header):not(.ast-primary-header-bar):not([class*="header"]):not([class*="menu"]):not(nav):not([role="navigation"]) {
  border-top: 0 !important;
  border-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  background: transparent !important;
  overflow: hidden !important;
}
