/* ==========================================================
   Header & Footer — ThaiBoiler
   โทนหลัก: แดง / ขาว / ดำ  สไตล์เรียบ กึ่งทางการ
   ========================================================== */

:root {
  --tb-red: #881c1c;
  --tb-red-dark: #6c1515;
  --tb-red-soft: #f7eded;
  --tb-black: #161616;
  --tb-ink: #222222;
  --tb-muted: #6b6b6b;
  --tb-line: #e8e8e8;
  --tb-white: #ffffff;
  --tb-radius: 6px;
  --tb-ease: cubic-bezier(.2, .7, .2, 1);
}

.tb-header ul,
.tb-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tb-header svg,
.tb-footer svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex: none;
}

/* ---------- Header ---------- */

/* function.js ใส่ .fixed ตอนเลื่อนขึ้น — ใช้ sticky แทน fixed เพื่อไม่ให้หน้ากระโดด */
#navbar.tb-header,
#navbar.tb-header.fixed {
  position: sticky !important;
  top: 0;
  z-index: 999;
  width: 100%;
  font-family: "Prompt", sans-serif;
}

/* แถบบน */
.tb-topbar {
  background: var(--tb-black);
  color: #cfcfcf;
  font-size: 13px;
  font-weight: 300;
  line-height: 1;
}

.tb-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  gap: 16px;
}

.tb-topbar a,
.tb-topbar button {
  color: #cfcfcf;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .2s;
}

.tb-topbar a:hover,
.tb-topbar button:hover {
  color: var(--tb-white);
}

.tb-topbar svg {
  width: 14px;
  height: 14px;
  opacity: .8;
}

.tb-topbar-contact {
  display: flex;
  gap: 24px;
}

.tb-topbar-links {
  display: flex;
  align-items: center;
}

.tb-topbar-links > li {
  position: relative;
  padding: 0 14px;
}

.tb-topbar-links > li + li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 12px;
  margin-top: -6px;
  background: #3d3d3d;
}

.tb-topbar-links > li:last-child {
  padding-right: 0;
}

.tb-lang span {
  color: #8a8a8a;
  letter-spacing: .5px;
}

.tb-lang .is-current {
  color: var(--tb-white);
  font-weight: 500;
}

.tb-lang-sep {
  margin: 0 6px;
  color: #4a4a4a !important;
}

/* เมนูสมาชิก (หลัง login) */
.tb-member-toggle {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.tb-member-toggle .tb-caret {
  width: 14px;
  height: 14px;
}

.tb-member-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  min-width: 210px;
  padding: 6px 0;
  background: var(--tb-white);
  border-radius: var(--tb-radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .2s, transform .2s var(--tb-ease), visibility .2s;
  z-index: 10;
}

.tb-member-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}

.tb-member:hover .tb-member-menu,
.tb-member.is-open .tb-member-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.tb-member-menu a,
.tb-member-menu span {
  display: block !important;
  padding: 10px 18px;
  color: var(--tb-ink) !important;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
}

.tb-member-menu a:hover {
  background: var(--tb-red-soft);
  color: var(--tb-red) !important;
}

.tb-member-menu .is-disabled {
  color: #b0b0b0 !important;
  cursor: default;
}

.tb-member-menu .tb-logout {
  border-top: 1px solid var(--tb-line);
  margin-top: 4px;
}

/* แถบหลัก */
.tb-mainbar {
  background: var(--tb-white);
  border-bottom: 3px solid var(--tb-red);
  transition: box-shadow .25s;
}

.tb-header.is-scrolled .tb-mainbar {
  box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
}

.tb-mainbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  gap: 24px;
}

.tb-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--tb-ink);
  min-width: 0;
}

.tb-brand img {
  height: 60px;
  width: auto;
  flex: none;
  transition: height .25s var(--tb-ease);
}

.tb-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  padding-left: 14px;
  border-left: 1px solid var(--tb-line);
}

.tb-brand-text strong {
  font-size: 17px;
  font-weight: 600;
  color: var(--tb-black);
}

.tb-brand-text small {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--tb-muted);
  letter-spacing: .6px;
  text-transform: uppercase;
  margin-top: 3px;
}

.tb-brand:hover strong {
  color: var(--tb-red);
}

/* เมนูหลัก */
.tb-nav > ul {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tb-nav > ul > li {
  position: relative;
}

.tb-nav > ul > li > a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 14px;
  color: var(--tb-ink);
  font-size: 15px;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s;
}

.tb-nav > ul > li > a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  background: var(--tb-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s var(--tb-ease);
}

.tb-nav > ul > li > a:hover,
.tb-nav > ul > li > a.is-active {
  color: var(--tb-red);
}

.tb-nav > ul > li > a:hover::after,
.tb-nav > ul > li > a.is-active::after {
  transform: scaleX(1);
}

.tb-nav .tb-caret {
  width: 18px;
  height: 18px;
  margin-right: -4px;
  opacity: .6;
  transition: transform .2s;
}

.tb-has-sub:hover > a .tb-caret {
  transform: rotate(180deg);
}

/* ปุ่ม ติดต่อเรา */
.tb-nav > ul > li > a.tb-nav-cta {
  margin-left: 10px;
  padding: 10px 22px;
  background: var(--tb-red);
  color: var(--tb-white);
  border-radius: var(--tb-radius);
  font-weight: 500;
  transition: background .2s;
}

.tb-nav > ul > li > a.tb-nav-cta::after {
  display: none;
}

.tb-nav > ul > li > a.tb-nav-cta:hover,
.tb-nav > ul > li > a.tb-nav-cta.is-active {
  background: var(--tb-red-dark);
  color: var(--tb-white);
}

/* เมนูย่อย (dropdown) */
.tb-sub-toggle {
  display: none;
}

.tb-sub {
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 250px;
  padding: 8px 0 !important;
  background: var(--tb-white);
  border-top: 2px solid var(--tb-red);
  border-radius: 0 0 var(--tb-radius) var(--tb-radius);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s var(--tb-ease), visibility .2s;
  z-index: 20;
}

.tb-has-sub:hover > .tb-sub,
.tb-has-sub:focus-within > .tb-sub {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.tb-sub a,
.tb-sub span {
  display: block;
  padding: 9px 20px;
  color: var(--tb-ink);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  transition: background .15s, color .15s, padding .15s;
}

.tb-sub a:hover {
  background: var(--tb-red-soft);
  color: var(--tb-red);
  padding-left: 24px;
}

.tb-sub-group {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--tb-line);
}

.tb-sub .tb-sub-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--tb-muted);
  letter-spacing: .3px;
  padding-bottom: 4px;
}

.tb-sub-group li a,
.tb-sub-group li span {
  color: #4a4a4a;
  padding-left: 30px;
  position: relative;
}

.tb-sub-group li a:hover {
  padding-left: 34px;
}

.tb-sub-group li a::before,
.tb-sub-group li span::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--tb-red);
}

.tb-nav-mobile-extra {
  display: none;
}

/* ปุ่มแฮมเบอร์เกอร์ */
.tb-burger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--tb-line);
  border-radius: var(--tb-radius);
  background: var(--tb-white);
  cursor: pointer;
  flex: none;
}

.tb-burger span {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--tb-black);
  border-radius: 2px;
  transition: transform .25s var(--tb-ease), opacity .2s, top .25s var(--tb-ease);
}

.tb-burger span:nth-child(1) { top: 15px; }
.tb-burger span:nth-child(2) { top: 21px; }
.tb-burger span:nth-child(3) { top: 27px; }

.tb-burger.is-open span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.tb-burger.is-open span:nth-child(2) { opacity: 0; }
.tb-burger.is-open span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* ---------- Footer ---------- */

.tb-footer {
  background: var(--tb-black);
  color: #bdbdbd;
  font-family: "Prompt", sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.7;
  border-top: 4px solid var(--tb-red);
}

.tb-footer a {
  color: #bdbdbd;
  text-decoration: none;
  transition: color .2s;
}

.tb-footer a:hover {
  color: var(--tb-white);
}

.tb-footer-grid {
  display: grid;
  grid-template-columns: 1.35fr 1.4fr 1fr .9fr;
  gap: 48px;
  padding: 56px 0 48px;
}

.tb-footer-logo img {
  height: 72px;
  width: auto;
  background: var(--tb-white);
  border-radius: 50%;
  padding: 3px;
}

.tb-footer h2 {
  margin: 18px 0 4px;
  color: var(--tb-white);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
}

.tb-footer-en {
  margin: 0;
  color: #8a8a8a;
  font-size: 12px;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.tb-footer h3 {
  position: relative;
  margin: 0 0 20px;
  padding-bottom: 12px;
  color: var(--tb-white);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
}

.tb-footer h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 28px;
  height: 2px;
  background: var(--tb-red);
}

.tb-footer-contact li {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.tb-footer-contact svg {
  margin-top: 5px;
  color: #e05a5a;
}

.tb-footer-menu li + li {
  margin-top: 8px;
}

.tb-footer-menu a {
  position: relative;
  display: inline-block;
  transition: color .2s, transform .2s var(--tb-ease);
}

.tb-footer-menu a:hover {
  transform: translateX(4px);
}

.tb-footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tb-footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid #383838;
  border-radius: 50%;
  color: #d8d8d8;
  transition: background .2s, border-color .2s, color .2s;
}

.tb-footer-social a:hover {
  background: var(--tb-red);
  border-color: var(--tb-red);
  color: var(--tb-white);
}

.tb-footer-social svg {
  width: 18px;
  height: 18px;
}

.tb-footer-bottom {
  border-top: 1px solid #2a2a2a;
  padding: 18px 0;
  color: #7d7d7d;
  font-size: 12.5px;
  text-align: center;
}

/* ---------- Responsive ---------- */

/* จอแคบกว่า 1400px แต่ยังแสดงเมนูเต็ม: ย่อชื่อสมาคมและระยะเมนูไม่ให้ตัดบรรทัด */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .tb-brand img {
    height: 54px;
  }

  .tb-brand-text strong {
    font-size: 15px;
    white-space: nowrap;
  }

  .tb-brand-text small {
    font-size: 10px;
    letter-spacing: .3px;
    white-space: nowrap;
  }

  .tb-nav > ul > li > a {
    padding: 10px 10px;
    font-size: 14.5px;
  }

  .tb-nav > ul > li > a::after {
    left: 10px;
    right: 10px;
  }

  .tb-nav > ul > li > a.tb-nav-cta {
    margin-left: 6px;
    padding: 10px 18px;
  }
}

@media (max-width: 1199.98px) {
  .tb-burger {
    display: block;
  }

  .tb-mainbar-inner {
    min-height: 72px;
  }

  .tb-brand img {
    height: 52px;
  }

  .tb-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-height: 0;
    overflow: hidden;
    background: var(--tb-white);
    box-shadow: 0 16px 32px rgba(0, 0, 0, .12);
    transition: max-height .35s var(--tb-ease);
  }

  .tb-nav.is-open {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    border-top: 3px solid var(--tb-red);
  }

  .tb-mainbar {
    position: relative;
  }

  .tb-nav > ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0;
  }

  .tb-nav > ul > li {
    border-bottom: 1px solid var(--tb-line);
  }

  .tb-nav > ul > li > a {
    padding: 15px 24px;
    font-size: 15px;
  }

  .tb-nav > ul > li > a::after {
    left: 0;
    right: auto;
    top: 0;
    bottom: 0;
    width: 3px;
    height: auto;
    transform: scaleY(0);
  }

  .tb-nav > ul > li > a:hover::after,
  .tb-nav > ul > li > a.is-active::after {
    transform: scaleY(1);
  }

  .tb-nav > ul > li > a .tb-caret {
    display: none;
  }

  .tb-sub-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 8px;
    top: 6px;
    width: 40px;
    height: 40px;
    border: 0;
    background: none;
    color: var(--tb-muted);
    cursor: pointer;
  }

  .tb-sub-toggle svg {
    width: 22px;
    height: 22px;
    transition: transform .2s;
  }

  .tb-has-sub.is-open .tb-sub-toggle svg {
    transform: rotate(180deg);
  }

  .tb-sub,
  .tb-has-sub:hover > .tb-sub,
  .tb-has-sub:focus-within > .tb-sub {
    position: static;
    display: none;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    background: #fafafa;
    padding: 4px 0 10px !important;
  }

  .tb-has-sub.is-open > .tb-sub {
    display: block;
  }

  .tb-sub a,
  .tb-sub span {
    padding-left: 40px;
  }

  .tb-sub a:hover {
    padding-left: 44px;
  }

  .tb-sub-group li a,
  .tb-sub-group li span {
    padding-left: 52px;
  }

  .tb-sub-group li a:hover {
    padding-left: 56px;
  }

  .tb-sub-group li a::before,
  .tb-sub-group li span::before {
    left: 42px;
  }

  .tb-nav > ul > li:last-child {
    border-bottom: 0;
    padding: 16px 24px 8px;
  }

  .tb-nav > ul > li > a.tb-nav-cta {
    margin: 0;
    justify-content: center;
  }

  .tb-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }
}

@media (max-width: 767.98px) {
  .tb-topbar {
    display: none;
  }

  .tb-nav-mobile-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 24px 20px;
  }

  .tb-nav-mobile-extra a {
    flex: 1 1 auto;
    padding: 10px 14px;
    border: 1px solid var(--tb-line);
    border-radius: var(--tb-radius);
    color: var(--tb-ink);
    font-size: 14px;
    text-align: center;
    text-decoration: none;
  }

  .tb-nav-mobile-extra a:hover {
    border-color: var(--tb-red);
    color: var(--tb-red);
  }

  .tb-brand {
    gap: 10px;
  }

  .tb-brand img {
    height: 46px;
  }

  .tb-brand-text {
    padding-left: 10px;
  }

  .tb-brand-text strong {
    font-size: 13px;
    line-height: 1.35;
  }

  .tb-brand-text small {
    font-size: 9.5px;
    letter-spacing: .3px;
  }

  .tb-footer-grid {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 44px 0 36px;
  }
}

@media (max-width: 399.98px) {
  .tb-brand-text small {
    display: none;
  }
}
