/* 1. ดึงฟอนต์ Kanit จาก Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600&display=swap');

/* 2. บังคับใช้ฟอนต์ Kanit กับ "ทุกองค์ประกอบ" บนเว็บแบบขั้นเด็ดขาด (แก้ปัญหาหัวข้อไม่เปลี่ยน) */
*, body, h1, h2, h3, h4, h5, h6, p, a, li, span, div, button, input, textarea,
.entry-title, .widget-title, .post-title, .elementor-heading-title {
    font-family: 'Kanit', sans-serif !important;
}
/* 2. ลบสีขาว ลบเงา และลดความสูงของกล่องครอบเมนู */
header, 
#masthead, 
.site-header, 
.main-navigation, 
.site-navigation,
.site-header-wrapper {
    background-color: transparent !important;
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* 3. ดึงแบนเนอร์ขึ้นมาปิดช่องโหว่สีขาว (***บังคับให้ทำงานเฉพาะหน้าแรกเท่านั้น***) */
.home #content, 
.home .site-content, 
.home .site-main {
    margin-top: -170px !important; 
    position: relative !important;
    z-index: 1 !important;
}

/* 4. หน้าอื่นๆ ที่ไม่ใช่หน้าแรก ให้ดันเนื้อหาลงมาปกติ ไม่ให้ซ้อนเมนู */
body:not(.home) #content,
body:not(.home) .site-content,
body:not(.home) .site-main {
    margin-top: -55px !important;
    padding-top: -80px !important; /* เพิ่มระยะห่างให้หน้าในดูสวยงาม */
}

/* 5. ดันเมนูให้อยู่เลเยอร์บนสุด ป้องกันเนื้อหาทับ */
#masthead, 
.site-header {
    position: relative !important;
    z-index: 999 !important;
}

/* 6. จัดปุ่มเมนูชิดขวา และเตรียมพื้นที่ให้โลโก้ */
.main-navigation ul, .menu {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 15px !important;
    padding: 10px 40px 10px 0 !important; 
    margin: 0 !important;
    background: transparent !important;
    position: relative !important;
}

/* 7. สร้างโลโก้วงกลมลอยด้านซ้าย (ใส่ URL โลโก้ตรงนี้) */
.main-navigation ul::before, .menu::before {
    content: "" !important;
    position: absolute !important;
    left: 40px !important; 
    top: 50% !important;
    transform: translateY(-50%) !important; 
    width: 75px !important; 
    height: 75px !important; 
    background-image: url('https://med.pi.ac.th/wp-content/uploads/2026/06/MED_ไดคัท.png') !important; 
    background-size: contain !important; 
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: #ffffff !important; 
    border-radius: 50% !important; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important; 
    z-index: 100 !important;
}

/* 8. สไตล์ปุ่มเมนู (เปลี่ยนเป็นฟอนต์ Kanit) */
.main-navigation li a, .menu li a {
    display: inline-block !important;
    padding: 10px 24px !important;
    background-color: #f8fafc !important; 
    color: #334155 !important; 
    border-radius: 8px !important; 
    text-decoration: none !important;
    font-family: 'Kanit', sans-serif !important; 
    font-size: 16px !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important; 
}

/* 9. เอฟเฟกต์ตอนชี้เมาส์ */
.main-navigation li a:hover, .menu li a:hover {
    background-color: #1e40af !important; 
    color: #ffffff !important; 
    transform: translateY(-2px) !important; 
}

/* =========================================
   สไตล์ตารางแบบ "การ์ดประกาศ" (Modern Card Style)
   ========================================= */

/* 1. ยกเลิกเส้นกรอบตารางแบบเดิม และตั้งค่าให้แต่ละแถวแยกออกจากกัน */
table {
    width: 100% !important;
    border-collapse: separate !important; /* คำสั่งสำคัญที่แยกแถวออกจากกัน */
    border-spacing: 0 12px !important; /* ระยะห่างช่องไฟระหว่างการ์ดแต่ละใบ 12px */
    background-color: transparent !important;
    border: none !important;
    margin-top: 10px !important;
}

/* 2. เปลี่ยนแต่ละบรรทัด (Row) ให้กลายเป็นการ์ดสีขาว มีเงาแบบพรีเมียม */
table tr {
    background-color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.3s ease !important; /* ทำให้เอฟเฟกต์ตอนชี้เมาส์ดูนุ่มนวล */
}

/* 3. จัดระยะขอบด้านใน และกำหนดฟอนต์ */
table td, table th {
    padding: 18px 24px !important;
    border: none !important;
    vertical-align: middle !important;
    color: #475569 !important; /* สีเทาเข้ม อ่านสบายตา */
    font-family: 'Kanit', sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    transition: color 0.3s ease !important;
}

/* 4. ลูกเล่นพิเศษ: ตกแต่งคอลัมน์แรก (วันที่) ให้เป็นแถบสีสัน (Badge) */
table tr td:first-child {
    border-top-left-radius: 8px !important; /* ทำมุมซ้ายโค้งมน */
    border-bottom-left-radius: 8px !important;
    background-color: #f8fafc !important; /* พื้นหลังสีเทาอ่อนสุด แยกโซนวันที่ชัดเจน */
    color: #0f5132 !important; /* ตัวหนังสือสีเขียวเข้ม */
    font-weight: 500 !important;
    width: 18% !important;
    white-space: nowrap !important;
    border-left: 4px solid #0f5132 !important; /* เพิ่มขีดเส้นสีเขียวด้านซ้ายสุดของการ์ด */
}

/* ทำมุมขวาของการ์ดให้โค้งมน */
table tr td:last-child {
    border-top-right-radius: 8px !important; 
    border-bottom-right-radius: 8px !important;
}

/* 5. เอฟเฟกต์ 3D: เมื่อชี้เมาส์ การ์ดจะลอยขึ้นและเปลี่ยนสีแถบดึงดูดสายตา */
table tr:hover {
    transform: translateY(-4px) !important; /* การ์ดลอยขึ้น 4px */
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1) !important; /* เงาเข้มและขยายกว้างขึ้น */
}

/* ตอนชี้เมาส์ให้เปลี่ยนสีแถบและข้อความเป็นสีน้ำเงินเข้ม */
table tr:hover td:first-child {
    border-left: 4px solid #1e3a8a !important; 
    color: #1e3a8a !important;
}
table tr:hover td {
    color: #1e3a8a !important; 
}