/* --- Global Styles & Fonts --- */
:root {
    --primary-color: #005c78;
    --secondary-color: #4CAF50;
    --light-green-bg: #f1f8e9;
    --text-color: #333;
    --light-gray: #f4f4f4;
    --border-color: #dcdcdc; /* สีเส้นคั่น */
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--light-gray);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

ul {
    list-style: none;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    /*padding: 2rem;*/
}

/* --- Header & Navigation (ปรับปรุงใหม่) --- */
/*.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--light-green-bg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}*/
.main-header {
    display: flex;
    justify-content: flex-start; /* ⭐ กำหนดให้อยู่ชิดซ้าย ⭐ */
    align-items: center;
    padding: 1rem 0.rem;
    background-color: var(--light-green-bg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 5rem; /* ⭐ เพิ่มระยะห่างระหว่าง Logo และ Nav ⭐ */
}

.logo a {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.main-nav ul {
    display: flex;
    align-items: center;
}

/* ⭐ เพิ่มเส้นคั่นระหว่างเมนู ⭐ */
.main-nav li {
    padding: 0 1.2rem; /* เพิ่ม padding ซ้ายขวาให้มีช่องว่างจากเส้นคั่น */
    border-right: 1px solid var(--border-color); /* สร้างเส้นคั่นด้านขวา */
    position: relative;
}

/* เอาเส้นคั่นออกจากเมนูสุดท้าย */
.main-nav li:last-child {
    border-right: none;
}

/* ⭐ เอฟเฟกต์ขีดเส้นใต้เมนู ⭐ */
.main-nav a {
    color: var(--text-color);
    font-weight: 500;
    padding: 10px 0; /* เพิ่ม padding บนล่างเล็กน้อย */
    position: relative; /* สำคัญมากสำหรับ ::after */
    transition: color 0.3s ease;
}

.main-nav a:hover {
    color: var(--primary-color); /* เปลี่ยนสีตัวอักษรเมื่อชี้ */
}

/* สร้างเส้นใต้ด้วย Pseudo-element ::after */
.main-nav a::after {
    content: '';
    position: absolute;
    width: 100%; /* เริ่มต้นที่ความกว้าง 0 */
    height: 2px;
    background-color: var(--primary-color);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    /*transition: width 0.3s ease-in-out; /* ทำให้เส้นขยายนุ่มนวล */
    transition: width 0.3s ease-in-out; /* ยังคงมี transition เผื่อใช้กับ hover effect อื่นๆ ในอนาคต */
}

/* เมื่อนำเมาส์ไปชี้ ให้เส้นขยายเต็มความกว้าง */
.main-nav a:hover::after {
    width: 100%;
}


/* --- Showcase & Filter Buttons --- */
.doctor-showcase {
    text-align: center;
    padding: 1rem 0;
}

.doctor-showcase h1 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 500;
}

#filter-buttons {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1.2rem;
    border: 1px solid #ccc;
    background-color: #fff;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 20px;
    font-family: 'Kanit', sans-serif;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* --- Doctor Card --- */
#doctor-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.doctor-card {
    display: flex;
    background-color: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /*min-height: 250px;*/
}

.doctor-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.profile-pic {
    flex: 0 0 180px;
    height: 200px;
}

.profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-details {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}

.profile-details h3 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.profile-details .specialty {
    font-weight: 500;
    color: #555;
    margin-bottom: 1rem;
}

.contact-info {
    margin-bottom: 8px;
}

.contact-info li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.contact-info i {
    color: var(--secondary-color);
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.btn-profile {
    display: inline-block;
    background-color: var(--secondary-color);
    color: #fff;
    padding: 0.2rem 1.2rem;
    border-radius: 2px;
    text-align: center;
    margin-top: auto;
    align-self: flex-start;
    transition: background-color 0.3s ease;
}

.btn-profile:hover {
    background-color: #45a049;
}

/* --- Footer --- */
.main-footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    background-color: #333;
    color: #fff;
}

/* --- Responsive Design --- */
@media (min-width: 768px) {
    #doctor-container {
        grid-template-columns: repeat(auto-fit, minmax(550px, 1fr));
    }
}

@media (min-width: 1200px) {
    #doctor-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* สำหรับ Mobile (จอขนาดเล็ก) */
@media (max-width: 600px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* เอาเส้นคั่นออกเมื่อแสดงบนมือถือ */
    .main-nav li {
        border-right: none;
        padding: 0 0.5rem;
    }

    .doctor-card {
        flex-direction: column;
        align-items: center;
        padding-top: 2rem;
    }

    .profile-details{
        align-items: center;
        text-align: center;
    }

    .profile-pic {
        flex-basis: auto;
        margin-bottom: 0.rem;
    }

    .profile-pic img {
        width: 170px;
        height: 180px;
        border-radius: 50%;
        border: 5px solid #fff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .btn-profile{
        align-self: center;
    }
}