/*
 * SiamSEOsav — stylesheet.css (override / additions)
 * Inherits main.css, customize.css, stylesheet.css from SiamBBsav2 via phpBB parent-style lookup.
 * Only put NEW or CHANGED rules here.
 */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  --sa-brand-red:   #e32119;
  --sa-brand-gold:  #f5a623;
  --sa-brand-dark:  #5b3a29;
  --sa-focus-ring:  0 0 0 3px rgba(227,33,25,.35);
  --sa-radius:      .5rem;
  --sa-transition:  .18s ease;
  /* standalone homepage/forum_page.php neutral tokens (Tier B port, 2569-07-11) */
  --sa-bg:          #f4f5f7;
  --sa-card:        #fff;
  --sa-ink:         #1a1d21;
  --sa-muted:       #6b7280;
  --sa-line:        #e5e7eb;
  --sa-card-radius: 12px;
}

/* ===== ACCESSIBILITY: visible focus rings ===== */
:focus-visible {
  outline: 2px solid var(--sa-brand-red);
  outline-offset: 2px;
  box-shadow: var(--sa-focus-ring);
}
a:focus-visible { border-radius: 2px; }

/* ===== SKIP LINK ===== */
.visually-hidden-focusable:focus {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 9999;
  padding: .4em .8em;
  background: var(--sa-brand-red);
  color: #fff;
  border-radius: var(--sa-radius);
  font-weight: 700;
}

/* ===== TYPOGRAPHY ===== */
body {
  font-family: "Open Sans", "Noto Sans Thai", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Heading hierarchy for SEO */
h1.topic-title,
h1.forum-title {
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  line-height: 1.3;
}
h2.forum-title,
h2 { font-size: clamp(1rem, 2vw, 1.2rem); }

/* ===== NAVBAR & HEADER ===== */
#HeaderNavigation {
  border-bottom: 2px solid var(--sa-brand-gold);
}
#HeaderNavigation .navbar-brand img,
.site_logo {
  /* already defined in parent — no change needed */
}

/* ===== FORUM LIST ===== */
/* ไม่ override bg-forum-head1/bg-forum-head2 — ใช้ค่า white.css ของ parent (#FFC400, #FFE387) */
.forabg:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
}

/* Latest-topics list — minimal override ที่ไม่ทำลาย hanging-indent ใน ilist.css */
.i-forumlist {
  overflow: hidden;  /* ป้องกัน horizontal overflow จากชื่อกระทู้ยาว */
}
/* ไม่ reset margin-left ของ ul — ให้ ilist.css จัดการ text-indent: -10px */
.i-forumlist a {
  color: #3a2a1a;
  text-decoration: none;
}
.i-forumlist a:hover { color: var(--sa-brand-red); }

/* ===== HERO SLIDER + HIGHLIGHT PANEL ===== */
.sa-hero {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
  --hero-h: 456px;
  margin-bottom: 32px;
}
.sa-hero--full { grid-template-columns: 1fr; }

.sa-slider {
  position: relative; overflow: hidden; border-radius: 14px;
  background: #0b0b0b; height: var(--hero-h);
}
.sa-slides { display: flex; height: 100%; transition: transform .5s ease; }
.sa-slide  { flex: 0 0 100%; min-width: 0; height: 100%; position: relative; }
.sa-slide a { display: block; height: 100%; position: relative; }
.sa-slide img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sa-slide-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 50px 60px 18px 18px;
  background: linear-gradient(transparent, rgba(0,0,0,.88));
  color: #fff;
}
.sa-slide-badge {
  display: inline-block; background: rgba(255,255,255,.15); color: rgba(255,255,255,.82);
  font-size: 10px; font-weight: 600; padding: 2px 9px; border-radius: 999px; margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,.28);
  max-width: calc(100% - 70px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle; letter-spacing: .3px;
}
.sa-slide-cap h2 {
  margin: 0; font-size: 19px; font-weight: 800; line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sa-arrow {
  position: absolute; top: calc(50% - 18px); z-index: 3;
  width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.82); color: #222; font-size: 21px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); transition: .15s;
}
.sa-arrow:hover { background: #fff; }
.sa-arrow-prev { left: 10px; } .sa-arrow-next { right: 10px; }
.sa-dots-wrap {
  position: absolute; left: 0; right: 0; bottom: 9px; z-index: 3;
  display: flex; gap: 7px; justify-content: center;
}
.sa-dot-btn {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.5); transition: .2s;
}
.sa-dot-btn.is-active { background: #fff; width: 20px; border-radius: 999px; }

.sa-hero-right {
  background: #1a1d24; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; height: var(--hero-h);
}
.sa-hero-right-hd {
  padding: 11px 14px; flex: none;
  font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.55);
  letter-spacing: .6px; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sa-hi-item {
  display: flex; gap: 11px; padding: 13px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex: 1; align-items: center; text-decoration: none;
  transition: background .12s; min-height: 0;
}
.sa-hi-item:hover { background: rgba(255,255,255,.06); }
.sa-hi-item:last-child { border-bottom: 0; }
.sa-hi-thumb {
  flex: none; width: 92px; height: 64px;
  border-radius: 8px; overflow: hidden; background: #2a2d35;
}
.sa-hi-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sa-hi-no-thumb  { flex: none; width: 6px; height: 0; }
.sa-hi-body { flex: 1; min-width: 0; }
.sa-hi-cat {
  display: inline-block; background: rgba(255,255,255,.1); color: rgba(255,255,255,.58);
  font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-bottom: 5px;
  max-width: min(220px, 100%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle; letter-spacing: .3px;
}
.sa-hi-title {
  font-size: 13px; font-weight: 700; color: #dde0e8; margin: 0 0 5px; line-height: 1.38;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sa-hi-meta { font-size: 11px; color: rgba(255,255,255,.35); }

/* Hero Responsive */
@media (max-width: 900px) {
  .sa-hero { grid-template-columns: 1fr; --hero-h: auto; }
  .sa-slider, .sa-slides, .sa-slide, .sa-slide a { height: auto; }
  .sa-slide img { height: auto; aspect-ratio: 16/9; }
  .sa-hero-right { height: auto; }
  .sa-hi-item { flex: none; }
}
@media (max-width: 600px) {
  .sa-slide-cap h2 { font-size: 15px; }
  .sa-slide-cap { padding: 35px 50px 14px 14px; }
  .sa-arrow { width: 30px; height: 30px; font-size: 18px; }
}
@media (max-width: 480px) {
  .sa-slide-cap { padding: 18px 42px 10px 12px; }
  .sa-slide-badge { font-size: 9px; padding: 1px 6px; margin-bottom: 4px; }
  .sa-slide-cap h2 { font-size: 13px; -webkit-line-clamp: 1; }
  .sa-hi-thumb { width: 90px; height: 68px; }
}

/* ===== TOPIC PAGE ===== */
.post {
  border: 1px solid #e8e1d8;
  border-radius: var(--sa-radius);
  transition: box-shadow var(--sa-transition);
}
.post:hover { box-shadow: 0 2px 6px rgba(0,0,0,.07); }

/* Post content images — responsive + lazy */
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ===== SHARE BUTTONS (URL-based, no SDK) ===== */
.sa-share-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 4px; text-decoration: none;
  font-size: 14px; font-weight: 600; color: #fff; margin-right: 6px;
  transition: opacity .15s;
}
.sa-share-btn:hover { opacity: .85; color: #fff; }
.sa-share-fb   { background: #1877F2; }
.sa-share-line { background: #06C755; margin-right: 0; }

/* ===== ADS: clear floats + spacing ===== */
.sa-ad-block {
  margin: 1rem 0;
  text-align: center;
  overflow: hidden;
}
/* Prevent CLS: reserve space for typical ad sizes */
.sa-ad-leaderboard { min-height: 90px; }
.sa-ad-rectangle   { min-height: 250px; }

/* ===== FOOTER ===== */
#page-footer {
  border-top: 3px solid var(--sa-brand-gold);
}
/* ไม่ override padding/text-indent ของ .i-footerlist — ให้ ilist.css จัดการ hanging indent */
.i-footerlist a:hover { color: var(--sa-brand-red); }

/* ===== STICKY NAV (แทน headhesive — วางที่ <header> เพราะ parent สูงพอให้ sticky ทั้งหน้า) ===== */
.sa-nav-sticky { position: sticky; top: 0; z-index: 1030; background: var(--bs-body-bg, #fff); }
/* viewtopic: ตัด breadcrumb ออกจาก sticky header เฉพาะมือถือ = เหลือแถวเดียว (desktop โชว์เต็ม; JSON-LD ไม่กระทบ) */
@media (max-width: 767.98px) {
  .section-viewtopic .nav-breadcrumbs { display: none !important; }
}

/* ===== SCROLL-TO-TOP (vanilla, สร้างโดย siam-ui.js) — แทน jquery.scrollUp เดิม ===== */
.sa-scrollup {
  position: fixed; bottom: 22px; right: 22px; z-index: 10000; /* เหนือ cookieconsent */
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  /* ทอง ไม่ใช่แดง — หลักที่ตกลงกันไว้: หลีกเลี่ยงปุ่มแดงเพราะดูเหมือนปุ่ม Delete/Alarm (2569-07-11) */
  background: var(--sa-brand-gold, #f5a623); color: #fff;
  box-shadow: 0 3px 14px rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility .2s, background .15s, transform .15s;
}
.sa-scrollup.is-vis { opacity: .85; visibility: visible; }
.sa-scrollup:hover { opacity: 1; transform: translateY(-3px); background: var(--sa-brand-dark, #5b3a29); }
.sa-scrollup::before {
  content: ''; display: block; width: 11px; height: 11px;
  border-left: 2.5px solid #fff; border-top: 2.5px solid #fff;
  transform: rotate(45deg) translate(1px, 2px);
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 767.98px) {
  .btn, a.nav-link:not(.dropdown-toggle) { min-height: 44px; display: flex; align-items: center; }
  a.nav-link.dropdown-toggle { min-height: 44px; }
  /* ลิงก์ "กลับไปฟอรั่ม" ใน hamburger (viewtopic): ชื่อฟอรั่มไทยยาวไม่ wrap ล้นขวา → span ย่อ + ตัดคำได้ */
  #MainNavigation .d-md-none .nav-link { white-space: normal; }
  #MainNavigation .d-md-none .nav-link span { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
  /* ปุ่ม post reply (btn-success) ใน action-bar viewtopic: ย่อให้เท่าปุ่มแชร์ f/LINE (ล้ม min-height 44px) */
  .action-bar a.btn-success.button { min-height: 0; padding: 5px 12px; font-size: 14px; }
  /* posting.php BBCode toolbar: ปุ่ม .btn โดน display:flex → stack; ให้ container flex-wrap เรียงแถวแทน */
  #format-buttons { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .i-forumlist ul li { line-height: 32px; }
  .post { margin-bottom: .5rem; }
  .forum-description { display: block !important; }
}

/* Prevent horizontal scroll on small screens */
@media (max-width: 575.98px) {
  /* เดิม .container-xxl { overflow-x: hidden } เอาออก — ทำให้ .sa-nav-sticky พังบนมือถือ (intermediate
     scroll container); กัน h-overflow ที่ html (root, ใน SiamBBsav2 base css) แทน ซึ่งไม่ break sticky
     — ตรงกับ golden §11 gotcha#9 */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ===== PRINT STYLES ===== */
@media print {
  #HeaderNavigation, #page-footer, .action-bar, .sa-ad-block,
  .post-buttons, #phpbb_alert, #phpbb_confirm, .sa-scrollup { display: none !important; }
  .content { font-size: 11pt; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===== HIGH CONTRAST / DARK MODE HINT ===== */
@media (prefers-color-scheme: dark) {
  /* phpBB Bootstrap already handles dark mode via data-bs-theme.
     Add custom overrides here if needed in future. */
}

/* =====================================================================
 * TIER B (2569-07-11): standalone homepage (index.php) + forum_page.php
 * chrome/layout classes — ported OUT of the two files' duplicated inline
 * <style> blocks (each ~14-20KB, near-identical) into this one shared
 * theme file, loaded by both phpBB template pages AND the standalone
 * pages via sav_css_links() (see sav_chrome.php). This is the same
 * mechanism golden (sukapabdee.com's skp_chrome.php) uses.
 *
 * Fixed while porting (both files agreed with each other, consistently
 * diverged from the rest of the site — treated as leftover from an
 * earlier copy, not intentional):
 *   - primary color was blue #1E5B8C/#163F61 on the homepage/forum_page,
 *     vs var(--sa-brand-red)/var(--sa-brand-dark) used everywhere else
 *     on this site (CLAUDE.md documents red as brand) → unified to red.
 *   - .sa-scrollup was a second, gold/42px/opacity-.7 definition here,
 *     vs the red/44px/z-10000 version already established above (Tier A,
 *     siam-ui.js) → dropped the duplicate, single canonical rule wins.
 *   - .sa-share-btn on the homepage/forum_page was smaller (4px 10px /
 *     12.5px) than the phpBB action-bar version above (5px 12px / 14px)
 *     → kept both: the smaller size is now scoped under its actual
 *     containers (.sa-foot-nav, .sa-sort-share) so phpBB pages keep the
 *     original 14px sizing unaffected.
 *   - MISSED ON FIRST PASS (found via user browser test): both original
 *     inline <style> blocks had a blanket `a { color: inherit; text-
 *     decoration: none; }` reset — the standalone pages never loaded
 *     Bootstrap CSS at all before this refactor (100% custom .sa-* CSS),
 *     so nothing else was resetting link underline. sav_css_links() now
 *     loads Bootstrap 5, which underlines links by default → nav +
 *     topic-title links appeared underlined. Restored the reset, scoped
 *     to the standalone-page containers only (NOT a blanket `a` rule) so
 *     it can't change link underline behavior on phpBB template pages
 *     that may rely on Bootstrap's default elsewhere.
 *   - 2nd-order bug from that fix (found via user browser test): using
 *     `.sa-topbar a`/`.sa-foot-nav a` etc. (class+element) is MORE
 *     specific than single-class rules like `.sa-btn-solid{color:#fff}`
 *     and `.sa-share-btn{color:#fff}` → login button + FB/LINE share
 *     button text lost their explicit white and inherited dark body text
 *     instead. Fixed by wrapping the container list in `:where()`, which
 *     has ZERO specificity — the reset now only ever wins as a fallback
 *     when nothing else sets color/text-decoration, and can never beat
 *     an explicit single-class component rule.
 * ===================================================================== */

:where(.sa-topbar, .sa-head, .sa-wrap, .sa-footer, .sa-foot-nav) a {
  color: inherit;
  text-decoration: none;
}

/* ===== TOPBAR ===== */
/* น้ำตาลเข้มจาก --sa-brand-dark (ผูกกับแบรนด์) แทนเทาน้ำเงินทั่วไป — ตาม sukapabdee.com (#33241A จาก coffee) */
.sa-topbar { background: #2e1d15; }
/* overflow-x:auto + scrollbar ซ่อน — pattern เดียวกับ .sa-nav ด้านล่าง (เจอจริง 2569-07-11: Firefox มือถือ
   auto text-size-adjust ขยายฟอนต์ปุ่ม topbar ทำให้แถวกว้างเกิน viewport แต่ .sa-nav กันไว้แล้วอยู่ก่อน
   .sa-topbar-inner ไม่เคยได้กันแบบเดียวกัน → ล้นขวาทั้งหน้า ลาก scrollup fixed ไปด้วย เหมือน sukapabdee.com) */
.sa-topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; height: 42px; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.sa-topbar-inner::-webkit-scrollbar { display: none; }
.sa-topbar-spacer { flex: 1; }
.sa-topbar .sa-btn-mcp { color: #fbbf24 !important; box-shadow: inset 0 0 0 1px rgba(251,191,36,.35) !important; }
.sa-topbar .sa-btn-mcp:hover { background: rgba(251,191,36,.18) !important; color: #fde68a !important; }
.sa-topbar .sa-btn-acp { color: #f97316 !important; box-shadow: inset 0 0 0 1px rgba(249,115,22,.35) !important; }
.sa-topbar .sa-btn-acp:hover { background: rgba(249,115,22,.18) !important; color: #fed7aa !important; }
.sa-topbar .sa-icon-btn { background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); color: #ddd; width: 32px; height: 32px; font-size: 15px; }
.sa-topbar .sa-icon-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.sa-topbar .sa-btn-solid { padding: 5px 14px; font-size: 12.5px; background: #2563eb; }
.sa-topbar .sa-btn-solid:hover { background: #1d4ed8; }
.sa-topbar .sa-btn-register { padding: 5px 14px; font-size: 12.5px; color: var(--sa-brand-gold); box-shadow: inset 0 0 0 1px var(--sa-brand-gold); }
.sa-topbar .sa-btn-register:hover { background: var(--sa-brand-gold); color: #1a1a1a; }
.sa-topbar .sa-btn-ghost { background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); color: rgba(255,255,255,.85); padding: 5px 12px; font-size: 12.5px; }
.sa-topbar .sa-btn-ghost:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ===== STICKY HEAD + NAVBAR (standalone index.php/forum_page.php only) ===== */
/* พื้นหลังจางๆ ของสีแบรนด์ (ไม่ใช่ขาวล้วน) ให้มีมิติตอน sticky — ตาม sukapabdee.com (#E9EEE6 จากเขียวเขา)
   ใช้ #fbeaea ที่มีอยู่แล้วในไฟล์นี้ (.sa-crumb a:hover) เพื่อให้พาเลตต์แดงอ่อนสอดคล้องกันทั้งหน้า */
.sa-head { background: #fbeaea; border-bottom: 3px solid var(--sa-brand-red); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(0,0,0,.09); }
.sa-head-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; height: 58px; gap: 0; }
.sa-brand-h1 { margin: 0; padding: 0; font-size: inherit; font-weight: inherit; line-height: 1; flex: none; }
.sa-brand { display: flex; align-items: center; gap: 10px; margin-right: 20px; text-decoration: none; }
.sa-logo-img { height: 38px; width: auto; max-width: 200px; display: block; }
.sa-brand-name { font-size: 19px; font-weight: 800; color: var(--sa-brand-gold); white-space: nowrap; }
.sa-nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sa-nav::-webkit-scrollbar { display: none; }
.sa-nav a { font-size: 13px; font-weight: 600; color: #333; padding: 7px 10px; border-radius: 6px; white-space: nowrap; transition: background .12s, color .12s; flex: none; }
.sa-nav a:hover, .sa-nav a.is-active { color: var(--sa-brand-red); background: rgba(227,33,25,.07); }
.sa-nav-home { color: var(--sa-brand-red) !important; font-weight: 700 !important; }
.sa-hamburger { display: none; flex: none; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 9px; cursor: pointer; background: #f1f3f5; box-shadow: inset 0 0 0 1px var(--sa-line); font-size: 19px; color: #333; transition: background .12s; padding: 0; }
.sa-hamburger:hover { background: #e7eaed; }
/* มือถือแตะปุ่มแล้วเห็นวงแหวน focus สีฟ้า default ของ browser (ไม่ใช้ :focus-visible ทุกจอ/ทุก browser
   ตอนแตะจริง) — ล้มด้วย outline สีแบรนด์แทน ใช้ --sa-focus-ring ตัวเดียวกับที่ตั้งไว้แล้วบนสุดไฟล์ */
.sa-hamburger:focus { outline: none; box-shadow: var(--sa-focus-ring); }

/* generic pill button + icon button + badge + user menu (topbar) */
.sa-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 999px; white-space: nowrap; transition: .15s; line-height: 1.2; }
.sa-btn-ghost { color: #444; background: #f1f3f5; box-shadow: inset 0 0 0 1px var(--sa-line); }
.sa-btn-ghost:hover { background: #e7eaed; }
.sa-btn-solid { color: #fff; background: var(--sa-brand-red); }
.sa-btn-solid:hover { background: var(--sa-brand-dark); }
.sa-icon-btn { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; font-size: 16px; color: #444; background: #f1f3f5; box-shadow: inset 0 0 0 1px var(--sa-line); transition: .15s; }
.sa-icon-btn:hover { background: #e7eaed; }
.sa-badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--sa-brand-red); color: #fff; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.sa-usermenu { position: relative; }
.sa-usermenu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 6px; color: rgba(255,255,255,.85); background: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); white-space: nowrap; transition: .15s; }
.sa-usermenu summary:hover { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.sa-usermenu summary::-webkit-details-marker { display: none; }
.sa-uname { display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.sa-caret { font-size: 9px; transition: transform .15s; }
.sa-usermenu[open] summary .sa-caret { transform: rotate(180deg); }
.sa-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 200; min-width: 196px; background: #fff; border: 1px solid var(--sa-line); border-radius: 12px; padding: 6px; box-shadow: 0 14px 34px -10px rgba(0,0,0,.3); }
.sa-menu a { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: #333; white-space: nowrap; }
.sa-menu a:hover { background: #f1f3f5; }
.sa-menu a.sa-menu-danger { color: #c0392b; }
.sa-menu a.sa-menu-danger:hover { background: #fdecea; }
.sa-menu-sep { height: 1px; background: var(--sa-line); margin: 5px 2px; }

/* ===== MAIN WRAP ===== */
.sa-wrap { max-width: 1180px; margin: 0 auto; padding: 22px 16px 16px; }
.sa-wrap--forum { padding-bottom: 64px; }
.sa-section { margin-bottom: 36px; }

/* ===== SECTION BANNER ===== */
.sa-banner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; margin: 0 0 16px; border-radius: 12px;
  background: linear-gradient(120deg, var(--c1), var(--c2));
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--c1) 55%, transparent);
  animation: sa-rise .4s cubic-bezier(.2,.7,.2,1) both;
}
.sa-banner::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.3), transparent 55%); }
.sa-banner-left { display: flex; align-items: center; gap: 11px; min-width: 0; position: relative; z-index: 1; }
.sa-banner-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; font-size: 17px; line-height: 1; background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 2px 6px rgba(0,0,0,.15); color: rgba(255,255,255,.92); }
.sa-banner-title { margin: 0; font-size: 17px; font-weight: 800; color: #fff; letter-spacing: .2px; text-shadow: 0 1px 2px rgba(0,0,0,.18); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-banner-title a { color: inherit; text-decoration: none; }
.sa-banner-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.sa-banner-link { position: relative; z-index: 1; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #fff; background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); transition: background .15s, transform .15s; }
.sa-banner-link:hover { background: rgba(255,255,255,.32); transform: translateX(2px); }
@media (max-width: 600px) { .sa-banner-link { display: none; } }
@keyframes sa-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sa-banner { animation: none; } }

/* ===== CARD GRID (Popular topics) ===== */
.sa-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.sa-card { background: var(--sa-card); border: 1px solid var(--sa-line); border-radius: var(--sa-card-radius); overflow: hidden; display: flex; flex-direction: column; transition: .15s; }
.sa-card:hover { box-shadow: 0 6px 22px rgba(0,0,0,.09); transform: translateY(-2px); }
.sa-thumb { display: block; height: 176px; overflow: hidden; background: #eef1f4; }
.sa-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sa-body { padding: 13px 15px 15px; flex: 1; display: flex; flex-direction: column; }
.sa-title { font-size: 15px; margin: 0 0 7px; line-height: 1.38; font-weight: 700; }
.sa-title a:hover { color: var(--sa-brand-red); }
.sa-excerpt { font-size: 13px; color: var(--sa-muted); margin: 0 0 10px; flex: 1; }
.sa-meta { font-size: 12px; color: var(--sa-muted); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sa-author { font-weight: 600; color: var(--sa-ink); }
.sa-dot { opacity: .5; }

/* ===== LIST LAYOUT (per-forum sections + forum_page.php topic list) ===== */
.sa-list { display: flex; flex-direction: column; gap: 10px; }
.sa-li { display: flex; gap: 0; background: var(--sa-card); border: 1px solid var(--sa-line); border-radius: var(--sa-card-radius); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.sa-li:hover { box-shadow: 0 4px 18px rgba(0,0,0,.08); transform: translateY(-1px); }
.sa-li-thumb { flex: none; display: block; width: 148px; overflow: hidden; background: #eef1f4; align-self: stretch; }
.sa-li-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; min-height: 105px; }
.sa-li-body { flex: 1; min-width: 0; padding: 12px 15px; display: flex; flex-direction: column; justify-content: center; }
.sa-li-title { font-size: 15px; font-weight: 700; margin: 0 0 6px; line-height: 1.38; }
.sa-li-title a:hover { color: var(--sa-brand-red); }
.sa-li-excerpt { font-size: 13px; color: var(--sa-muted); margin: 0 0 8px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sa-li-meta { font-size: 12px; color: var(--sa-muted); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sa-li-author { font-weight: 600; color: var(--sa-ink); }
.sa-li-new { display: inline-block; background: #22c55e; color: #fff; font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; vertical-align: middle; margin-right: 5px; letter-spacing: .3px; line-height: 18px; flex: none; }
.sa-li-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 5px; }
.sa-badge-type { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sa-badge-moved { background: #e0e7ff; color: #3730a3; }
.sa-badge-sticky { background: #fef3c7; color: #92400e; }
.sa-badge-announce { background: #fee2e2; color: #991b1b; }
.sa-badge-locked { background: #f3f4f6; color: #6b7280; }
.sa-li-footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--sa-muted); }
.sa-li-pages { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.sa-li-pages a { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 4px; font-size: 11.5px; font-weight: 600; background: #f1f3f5; color: #444; border: 1px solid var(--sa-line); }
.sa-li-pages a:hover { background: #e7eaed; }
.sa-goto-last { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 4px; background: #f1f3f5; border: 1px solid var(--sa-line); color: #555; font-size: 13px; margin-left: 4px; text-decoration: none; font-weight: 700; line-height: 1; vertical-align: middle; transition: background .12s; }
.sa-goto-last:hover { background: #e7eaed; color: #222; }

/* ===== BOARD INFO — Online + Stats (index.php only) ===== */
.sa-board-info { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 36px; }
.sa-bi-card { background: #fff; border-radius: 10px; border: 1px solid var(--sa-line); box-shadow: 0 1px 4px rgba(0,0,0,.06); padding: 16px 20px; }
.sa-bi-card h2 { font-size: 12px; font-weight: 600; color: var(--sa-muted); background: #f5f3f1; border-radius: 6px; padding: 5px 11px; margin: 0 0 14px; display: flex; align-items: center; gap: 7px; }
.sa-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.sa-stat-item { font-size: 12.5px; color: var(--sa-muted); }
.sa-stat-item strong { display: block; font-size: 14px; font-weight: 500; color: var(--sa-ink); line-height: 1.4; margin-bottom: 1px; }
.sa-stat-newest { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--sa-line); font-size: 12.5px; color: var(--sa-muted); }
.sa-online-sum { font-size: 13px; color: var(--sa-muted); margin-bottom: 10px; }
.sa-online-sum strong { color: var(--sa-ink); font-weight: 500; }
.sa-online-list { font-size: 13px; line-height: 1.9; word-break: break-word; }
.sa-online-link { font-weight: 400; text-decoration: none; }
.sa-online-link:hover { text-decoration: underline; }
.sa-online-hidden { font-style: italic; opacity: .65; }
.sa-memberlist-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; padding: 5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--sa-brand-red); border: 1px solid rgba(227,33,25,.3); text-decoration: none; transition: background .12s; }
.sa-memberlist-link:hover { background: rgba(227,33,25,.07); }
@media (max-width: 700px) { .sa-board-info { grid-template-columns: 1fr; } }

/* ===== BREADCRUMB (forum_page.php only) ===== */
/* min-width:0 บน flex item + overflow-wrap:anywhere — ให้ชื่อฟอรั่มไทยยาว (ไม่มีเว้นวรรค) ตัดคำได้แทนที่จะ
   ดันความกว้างเอกสารเกิน viewport มือถือ (เจอจริง 2569-07-11: breadcrumb ล้นขวา + scrollup fixed หลุดจอ
   ตามไปด้วย — เคยแก้ pattern เดียวกันมาแล้วที่ #MainNavigation .d-md-none .nav-link span ตอน Tier A
   และที่ sukapabdee.com's .sa-crumb ก่อนหน้านี้) */
.sa-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; padding: 9px 16px; background: linear-gradient(90deg, #fdeeee, #fff 60%); border: 1px solid #f3cccc; border-radius: 10px; box-shadow: 0 1px 4px rgba(227,33,25,.07); font-size: 13px; }
.sa-crumb a { color: #666; text-decoration: none; font-weight: 500; padding: 2px 6px; border-radius: 5px; transition: color .12s, background .12s; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.sa-crumb a:hover { color: var(--sa-brand-red); background: #fbeaea; }
.sa-crumb-sep { color: #ccc; padding: 0 1px; font-size: 15px; line-height: 1; flex: none; }
.sa-crumb-current { color: #444; font-weight: 700; font-size: 13px; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

/* ===== PAGINATION (forum_page.php only) ===== */
.sa-pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 28px; flex-wrap: wrap; }
.sa-page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: #444; background: #fff; border: 1px solid var(--sa-line); transition: .12s; text-decoration: none; }
.sa-page-btn:hover { background: #f1f3f5; border-color: #ccc; }
/* ฟ้า info (Bootstrap primary #0d6efd) ไม่ใช่แดง — หลักเดียวกับ .sa-scrollup ด้านบน (2569-07-11) */
.sa-page-btn.is-active { background: #0d6efd; color: #fff; border-color: #0d6efd; }
.sa-page-btn.is-disabled { opacity: .4; pointer-events: none; }

/* ===== FORUM DESCRIPTION + ACTION BUTTONS (forum_page.php only) ===== */
.sa-forum-desc { font-size: 14px; color: #555; line-height: 1.65; margin: 0 0 14px; padding: 10px 14px; background: #fafafa; border-left: 3px solid var(--sa-brand-red); border-radius: 0 6px 6px 0; }
.sa-forum-desc p { margin: 0; }
.sa-forum-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.sa-btn-primary { background: #16a34a; color: #fff; }
.sa-btn-primary:hover { background: #15803d; color: #fff; }
.sa-btn-outline { background: #fff; color: #444; border: 1px solid var(--sa-line); }
.sa-btn-outline:hover { background: #f5f5f5; color: #222; }

/* ===== SUBFORUMS (forum_page.php only) ===== */
.sa-subforums { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 8px; margin-bottom: 18px; }
.sa-subforum-card { display: flex; align-items: center; gap: 9px; padding: 10px 13px; background: #fff; border: 1px solid var(--sa-line); border-radius: 8px; transition: box-shadow .15s, border-color .15s; text-decoration: none; color: inherit; }
.sa-subforum-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); border-color: #bbb; }
.sa-subforum-icon { font-size: 20px; flex: none; line-height: 1; }
.sa-subforum-name { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.sa-subforum-topics { font-size: 11.5px; color: var(--sa-muted); margin-top: 2px; }

/* ===== SORT BAR (forum_page.php only) ===== */
.sa-sort { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.sa-sort-label { font-size: 12px; color: var(--sa-muted); margin-right: 3px; }
.sa-sort-btn { font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 6px; color: #555; background: #f1f3f5; border: 1px solid var(--sa-line); text-decoration: none; transition: background .12s, color .12s; }
.sa-sort-btn:hover { background: #e7eaed; color: #333; }
.sa-sort-btn.is-active { background: #fff; color: var(--sa-brand-red); border-color: var(--sa-brand-red); font-weight: 700; }
.sa-sort-share { margin-left: auto; display: flex; gap: 5px; flex: none; }

/* ===== FOOTER (standalone index.php/forum_page.php) ===== */
.sa-footer { background: #fff; color: #444; margin-top: 16px; border-top: 4px solid var(--sa-brand-gold); }
.sa-foot-links { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 1180px; margin: 0 auto; padding: 26px 8px 18px; }
.sa-foot-col { padding: 0 16px 16px; border-right: 1px solid #eee; }
.sa-foot-col:last-child { border-right: 0; }
.sa-foot-col ul { list-style: none; margin: 0; padding: 0; }
.sa-foot-col li { margin-bottom: 8px; }
.sa-foot-col a { font-size: 13px; color: #333; transition: color .12s; display: flex; align-items: center; gap: 6px; }
/* FontAwesome แทน '»' glyph — ตาม sukapabdee.com: คมชัดกว่า + คุมสี/ขนาดแยกจากตัวหนังสือได้ (2569-07-11) */
.sa-foot-col a i { color: var(--sa-brand-gold); flex: none; width: 16px; text-align: center; }
/* หัวข้อคอลัมน์ footer — ตาม sukapabdee.com (เดิม siamadvisor มี h4 แต่ display:none ซ่อนไว้) */
.sa-foot-col h4 { font-size: 13px; font-weight: 700; color: var(--sa-brand-dark); margin: 0 0 10px; }
.sa-foot-col a:hover { color: var(--sa-brand-red); }
.sa-fi { font-style: normal; flex: none; width: 20px; text-align: center; font-size: 14px; }
.sa-foot-info { font-size: 13px; color: #555; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.sa-foot-logo-row { max-width: 1180px; margin: 0 auto; padding: 16px 16px 14px; text-align: center; border-top: 1px solid #eee; }
.sa-foot-logo-row a { display: inline-block; padding: 6px 12px; transition: opacity .15s; }
.sa-foot-logo-row a:hover { opacity: .75; }
.sa-foot-logo-row img { height: 42px; width: auto; display: block; }
.sa-foot-sitename { font-size: 19px; font-weight: 800; color: var(--sa-brand-gold); }
.sa-foot-bar { background: #5b5d5d; }
.sa-foot-bar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.sa-foot-copy { font-size: 12.5px; color: rgba(255,255,255,.8); }
.sa-foot-copy a, .sa-foot-links-bar a { color: rgba(255,255,255,.8); transition: color .12s; }
.sa-foot-copy a:hover, .sa-foot-links-bar a:hover { color: #fff; }
.sa-foot-links-bar { font-size: 12.5px; color: rgba(255,255,255,.8); }
.sa-foot-credit { background: #5b5d5d; font-size: 11px; color: rgba(255,255,255,.55); text-align: center; padding: 5px 16px 8px; border-top: 1px solid rgba(255,255,255,.15); }
.sa-foot-credit a { color: rgba(255,255,255,.65); transition: color .12s; }
.sa-foot-credit a:hover { color: #fff; }

/* ===== FOOTER NAV BAR (share + delete-cookies/members/team/who's-online) ===== */
.sa-foot-nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 8px 16px; background: #f5f3f1; border-radius: 8px; border: 1px solid var(--sa-line); }
.sa-foot-nav-left, .sa-foot-nav-right { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; }
.sa-foot-nav-link { font-size: 13px; color: var(--sa-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; padding: 3px 0; transition: color .12s; white-space: nowrap; }
.sa-foot-nav-link:hover { color: var(--sa-brand-red); }
.sa-foot-nav-link .fa { width: 16px; text-align: center; font-size: 15px; }
.sa-foot-nav-sep { color: var(--sa-line); font-size: 13px; }
/* compact share-button sizing, scoped to its actual homepage/forum_page containers only
   (phpBB action-bar .sa-share-btn above stays 14px/5px-12px — unaffected) */
.sa-foot-nav .sa-share-btn, .sa-sort-share .sa-share-btn { padding: 4px 10px; font-size: 12.5px; }
@media (max-width: 600px) { .sa-foot-nav { flex-direction: column; align-items: flex-start; } }

/* ===== RESPONSIVE — standalone header/list (shared breakpoints) ===== */
@media (max-width: 900px) {
  .sa-hamburger { display: inline-flex; margin-left: auto; }
  .sa-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    display: none; flex-direction: column; gap: 0;
    background: #fff; padding: 6px 0;
    border-bottom: 3px solid var(--sa-brand-red);
    box-shadow: 0 8px 20px -4px rgba(0,0,0,.12);
    z-index: 99; flex: none; min-width: 0;
    /* เมนูยาวเกินจอ: .sa-nav เป็น absolute (ไม่ดันเนื้อหา) → ถ้าล้นขอบล่างต้อง scroll ในตัวเองได้
       cap ความสูงไว้ที่ viewport ลบความสูง header + เปิด overflow-y (dvh รองรับ URL bar มือถือ)
       ตาม sukapabdee.com (2569-07-11) */
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .sa-nav a { background: transparent; border-radius: 0; padding: 11px 20px; border-bottom: 1px solid var(--sa-line); font-size: 14px; display: flex; align-items: center; justify-content: space-between; white-space: normal; flex: none; }
  .sa-nav a::after { content: '›'; font-size: 18px; color: var(--sa-muted); margin-left: 8px; }
  .sa-nav a:last-child { border-bottom: 0; }
  .sa-nav a:hover { background: #fafafa; color: var(--sa-brand-red); }
  .sa-nav a:hover::after { color: var(--sa-brand-red); }
  .sa-nav.is-open { display: flex; }
  .sa-head-inner { position: relative; }
}
@media (max-width: 600px) {
  .sa-head-inner { height: 52px; }
  .sa-brand-name { font-size: 16px; }
  .sa-li-thumb { width: 110px; }
  .sa-li-title { font-size: 14px; }
  .sa-li-excerpt { -webkit-line-clamp: 1; }
  .sa-grid { grid-template-columns: 1fr; }
  .sa-btn-ghost { display: none; }
  /* FF มือถือ inflate ฟอนต์ → ปุ่ม register/login (nowrap) ล้นขวา ดันหน้าเลื่อนขวานิดหน่อย
     ย่อ padding/font ให้พอดี + overflow-x:clip ที่ topbar กัน page-scroll เป็น safety สุดท้าย
     (ตรงกับ sukapabdee.com — เดิม siamadvisor ไม่มี rule ชุดนี้เลย เจอ+พอร์ต 2569-07-12) */
  .sa-topbar { overflow-x: clip; }
  .sa-topbar-inner { padding: 0 8px; gap: 4px; }
  .sa-topbar .sa-btn { padding: 4px 9px; font-size: 11.5px; }
}
@media (max-width: 480px) {
  .sa-li { flex-direction: column; }
  .sa-li-thumb { width: 100%; height: 160px; }
}
@media (max-width: 760px) {
  .sa-foot-links { grid-template-columns: 1fr 1fr; padding: 18px 4px 12px; }
  .sa-foot-col { padding: 0 12px 12px; border-right: 0; border-bottom: 1px solid #eee; }
  .sa-foot-col:last-child { border-bottom: 0; }
}
@media (max-width: 480px) {
  .sa-foot-links { grid-template-columns: 1fr; }
}
