/* ตั้งค่าฟอนต์หลักของเว็บไซต์ */
body {
  font-family: "Kanit", sans-serif !important;
  background-color: #f1f5f9;
}

/* ตั้งค่าฟอนต์หัวข้อ ให้ดูทันสมัย */
h1,
h2,
h3,
h4,
.block-header {
  font-family: "Kanit", sans-serif; /* หรือเลือกเป็น 'Prompt' */
  font-weight: 600;
}

/* หากต้องการปุ่มที่ดูทันสมัย */
.btn-admin {
  font-family: "Prompt", sans-serif;
}

/* ==========================================================================
   1. BASE RESET & CONFIGURATION (การตั้งค่าพื้นฐานและฟอนต์หลัก)
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap");

:root {
  --primary-color: #0f172a; /* สีกรมท่าเข้ม */
  --accent-color: #2563eb; /* สีน้ำเงินสว่าง */
  --bg-light: #f8fafc; /* สีพื้นหลังเทาขาวนวล */
  --text-main: #334155; /* สีข้อความทั่วไป */
  --text-dark: #0f172a; /* สีหัวข้อเข้ม */
  --cream-accent: #eaddca; /* สีครีม/น้ำตาลอ่อนสำหรับหัวข้อเมนูย่อย */
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-light);
  color: var(--text-main);
  font-family: "Sarabun", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Container พื้นฐานสำหรับหน้าทั่วไป */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   2. NAVBAR & NAVIGATION MENU (แถบเมนูนำทางด้านบนสุด - ชิดขอบจอ)
   ========================================================================== */
/* ตั้งค่า Navbar หลัก */
.main-navbar {
  background: rgba(255, 255, 255, 0.95); /* พื้นหลังโปร่งใสเล็กน้อย */
  backdrop-filter: blur(10px); /* เอฟเฟกต์กระจกฝ้า */
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 10px 0;
  transition: all 0.3s ease;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

/* โลโก้และชื่อหน่วยงาน */
.nav-logo a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-logo img {
  height: 50px;
  width: auto;
}

/* เมนู */
.nav-menu {
  display: flex;
  list-style: none;
  gap: 25px;
  align-items: center;
}

.nav-menu a {
  text-decoration: none;
  color: #475569;
  font-weight: 500;
  transition: color 0.3s;
  padding: 8px 0;
}

.nav-menu a:hover,
.nav-menu li.active a {
  color: #0f172a;
  border-bottom: 2px solid #0f172a;
}

/* ปุ่มเข้าสู่ระบบ */
.btn-admin {
  background: #0f172a;
  color: white !important;
  padding: 8px 20px !important;
  border-radius: 8px;
  transition:
    transform 0.2s,
    background 0.2s;
}

.btn-admin:hover {
  background: #1e293b;
  transform: scale(1.05);
}

/* เมนูสำหรับมือถือ (ปรับแต่งตามความเหมาะสม) */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
  }
  .nav-menu {
    display: none; /* ซ่อนเมนูไว้ก่อน แล้วใช้ JS เปิด */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
}

/* ==========================================================================
   3. MAIN BANNER SLIDER (สไลด์แบนเนอร์หลักด้านบน - ชิดขอบจอ 100%)
   ========================================================================== */
.full-width-slider-container {
  width: 100% !important;
  max-width: 100% !important;
  margin-top: 0 !important;
  margin-bottom: 35px !important;
  padding: 0 !important;
  overflow: hidden;
  position: relative;
}

/* บังคับตัว Swiper ให้ขยายสุดขอบ */
.full-width-slider-container .main-slider {
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 0px !important; /* ลบมุมโค้งออกเพื่อให้ชนขอบพอดี */
  margin: 0 !important;
  padding: 0 !important;
}

.banner-wrapper {
  position: relative;
  width: 100% !important;
  line-height: 0; /* กำจัดช่องว่างใต้ img */
}

/* ⭐️ แสดงภาพแบนเนอร์เต็ม 100% ไม่ตัด */
.banner-image {
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
  display: block;
}

/* แถบพาดหัวข้อข่าวบนรูปสไลด์ */
.banner-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  padding: 50px 30px 20px 30px;
  box-sizing: border-box;
}

.banner-caption h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 500;
  color: #ffffff;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.7);
  max-width: 1200px;
  margin: 0 auto;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ปุ่มควบคุม Swiper */
.full-width-slider-container .swiper-button-next,
.full-width-slider-container .swiper-button-prev {
  color: #ffffff !important;
  background: rgba(0, 0, 0, 0.3);
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.full-width-slider-container .swiper-button-next::after,
.full-width-slider-container .swiper-button-prev::after {
  font-size: 1rem !important;
  font-weight: bold;
}

/* 📱 ปรับแต่งความสูงแบนเนอร์เพิ่มเติมเมื่ออยู่บนหน้าจอมือถือ */
@media (max-width: 768px) {
  .full-width-slider-container {
    margin-bottom: 20px !important;
  }
  .banner-caption {
    padding: 30px 15px 15px 15px;
  }
  .banner-caption h3 {
    font-size: 1rem;
  }
}
/* ==========================================================================
   4. TRIPLE COLUMN LAYOUT (ระบบ 3 คอลัมน์หน้าแรกพุ่งชนขอบหน้าจอ)
   ========================================================================== */
.triple-layout-container {
  display: flex;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 30px !important;
  box-sizing: border-box;
  gap: 25px;
  margin-bottom: 50px;
}

.sidebar-column {
  width: 280px;
  flex-shrink: 0;
}

.main-center-content {
  flex: 1;
  min-width: 0; /* ล็อกกรอบไม่ให้ Swiper ดันโครงสร้างทะลุ */
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 25px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
}

/* ==========================================================================
   5. SIDEBAR MENU BLOCKS (บล็อกเมนูย่อยสีครีมสไตล์ภาพตัวอย่าง)
   ========================================================================== */
.sidebar-block {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
  padding: 5px;
}

.sidebar-block .block-header {
  background-color: var(--cream-accent);
  color: #2e2e2e;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  padding: 12px 10px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.sidebar-block .block-menu-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 5px 0;
}

.sidebar-block .block-menu-list li {
  border-bottom: 1px solid #f1f5f9;
}

.sidebar-block .block-menu-list li:last-child {
  border-bottom: none;
}

.sidebar-block .block-menu-list li a {
  display: flex;
  align-items: flex-start;
  padding: 10px 12px;
  color: #475569;
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.4;
  transition: all 0.2s ease;
}

/* ❖ ไอคอนหน้ารายการเมนูย่อย */
.sidebar-block .block-menu-list li a::before {
  content: "❖";
  color: #0ea5e9;
  font-size: 0.85rem;
  margin-right: 8px;
  flex-shrink: 0;
}

.sidebar-block .block-menu-list li a:hover {
  background-color: #f8fafc;
  color: var(--accent-color);
  padding-left: 18px;
}

.front-sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-block {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.block-header {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 15px;
  font-weight: 600;
  font-size: 1rem;
}

.block-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.block-menu-list li a {
  display: block;
  padding: 12px 15px;
  color: #334155;
  text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
  transition: 0.2s;
}

.block-menu-list li a:hover {
  background: #f8fafc;
  color: #0f172a;
  padding-left: 20px;
}

/* ==========================================================================
   6. POST CARDS SLIDER (การ์ดรายการข่าวประชาสัมพันธ์ล่าสุด)
   ========================================================================== */
.news-slider {
  padding-bottom: 50px !important;
}

.post-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  height: 100%;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.post-card .cover-wrapper {
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  background-color: #f1f5f9;
}

.post-card .cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .cover-image {
  transform: scale(1.05);
}

.post-card-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.post-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.4;
  margin-bottom: 8px;
}

.post-meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 12px;
}

.post-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #475569;
  margin-bottom: 20px;
}

.btn-readmore {
  align-self: flex-start;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s;
}

.btn-readmore:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* ==========================================================================
   7. PREMIUM VIEW PAGE STYLES (สไตล์หน้าเปิดอ่านข่าวสารตัวเต็ม - view.php)
   ========================================================================== */
.view-container {
  max-width: 950px;
  margin: 40px auto;
  padding: 0 20px;
}

.view-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 45px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  font-size: 0.9rem;
  margin-bottom: 25px;
  color: #64748b;
}

.breadcrumb a {
  color: var(--accent-color);
  text-decoration: none;
}

.view-header {
  margin-bottom: 30px;
}

.view-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  margin-bottom: 15px;
}

.cover-image-container {
  width: 100%;
  margin-bottom: 35px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #edf2f7;
  box-shadow: var(--shadow-sm);
}

.cover-image-container img {
  width: 100%;
  height: auto;
  display: block;
}

.content-body {
  font-size: 1.15rem;
  color: var(--text-main);
  line-height: 1.8;
  margin-bottom: 50px;
  white-space: pre-line;
}

/* 🔗 จัดการสไตล์ลิงก์เชื่อมโยงที่ระบบตรวจจับได้ในเนื้อหาข่าวอัตโนมัติ */
.content-body a {
  color: var(--accent-color) !important;
  text-decoration: underline !important;
  font-weight: 500;
  word-break: break-all;
}

.content-body a:hover {
  color: #1d4ed8 !important;
}

/* ==========================================================================
   8. INTERACTIVE GALLERY & LIGHTBOX ZOOM (คลังอัลบั้มรูปภาพกิจกรรมและซูมป๊อปอัป)
   ========================================================================== */
.gallery-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 35px;
}

.gallery-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-dark);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.gallery-item {
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.06);
}

/* ฉากหลังโปร่งแสงสีดำตอนซูมภาพเต็มจอ */
.lightbox {
  display: none;
  position: fixed;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.96);
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
  padding: 20px;
}

.lightbox-content {
  max-width: 95%;
  max-height: 85vh;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: zoomAnimation 0.25s ease-out;
}

@keyframes zoomAnimation {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  padding: 10px 24px;
  background: #f1f5f9;
  color: #1e293b !important;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  border: 1px solid #cbd5e1;
  transition: all 0.2s;
}

.btn-back-home:hover {
  background: #e2e8f0;
  transform: translateX(-3px);
}

/* ==========================================================================
   9. RESPONSIVE MEDIA QUERIES (ระบบความยืดหยุ่นรองรับหน้าจอคอมและมือถือทุกสเกล)
   ========================================================================== */
@media (min-width: 1600px) {
  .triple-layout-container {
    padding: 0 50px !important;
    gap: 35px;
  }
  .nav-container {
    padding: 18px 50px !important;
  }
}

@media (max-width: 1200px) {
  .triple-layout-container {
    flex-wrap: wrap;
    padding: 0 20px !important;
  }
  .left-sidebar {
    width: 250px;
  }
  .right-sidebar {
    width: 100% !important; /* ยุบเมนูฝั่งขวาลงข้างล่างเพื่อไม่ให้ตรงกลางเบียดแน่นเกินไป */
  }
}

@media (max-width: 992px) {
  .nav-container {
    padding: 12px 20px !important;
    flex-direction: column;
    gap: 12px;
  }
  .nav-menu {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav-menu li a {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
  .triple-layout-container {
    flex-direction: column !important;
    gap: 35px;
  }
  .sidebar-column {
    width: 100% !important;
  }
  .banner-caption {
    padding: 30px 15px 15px 15px;
  }
  .banner-caption h3 {
    font-size: 1.1rem;
  }
}

@media (max-width: 768px) {
  .view-card {
    padding: 20px;
    border-radius: 0;
    border: none;
  }
  .view-container {
    padding: 0;
    margin: 10px auto;
  }
  .view-title {
    font-size: 1.5rem;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
}

/* ==========================================================================
   9. PERFECT RESPONSIVE MEDIA QUERIES (ปรับแต่งการแสดงผลบนแท็บเล็ตและมือถือ)
   ========================================================================== */

/* 💻 หน้าจอคอมพิวเตอร์ขนาดกลาง หรือแท็บเล็ตหน้าจอกว้าง (สไตล์ iPad Pro) */
@media (max-width: 1200px) {
  .triple-layout-container {
    flex-wrap: wrap;
    padding: 0 20px !important;
    gap: 20px;
  }
  .left-sidebar {
    width: 250px;
  }
  .right-sidebar {
    width: 100% !important; /* ดีดเมนูงานนิเทศลงไปกองด้านล่างข่าว */
  }
}

/* 📱 หน้าจอมือถือและแท็บเล็ตแนวตั้ง (สไตล์สมาร์ทโฟนทั่วไป) */
@media (max-width: 992px) {
  /* 1. ล้างบั๊กสไลด์แบนเนอร์ด้านบนไม่ให้ดึงหน้าเว็บทะลุขอบมือถือ */
  .full-width-slider-container {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 10px !important;
    margin-bottom: 20px !important;
  }

  .banner-image {
    /* แสดงภาพเต็ม ไม่ตัด บนมือถือ */
    height: auto;
  }

  .banner-caption {
    padding: 25px 15px 15px 15px;
  }

  .banner-caption h3 {
    font-size: 1rem;
    line-height: 1.3;
  }

  /* 2. จัดระเบียบแถบเมนูนำทางด้านบน (Navbar) บนมือถือ */
  .nav-container {
    padding: 10px 15px !important;
    flex-direction: column;
    gap: 10px;
  }

  .nav-logo a {
    font-size: 1.1rem;
  }

  .nav-logo img {
    height: 35px;
  }

  .nav-menu {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav-menu li a {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  /* 3. ยุบโครงสร้าง 3 คอลัมน์ ให้เรียงเป็นแนวดิ่งแถวเดี่ยว 100% เรียบเนียน */
  .triple-layout-container {
    flex-direction: column !important;
    padding: 0 15px !important; /* ช่องไฟขอบจอซ้าย-ขวาบนมือถือ */
    gap: 30px !important;
    overflow: hidden; /* บล็อกเนื้อหาทะลุ */
  }

  .sidebar-column {
    width: 100% !important; /* เมนูย่อยซ้ายและขวาจะยืดเต็มจอมือถือ */
  }

  .main-center-content {
    width: 100% !important;
  }

  .section-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }
}

/* 📱 หน้าจอมือถือขนาดเล็กเป็นพิเศษ */
@media (max-width: 576px) {
  .view-card {
    padding: 15px;
  }
  .view-title {
    font-size: 1.3rem;
  }
  .post-card-content {
    padding: 15px;
  }
  .post-title {
    font-size: 1.05rem;
  }
  /* ปรับแต่งปุ่มลูกศร Swiper บนมือถือให้เล็กลงไม่บังเนื้อหา */
  .full-width-slider-container .swiper-button-next,
  .full-width-slider-container .swiper-button-prev {
    width: 32px;
    height: 32px;
  }
  .full-width-slider-container .swiper-button-next::after,
  .full-width-slider-container .swiper-button-prev::after {
    font-size: 0.9rem !important;
  }
}

/* ==========================================================================
   MOBILE NAVIGATION UPGRADE (ระบบปุ่มสามขีดเปิดปิดเมนูสำหรับมือถือ)
   ========================================================================== */

/* ซ่อนปุ่มเปิดเมนูเมื่อเปิดบนหน้าจอคอมพิวเตอร์ปกติ */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.nav-toggle span {
  width: 100%;
  height: 3px;
  background-color: var(--text-dark);
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* 📱 ปรับแต่ง Navbar บนมือถือตั้งแต่สเกล 992px ลงไป */
@media (max-width: 992px) {
  .nav-container {
    padding: 12px 20px !important;
    flex-direction: row !important; /* จัดโลโก้และปุ่มสามขีดให้อยู่แถวเดียวกัน */
    justify-content: space-between !important;
    position: relative;
  }

  .nav-logo a span {
    font-size: 1rem; /* ลดขนาดชื่อหน่วยงานลงบนจอเล็ก */
  }

  /* แสดงปุ่มสามขีดบนมือถือ */
  .nav-toggle {
    display: flex;
  }

  /* ซ่อนเมนูลิงก์จริงเอาไว้ก่อน เพื่อรอการกดคลิก */
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    flex-direction: column;
    gap: 0;
    padding: 10px 0;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
  }

  /* เมื่อกดเปิดเมนู (Active) สั่งให้สไลด์กางลงมาสวยๆ */
  .nav-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-menu li {
    width: 100%;
    text-align: center;
  }

  .nav-menu li a {
    padding: 12px 20px;
    border-radius: 0;
    font-size: 1rem;
  }

  .nav-menu li a.btn-admin {
    margin: 10px 20px;
    border-radius: 8px;
  }

  /* ✖ แปลงร่างปุ่มสามขีดเป็นกากบาทตอนกดเปิด */
  .nav-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }
}

/* คอนเทนเนอร์หลัก */
/* 1. กล่องนอกสุด: บังคับคุมขนาด และซ่อนส่วนเกินบนมือถือ */
.news-ticker-container {
  display: flex;
  align-items: center;
  background-color: #0f172a; /* สี Slate 900 */
  color: #ffffff;
  height: 40px;
  overflow: hidden;
  border-radius: 8px;
  box-sizing: border-box;
  width: 100%;
  font-family: "Sarabun", sans-serif;
}

/* 2. ป้ายคำว่า ประชาสัมพันธ์: สีทองพรีเมียม ไม่โดนบีบเบี้ยวในมือถือ */
.ticker-label {
  background-color: #c99e29; /* สีทองพรีเมียม */
  color: #ffffff;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  flex-shrink: 0; /* ป้องกันป้ายโดนบีบจนตัวหนังสือตกบรรทัดในจอเล็ก */
  z-index: 10;
  box-shadow: 4px 0 8px rgba(0, 0, 0, 0.2);
}

/* 3. กล่องหุ้มข้อความวิ่ง: ตัวควบคุมพื้นที่การมองเห็น */
.ticker-wrapper {
  flex: 1;
  overflow: hidden;
  min-width: 0; /* บังคับให้ Flexbox ตัดเนื้อหาที่ล้นจอออกไปเพื่อให้แอนิเมชันทำงาน */
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
}

/* 4. ข้อความที่วิ่ง: 🛠️ ปรับปรุงแก้ไขไม่ให้ข้อความขาดหาย */
.ticker-content {
  display: inline-flex; /* 🌟 เปลี่ยนจาก inline-block เป็น inline-flex เพื่อยึดแถวข้อมูล */
  align-items: center;
  white-space: nowrap; /* 🌟 บังคับข้อความยาวเป็นเส้นตรงแนวราบ ห้ามหักขึ้นบรรทัดใหม่เด็ดขาด */
  width: max-content; /* 🌟 บังคับให้ขนาดกล่องขยายกว้างเท่ากับความยาวข้อความจริงทั้งหมด */
  padding-left: 100%; /* เริ่มต้นวิ่งจากขอบขวาสุดของพื้นที่มองเห็น */
  font-size: 0.9rem;
  will-change: transform; /* แจ้งเตือนเบราว์เซอร์ล่วงหน้าให้เตรียมพร้อม */
  animation: mobile-smooth-ticker 25s linear infinite; /* ปรับความเร็วได้ตรงนี้ */
}

/* 5. ชุดคำสั่งแอนิเมชันแบบ 3D (Hardware Acceleration) ทำให้มือถือวิ่งลื่นไหล */
@keyframes mobile-smooth-ticker {
  0% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  100% {
    /* 🌟 วิ่งไปทางซ้ายจนสุดความกว้างของตัวมันเองพอดี ไม่ขาดไม่เกิน */
    -webkit-transform: translate3d(-100%, 0, 0);
    transform: translate3d(-100%, 0, 0);
  }
}

/* ลูกเล่นเสริม: เมื่อใช้นิ้วแตะค้างไว้ (บนมือถือ) หรือเอาเมาส์ชี้ (บนคอม) ข้อความจะหยุดวิ่งชั่วคราว */
.ticker-wrapper:hover .ticker-content,
.ticker-wrapper:active .ticker-content {
  animation-play-state: paused;
}

/* สำหรับ Sidebar ฝั่งขวา */
.right-sidebar {
  width: 300px;
}

.block-menu-list li a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  text-decoration: none;
  transition: 0.3s;
}

.block-menu-list li a:hover {
  background: #f1f5f9;
  color: #0f172a;
  padding-left: 20px;
}

/* เพิ่ม Icon เล็กๆ หน้าชื่อเมนูจะทำให้ดูน่าอ่านขึ้นมากครับ */

/*หัวข้อ*/
.section-title {
  font-family: "Sarabun", sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 25px;
  position: relative;
  padding-bottom: 10px;
  display: inline-block;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 60px;
  height: 4px;
  background: #d4af37; /* สีทอง */
  border-radius: 2px;
}

/* อ่านรายละเอียดเพิ่มเติม */

.btn-readmore-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 12px 10px;
  background: #f1f5f9;
  color: #0f172a;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  box-sizing: border-box;
  transition: all 0.2s ease-in-out;

  position: relative;
  z-index: 50 !important;
  -webkit-tap-highlight-color: transparent;

  /* 🌟 เพิ่ม 2 บรรทัดนี้: บังคับให้ปุ่มลอยขึ้นมาอยู่ระนาบหน้าสุดของมิติ 3D บนมือถือ ป้องกันการกดไม่ติด */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
