/* ===========================================================================
   Footer ตามแบบ Figma — template 107198 "spufoot" (สร้างด้วย tools/build-footer.php)
   ตัวอักษร/สี ตั้งใน widget ของ Elementor · ไฟล์นี้ดูแลแค่ตาราง เส้นแบ่ง และปุ่มติดต่อ

   จอคอมพ์                                       | โลโก้
   คณะ/สาขา | หน่วยงาน        | สื่อประชาสัมพันธ์  | ที่อยู่
            |-----------------+------------------| ติดต่อเรา (4 ปุ่ม)
            | โครงการฯ        | บุคลากร          | Social Media
   ---------------------------------------------
   นโยบายข้อมูลส่วนบุคคล ...                         Copyright
   About Faculty Story ...
   =========================================================================== */

.spu-foot {
  --ft-line: #3a293a;      /* เส้นแบ่งในตาราง */
  --ft-side: 300px;        /* ความกว้างแถบโลโก้ด้านขวา */
  --ft-gap: 20px;          /* ระยะระหว่างตารางกับแถบโลโก้ */
  --ft-pad: 20px;          /* ระยะข้อความจากเส้นแบ่ง */
}
.spu-foot > .e-con-inner { flex-direction: row !important; align-items: stretch; gap: var(--ft-gap) !important; }

/* ---- ตารางเมนู ---- */
.spu-foot .spu-foot__links {
  flex: 1 1 0 !important;
  min-width: 0;
  width: auto !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto 1fr;
}
.spu-foot .spu-foot__cell { width: auto !important; max-width: none !important; display: block !important; padding: 0 var(--ft-pad) 26px !important; }
.spu-foot .spu-foot__cell--fac   { grid-column: 1; grid-row: 1 / span 2; padding-left: 0 !important; }
.spu-foot .spu-foot__cell--dept  { grid-column: 2; grid-row: 1; }
.spu-foot .spu-foot__cell--media { grid-column: 3; grid-row: 1; }
.spu-foot .spu-foot__cell--proj  { grid-column: 2; grid-row: 2; }
.spu-foot .spu-foot__cell--staff { grid-column: 3; grid-row: 2; }
.spu-foot .spu-foot__cell--dept,
.spu-foot .spu-foot__cell--media,
.spu-foot .spu-foot__cell--proj,
.spu-foot .spu-foot__cell--staff { border-left: 1px solid var(--ft-line); }
.spu-foot .spu-foot__cell--proj,
.spu-foot .spu-foot__cell--staff { border-top: 1px solid var(--ft-line); padding-top: 26px !important; }

.spu-foot .spu-foot__cell > .elementor-widget { margin-bottom: 0; }
.spu-foot .spu-foot__head .elementor-heading-title a { color: inherit; font: inherit; }
.spu-foot .spu-foot__menu .elementor-nav-menu--main .elementor-item { justify-content: flex-start; }
.spu-foot .spu-foot__pink a,
.spu-foot .spu-foot__pill a,
.spu-foot-bottom a { font-size: inherit !important; }   /* Site Settings ตั้งลิงก์ไว้ 16px */
.spu-foot .spu-foot__pink .elementor-heading-title { padding: 5px 0; }

/* ---- แถบโลโก้ด้านขวา ---- */
.spu-foot .spu-foot__side {
  flex: 0 0 var(--ft-side) !important;
  width: var(--ft-side) !important;
  display: block !important;
  border-left: 3px solid #fff;
  padding: 0 0 26px 18px !important;
}
.spu-foot .spu-foot__logo img { width: 180px; }
.spu-foot .spu-foot__addr p { margin: 0; }

/* ปุ่มติดต่อ: แคปซูลดำมีเงา + วงกลมขาว */
.spu-foot .spu-foot__pill { margin-bottom: 9px !important; }
.spu-foot .spu-foot__pill .elementor-icon-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px 0 6px;
  flex-direction: row !important;
  text-align: left !important;
  gap: 10px;
  border-radius: 99px;
  background: linear-gradient(90deg, #050505 0%, #0d0d0d 70%, rgb(13 13 13 / 0) 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .04), 0 6px 14px rgb(0 0 0 / .45);
}
.spu-foot .spu-foot__pill .elementor-icon-box-icon { margin: 0 !important; display: flex; }
.spu-foot .spu-foot__pill .elementor-icon-box-title { margin: 0; }
.spu-foot .spu-foot__pill .elementor-icon-box-title a::before { content: ""; position: absolute; inset: 0; border-radius: inherit; }   /* กดได้ทั้งแคปซูล */

.spu-foot .spu-foot__social .elementor-social-icons-wrapper { justify-content: flex-start; }

/* ---- แถวล่าง ---- */
.spu-foot-bottom > .e-con-inner {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 40px;
  row-gap: 0 !important;
  align-items: start;
}
/* เส้นใต้ตาราง — ยาวเท่าตาราง ไม่ลอดใต้แถบโลโก้ */
.spu-foot-bottom > .e-con-inner::before {
  content: "";
  grid-column: 1 / -1;
  grid-row: 1;
  width: calc(100% - var(--ft-side, 300px) - 20px);
  height: 1px;
  margin-bottom: 16px;
  background: #3a293a;
}
.spu-foot-bottom .spu-foot-bottom__privacy { grid-column: 1; grid-row: 2; }
.spu-foot-bottom .spu-foot-bottom__nav     { grid-column: 1; grid-row: 3; }
.spu-foot-bottom .spu-foot-bottom__copy    { grid-column: 2; grid-row: 2; text-align: right; white-space: nowrap; }
.spu-foot-bottom .elementor-widget-text-editor { width: auto !important; margin: 0 !important; }
.spu-foot-bottom p { margin: 0; }
.spu-foot-bottom__privacy a { margin-right: .45em; }
.spu-foot-bottom__nav a { margin-right: 1em; }

/* ---- แท็บเล็ต: แถบโลโก้ขึ้นไปด้านบน ตารางเต็มความกว้าง ---- */
@media (max-width: 1024px) {
  .spu-foot > .e-con-inner { flex-direction: column !important; gap: 0 !important; }
  .spu-foot .spu-foot__side {
    order: -1; flex-basis: auto !important; width: 100% !important;
    border-left: 0; border-bottom: 1px solid var(--ft-line);
    padding: 0 0 24px !important; margin-bottom: 30px;
  }
  .spu-foot .spu-foot__side { column-count: 2; column-gap: 48px; }
  .spu-foot .spu-foot__side > .elementor-widget { break-inside: avoid; }
  .spu-foot .spu-foot__side > .elementor-widget:nth-child(3) { break-before: column; margin-top: 0 !important; }   /* "ติดต่อเรา" ขึ้นคอลัมน์ขวา */
  .spu-foot .spu-foot__links { flex: none !important; width: 100% !important; }
  .spu-foot-bottom > .e-con-inner::before { width: 100%; }
}

/* ---- มือถือ: เรียงลงมาทีละส่วน ตามแบบ ---- */
@media (max-width: 767px) {
  .spu-foot .spu-foot__side { display: block !important; column-count: 1; padding-bottom: 22px !important; margin-bottom: 22px; }
  .spu-foot .spu-foot__side > .elementor-widget:nth-child(3) { break-before: auto; margin-top: 14px !important; }
  .spu-foot .spu-foot__links { display: block !important; }
  .spu-foot .spu-foot__cell { padding: 0 0 18px !important; border: 0 !important; }
  .spu-foot .spu-foot__head { margin-bottom: 8px !important; }

  .spu-foot-bottom > .e-con-inner { display: flex !important; flex-direction: column; gap: 16px !important; }
  .spu-foot-bottom > .e-con-inner::before { display: none; }
  .spu-foot-bottom .spu-foot-bottom__privacy { order: 1; border-top: 1px solid #3a293a; padding-top: 16px; }
  .spu-foot-bottom .spu-foot-bottom__copy    { order: 2; text-align: right; white-space: normal; }
  .spu-foot-bottom .spu-foot-bottom__nav     { order: 3; }
  .spu-foot-bottom__privacy a { display: block; margin: 0; }
}

/* กล่องสคริปต์ท้าย footer (PDPA cookie + แชท) — ไม่ต้องเห็นเป็นแถบเทา */
.elementor-location-footer > .e-con:not(.spu-foot):not(.spu-foot-bottom) { padding: 0 !important; min-height: 0; background: #0a0a0a; }
.elementor-location-footer > .e-con:not(.spu-foot):not(.spu-foot-bottom) .elementor-widget-shortcode { margin: 0; }

/* มือถือ: เว้นที่ด้านล่างให้ปุ่มแชทลอย ไม่บังลิงก์ Contact */
@media (max-width: 767px) {
  .spu-foot-bottom > .e-con-inner { padding-bottom: 72px !important; }
}
