html, body {
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: "Prompt", sans-serif;
    background: #f4fdf6;
    color: #333;
}

/* Header */
header {
    background: linear-gradient(135deg, #ffffff, #ffffff);
    color: rgb(0, 53, 24);
    padding: 1rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}
nav {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
nav .logo {
    font-size: 1.5rem;
    font-weight: 600;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

nav ul li a {
    font-size: 14px;
    text-decoration: none;
    color: rgb(0, 53, 24);
    font-weight: 500;
    transition: all 0.3s;
}
nav ul li a:hover {
    color: #00c206;
    transform: translateY(-2px);
    text-decoration: underline 2px solid #008f3d; /* เส้นใต้ตอน hover */
}

/* ปุ่ม hamburger */
.menu-toggle {
    display: none;
    font-size: 1.0rem;
    background: none;
    border: none;
    color: rgb(0, 53, 24);
    cursor: pointer;
    z-index: 1100;
}
/* === Logo Styles (ปรับปรุงใหม่) === */
.logo a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #003518;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.logo img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* === Banner Styles (เพิ่มใหม่) === */
.header-banner {
    width: 100%;
    text-align: center;
    padding: 0;
}

.header-banner img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}


/* === Dropdown Menu Styles === */

/* 1. กำหนดให้เมนูหลักเป็นตัวอ้างอิงตำแหน่ง */
#menu li.dropdown {
    position: relative;
}

/* ปรับกล่อง dropdown-menu ให้กว้างขึ้น */
.dropdown-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    min-width: 250px;  /* 👈 เพิ่มความกว้างเมนูย่อย */
    opacity: 0;
    margin-top: 23px;    /* กำหนดระยะห่างจากขอบบน */
    margin-bottom: 15px; /* กำหนดระยะห่างจากขอบล่าง */
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    border-radius: 0px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
/* เมนูย่อยแต่ละบรรทัด */
.dropdown-menu li {
    margin: -10px;
    padding: 0;
}
/* ปรับเมนูย่อยให้ทุกช่องสูงเท่ากัน */
.dropdown-menu li a {
    display: flex;
    align-items: center;
    height: 45px;          /* 👈 ทุกช่องสูงเท่ากัน */
    padding: 0 1rem;       /* 👈 ระยะซ้ายขวาเท่ากัน */
    font-size: 14px;
    color: #333;
    text-decoration: none;
    border-left: 4px solid transparent; /* เส้นเขียวโปร่งใสเริ่มต้น */
    text-decoration: none; /* ลบเส้นใต้เวลา hover ด้วย */
    transition: all 0.2s ease;
}

/* Hover */
.dropdown-menu li a:hover {
    background-color: #f4fdf6;
    color: #008f3d;
    border-left: 4px solid #008f3d;
}



/* 5. เมื่อนำเมาส์ไปชี้ที่เมนูหลัก ให้แสดงเมนูย่อยออกมา */
#menu li.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.hidden {
    display: none !important;
}
/* ซ่อน menu-header บนจอใหญ่ */
.menu-header {
    display: none;
}
@media(max-width: 1240px) {
    nav ul {
        flex-direction: column;
        gap: 1rem;
        background: #ffffff;
        position: fixed;
        top: 0;
        left: -300px;  /* ซ่อน */
        /* height: 100vh;  ❌ ลบออก */
        height: auto;   /* ✅ สูงตามจำนวนเมนู */
        min-height: 100%; /* ถ้าเมนูน้อย จะยาวอย่างน้อยเต็มจอ */
        width: 270px;
        padding: 1rem 1rem;
        box-shadow: 4px 0 12px rgba(0,0,0,0.2);
        transition: left 0.3s ease;
        margin: 0;
        z-index: 1200;
    }
    nav .logo a{
        font-size: 12px;
        font-weight: 1000;
    }
    nav ul.active {
        left: 0; /* Slide ออกมา */
    }

    .menu-toggle {
        display: block;
        font-size: 1.5rem;
        border: none;
        background: none;
        cursor: pointer;
        color: #003518;
    }

    /* logo บนเมนู */
    .menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid #ddd;
        margin-bottom: 1rem;
    }

    .side-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .side-logo img {
        width: 35px;
        height: 35px;
        object-fit: contain;
    }
    .side-logo span {
        font-size: 14px;
        font-weight: 600;
        color: #003518;
    }

    /* ปุ่มปิด X */
    .close-btn {
        font-size: 1.3rem;
        border: none;
        background: none;
        cursor: pointer;
        color: #003518;
    }

    /* เมนูย่อยเป็นแบบเลื่อนลงติดเมนูหลัก */
    .dropdown-menu {
        display: none;
        flex-direction: column;
        background: #f9f9f9;
        padding-left: 1rem;
        margin: 0.5rem 0;
        border-left: 3px solid #008f3d;
    }

    #menu li.dropdown.active .dropdown-menu {
        display: flex;
    }

    .dropdown-menu li a {
        font-size: 14px;
        padding: 0.5rem;
        color: #333;
    }
    .dropdown-menu li a:hover {
        background: #f4fdf6;
        color: #008f3d;
    }
}



.container {
    max-width: 1420px;   /* กำหนดขนาดสูงสุด */
    margin: 0 auto;      /* จัดกึ่งกลาง */
    padding: 1rem;
}

.main-content-wrapper {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1.5rem;
    flex: 1;
}
.sidebar {
    width: 250px;
}
.box {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}
.box:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.12);
}

footer {
    background: #2b2b2b;
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: 0; /* เปลี่ยนเป็น 0 หรือลบบรรทัดนี้ทิ้งไปเลย */
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}
/* Splash Screen */
#splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f4fdf6; /* สีพื้นหลังตอนโหลด */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

.splash-content {
    text-align: center;
}

.splash-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 1rem;
    animation: pulse 1.5s infinite;
}

/* ทำให้โลโก้ขยับเล็กๆ */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

#splash h1 {
    font-size: 18px;
    font-weight: 600;
    color: #003518;
    margin-bottom: 1rem;
}

/* Spinner */
.spinner {
    border: 5px solid #f3f3f3; /* สีวงกลมพื้นหลัง */
    border-top: 5px solid #00c206; /* สีหมุน */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media(max-width: 1240px) {
    .container {
        flex-direction: column;
    }

    .main-content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
    }
}