﻿/* กำหนดค่าพื้นฐาน */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
   /* background-color: #f4f7f9;*/
    color: #333;
    background: url("img/home/BG1.jpg")  ;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

html {
    scroll-behavior: smooth ; 
}
 /*=================================== */
/* 3. Navigation Bar Styles */
/* =================================== */

header {
    background-color: #ffffffb2; 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;  
}
/* ให้อยู่ด้านบนสุด*/
[id] {
  scroll-margin-top: 80px;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

/* สไตล์โลโก้ */
.logo img {
    height: 60px; /* กำหนดความสูงของโลโก้ */
    width: auto;
    display: block;
}

/* สไตล์รายการเมนู */
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.main-nav li {
    margin-left: 30px;
}

.main-nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    padding: 8px 0;
    transition: color 0.3s, border-bottom 0.3s;
    border-bottom: 3px solid transparent; /* เตรียมเส้นขีดใต้เมนู */
}

/* สไตล์เมื่อนำเมาส์ไปชี้/เมนูที่ active */
.main-nav a:hover,
.main-nav a.active {
    color: #0073e6; /* ใช้สีน้ำเงินธีม 
    border-bottom: 3px solid #0073e6;*/
}

/* สไตล์สำหรับปุ่ม Contact (เน้นเป็นพิเศษ) */
.main-nav a.contact-link {
    background-color: #ff9900; /* สีส้มธีม */
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    border-bottom: none;
    margin-left: 15px;
}

.main-nav a.contact-link:hover {
    background-color: #cc7a00;
    color: white;
    border-bottom: none;
}

/* ปุ่มสำหรับเมนูมือถือ (ซ่อนไว้บนเดสก์ท็อป) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5em;
    color: #0073e6;
    cursor: pointer;
}

/* =================================== */
/* Responsive Design (สำหรับมือถือ) */
/* =================================== */

/* =================================== */
/* Responsive Design (สำหรับมือถือ) - แก้ไขและปรับปรุงใหม่ */
/* =================================== */

@media (max-width: 768px) {
    /* 1. HEADER & TOGGLE BUTTON */
    .nav-container {
        padding: 10px 5%!important; /* เพิ่ม padding ซ้ายขวาให้ห่างขอบจอ */
    }
    
    .logo img {
        height: 50px; /* ลดขนาดโลโก้บนมือถือ */
    }

    .menu-toggle {
        display: block; /* แสดงปุ่มเมนูบนมือถือ */
    }
    header{
        background-color: #fff;
    }
    /* 2. MAIN NAVIGATION (สำหรับ Mobile Menu) */
    .main-nav {
        /* [KEY] การควบคุมเมนูสำหรับแอนิเมชัน: */
        display: block; /* ต้องเป็น block เพื่อให้ max-height ทำงาน */
        max-height: 0; /* ซ่อนเมนูเริ่มต้น */
        overflow: hidden; 
        transition: max-height 0.4s ease-in-out, box-shadow 0.3s; /* เพิ่มความสมูท */
        
        /* ตำแหน่งและสไตล์ของเมนูที่เลื่อนลงมา */
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 70px; /* ใต้ header (60px height + 10px padding top/bottom) */
        left: 0;
        background-color: #ffffff;
        box-shadow: none; /* ลบเงาเริ่มต้นออก */
        padding: 0;
        z-index: 999;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: flex-start; /* จัดเรียงข้อความชิดซ้าย */
        width: 100%;
        padding-bottom: 10px; /* เพิ่ม padding ภายใน ul */
        
    }

    .main-nav li {
        margin: 0; /* ลบ margin-left 30px ของ desktop ออก */
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #eee; /* เพิ่มเส้นแบ่งเบาๆ */
    }
    
    .main-nav li:last-child {
        border-bottom: none;
    }

    .main-nav a {
        display: block;
        padding: 12px 15px; /* เพิ่ม padding แนวตั้งเพื่อให้กดง่ายขึ้น */
        color: #0073e6;
        font-weight: 500;
        border-bottom: none; /* ลบเส้นขีดใต้เมนูของ Desktop ออก */
    }
    
    /*.main-nav a:hover {
        background-color: #e6f3ff;  สีฟ้าอ่อนเมื่อ Hover 
        color: #0073e6;
    }*/
    
    /* .main-nav a.active {
        [สำคัญ] สไตล์เมนู Active บน Mobile 
        color: #0073e6;
        background-color: #f4f7f9;
        font-weight: bold;
    }*/


    /* 3. ปรับปุ่ม Contact ในโหมดมือถือ */
    .main-nav a.contact-link {
        /* ทำให้เป็นลิงก์ปกติ แทนที่จะเป็นปุ่มเต็ม */
        background-color: transparent; 
        color: #ff9900; /* ใช้สีส้มแค่ตัวอักษรเพื่อเน้น */
        border-radius: 0;
        margin-left: 0; /* ลบ margin-left ที่ไม่ต้องการออก */
    }

    .main-nav a.contact-link:hover {
        background-color: #fff8e6;
        color: #cc7a00;
        border-bottom: none;
    }


    /* 4. สถานะเมนูเปิด (Active State) */
    .nav-container.active .main-nav {
        /* [KEY] เมื่อเมนูเปิด ให้ตั้งค่า max-height ให้สูงพอที่จะแสดงเนื้อหาทั้งหมด */
        max-height: 400px; /* ควรตั้งค่าให้สูงกว่าผลรวมของรายการเมนู */
      /*  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);  แสดงเงาเมื่อเมนูเปิด */
    }
    
    /* แก้ไขการจัดเรียง stats ที่เคยมีปัญหา */
    .key-stats {
        flex-wrap: wrap; 
    }
    
    .key-stats div {
        flex: 1 1 45%; /* แบ่งเป็น 2 คอลัมน์บนจอ 768px */
    }
}

/* =================================== */
/* ULTRA-MOBILE OPTIMIZATION (<= 480px) */
/* =================================== */

@media (max-width: 480px) {
    /* ... โค้ดเดิมใน 480px ... */
    
    .key-stats {
        flex-direction: column; /* ให้สถิติเรียงเป็นแนวตั้ง */
        /* ... */
    }
    
    .key-stats div {
        flex: 1 1 100%; /* กลับมาเป็นแถวเดียว */
        /* ... */
    }
    
    /* Back to Top */
    #backToTopBtn {
        bottom: 15px;
        right: 15px;
        padding: 10px 14px; /* ปรับขนาดให้พอดีมือถือ */
        font-size: 1.1em;
    }
}

/* =================================== */
/* 5. Home/Hero Section Styles (BACKGROUND IMAGE) */
/* =================================== */

.hero-section {
    position: relative;
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    overflow: hidden;
    
}

/* Overlay */
.hero-overlay {
        position: absolute;
    inset: 0;
    background: linear-gradient(
        rgba(0, 25, 55, 0.82),
        rgba(0, 70, 120, 0.65)
    );
    z-index: 1;
    
}

/* Content */
.hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    padding: 20px;
}

.hero-title {
    font-size: 44px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 4px 20px rgba(0,0,0,0.35);
    margin-bottom: 16px;
}

.hero-subtitle {
    color: rgba(255,255,255,0.85);
    margin-bottom: 10px;
}

.hero-description {
    font-size: 18px;
    line-height: 1.7;
    color: rgba(255,255,255,0.95);
}

/* Buttons */
.hero-buttons {
    margin-top: 28px;
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 26px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.25s ease;
}

/* ปุ่มหลัก */
.btn-primary {
    background: #00a8ff;
    color: #fff;
}

.btn-primary:hover {
    background: #0088cc;
    transform: translateY(-2px);
}

/* ปุ่มขอบขาวแบบโปร */
.btn-outline {
    border: 2px solid rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.08);
    color: #fff;
    backdrop-filter: blur(6px);
}

.btn-outline:hover {
    background: #ffffff;
    color: #003b5c;
}

/* Stats */
.hero-stats {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    gap: 60px;
    padding: 18px 20px;
    z-index: 2;
}

.stat span {
    font-size: 24px;
    font-weight: 700;
    display: block;
}

.stat p {
    font-size: 14px;
    opacity: 0.9;
}

/* ================= REAL MOBILE HERO FIX ================= */
@media (max-width: 768px) {

  /* Hero ใช้ layout แนวตั้ง */
  .hero-section {
    min-height: auto;
    padding: 110px 18px 40px;
    display: block;
    background: url("img/home/BG1.jpg")  ;
    background-size: cover;
    background-position: center;
  }

  /* เนื้อหากลางเต็มความกว้าง */
  .hero-content {
    max-width: 100%;
    text-align: center;
  }

  /* ฟอนต์บาลานซ์มือถือ */
  .hero-title {
    font-size: 26px;
    line-height: 1.35;
  }

  .hero-subtitle {
    font-size: 13px;
  }

  .hero-description {
    font-size: 14px;
    line-height: 1.6;
  }

  /* ปุ่มเต็มความกว้าง */
  .hero-buttons {
    gap: 10px;
    margin-top: 22px;
  }

  .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  /* ====== จุดสำคัญสุด ====== */
  /* ยกเลิกการ์ดลอยด้านขวาทั้งหมด */
  .hero-stats {
    position: static;        /* ห้าม absolute */
    width: 100%;
    margin-top: 28px;

    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;

    background: none;        /* เอากล่องดำลอยออก */
    backdrop-filter: none;
    padding: 0;
  }

  /* ทำ stat เป็นการ์ดเรียงลง */
  .stat {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    border-radius: 14px;
    padding: 16px;
  }

  .stat span {
    font-size: 20px;
  }

  .stat p {
    font-size: 13px;
  }
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

#about-us {
    background-color: #f4f7f9;
    padding: 60px 0;
}

h1 {
    text-align: center;
    color: #004d99; /* สีน้ำเงินเข้ม */
    font-size: 2.5em;
    margin-bottom: 40px;
    /*border-bottom: 3px solid #0099ff;*/
    display: inline-block;
    padding-bottom: 10px;
    width: 100%;
}

h2, h3 {
    color: #0073e6;
    margin-top: 0;
}

/* จัดเลย์เอาต์หลัก */
.about-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-bottom: 50px;
}

.text-content {
    flex: 2; /* ใช้พื้นที่มากกว่า */
}

/* ปรับสไตล์ image-box เดิมเล็กน้อย */
.image-box {
    flex: 1;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    /* ลบ height: 400px; ถ้าเคยกำหนดไว้ใน .image-box img เพื่อให้ภาพปรับตามขนาด */
}

/* สไตล์สำหรับ Slideshow */
.slideshow-container {
  max-width: 100%;
  position: relative;
  margin: auto;
}

.mySlides {
  display: none; /* ซ่อนทุกสไลด์เริ่มต้น */
}

.mySlides img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* จุดควบคุม (The Dots) */
.dot {
  cursor: pointer;
  height: 12px;
  width: 12px;
  margin: 0 2px;
  background-color: #bbb;
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.6s ease;
}

.active-dot, .dot:hover {
  background-color: #0073e6; /* ใช้สีธีมเมื่อ Active/Hover */
}

/* Fade animation */
.fade {
  animation-name: fade;
  animation-duration: 1.5s;
}

@keyframes fade {
  from {opacity: .4} 
  to {opacity: 1}
}

/* สไตล์สำหรับความสามารถหลัก (Capabilities) */
.capabilities {
    background-color: #e6f3ff;
    padding: 20px;
    border-radius: 6px;
    margin-top: 30px;
}

.capabilities ul {
    list-style: none;
    padding: 0;
}

.capabilities li {
    padding: 8px 0;
    border-bottom: 1px dashed #b3d9ff;
    font-size: 0.95em;
}

.capabilities li:last-child {
    border-bottom: none;
}

.btn-more {
    display: inline-block;
    background-color: #ff9900; /* สีส้ม */
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 15px;
    transition: background-color 0.3s;
}

.btn-more:hover {
    background-color: #cc7a00;
}

/* สไตล์สำหรับตัวเลขกำลังการผลิต */
.production-stats {
    background-color: #004d99;
    color: white;
    padding: 15px;
    text-align: center;
}

.production-stats h3 {
    color: white;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.production-stats p {
    font-size: 1.1em;
    margin: 5px 0;
}

.production-stats span {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: #ff9900;
    line-height: 1.1;
}

/* สไตล์สำหรับใบรับรองมาตรฐาน */
.certifications {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid #e0e0e0;
}

.certifications h3 {
    margin-bottom: 20px;
}

.logo-gallery {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.logo-gallery img {
    height: 160px; /* กำหนดขนาดโลโก้ */
    width: auto;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.logo-gallery img:hover {
    opacity: 1;
}

/* การปรับให้เหมาะกับหน้าจอขนาดเล็ก (Responsive Design) */
@media (max-width: 900px) {
    .about-content {
        flex-direction: column;
    }

    .text-content, .image-box {
        flex: none;
        width: 100%;
    }

    .image-box {
        order: -1; /* ให้รูปภาพอยู่ด้านบนบนมือถือ */
    }

    .logo-gallery img{
        height: 60px;
    }
}


/* =================================== */
/* 4. Publication Table Styles */
/* =================================== */

#publication {
    background-color: #f4f7f9; /* ใช้สีพื้นหลังอ่อนๆ */
    padding: 60px 0;
}

.publication-table-container {
    max-width: 1200px;
    margin: 0 auto;
}

.publication-table-container h2 {
    color: #004d99;
    font-size: 1.6em;
    margin-top: 40px;
    margin-bottom: 15px;
    border-bottom: 2px solid #0073e6;
    padding-bottom: 5px;
}

.publication-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden; /* เพื่อให้มุมโค้งแสดงผลได้ดี */
}

.publication-table thead th {
    background-color: #0073e6; /* สีธีม */
    color: white;
    padding: 15px 10px;
    text-align: left;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

.publication-table tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.publication-table tbody tr:last-child td {
    border-bottom: none;
}

/* สลับสีแถวเพื่อให้อ่านง่ายขึ้น */
.publication-table tbody tr:nth-child(even) {
    background-color: #fcfcfc;
}

.publication-table tbody tr:hover {
    background-color: #e6f3ff; /* สีอ่อนเมื่อนำเมาส์ไปชี้ */
}

.publication-table a {
    color: #004d99;
    text-decoration: none;
    transition: color 0.3s;
}

.publication-table a:hover {
    color: #ff9900;
}

/* สไตล์ไอคอนดาวน์โหลด */
.publication-table .fa-download {
    color: #ff9900;
    font-size: 1.1em;
    padding: 5px;
    transition: color 0.3s;
}

.publication-table .fa-download:hover {
    color: #cc7a00;
}

/* =================================== */
/* 2. Contact Us Section Styles */
/* =================================== */

#contact-us {
    background-color: #f4f7f9; /* ใช้สีพื้นหลังที่อ่อนกว่าเพื่อแบ่งส่วน */
    padding: 60px 0;
}

#contact-us h1 {
    /* ใช้สไตล์เดียวกับ About Us */
    color: #004d99; 
}

.contact-grid {
    display: flex;
    gap: 40px;
    margin-top: 30px;
    align-items: stretch; /* ให้กล่องยืดเท่ากัน */
}

.contact-info-box {
    flex: 1;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.contact-info-box h2 {
    color: #0073e6;
    margin-bottom: 25px;
    border-bottom: 2px solid #e6f3ff;
    padding-bottom: 10px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.info-item i {
    font-size: 1.5em;
    color: #ff9900; /* ใช้สีส้มเน้น */
    margin-right: 15px;
    margin-top: 2px;
}

.info-item p {
    margin: 0;
    font-size: 1.05em;
    color: #555;
}

.btn-email {
    display: block;
    width: 90%;
    text-align: center;
    background-color: #0099ff; /* สีฟ้าใหม่ */
    color: white;
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 30px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn-email:hover {
    background-color: #007acc;
}

/* สไตล์สำหรับแผนที่ */
.map-box {
    flex: 2; /* ให้แผนที่ใช้พื้นที่มากกว่าข้อมูลติดต่อ */
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.map-box h2 {
    color: #0073e6;
    margin-bottom: 15px;
}

.map-box iframe {
    width: 100%;
    height: 400px; /* กำหนดความสูงของแผนที่ */
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* Responsive Design สำหรับ Contact Us */
@media (max-width: 900px) {
    .contact-grid {
        flex-direction: column;
    }
}

/* =================================== */
/* 7. Footer Styles */
/* =================================== */

footer {
    background-color: #003366; /* สีน้ำเงินเข้ม */
    color: #f0f0f0; /* สีตัวอักษรสีอ่อน */
    padding-top: 50px;
    font-size: 0.95em;
}

.footer-grid {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    padding-bottom: 40px;
    flex-wrap: wrap; /* รองรับการจัดเรียงเมื่อหน้าจอเล็ก */
}

/* หัวข้อคอลัมน์ */
.footer-grid h4 {
    color: #ff9900; /* สีส้มธีม */
    text-transform: uppercase;
    font-size: 1.1em;
    margin-bottom: 20px;
    border-bottom: 2px solid #005bb5;
    padding-bottom: 5px;
}

/* โลโก้และคอลัมน์ 1 */
.footer-col-1 {
    max-width: 300px;
}
.footer-logo img {
    height: 60px; /* ขนาดโลโก้ */
    margin-bottom: 15px;
}
.footer-col-1 p {
    color: #ccc;
}

/* ลิงก์ในคอลัมน์ 2 และ 3 */
.footer-col-2, .footer-col-3 {
    width: 180px;
}

.footer-col-2 ul, .footer-col-3 ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col-2 a, .footer-col-3 a {
    color: #ccc;
    text-decoration: none;
    display: block;
    padding: 5px 0;
    transition: color 0.3s,transform 0.3s;
}

.footer-col-2 a:hover, .footer-col-3 a:hover {
    color: #ffffff;
    /*padding-left: 5px;  เพิ่มลูกเล่นเล็กน้อย */
    transform: translateX(5%);
}

/* คอลัมน์ 4: ข้อมูลติดต่อ */
.footer-col-4 address p {
    color: #ccc;
    margin-bottom: 10px;
    line-height: 1.5;
}

.footer-col-4 i {
    color: #ff9900;
    margin-right: 8px;
    font-size: 1em;
}

/* ลิงก์โซเชียลมีเดีย */
.social-links a {
    color: #ccc;
    font-size: 1.4em;
    margin-right: 15px;
    transition: color 0.3s;
}

.social-links a:hover {
    color: #ff9900;
}

/* ส่วนลิขสิทธิ์ด้านล่างสุด */
.footer-bottom {
    background-color: #002244; /* สีน้ำเงินเข้มกว่า */
    padding: 15px 0;
    text-align: center;
    border-top: 1px solid #004d99;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.85em;
    color: #aaa;
}
@media (max-width: 1024px){
    .hero-section{
        background-attachment: scroll !important;
        min-height: 100vh; 
        height: auto;
        justify-content:flex-start;
    }
}
/* Responsive Design สำหรับ Footer */
@media (max-width: 768px) {
    .footer-grid {
        flex-direction: column;
    }
    
    .footer-col-1, .footer-col-2, .footer-col-3, .footer-col-4 {
        width: 100%;
        margin-bottom: 25px;
        padding-bottom: 15px;
        border-bottom: 1px solid #004d99;
    }
    
    .footer-col-4 {
        border-bottom: none;
    }
}

/* =================================== */
/* 10. ULTRA-MOBILE OPTIMIZATION (<= 480px) */
/* ใช้เพื่อลดขนาดตัวอักษรและปุ่มอีกเล็กน้อย */
/* =================================== */

@media (max-width: 480px) {
    /* 1. HERO SECTION */
    
    .hero-text-center h1 {
        font-size: 2em; /* ลดลงเหลือ 2em เพื่อไม่ให้ล้น */
    }

    .hero-text-center h2 {
        font-size: 1em; 
    }
    
    .hero-text-center p {
        font-size: 0.9em;
    }

    /* ปรับปุ่ม CTA ให้เล็กลงเล็กน้อย */
    .hero-cta-buttons a {
        width: 90%; /* ให้ปุ่มกว้างขึ้นเพื่อกดง่าย */
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    /* 2. KEY STATS (สถิติด้านล่าง Hero) */
    .key-stats {
        flex-direction: column; /* ให้สถิติเรียงเป็นแนวตั้ง */
        background-color: rgba(0, 0, 0, 0.5); /* ปรับสี Overlay ให้ทึบขึ้นเล็กน้อย */
        padding: 10px;
    }
    
    .key-stats div {
        flex: 1 1 100%;
        padding: 5px 0;
    }
    
    .key-stats span {
        font-size: 1.2em; /* ลดขนาดตัวเลขสถิติลง */
    }
    
    .key-stats p {
        font-size: 0.7em;
        line-height: 1;
    }

    

    /* 3. PUBLICATION TABLE */
    .publication-table thead th,
    .publication-table tbody td {
        padding: 8px 5px; /* ลด padding ในตาราง */
        font-size: 0.8em;
    }
    
    /* ซ่อนคอลัมน์ที่ไม่จำเป็น (เช่น ลำดับ, ปีที่บังคับใช้) บนมือถือ */
    .publication-table thead th:nth-child(1), /* ลำดับ */
    .publication-table tbody td:nth-child(1),
    .publication-table thead th:nth-child(3), /* ปี/Rev */
    .publication-table tbody td:nth-child(3) {
        display: none; 
    }

    /* 4. CONTACT US */
    .info-item i {
        font-size: 1.2em;
    }
    .info-item p {
        font-size: 0.9em;
    }

    .map-box iframe {
        height: 300px; /* ลดความสูงของแผนที่ลง */
    }

    /* 5. FOOTER */
    .footer-grid h4 {
        font-size: 1em;
    }
    h1{
        font-size: 1.5rem;
    }
    h2{
        font-size: 1em;
    }
    
    .publication-table-container h2{
        font-size: 1rem;
    }

    .modal-content{
        width: 95%;
    }
}

/* =================================== */
/* 11. BACK TO TOP BUTTON STYLES */
/* =================================== */

#backToTopBtn {
    display: none; /* ซ่อนเริ่มต้น (จะแสดงด้วย JavaScript) */
    position: fixed; /* ให้อยู่ที่ตำแหน่งเดิมเมื่อเลื่อนหน้าจอ */
    bottom: 20px; /* ห่างจากด้านล่าง 20px */
    right: 30px; /* ห่างจากด้านขวา 30px */
    z-index: 1001; /* ให้อยู่บนสุด เหนือ Header/Footer */
    background-color: #0073e6; /* สีน้ำเงินธีม */
    color: white;
    border: none;
    padding: 23px 24.8px;
    border-radius: 50%; /* ทำให้เป็นทรงกลม */
    font-size: 1.3em;
    line-height: 1; /* จัดไอคอนให้อยู่ตรงกลาง */
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, opacity 0.3s;
    transition: transform 0.2s ease;
}

#backToTopBtn:hover {
    background-color: #ff9900; /* เปลี่ยนเป็นสีส้มเมื่อ Hover */
    transform: translateY(-15%);
}

/* CSS สำหรับพื้นหลังทับ (Overlay) - (มีการปรับเพิ่ม display: flex;) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.781);
    display: flex; /* สำคัญ: เพื่อจัด Modal Content ให้อยู่กึ่งกลาง */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.5s, visibility 0.5s;
}

/* CSS สำหรับกล่อง Pop-up (แก้ไข) */
.modal-content {
    font-family: 'Prompt', sans-serif;
    background-color: rgb(255, 255, 255);
    border-radius: 15px;
    max-width: 950px;
    overflow: hidden;
    text-align: center;

    /* ************************************** */
    /* ** ส่วนสำคัญสำหรับแอนิเมชัน (เริ่มต้น) ** */
    /* ************************************** */
    
    /* 1. ตำแหน่งเริ่มต้น: เลื่อนขึ้นไป 50px และซ่อนความทึบ */
    transform: translateY(-50px); 
    opacity: 0; 
    
    /* 2. กำหนดการเคลื่อนไหว: เปลี่ยนค่า transform และ opacity ภายใน 0.4 วินาที */
    transition: transform 0.4s ease-out, /* เปลี่ยนเป็น ease-out เพื่อให้ดูนุ่มนวลขึ้น */
                opacity 0.6s ease-out; 
}

/* CSS สำหรับรูปภาพใน Pop-up (เหมือนเดิม) */
.modal-image {
    width: 100%;
    height: auto;
    display: block;
}

/* CSS สำหรับส่วนข้อความและปุ่ม (เหมือนเดิม) */
.modal-actions {
    padding: 15px;
}
.modal-actions h2{
    font-size: 1.5em;
}

/* CSS สำหรับปุ่ม (เหมือนเดิม) */
#enter-button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: background-color 0.2s ease-in, transform 0.3s ease-in-out;
    font-family: 'Prompt', sans-serif;
}

#enter-button:hover{
    background-color: #003772;
    transform: scale(1.05);
}

/* CSS สำหรับการแสดง Pop-up (ควบคุมด้วย JavaScript) */
.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

/* ** ส่วนสำคัญ: สถานะที่ Pop-up ถูกเปิด ** */
.modal-overlay.active .modal-content {
    transform: translateY(0); /* เลื่อนกลับมาตำแหน่งปกติ (กึ่งกลางจอ) */
    opacity: 1; /* แสดงผลแบบทึบ */
}

/*<script>
    document.addEventListener('DOMContentLoaded', () => {
    const modal = document.getElementById('welcome-modal');
    const enterButton = document.getElementById('enter-button');

    // 1. แสดง Pop-up ทันทีที่หน้าเว็บโหลด
    modal.classList.add('active');

    // 2. จัดการเมื่อคลิกปุ่ม "เข้าสู่เว็บไซต์"
    enterButton.addEventListener('click', () => {
        // ซ่อน Pop-up โดยลบคลาส 'active'
        modal.classList.remove('active');
        
        // (*** เพิ่มโค้ดอื่น ๆ ที่คุณต้องการให้เกิดขึ้นหลังเข้าสู่เว็บไซต์ที่นี่ ***)
    });
});
</script>*/
