:root {
    --primary-color: #007bff; /* สีหลัก */
    --secondary-color: #555; /* สีรอง */
    --text-color: #333; /* สีข้อความทั่วไป */
    --background-color: #f4f4f4; /* สีพื้นหลังทั่วไป */
    --white-color: #fff; /* สีขาว */
    --border-color: #ddd; /* สีเส้นขอบทั่วไป */
    --dark-blue: #00008B; /* สีน้ำเงินเข้มตามที่ใช้ใน Header/Footer */
    --hamburger-bar-color: var(--white-color); /* สีขีด Hamburger */
    --hamburger-bar-height: 3px; /* ความสูงของแต่ละขีด */
    --hamburger-gap: 5px; /* ช่องว่างระหว่างขีด */
    --hamburger-width: 25px; /* ความกว้างของ Icon */
}

body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* ปรับ padding ซ้ายขวา */
}

/* Header Section - ใช้ CSS แทน inline style */
header {
    background-color: var(--dark-blue); /* ใช้สีน้ำเงินเข้ม */
    color: var(--white-color); /* ใช้สีขาว */
    padding: 5px 0; /* ปรับ padding บนและล่าง */
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px; /* ปรับ padding ซ้ายขวา */
}

/* สไตล์สำหรับ Logo Image */
header .container img {
    height: 30px; /* ความสูง Logo */
    margin-right: 10px;
    vertical-align: middle;
}

.logo a {
    font-size: 1.3em;
    font-weight: bold;
    text-decoration: none;
    color: inherit; /* ใช้สีที่รับทอดมาจาก Header */
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap; /* ป้องกันชื่อคริสตจักรขึ้นบรรทัดใหม่ */
}

/* Desktop Navigation */
nav.desktop-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center; /* จัดแนวตั้งให้อยู่ตรงกลาง */
    flex-wrap: nowrap; /* *** ป้องกันรายการเมนูขึ้นบรรทัดใหม่บน Desktop *** */
}

nav.desktop-menu ul li {
    margin-left: 15px;
    /* flex-shrink: 0; ถ้ายัง wrapping อาจลองเพิ่มอันนี้ */
}

nav.desktop-menu ul li a {
    text-decoration: none;
    color: inherit; /* ใช้สีที่รับทอดมาจาก Header */
    transition: color 0.3s ease, text-shadow 0.3s ease;
    padding: 5px 0; /* Padding บนและล่างของลิงก์ */
    /* สไตล์ 3D และ Glow ที่คุณมีอยู่ */
    text-shadow: 1px 1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000, -1px -1px 2px #000;
    white-space: nowrap; /* ป้องกันชื่อเมนูขึ้นบรรทัดใหม่ */
}

nav.desktop-menu ul li a:hover {
    color: #ADD8E6; /* สีฟ้าอ่อนสำหรับเปล่งแสง */
    text-shadow: 0 0 10px #ADD8E6, 0 0 20px #ADD8E6, 0 0 30px #ADD8E6; /* สไตล์เปล่งแสง */
}

/* Style สำหรับ dropdown เลือกภาษาใน desktop menu */
header nav.desktop-menu ul li select {
    font-size: 1em;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    appearance: none; /* ซ่อนลูกศร default */
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23fff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'); /* ลูกศรสีขาว */
    background-repeat: no-repeat;
    background-position-x: 95%;
    background-position-y: 50%;
    cursor: pointer;
    padding-right: 30px;
    background-color: var(--dark-blue); /* กำหนดสีพื้นหลังให้เหมือน Header */
    color: var(--white-color); /* กำหนดสีข้อความให้เป็นสีขาว */
}

/* Hamburger Menu Button (for mobile) */
.hamburger-menu {
    /* display: none; <-- ย้ายการควบคุม display ไปที่ Media Query */
    cursor: pointer;
    font-size: 1.5em; /* กำหนดขนาดรวมของปุ่ม (อาจปรับได้) */
    color: var(--white-color); /* สีปุ่ม */
    background: none; /* ไม่มีพื้นหลัง */
    border: none; /* ไม่มีเส้นขอบ */
    padding: 0; /* ไม่มี padding */
    margin: 0; /* ไม่มี margin */
    display: flex; /* ใช้ flex เพื่อจัดกลาง Icon */
    align-items: center;
    justify-content: center;
    width: var(--hamburger-width); /* กำหนดความกว้างปุ่มเท่า Icon */
    height: calc(var(--hamburger-bar-height) * 3 + var(--hamburger-gap) * 2); /* กำหนดความสูงปุ่มเท่า Icon */
    position: relative; /* จำเป็นสำหรับการวางขีดด้วย pseudo-elements */
    z-index: 20; /* ให้อยู่เหนือ Mobile Menu */
}

.hamburger-menu:hover {
    opacity: 0.8;
}

/* Style สำหรับสร้าง Icon Hamburger ด้วย CSS */
/* ใช้ pseudo-elements ::before และ ::after */
.hamburger-menu::before,
.hamburger-menu::after,
.hamburger-menu span { /* สร้างขีดกลางด้วย span เปล่าๆ */
    content: ''; /* จำเป็นสำหรับ ::before และ ::after */
    display: block;
    height: var(--hamburger-bar-height);
    background-color: var(--hamburger-bar-color);
    border-radius: calc(var(--hamburger-bar-height) / 2); /* ทำให้ขีดมีขอบมน */
    position: absolute; /* วางตำแหน่งแบบ Absolute */
    left: 0;
    width: var(--hamburger-width);
}

/* ตำแหน่งขีดบน (::before) */
.hamburger-menu::before {
    top: 0;
}

/* ตำแหน่งขีดกลาง (span) */
.hamburger-menu span {
    top: calc(50% - var(--hamburger-bar-height) / 2);
}

/* ตำแหน่งขีดล่าง (::after) */
.hamburger-menu::after {
    bottom: 0;
}


/* Mobile Navigation Menu - ใช้ CSS จาก style.css */
.mobile-menu {
    /* display: none; <-- ย้ายการควบคุม display ไปที่ Media Query */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--dark-blue); /* ใช้สีน้ำเงินเข้ม */
    z-index: 10;
    overflow-y: auto;
    padding-top: 80px; /* เผื่อพื้นที่ด้านบนให้ Header ไม่บัง และมีที่ว่าง */
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    visibility: hidden; /* ซ่อนแบบสมบูรณ์เมื่อไม่เปิด */
}

.mobile-menu.open {
    /* display: block; หรือใช้ */
    opacity: 1;
    visibility: visible;
}

.mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

.mobile-menu ul li {
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* ใช้สีขาวแบบโปร่งแสงสำหรับเส้นคั่น */
}

.mobile-menu ul li:last-child {
    border-bottom: none;
}

.mobile-menu ul li a {
    text-decoration: none;
    color: inherit; /* ใช้สีที่รับทอดมาจาก Mobile Menu */
    font-size: 1.4em; /* เพิ่มขนาด Font บน Mobile Menu */
    display: block; /* ทำให้คลิกได้ทั้งพื้นที่ li */
    padding: 10px; /* เพิ่ม padding ให้กดง่ายขึ้น */
}

/* Style สำหรับ dropdown เลือกภาษาใน mobile menu */
.mobile-menu ul li select {
    font-size: 1.4em;
    padding: 10px 20px;
    border: 1px solid var(--white-color); /* ใช้เส้นขอบสีขาว */
    border-radius: 5px;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23fff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'); /* ลูกศรสีขาว */
    background-repeat: no-repeat;
    background-position-x: 95%;
    background-position-y: 50%;
    cursor: pointer;
    color: var(--white-color);
    background-color: var(--dark-blue); /* กำหนดสีพื้นหลังให้เหมือน Mobile Menu */
    padding-right: 40px;
    margin-top: 10px;
    width: calc(100% - 40px); /* ทำให้ dropdown กว้างพอดี container */
    max-width: 300px; /* จำกัดความกว้างสูงสุด */
}


/* Main Content */
main {
    padding: 30px 0;
}

/* ปรับระยะห่างด้านบนของหัวข้อชื่อผู้บริหาร (h3) และจัดข้อความให้อยู่กึ่งกลาง */
main h3 {
    margin-top: 10px; /* ค่าเดิมที่คุณอาจปรับไว้ */
    text-align: center; /* *** เพิ่มบรรทัดนี้เข้าไป *** */
}

/* Footer Section - ใช้ CSS แทน inline style */
footer {
    background-color: var(--dark-blue); /* ใช้สีน้ำเงินเข้ม */
    color: var(--white-color); /* ใช้สีขาว */
    text-align: center;
    padding: 10px 0; /* ปรับ padding ให้มากขึ้นเล็กน้อย */
    /* border-top: 1px solid var(--secondary-color); */
}

footer .container {
    padding: 10px; /* Padding ภายใน container ของ footer */
}

/* Style สำหรับรูปภาพทั้งหมดที่อยู่ในส่วนเนื้อหาหลัก (main) */
main img {
    max-width: 100%; /* กำหนดความกว้างสูงสุดไม่ให้เกิน Container */
    height: auto; /* รักษาสัดส่วนของรูปภาพ */
    display: block; /* ทำให้รูปภาพเป็น Block Element เพื่อให้จัดระยะห่างภายนอก (margin) ได้ง่าย */
    margin-top: 20px; /* เพิ่มระยะห่างด้านบนรูปภาพ */
    margin-bottom: 20px; /* เพิ่มระยะห่างด้านล่างรูปภาพ */
    margin-left: auto; /* จัดกึ่งกลางรูปภาพ (หากรูปภาพไม่กว้างเต็ม Container) */
    margin-right: auto; /* จัดกึ่งกลางรูปภาพ (หากรูปภาพไม่กว้างเต็ม Container) */
    border-radius: 8px; /* ทำให้มุมรูปภาพมนเล็กน้อย (Optional) */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* เพิ่มเงาเล็กน้อย (Optional) */
}

/* Style สำหรับรูปภาพกิจกรรมกลุ่มเซลล์โดยเฉพาะ (ขนาดเล็กลง + กรอบ) */
main .cell-group-image {
    max-width: 100%; /* *** กำหนดความกว้างสูงสุดให้รูปภาพมีขนาดเล็กลงเล็กน้อย (ปรับตัวเลข 400px ได้ตามต้องการ) *** */
    height: auto; /* รักษาสัดส่วนของรูปภาพ */
    display: block; /* *** ทำให้รูปภาพเป็น Block Element เพื่อให้จัดกึ่งกลางและมีระยะห่างภายนอกได้ง่าย *** */
    margin-top: 20px; /* เพิ่มระยะห่างด้านบนรูปภาพ */
    margin-bottom: 20px; /* เพิ่มระยะห่างด้านล่างรูปภาพ */
    margin-left: auto; /* *** จัดกึ่งกลางรูปภาพ (หากรูปภาพไม่กว้างเต็ม Container) *** */
    margin-right: auto; /* *** จัดกึ่งกลางรูปภาพ (หากรูปภาพไม่กว้างเต็ม Container) *** */

    /* *** Style สำหรับกรอบสวยงาม *** */
    border: 5px solid var(--primary-color, #007bff); /* เพิ่มเส้นขอบสีหลัก (ปรับสีและความหนาได้) */
    border-radius: 10px; /* ทำให้มุมกรอบมน (ปรับได้) */
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); /* เพิ่มเงา (ปรับได้) */

    /* อาจเพิ่ม transition เพื่อให้มี effect เล็กน้อยเมื่อเมาส์ชี้ */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* *** Style ใหม่สำหรับควบคุม Aspect Ratio และป้องกันภาพยืด/บีบ *** */
    aspect-ratio: 4 / 3; /* *** กำหนดอัตราส่วน กว้างต่อสูง เป็น 4 ต่อ 3 (กว้างกว่าสูงเล็กน้อย) *** */
    /* คุณสามารถลองค่าอื่นได้ เช่น 16 / 9 สำหรับภาพที่กว้างกว่าเดิมมาก หรือ 1 / 1 สำหรับภาพสี่เหลี่ยมจตุรัส */
    object-fit: cover; /* *** ทำให้รูปภาพครอบคลุมพื้นที่ของกรอบตาม aspect-ratio โดยไม่ยืด แต่ส่วนเกินของภาพอาจถูก Crop ออกไป *** */
    /* หากใช้ object-fit: contain; รูปภาพจะไม่ถูก Crop แต่จะมีพื้นที่ว่างในกรอบแทน */
}

/* Optional: Effect ตอนเมาส์ชี้ที่รูปภาพ */
main .cell-group-image:hover {
    transform: scale(1.03); /* ขยายภาพเล็กน้อย */
    box-shadow: 0 6px 15px rgba(0,0,0,0.3); /* เพิ่มเงาให้ชัดขึ้น */
}

/* หมายเหตุ: Rule 'main img' ที่มีอยู่เดิมจะยังคงมีผล แต่ Style ที่กำหนดใน '.cell-group-image' จะมีความสำคัญกว่า */


/* --- Styles for Bible page (bible.php) --- */

/* Style สำหรับ form เลือกหนังสือ */
main form {
    margin-bottom: 20px; /* เพิ่มระยะห่างด้านล่างฟอร์ม */
}

/* เพิ่มขนาด label สำหรับ Desktop */
main form label {
    font-size: 1.1em;
    display: inline-block;
    margin-bottom: 5px;
    margin-right: 10px; /* เพิ่มระยะห่างระหว่าง label กับ select */
}

/* Style สำหรับ dropdown list เลือกหนังสือ */
main form select#book {
    font-size: 1.1em;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23555" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'); /* ลูกศรสีเทาเข้ม */
    background-repeat: no-repeat;
    background-position-x: calc(100% - 10px); /* ปรับตำแหน่งลูกศร */
    background-position-y: 50%;
    padding-right: 30px;
}

/* Chapter List (for bible.php) */
.chapter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.chapter-link {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--secondary-color);
    font-size: 0.9em;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.chapter-link:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

/* Table styles for bible.php (แสดงข้อพระคัมภีร์) */
main table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--white-color); /* เพิ่มสีพื้นหลังตาราง */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* เพิ่มเงาเล็กน้อย */
}

main table th, main table td {
    border: 1px solid var(--border-color);
    padding: 10px; /* เพิ่ม padding */
    text-align: left;
}

main table th {
    background-color: #f0f0f0;
    font-weight: bold;
    color: var(--text-color);
}

/* Style สำหรับคอลัมน์ข้อที่ (verse) */
main table td:first-child {
    width: 60px; /* กำหนดความกว้างคอลัมน์ข้อที่ */
    text-align: center; /* จัดข้อที่ให้อยู่กึ่งกลาง */
    font-weight: bold;
    background-color: #f9f9f9; /* สีพื้นหลังเล็กน้อย */
}


/* --- Styles for About Us page (about.php) - Map --- */

/* Style สำหรับ container ของแผนที่ (เพื่อให้ Responsive)  */
.map-container {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%; /* อัตราส่วน 16:9 */
    height: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}


/* Style สำหรับ iframe แผนที่ภายใน container */
.map-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}   
    
    /* --- Responsive adjustment for smaller screens --- */
    /* เมื่อหน้าจอแคบลง ให้ Card เรียงกันเป็นคอลัมน์เดียว */
    @media (max-width: 768px) { /* ปรับ Breakpoint ตามที่ต้องการ */
        .card-container {
    grid-template-columns: 1fr; /* เปลี่ยนเป็น 1 คอลัมน์เต็มความกว้าง */
    gap: 15px; /* ปรับระยะห่างบนมือถือ */
    }
    
        .card-item {
    /* ปรับ Style Card บนมือถือถ้าต้องการ */
    padding: 10px;
    }
    }


/* --- Styles for Videos page (videos.php) - Video List Layout --- */

/* Container สำหรับรายการวีดีโอทั้งหมด - ใช้ Flexbox เพื่อจัดเรียง 3 คอลัมน์ */
.videos-list-container {
    display: flex; /* ทำให้ลูกๆ (.video-item) เรียงกันในแนวนอน */
    flex-wrap: wrap; /* อนุญาตให้ลูกๆ ขึ้นบรรทัดใหม่เมื่อพื้นที่ไม่พอ */
    gap: 20px; /* กำหนดช่องว่างระหว่างรายการวีดีโอ */
    margin-bottom: 20px;
    width: 100%; /* เพิ่ม Rule นี้ */
}

/* แต่ละรายการวีดีโอ (เป็น Flex Item) - กำหนดความกว้างและพฤติกรรม */
.video-item {
    /* Flex: grow, shrink, basis */
    /* ใช้การคำนวณใหม่: (100% - พื้นที่ gap รวม) / จำนวนรายการ */
    /* (100% - (2 * 20px)) / 3 = (100% - 40px) / 3 */
    flex: 1 1 calc((100% - 40px) / 3);
    max-width: calc((100% - 40px) / 3); /* จำกัดความกว้างสูงสุดให้ตรงกัน */
    box-sizing: border-box; /* รวม padding/border ในการคำนวณความกว้าง */
    /* เพิ่ม style อื่นๆ เพื่อทำ "กรอบสี่ผืนผ้า" เช่น border, padding, box-shadow (ถ้าต้องการ) */
    /* ตัวอย่าง: */
    /* border: 1px solid var(--border-color); */
    /* padding: 15px; */
    /* border-radius: 8px; */
    /* box-shadow: 0 2px 5px rgba(0,0,0,0.1); */
}

/* Style สำหรับหัวข้อและคำอธิบายภายใน video-item */
.video-item h3 {
    margin-top: 0;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.video-item p {
    font-size: 0.9em;
    color: var(--secondary-color); /* ใช้สีรองที่คุณกำหนดไว้ */
    margin-top: 10px;
}

/* Style สำหรับ container ของวีดีโอ (เพื่อให้ Responsive) - ใช้ซ้ำกับ .map-container ได้ */
.video-container {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%; /* อัตราส่วน 16:9 */
    height: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Style สำหรับ iframe วีดีโอภายใน container - ใช้ซ้ำกับ .map-container iframe ได้ */
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}


/* --- Responsive Design Media Queries --- */

/* *** ปรับ Breakpoint ให้เปลี่ยนเป็น Mobile Menu เร็วขึ้น *** */
@media (max-width: 900px) { /* เปลี่ยนจาก 768px เป็น 900px */
    .container {
        padding: 0 15px; /* ลด padding บนมือถือ */
    }

    header .container {
         flex-wrap: wrap; /* อนุญาตให้รายการขึ้นบรรทัดใหม่ */
         padding-top: 10px;
         padding-bottom: 10px;
    }

    header .container img {
        height: 40px; /* เพิ่มขนาดโลโก้บนมือถือ */
    }

    .logo {
        flex-grow: 1; /* ทำให้ logo ขยายตัวเผื่อที่ว่าง */
        margin-right: 10px;
    }

    .logo a {
        font-size: 1.5em; /* เพิ่มขนาด font logo บนมือถือ */
    }

    /* *** ซ่อน Desktop Menu บนจอเล็ก *** */
    nav.desktop-menu {
        display: none; /* Hide desktop menu on mobile */
    }

    /* *** แสดง Hamburger Menu Button บนจอเล็ก *** */
    .hamburger-menu {
        display: flex; /* Show hamburger menu on mobile */
         font-size: 2em; /* เพิ่มขนาดปุ่ม Hamburger */
    }

    /* Mobile menu will be shown/hidden by JavaScript */

    /* ปรับขนาด label และ select สำหรับมือถือในหน้า Bible */
    main .container form label {
        font-size: 1.2em; /* ปรับขนาด font */
        display: block; /* แสดงแบบ block ให้อยู่บรรทัดใหม่ */
        margin-bottom: 10px;
        margin-right: 0;
    }

    main .container form select#book {
        font-size: 1.2em; /* ปรับขนาด font */
        padding: 12px;
        width: 100%; /* ทำให้ select กว้างเต็มพื้นที่ */
        background-position-x: calc(100% - 15px); /* ปรับตำแหน่งลูกศร */
    }

     /* ปรับ table styles สำหรับมือถือในหน้า Bible */
    /* ทำให้ Table, Thead, Tbody แสดงผลแบบ Block */
    main table, main thead, main tbody {
        display: block;
        width: 100%; /* ให้ตารางใช้ความกว้างเต็ม */
    }

    /* ซ่อน Header เดิมของตาราง */
    main thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* *** กำหนด Style สำหรับ Row (แต่ละข้อพระคัมภีร์) *** */
    main tr {
        margin-bottom: 15px; /* เพิ่มระยะห่างระหว่างแต่ละข้อ */
        display: flex; /* *** ใช้ Flexbox ที่ TR เพื่อควบคุมการเรียงของ TD 2 ตัว *** */
        flex-wrap: nowrap; /* *** ป้องกัน TD ขึ้นบรรทัดใหม่ *** */
        align-items: stretch; /* ทำให้ TD สูงเท่ากัน */
        background-color: var(--white-color); /* พื้นหลังสีขาวสำหรับแต่ละบล็อกข้อ */
        padding: 0;
        border: 1px solid var(--border-color); /* เพิ่ม Border ที่ TR แทน */
        box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* เพิ่มเงา */
        border-radius: 8px; /* ขอบมน */
        overflow: hidden; /* ซ่อนส่วนที่ล้น */
        width: 100%; /* ให้ TR ใช้ความกว้างเต็ม */
        box-sizing: border-box; /* รวม border/padding ในความกว้าง */
    }

    /* *** กำหนด Style พื้นฐานสำหรับ Cell (ทั้งหมายเลขข้อและเนื้อหา) *** */
    main td {
        border: none; /* ลบเส้นขอบ Cell เดิม */
        padding: 10px; /* เพิ่ม padding ด้านใน Cell */
        text-align: left; /* จัดข้อความชิดซ้ายเป็นค่าเริ่มต้น */
        position: static; /* ตั้งเป็น static */
        width: 100%; /* ให้ TD ใช้ความกว้างเต็ม TR เมื่อ flex-wrap ทำงาน */
        box-sizing: border-box; /* รวม padding ในความกว้าง */
        /* ลบ Rule เก่าอื่นๆ ของ main td ใน @media ออก */
        flex-shrink: 0; /* ป้องกันการหดตัวเกินจำเป็น */
        display: block; /* ทำให้ td เป็น block */
    }

    /* *** Rule สำหรับ Cell แรก (หมายเลขข้อ) - คอลัมน์ซ้ายที่มีความกว้างคงที่ *** */
    main table td:first-child {
        background-color: #f9f9f9; /* สีพื้นหลังเล็กน้อยสำหรับส่วนหัว (หมายเลขข้อ) */
        font-weight: bold; /* ทำให้ตัวหนา */
        padding-bottom: 5px; /* เพิ่ม padding ด้านล่าง */
        width: 80px; /* *** กำหนดความกว้างคงที่สำหรับคอลัมน์หมายเลขข้อ *** */
        flex-basis: 80px; /* กำหนด basis เท่าความกว้าง */
        flex-grow: 0; /* ไม่ให้ขยาย */
        flex-shrink: 0; /* ไม่ให้หด */
        display: flex; /* *** ใช้ Flexbox ภายใน Cell นี้เพื่อจัดเรียง "ข้อที่" และหมายเลขข้อ *** */
        flex-direction: column; /* เรียงตามแนวตั้ง */
        align-items: center; /* จัดกลางตามแนวนอน */
        justify-content: center; /* จัดกลางตามแนวตั้ง */
        padding: 10px 5px; /* ปรับ padding ด้านใน */
    }

    /* *** สร้างข้อความ "ข้อที่" นำหน้าหมายเลขข้อ ใน Cell แรก และทำให้เป็น Block อยู่เหนือหมายเลขข้อ *** */
    main table td:first-child::before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
        text-align: center;
        margin-bottom: 3px;         
        position: static;
        padding: 0;
        margin-left: 0;
        margin-right: 0;
        border: none;
    }


    /* *** Rule สำหรับ Cell ที่สอง (เนื้อหา) - คอลัมน์ขวาที่ใช้พื้นที่ที่เหลือ *** */
    main table td:last-child {
       /* ใช้ Style พื้นฐานจาก main td */
       flex-grow: 1; /* *** ให้ขยายเพื่อใช้พื้นที่ที่เหลือทั้งหมด *** */
       flex-basis: 0; /* กำหนด basis เป็น 0 เพื่อให้ flex-grow ทำงานเต็มที่ */
       width: auto; /* ไม่ต้องกำหนด width คงที่ */
       padding-left: 15px; /* เพิ่ม padding ด้านซวา เพื่อให้ห่างจากคอลัมน์หมายเลขข้อ */
       /* ลบ Rule เก่าอื่นๆ ของ td:last-child ใน @media ออก */
       display: block; /* ย้ำว่าเป็น block */
       /* อาจเพิ่ม border-left ถ้าต้องการเส้นแบ่งคอลัมน์ */
       /* border-left: 1px solid #eee; */
    }


     /* Styles สำหรับรายการวีดีโอแบบ Responsive บนมือถือ */
     .video-item {
        flex: 1 1 100%; /* ให้เต็มความกว้าง container (1 คอลัมน์) */
        max-width: 100%; /* กำหนดความกว้างสูงสุดเป็น 100% */
        /* อาจปรับ padding/margin สำหรับ mobile ถ้าต้องการ */
        /* padding: 10px; */
    }

    /* ปรับ gap บน mobile ถ้าต้องการ */
     .videos-list-container {
        gap: 15px; /* ลดช่องว่างระหว่างรายการบนมือถือ */
     }
}

/* Hide mobile menu on larger screens */
/* *** ปรับ Breakpoint ให้ซ่อน Mobile Menu บนจอใหญ่ขึ้น *** */
@media (min-width: 901px) { /* เปลี่ยนจาก 769px เป็น 901px */
    .mobile-menu {
        display: none !important; /* ใช้ !important เพื่อให้แน่ใจว่าซ่อนอยู่ */
        visibility: hidden !important;
    }

     /* *** แสดง Desktop Menu บนจอใหญ่ขึ้น *** */
    nav.desktop-menu {
         display: block !important; /* ใช้ !important เพื่อให้แน่ใจว่าแสดงอยู่ */
    }

     /* *** ซ่อน Hamburger Menu Button บนจอใหญ่ขึ้น *** */
    .hamburger-menu {
         display: none !important; /* ใช้ !important เพื่อให้แน่ใจว่าซ่อนอยู่ */
    }
}

/* Style for background image specifically on index.php */
body.index-background {
    background-color: #f4f4f4; /* ใช้สีพื้นหลังเดิม หรือสีอื่นที่คุณต้องการ */
    color: var(--white-color, #fff); /* ใช้สีขาวตามตัวแปร หรือใช้ #fff */
}

/* Style for the wrapper div containing header and main content */
.content-background {
    /* กำหนดความสูงขั้นต่ำให้เท่ากับความสูงของ viewport (หน้าจอที่มองเห็น) */
    min-height: 100vh;
    background-image: url('picture/church_hall.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    }
/* หากมี Style background-color ที่ body เดิมอยู่ อาจต้อง Overwrite */
/* body { background-color: transparent !important; } */
/* หรือแก้ไข rule body ด้านบนสุดให้มี background-color อยู่แล้ว */

/* Style for the activity table - Completely invisible except for text */
table.activity-table {
    width: 40%;
    border-collapse: collapse; /* ลบช่องว่างระหว่างเส้นขอบ Cell */
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: none; /* ลบเงาของตารางออก */
    background-color: transparent; /* ทำให้พื้นหลังตารางโปร่งใส */
    color: var(--white-color, #fff); /* กำหนดสีข้อความทั้งหมดในตารางเป็นสีขาว */
    border: none; /* ลบเส้นขอบของตารางออก */

     /* *** เพิ่มบรรทัดนี้เพื่อเลื่อนตารางไปทางขวา *** */
     transform: translateX(20px); /* <<< เปลี่ยน 20px เป็นจำนวน Pixels ที่ต้องการเลื่อนไปทางขวา */

     /* อาจจะต้องเพิ่ม prefix สำหรับ Browser เก่าถ้าจำเป็น */
     /* -webkit-transform: translateX(20px); */
     /* -ms-transform: translateX(20px); */
}

/* Style for table headers and data cells - ทำให้มองไม่เห็น */
table.activity-table th,
table.activity-table td {
    border: none; /* ลบเส้นขอบของ Cell ออกทั้งหมด */
    padding: 10px; /* คง Padding ไว้ เพื่อให้ข้อความมีระยะห่าง */
    text-align: left; /* การจัดวางข้อความ เริ่มต้นเป็นชิดซ้าย */
    background-color: transparent; /* ทำให้พื้นหลัง Cell โปร่งใส */
    /* color: inherit; // สีข้อความรับทอดมาจาก table */
}

/* Style for table headers */
table.activity-table th {
    background-color: transparent; /* ทำให้พื้นหลัง Header Cell โปร่งใส */
    font-weight: bold; /* ตัวหนา */
    color: var(--white-color, #fff); /* กำหนดสีข้อความ Header เป็นสีขาว */
    text-align: center; /* จัดกลาง Header text */
}

/* Optional: Style for the first column (Day) */
table.activity-table td:first-child {
    font-weight: bold; /* ตัวหนา */
    white-space: nowrap; /* ไม่ขึ้นบรรทัดใหม่ */
    /* background-color: transparent; */
    /* color: inherit; */
}


/* --- Responsive styles for the activity table on small screens --- */
/* ปรับ Style Responsive สำหรับตารางบนมือถือ ให้มองไม่เห็น และแสดงเฉพาะข้อความ */
@media (max-width: 600px) {
    table.activity-table,
    table.activity-table thead,
    table.activity-table tbody,
    table.activity-table th,
    table.activity-table td,
    table.activity-table tr {
        display: block; /* แสดงผลแบบ Block */
    }

    table.activity-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px; /* ซ่อน Header เดิม */
    }

    table.activity-table tr {
        border: none; /* ลบเส้นขอบของ Row Block */
        margin-bottom: 15px; /* คงระยะห่างระหว่างแต่ละ Row Block */
        border-radius: 0; /* ไม่ต้องมีขอบมน */
        overflow: visible; /* ไม่ต้องซ่อนส่วนที่ล้น */
        background-color: transparent; /* ทำให้พื้นหลัง Row Block โปร่งใส */
        box-shadow: none; /* ลบเงา */
    }

    table.activity-table td {
        border: none; /* ลบเส้นขอบ Cell ออกทั้งหมด */
        border-bottom: none; /* ลบเส้นขอบล่าง Cell ออกทั้งหมด */
        position: relative;
        padding-left: 0; /* ลบ padding-left ที่เคยใช้สำหรับ Label Trick */
        text-align: center; /* จัดกลางข้อความใน Cell */
        background-color: transparent; /* ทำให้พื้นหลัง Cell โปร่งใส */
        color: var(--white-color, #fff); /* สีข้อความขาวเหมือนเดิม */
        display: block; /* แสดงผลแบบ Block เพื่อให้เรียงซ้อนกัน */
        padding: 5px 0; /* ปรับ Padding บนล่างของ Cell */
    }

    /* Style สำหรับ Pseudo-element Label (ข้อที่, วัน, เวลา, หัวข้อ/กิจกรรม) */
    table.activity-table td:before {
        position: static; /* เปลี่ยน Position เป็น Static */
        display: block; /* ทำให้ Label แสดงผลเป็น Block อยู่เหนือข้อความ */
        width: auto; /* กว้าง Auto */
        padding-right: 0;
        white-space: nowrap;
        font-weight: bold;
        content: attr(data-label); /* ใช้ค่าจาก data-label Attribute */
        text-align: center; /* จัดกลางข้อความ Label */
        color: var(--white-color, #fff); /* สีข้อความ Label เป็นสีขาว */
        margin-bottom: 3px; /* เพิ่มระยะห่างด้านล่าง Label */
    }

    table.activity-table td:last-child {
        border-bottom: 0; /* ไม่ต้องมีเส้นขอบล่างสำหรับ Cell สุดท้าย */
    }

    /* Specific adjustments for activity table columns on small screens */
    table.activity-table td:nth-child(1) { text-align: center; }
    table.activity-table td:nth-child(2) { text-align: center; }
    table.activity-table td:nth-child(3) { text-align: center; border-bottom: none; }

    /* Handle rowspan for "ทุกวัน อาทิตย์" label on mobile */
    table.activity-table tr td:first-child[rowspan] {
         display: block; /* แสดงผลเป็น Block */
         flex-direction: column; /* เรียงเนื้อหาใน Cell ตามแนวตั้ง */
         align-items: center; /* จัดกลางเนื้อหาใน Cell */
         justify-content: center;
         border-bottom: none; /* ลบเส้นขอบล่าง */
         text-align: center; /* จัดกลางข้อความ */
    }
     table.activity-table tr td:first-child[rowspan]::before {
        text-align: center; /* จัดกลาง Label */
     }

}

/* ทำให้ Font ในเมนู Desktop เป็นตัวหนา เมื่อภาษาเป็น English */
html[lang="en"] nav.desktop-menu ul li a {
    font-weight: bold; /* ทำให้ Font เป็นตัวหนา */
}

/* ทำให้ Font ในเมนู Mobile เป็นตัวหนา เมื่อภาษาเป็น English */
html[lang="en"] nav.mobile-menu ul li a {
    font-weight: bold; /* ทำให้ Font เป็นตัวหนา */
}

/* Optional: ทำให้ข้อความใน Dropdown เลือกภาษาเป็นตัวหนา เมื่อภาษาเป็น English */
html[lang="en"] header nav.desktop-menu ul li select,
html[lang="en"] .mobile-menu ul li select {
    font-weight: bold; /* ทำให้ Font เป็นตัวหนา */
}
