/* ============================================================
   หน้าบ้าน — ระบบดีไซน์ของเว็บไซต์อีเลิร์นนิ่ง
   สีหลัก (--primary / --secondary / --accent) มาจากหลังบ้าน → ตั้งค่าเว็บไซต์
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* ---------- สีที่หลังบ้านกำหนดได้ (ค่าสำรองถ้ายังไม่ตั้ง) ---------- */
  --primary:   #2563eb;
  --secondary: #1e293b;
  --accent:    #22c55e;
  --bg:        #f1f5f9;

  /* ---------- โทนกลาง ---------- */
  --ink:      #0f172a;
  --ink-2:    #334155;
  --muted:    #64748b;
  --line:     #e5e9f0;
  --line-2:   #eef2f7;
  --surface:  #ffffff;
  --surface-2:#f8fafc;

  /* ---------- ความโค้ง ---------- */
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* ---------- เงา ---------- */
  --sh-1: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --sh-2: 0 8px 24px -10px rgba(15, 23, 42, .18);
  --sh-3: 0 20px 48px -20px rgba(15, 23, 42, .28);

  /* ---------- ระยะ ---------- */
  --gap:  22px;
  --sect: 68px;

  /* ความสูงของแถบผู้ดูแล (แสดงเฉพาะตอนล็อกอิน) และของเฮดเดอร์
     ใช้คำนวณตำแหน่ง sticky ทุกจุด ไม่ให้อะไรมุดไปอยู่ใต้แถบดำ */
  --adminbar-h: 0px;
  --header-h:   72px;   /* ค่าเริ่มต้นเผื่อไว้ — สคริปต์ในเฮดเดอร์จะวัดค่าจริงมาแทน */
}
body.has-adminbar { --adminbar-h: 36px; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Kanit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; }
::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }

h1, h2, h3, h4 { font-weight: 500; margin: 0 0 12px; line-height: 1.35; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 4vw, 40px); }
h2 { font-size: clamp(22px, 2.6vw, 29px); }
h3 { font-size: clamp(17px, 1.6vw, 19px); }
p  { margin: 0 0 14px; }

.muted { color: var(--muted); font-size: .92em; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.page { padding: 34px 22px 72px; min-height: 62vh; }

/* โฟกัสที่มองเห็นได้ชัด — เข้าถึงง่ายด้วยคีย์บอร์ด */
:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============================================================
   ปุ่ม
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--primary) 70%, transparent);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -10px color-mix(in srgb, var(--primary) 75%, transparent);
  background: color-mix(in srgb, var(--primary) 90%, #000);
}
.btn:active { transform: translateY(0); }

.btn.outline {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--sh-1);
}
.btn.outline:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  color: var(--primary);
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
  padding: 8px 14px;
}
.btn.ghost:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); transform: none; }

.btn-lg { padding: 14px 30px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }

/* ============================================================
   ส่วนหัวเว็บ
   ============================================================ */
.site-header {
  position: sticky;
  top: var(--adminbar-h);   /* หลบแถบผู้ดูแลที่ปักอยู่ด้านบนสุด */
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 22px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 500;
  font-size: 17.5px;
  letter-spacing: -.01em;
  flex: 0 0 auto;
}
.logo img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.logo-mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--accent)));
  color: #fff;
  font-size: 16px;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--primary) 80%, transparent);
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}
.site-nav > a, .site-nav-items > li > a {
  padding: 8px 14px;
  border-radius: 99px;
  color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.site-nav > a:hover, .site-nav-items > li > a:hover,
.site-nav > a.active, .site-nav-items > li > a.active {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
}
.btn-nav {
  background: var(--primary) !important;
  color: #fff !important;
  padding: 9px 18px !important;
  border-radius: 99px;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--primary) 70%, transparent);
}
.btn-nav:hover { background: color-mix(in srgb, var(--primary) 90%, #000) !important; }

.nav-divider { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }

.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 14px 5px 5px !important;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.nav-user:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); background: var(--surface-2) !important; }
.nav-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 50%, var(--accent)));
  color: #fff;
  font-size: 13px;
  flex: 0 0 28px;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 40px; height: 40px;
  font-size: 17px;
  cursor: pointer;
  color: var(--ink);
}

/* ---------- เมนูจากหลังบ้าน ---------- */
.site-nav-items { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.site-nav-items li { position: relative; }
.site-nav-items .submenu {
  list-style: none;
  position: absolute; top: 100%; left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-3);
  padding: 7px;
  margin: 8px 0 0;
  display: none;
  z-index: 60;
}
.site-nav-items li:hover > .submenu { display: block; }
.site-nav-items .submenu a { display: block; padding: 9px 13px; font-size: 14.5px; border-radius: 9px; color: var(--ink-2); }
.site-nav-items .submenu a:hover { background: var(--surface-2); color: var(--primary); }

/* ============================================================
   หน้าแรก — ฮีโร่
   ============================================================ */
.home-hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 48px;
  align-items: center;
  padding: 26px 0 var(--sect);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  padding: 6px 15px;
  border-radius: 99px;
  margin-bottom: 20px;
}
.home-hero h1 { letter-spacing: -.025em; margin-bottom: 16px; }
.home-hero-text > p {
  font-size: 17px;
  color: var(--muted);
  max-width: 54ch;
  margin-bottom: 26px;
}

.hero-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 7px 7px 7px 20px;
  box-shadow: var(--sh-2);
  max-width: 560px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.hero-search:focus-within {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  box-shadow: 0 10px 30px -14px color-mix(in srgb, var(--primary) 70%, transparent);
}
.hero-search > i { color: var(--muted); font-size: 15px; }
.hero-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 15.5px;
  padding: 9px 2px;
  color: var(--ink);
}
.hero-search input::placeholder { color: #94a3b8; }

.hero-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; font-size: 14px; }
.chip-link {
  padding: 5px 14px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13.5px;
  transition: .15s ease;
}
.chip-link:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

/* ---------- ภาพประกอบฮีโร่ (การ์ดลอย) ---------- */
.home-hero-art { position: relative; min-height: 440px; }
.art-card {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--sh-3);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.art-card i { font-size: 22px; color: var(--primary); margin-bottom: 6px; }
.art-card strong { font-weight: 500; font-size: 15.5px; }
.art-card span { font-size: 13px; color: var(--muted); }
.art-card .lms-bar { margin-top: 10px; width: 100%; }

/* วางเยื้องกันแบบขั้นบันได — ไม่ให้การ์ดบังข้อความของกันและกัน */
.art-card-1 {
  top: 0; left: 0; width: 72%;
  background: linear-gradient(150deg, var(--surface), color-mix(in srgb, var(--primary) 5%, var(--surface)));
}
.art-card-2 { top: 168px; right: 0; width: 60%; animation: floaty 7s ease-in-out infinite; }
.art-card-2 i { color: var(--accent); }
.art-card-3 { top: 302px; left: 4%; width: 58%; animation: floaty 8s ease-in-out .8s infinite; }
.art-card-3 i { color: #d97706; }

@keyframes floaty {
  50% { transform: translateY(-12px); }
}
@media (prefers-reduced-motion: reduce) {
  .art-card { animation: none !important; }
  * { scroll-behavior: auto !important; }
}

/* ---------- แถบตัวเลข ---------- */
.stat-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 30px 20px;
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--primary) 7%, var(--surface-2)),
              color-mix(in srgb, var(--accent) 6%, var(--surface-2)));
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  text-align: center;
}
.stat-band > div { display: flex; flex-direction: column; gap: 2px; }
.stat-band strong {
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 600;
  color: var(--primary);
  letter-spacing: -.02em;
  line-height: 1.2;
}
.stat-band span { font-size: 13.5px; color: var(--muted); }

/* ============================================================
   บล็อกเนื้อหาหน้าแรก
   ============================================================ */
.section { padding: var(--sect) 0 0; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.section-head h2 { margin: 0 0 4px; }
.section-head p { margin: 0; color: var(--muted); font-size: 15px; }
.section-head.center { justify-content: center; text-align: center; }
.section-head.center p { max-width: 58ch; margin: 0 auto; }

/* ---------- ขั้นตอนการเริ่มเรียน ---------- */
.step-grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--gap);
  counter-reset: step;
}
.step-grid li {
  position: relative;
  padding: 30px 24px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.step-grid li:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-2);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
}
.step-no {
  position: absolute;
  top: -14px; left: 24px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--primary) 80%, transparent);
}
.step-grid i { font-size: 24px; color: var(--primary); display: block; margin-bottom: 12px; }
.step-grid h3 { margin-bottom: 6px; }
.step-grid p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---------- จุดเด่น ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.feature-card {
  padding: 28px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: transform .18s ease, box-shadow .18s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--sh-2); }
.feature-card i {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  font-size: 20px;
  margin-bottom: 16px;
}
.feature-card h3 { margin-bottom: 6px; }
.feature-card p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---------- เรียนต่อ ---------- */
.continue-band {
  padding: 30px 26px;
  /* วางไว้ใต้แบนเนอร์ — ระยะห่างด้านบนมาจาก padding ล่างของฮีโร่แล้ว */
  margin: 0 0 24px;
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--primary) 8%, var(--surface-2)),
              var(--surface-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
}
.continue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.continue-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.continue-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
}
.continue-thumb {
  flex: 0 0 74px;
  width: 74px; height: 60px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}
.continue-thumb img { width: 100%; height: 100%; object-fit: cover; }
.continue-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.continue-body small { font-size: 12px; color: var(--muted); }
.continue-body strong { font-weight: 500; font-size: 15px; line-height: 1.45; }
.continue-body > span { font-size: 12px; }
.continue-body .lms-bar { margin: 6px 0 2px; }
.continue-play { color: var(--primary); font-size: 20px; flex: 0 0 auto; opacity: .5; transition: opacity .16s ease; }
.continue-card:hover .continue-play { opacity: 1; }

/* ---------- แถบชวนสมัคร ---------- */
.cta-band {
  margin-top: var(--sect);
  padding: 56px 28px;
  text-align: center;
  border-radius: var(--r-xl);
  color: #fff;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  box-shadow: var(--sh-3);
}
.cta-band h2 { color: #fff; margin-bottom: 8px; }
.cta-band p { color: rgba(255, 255, 255, .88); margin: 0 0 4px; }
.cta-band .hero-actions { justify-content: center; }
.cta-band .btn { background: #fff; color: var(--primary); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); }
.cta-band .btn:hover { background: #fff; color: var(--primary); }
.cta-band .btn.outline { background: transparent; border-color: rgba(255, 255, 255, .5); color: #fff; }
.cta-band .btn.outline:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* ============================================================
   ฮีโร่ทั่วไป (หน้ารายการอื่น ๆ)
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  padding: 64px 24px;
  text-align: center;
  border-radius: var(--r-xl);
  margin-bottom: 40px;
}
.hero h1 { color: #fff; margin-bottom: 10px; }
.hero p { color: rgba(255, 255, 255, .9); max-width: 640px; margin: 0 auto 22px; }
.hero .btn { background: #fff; color: var(--primary); }

/* ============================================================
   การ์ดบทความ / เนื้อหาทั่วไป
   ============================================================ */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--gap); }
.card-post {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card-post:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-2);
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
}
.card-post .thumb {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  display: grid; place-items: center;
  color: #cbd5e1;
  font-size: 28px;
}
.card-post .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-post .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-post h3 { font-size: 17px; margin-bottom: 4px; }
.card-post .price { color: var(--primary); font-weight: 500; margin: 6px 0 0; }

.tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  padding: 2px 11px;
  border-radius: 99px;
  margin-bottom: 8px;
}

/* ============================================================
   บทความ
   ============================================================ */
.article { max-width: 780px; margin: 0 auto; }
.article .cover { width: 100%; border-radius: var(--r-lg); margin-bottom: 26px; box-shadow: var(--sh-2); }
.article-content { font-size: 17px; line-height: 1.95; color: var(--ink-2); }
.article-content h2 { margin: 34px 0 12px; color: var(--ink); }
.article-content h3 { margin: 26px 0 10px; color: var(--ink); }
.article-content p { margin: 0 0 18px; }
.article-content img { border-radius: var(--r); }
.article-content ul, .article-content ol { padding-left: 22px; margin: 0 0 18px; }
.article-content li { margin-bottom: 8px; }
.article-content blockquote {
  margin: 22px 0;
  padding: 16px 22px;
  border-left: 4px solid color-mix(in srgb, var(--primary) 55%, transparent);
  background: var(--surface-2);
  border-radius: 0 var(--r) var(--r) 0;
  color: var(--ink-2);
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 15.5px; }
.article-content th, .article-content td { border: 1px solid var(--line); padding: 10px 13px; text-align: left; }
.article-content th { background: var(--surface-2); font-weight: 500; }
.article-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   ฟอร์ม
   ============================================================ */
.auth-box {
  max-width: 440px;
  margin: 30px auto;
  padding: 36px 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-2);
}
.auth-box h1 { font-size: 25px; text-align: center; margin-bottom: 24px; }

.field { margin-bottom: 17px; }
.field label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

/* ============================================================
   ข้อความแจ้งเตือน
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--r);
  margin-bottom: 18px;
  font-size: 14.5px;
  border: 1px solid transparent;
}
.alert.success { background: #ecfdf5; color: #15803d; border-color: #bbf7d0; }
.alert.error   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert.info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.alert a { text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   แบ่งหน้า
   ============================================================ */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 40px 0 10px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 40px; height: 40px;
  display: grid; place-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  color: var(--ink-2);
  transition: .15s ease;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled, .pagination .dots { color: #cbd5e1; border-color: transparent; }

/* ============================================================
   ส่วนท้ายเว็บ
   ============================================================ */
.site-footer {
  margin-top: var(--sect);
  border-top: 1px solid var(--line);
  padding: 52px 0 22px;
  background: var(--surface-2);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 36px;
  padding-bottom: 34px;
}
.footer-brand { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 500; margin-bottom: 10px; }
.footer-inner h4 { font-size: 14.5px; font-weight: 500; margin-bottom: 14px; color: var(--ink); }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-links a { color: var(--muted); font-size: 14.5px; }
.footer-links a:hover { color: var(--primary); }
.footer-contact { display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; color: var(--muted); }
.footer-contact i { width: 18px; color: var(--primary); }
.copyright {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

/* ============================================================
   หน้ารายการ: ค้นหา / กรอง / เรียง
   ============================================================ */
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.list-head h1 { margin: 0; }

.breadcrumb {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 13.5px; color: var(--muted); margin-bottom: 18px;
}
.breadcrumb a:hover { color: var(--primary); }

.list-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.list-search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.list-search i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.list-search input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: inherit; font-size: 15px;
}
.list-toolbar select {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: inherit; font-size: 14.5px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.list-toolbar select:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }

.list-layout { display: grid; grid-template-columns: 252px 1fr; gap: 36px; align-items: start; }
.list-side { position: sticky; top: calc(var(--adminbar-h) + var(--header-h) + 18px); }
.filter-group { margin-bottom: 28px; }
.filter-group h3 { font-size: 15px; margin-bottom: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.filter-group ul { list-style: none; margin: 0; padding: 0; }
.filter-group ul ul { padding-left: 16px; border-left: 1px solid var(--line); margin: 4px 0 4px 6px; }
.filter-group li a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  margin-bottom: 2px;
  border-radius: 9px;
  font-size: 14.5px;
  color: var(--ink-2);
  transition: .14s ease;
}
.filter-group li a:hover { background: var(--surface-2); color: var(--primary); }
.filter-group li a.active { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); font-weight: 400; }
.filter-group li a em {
  margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 0 8px; border-radius: 99px;
}
.term-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 5px 8px 5px 15px; border-radius: 99px; font-size: 13px;
}
.chip a { color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; }
.chip a:hover { color: #dc2626; }

/* ============================================================
   สถานะว่าง
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--r-xl);
}
.empty-state i { font-size: 40px; opacity: .3; display: block; margin-bottom: 14px; }
.empty-state p { margin: 0 0 18px; }

/* ============================================================
   ความคิดเห็น
   ============================================================ */
.comments-section { max-width: 780px; margin: 56px auto 0; padding-top: 34px; border-top: 1px solid var(--line); }
.comment-list { list-style: none; padding: 0; margin: 22px 0; }
.comment-list.nested { padding-left: 28px; border-left: 2px solid var(--line); margin-top: 14px; }
.comment-item { padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.comment-head { display: flex; gap: 10px; align-items: baseline; }
.comment-body { margin: 6px 0; font-size: 15.5px; }
.comment-reply-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font-family: inherit; font-size: 13px; padding: 0; }
.comment-form {
  margin-top: 32px; padding: 26px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-2);
}
.comment-form h3 { margin-bottom: 14px; }

/* ============================================================
   แท็ก
   ============================================================ */
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.tag-list a {
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 5px 15px; border-radius: 99px; font-size: 13px; color: var(--muted);
  transition: .15s ease;
}
.tag-list a:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   ฟอร์มจากตัวสร้างฟอร์ม
   ============================================================ */
.sa-form { max-width: 740px; }
.sa-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.sa-field { margin-bottom: 17px; }
.sa-field.full { grid-column: 1 / -1; }
.sa-field label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 7px; }
.sa-field .req { color: #dc2626; }
.sa-field input[type=text], .sa-field input[type=email], .sa-field input[type=tel],
.sa-field input[type=number], .sa-field input[type=date], .sa-field input[type=time],
.sa-field input[type=file], .sa-field select, .sa-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 15px;
  background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.sa-field textarea { resize: vertical; }
.sa-field input:focus, .sa-field select:focus, .sa-field textarea:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}
.sa-field.has-error input, .sa-field.has-error textarea, .sa-field.has-error select { border-color: #dc2626; }
.sa-field .err-text { color: #dc2626; font-size: 12.5px; display: block; margin-top: 5px; }
.sa-field .muted { display: block; margin-top: 5px; font-size: 12.5px; }
.sa-choices { display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }
.sa-choices label { display: flex; align-items: center; gap: 9px; margin: 0; font-weight: 300; }
.sa-choices input { width: auto; }
.sa-consent { display: flex; align-items: flex-start; gap: 10px; font-weight: 300; line-height: 1.6; }
.sa-consent input { width: auto; margin-top: 5px; }

/* ============================================================
   จอเล็ก
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sect: 54px; }
  .home-hero { grid-template-columns: 1fr; gap: 34px; }
  .home-hero-art { min-height: 300px; max-width: 460px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .list-layout { grid-template-columns: 1fr; }
  .list-side { position: static; order: 2; border-top: 1px solid var(--line); padding-top: 24px; }
}

@media (max-width: 820px) {
  .site-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    gap: 4px;
    padding: 14px 20px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-2);
  }
  .site-nav.open { display: flex; }
  .site-nav-items { flex-direction: column; align-items: stretch; gap: 2px; }
  .site-nav-items .submenu { position: static; display: block; box-shadow: none; border: 0; padding: 0 0 0 14px; margin: 0; }
  .site-nav > a, .site-nav-items > li > a { padding: 11px 14px; }
  .nav-divider { display: none; }
  .nav-toggle { display: grid; place-items: center; margin-left: auto; }
  .btn-nav, .nav-user { justify-content: center; margin-top: 4px; }
}

@media (max-width: 720px) {
  :root { --sect: 46px; --gap: 16px; }
  .page { padding: 24px 18px 56px; }
  .container { padding: 0 18px; }
  .stat-band { grid-template-columns: repeat(2, 1fr); gap: 22px 6px; padding: 26px 16px; }
  .home-hero-art { display: none; }
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }
  .hero { padding: 46px 20px; }
  .cta-band { padding: 42px 22px; }
  .auth-box { padding: 28px 22px; }
  .section-head { align-items: flex-start; }
}

@media (max-width: 480px) {
  .hero-search { flex-wrap: wrap; border-radius: var(--r-lg); padding: 12px; }
  .hero-search input { width: 100%; }
  .hero-search .btn { width: 100%; }
  .hero-actions .btn { flex: 1; }
}
