/* ==========================================================================
   baikhao — main stylesheet
   ธีมเรียบ ทันสมัย โทนเข้ม-สว่างคู่กัน ให้หน้าตาใกล้เคียงต้นแบบ
   ========================================================================== */
:root{
  --navy: #131a24;
  --navy-2: #1b2532;
  --accent: #2dd4bf;
  --accent-2: #3b82f6;
  --bg-body: #f4f6f9;
  --bg-card: #ffffff;
  --border-color: #e7eaef;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #8a93a3;
  --radius: 14px;
}

* { box-sizing: border-box; }
body{
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: "Noto Sans Thai", "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a{ color: inherit; text-decoration: none; }
img{ max-width: 100%; }

/* ==========================================================================
   Header — คัดลอกดีไซน์จาก styles.css เวอร์ชันเดิม (site-header/topbar/catbar)
   ใช้ชื่อคลาสเดิมของระบบใหม่ (bk-*) เพื่อไม่กระทบ JS ของ mega menu
   ========================================================================== */

/* ---------- Sticky header wrapper (เดิม: .site-header) ---------- */
/* ลอยติดด้านบนเสมอ ไม่เลื่อนตามเนื้อหา ทุกขนาดหน้าจอ (คอม/แท็บเล็ต/มือถือ) */
html{ scroll-padding-top: 96px; } /* กันไม่ให้ anchor link ถูกส่วนหัวลอยบัง */
.bk-navbar{
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  /* เผื่อพื้นที่ safe-area บนมือถือรุ่นใหม่ (notch) */
  padding-top: env(safe-area-inset-top, 0);
}

/* ---------- Top row: โลโก้ + ค้นหา + auth (เดิม: .topbar) ---------- */
.bk-topbar{
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
  color: #fff;
  padding: .75rem 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}



/* ---------- Brand (เดิม: .brand) ---------- */
.bk-logo{
  display: inline-block;
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: -.5px;
  color: #fff;
  background: linear-gradient(45deg, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all .3s ease;
}
.bk-logo span{ /* ส่วนนี้เป็น gradient text อยู่แล้วจากตัว .bk-logo เอง */ }
.bk-logo:hover{
  color: #fff;
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* ---------- Search (เดิม: .search / .search-input / .search-btn) ---------- */
.bk-search-form{
  position: relative;
  max-width: 520px;
  width: 100%;
}
.bk-search-input{
  width: 100%;
  height: 42px;
  background: rgba(255,255,255,.95);
  color: #1e293b;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: .5rem 1rem .5rem 2.5rem;
  font-size: .95rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  transition: all .3s ease;
}
.bk-search-input:focus{
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96,165,250,.1);
  transform: translateY(-1px);
}
.bk-search-input::placeholder{ color: #64748b; }
.bk-search-btn{
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 0;
  color: #64748b;
  font-size: 1.1rem;
  border-radius: 0;
  transition: color .3s ease;
}
.bk-search-input:focus + .bk-search-btn{ color: #60a5fa; }

/* ---------- Search suggestions dropdown ---------- */
.search-sugg-panel{
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  color: var(--text-primary);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15,23,42,.22);
  overflow: hidden;
  z-index: 500;
}
.search-sugg-panel.is-open{ display: block; }

/* กล่อง scroll ชั้นใน: แยกออกจาก .search-sugg-panel โดยเจตนา เพื่อไม่ให้
   scrollbar ไปทับมุมโค้งของ panel ชั้นนอก (panel ชั้นนอกมี overflow:hidden
   ทำหน้าที่ครอบตัดให้เห็นมุมโค้งครบ 4 มุมเสมอ ไม่ว่าเนื้อหาข้างในจะ scroll หรือไม่) */
.search-sugg-scroll{
  max-height: 420px;
  overflow-y: auto;
}

.search-sugg-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  transition: background .12s ease;
}
.search-sugg-item:last-child{ border-bottom: none; }
.search-sugg-item:hover,
.search-sugg-item.is-active{ background: var(--bg-body); }

.search-sugg-thumb{
  flex: 0 0 52px;
  width: 52px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-body);
}
.search-sugg-thumb img{ width:100%; height:100%; object-fit: cover; display:block; }
.search-sugg-thumb-fallback{
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
  color: var(--text-muted);
}
.search-sugg-icon{
  flex: 0 0 36px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(59,130,246,.1);
  color: var(--accent-2);
  display:flex; align-items:center; justify-content:center;
}
.search-sugg-body{ min-width: 0; flex: 1 1 auto; }
.search-sugg-title{
  display: block;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-sugg-meta{
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.search-sugg-dot{ opacity: .6; }
.search-sugg-empty{
  padding: 16px 14px;
  font-size: .86rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Auth area (เดิม: .hello / .hdr-btn / .hdr-icon-btn) ---------- */
.bk-user-area{ font-size: .92rem; white-space: nowrap; }
.bk-hello{ font-size: .82rem; color: rgba(255,255,255,.45); }
.bk-hello strong{ color: rgba(255,255,255,.85); font-weight: 600; }

.bk-btn{
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem 0;
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  background: none;
  border: none;
  transition: color .18s ease, opacity .18s ease;
}
.bk-btn-ghost{ color: rgba(255,255,255,.75); }
.bk-btn-ghost:hover{ color: #fff; }
.bk-btn-logout{ color: rgba(255,255,255,.45); }
.bk-btn-logout:hover{ color: #fca5a5; }
.bk-btn-primary{ color: #60a5fa; font-weight: 600; }
.bk-btn-primary:hover{ color: #93c5fd; }

.bk-icon-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  color: rgba(255,255,255,.7);
  background: none;
  border: none;
  border-radius: 0;
  transition: color .18s ease;
}
.bk-icon-btn:hover{ color: #fff; background: none; }
.bk-icon-btn-logout:hover{ color: #fca5a5; }
.bk-icon-btn-primary{ color: #60a5fa; }
.bk-icon-btn-primary:hover{ color: #93c5fd; }

/* ---------- Category bar (เดิม: .catbar / .cat-main-nav / .maincat-link) ---------- */
.bk-menu{
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #e5e7eb;
  border-bottom: 1px solid rgba(0,0,0,.15);
  position: relative;
}
.bk-menu .container{ position: relative; }
.bk-menu-scroll{
  gap: 0;
  overflow-x: auto;
  white-space: nowrap;
  padding: .5rem 0;
  scrollbar-width: none;
}
.bk-menu-scroll::-webkit-scrollbar{ display:none; }

.bk-menu .nav-link{
  color: rgba(255,255,255,.72);
  padding: .55rem .45rem;
  font-weight: 500;
  font-size: .95rem;
  letter-spacing: -.01em;
  white-space: nowrap;
  position: relative;
  border-bottom: none;
  transition: color .2s ease;
}
.bk-menu .nav-link::after{
  content: '';
  position: absolute;
  bottom: 0; left: 50%; right: 50%;
  height: 2px;
  background: #60a5fa;
  border-radius: 2px 2px 0 0;
  transition: left .22s ease, right .22s ease;
}
.bk-menu .nav-link:hover{ color: #fff; }
.bk-menu .nav-link:hover::after{ left: 10%; right: 10%; }
.bk-menu .nav-link.active{ color: #fff; font-weight: 600; }
.bk-menu .nav-link.active::after{
  left: 10%; right: 10%;
  background: linear-gradient(90deg, #60a5fa, #34d399);
}

/* Mobile: เมนูหมวดหมู่แบบ pill เลื่อนแนวนอน (เดิม: @media maincat-link) */
@media (max-width: 991.98px){
  .bk-menu{ overflow-x: auto; overflow-y: hidden; padding: .5rem 0; }
  .bk-menu-scroll{ display:flex; gap: .4rem; padding: 0 1rem; }
  .bk-menu .nav-link{
    flex-shrink: 0;
    padding: .35rem 1rem;
    border-radius: 20px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    color: rgba(255,255,255,.9);
    font-size: .85rem;
    font-weight: 500;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
  }
  .bk-menu .nav-link::after{ display:none; }
  .bk-menu .nav-link:hover{
    background: rgba(255,255,255,.15);
    border-color: rgba(255,255,255,.25);
  }
  .bk-menu .nav-link.active{
    background: rgba(96,165,250,.2);
    border-color: rgba(96,165,250,.4);
    color: #fff;
    box-shadow: 0 2px 8px rgba(96,165,250,.3);
  }
  .bk-search-form{ max-width: 100%; }
}

/* ---------- Hero slider ---------- */
.bk-hero{
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #dfe6ee;
  min-height: 320px;
}
.bk-hero-slide{ position: relative; display:block; }
.bk-hero-slide img{
  width: 100%;
  height: 420px;
  object-fit: cover;
  display: block;
}
.bk-hero-caption{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 28px 28px 20px;
  background: linear-gradient(to top, rgba(0,0,0,.78) 10%, rgba(0,0,0,.35) 60%, transparent 100%);
  color: #fff;
}
.bk-hero-badge{
  display:inline-block;
  background: var(--accent-2);
  color:#fff;
  font-size:.78rem;
  font-weight:700;
  padding: 4px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.bk-hero-caption h2{
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.35;
}
.bk-hero-caption p{
  color: #d7dee8;
  font-size: .92rem;
  max-width: 720px;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-hero-meta{ font-size: .8rem; color: #b9c2cf; }
.bk-hero-dots{
  position:absolute; right: 18px; bottom: 14px;
  display:flex; gap:6px;
}
.bk-hero-dots span{
  width:8px; height:8px; border-radius:50%;
  background: rgba(255,255,255,.45);
}
.bk-hero-dots span.active{ background:#fff; width:22px; border-radius:6px; }

/* ---------- Trending sidebar ---------- */
.bk-side-card{
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
}
.bk-side-title{
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 14px;
  display:flex; align-items:center; gap:8px;
}
.bk-trend-item{
  display:flex; gap:10px; align-items:flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}
.bk-trend-item:last-child{ border-bottom:none; }
.bk-trend-rank{
  flex: 0 0 24px;
  font-weight: 800;
  color: var(--accent-2);
}
.bk-trend-title{ font-size: .9rem; font-weight: 600; line-height:1.4; }
.bk-trend-title:hover{ color: var(--accent-2); }
.bk-trend-meta{ font-size: .76rem; color: var(--text-muted); margin-top:2px; }

/* ---------- Article / news cards ---------- */
.bk-card{
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow:hidden;
  height: 100%;
  transition: box-shadow .15s ease, transform .15s ease;
}
.bk-card:hover{ box-shadow: 0 10px 24px rgba(20,30,50,.08); transform: translateY(-2px); }
.bk-card-img{
  aspect-ratio: 16/9;
  width: 100%;
  object-fit: cover;
  background: #eef1f5;
  display:block;
}
.bk-card-body{ padding: 14px; }
.bk-card-cat{
  display:inline-block;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(59,130,246,.1);
  padding: 3px 9px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.bk-card-title{
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-card-title:hover{ color: var(--accent-2); }
.bk-card-excerpt{
  font-size: .84rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-card-meta{ font-size: .76rem; color: var(--text-muted); }
.bk-card-meta i{ margin-right: 3px; }

/* ---------- Section title ---------- */
.bk-section-title{
  font-weight: 800;
  font-size: 1.2rem;
  margin: 0;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}
.bk-section-head{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom: 16px;
}
.bk-more-link{ font-size: .85rem; font-weight:600; color: var(--accent-2); }

/* ---------- Category tabs ---------- */
.cat-tabs{ }
.cat-tab{
  display:inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.cat-tab.active, .cat-tab:hover{
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ---------- Article detail page ---------- */
.bk-article-header{ margin-bottom: 18px; }
.bk-article-header h1{ font-weight: 800; font-size: 1.75rem; line-height:1.4; }
.bk-article-meta{ color: var(--text-muted); font-size: .88rem; }
.bk-article-cover{ border-radius: var(--radius); overflow:hidden; margin: 18px 0; }
.bk-article-content{ font-size: 1.02rem; line-height: 1.9; color: var(--text-primary); }
.bk-article-content img{ border-radius: 10px; margin: 12px 0; }
.bk-article-content h2, .bk-article-content h3{ font-weight: 800; margin-top: 1.6em; }
.bk-tag-pill{
  display:inline-block; background:#eef1f5; color:var(--text-secondary);
  padding: 5px 12px; border-radius: 999px; font-size:.8rem; margin: 0 6px 6px 0;
}
.bk-tag-pill:hover{ background: var(--navy); color:#fff; }

/* ---------- Footer ---------- */
.bk-footer{
  background: var(--navy);
  color: #aab4c2;
  margin-top: 48px;
  font-size: .9rem;
}
.bk-footer a{ color:#cbd5e1; }
.bk-footer a:hover{ color:#fff; }
.bk-footer h6{ color:#fff; font-weight:700; margin-bottom: 14px; }
.bk-footer hr{ border-color: rgba(255,255,255,.1); }

.footer-col li{ font-size: .86rem; line-height: 1.7; }
.footer-col a{ color:#aab4c2; }
.footer-col a:hover{ color:#fff; }
.footer-head a{
  color:#fff;
  font-weight: 700;
  font-size: .92rem;
}
.footer-sep{ border-color: rgba(255,255,255,.1); margin: 0; }
.footer-links li{ display: inline-block; }
.footer-links a{ color:#cbd5e1; }
.footer-links a:hover{ color:#fff; }
.footer-links .list-inline-item:not(:last-child){ margin-right: 1rem; }

/* ซ่อนไอคอน/ป้าย reCAPTCHA ที่ลอยมุมขวาล่าง (ตามข้อกำหนดของ Google ต้องแสดงข้อความแจ้งแทนใน footer) */
.grecaptcha-badge{ visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }

.footer-recaptcha-note{ font-size: .78rem; color:#8b95a5; line-height:1.6; }
.footer-recaptcha-note a{ color:#8b95a5; text-decoration: underline; }
.footer-recaptcha-note a:hover{ color:#fff; }

.social-btn{
  display:inline-flex; align-items:center;
  font-size: .82rem; font-weight: 600;
  color:#cbd5e1;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  padding: .35rem .85rem;
}
.social-btn:hover{ color:#fff; border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.06); }

/* ---------- Misc ---------- */
.line-clamp-2{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-3{ display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.object-fit-cover{ object-fit: cover; }
.pagination .page-link{ color: var(--text-primary); }
.pagination .page-item.active .page-link{ background: var(--navy); border-color: var(--navy); }

@media (max-width: 767px){
  .bk-hero-slide img{ height: 240px; }
  .bk-hero-caption h2{ font-size: 1.1rem; }
}

/* ==========================================================================
   มือถือ: โทนสีเฉพาะของส่วนหัว (แตกต่างจากเดสก์ท็อป) ให้เห็นชัดว่าเป็นแถบลอยอยู่
   บนสุดของจอเสมอ แยกออกจากเนื้อหาที่เลื่อนผ่านด้านล่าง
   ========================================================================== */
@media (max-width: 767.98px){
  .bk-navbar{ box-shadow: 0 6px 18px rgba(8,15,30,.4); }
  .bk-topbar{
    background: linear-gradient(120deg, #0b3b82 0%, #1554c7 55%, #0891b2 100%);
    padding: .6rem 0;
    border-bottom: 1px solid rgba(255,255,255,.14);
  }
  .bk-menu{
    background: linear-gradient(120deg, #08306b 0%, #123e91 100%);
    border-bottom-color: rgba(0,0,0,.25);
  }
  .bk-search-input{ height: 40px; }
}

/* ==========================================================================
   Tablet (768–991px): คงเลย์เอาต์แบบเดสก์ท็อปของส่วนหัวไว้ (แถวเดียว)
   แต่ลดระยะห่าง/ขนาดตัวอักษรลงเล็กน้อยให้พอดีกับพื้นที่แคบกว่า
   ========================================================================== */
@media (min-width: 768px) and (max-width: 991.98px){
  .bk-logo{ font-size: 1.5rem; }
  .bk-search-form{ max-width: 340px; }
}

/* ==========================================================================
   มือถือ: รายการบทความ (หน้าหมวดหมู่ / แท็ก / ค้นหา) แสดงเป็น "รายการแนวนอน"
   เรียงบนลงล่าง — รูปอยู่ซ้าย หัวข้อ+บทคัดย่ออยู่ขวา แทนการ์ดแนวตั้งแบบตาราง
   ========================================================================== */
@media (max-width: 575.98px){
  .bk-card{
    display: flex;
    flex-direction: row;
    align-items: center;
    height: auto;
  }
  /* กล่องรูปปกขนาดคงที่ ทรงสี่เหลี่ยมจัตุรัสเท่ากันทุกโพสต์ (เทคนิคเดียวกับ .side-thumb
     ในหน้ารายละเอียดข่าว: ใช้ padding-top ล็อกสัดส่วน ไม่ขึ้นกับความสูงของข้อความข้างๆ)
     จัดให้อยู่กึ่งกลางแนวตั้งของแถวเสมอ ไม่ชิดขอบบน */
  .bk-card-thumb-link{
    position: relative;
    display: block;
    width: 110px;
    flex: 0 0 110px;
    align-self: center;
  }
  .bk-card-thumb-link::before{ content:""; display:block; padding-top: 100%; }
  .bk-card-thumb-link .bk-card-img{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
  }
  .bk-card-body{ flex: 1 1 auto; min-width: 0; padding: 10px 12px; }
  .bk-card-cat{ font-size: .68rem; padding: 2px 7px; margin-bottom: 5px; }
  .bk-card-title{ font-size: .9rem; margin-bottom: 5px; -webkit-line-clamp: 2; }
  .bk-card-excerpt{ font-size: .78rem; margin-bottom: 6px; -webkit-line-clamp: 2; }
  .bk-card-meta{ font-size: .72rem; }
}
