/* เมนูหลัก */
.left-menu {
    /* background-color: #f8f9fa;
    padding: 20px 10px; */
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 1000;
    height: 100vh;
    overflow-y: auto; /* อนุญาตให้เลื่อนได้เมื่อเนื้อหาเกิน */
}

/* กลุ่มเมนู */
.menu-group {
    background-color: #f8f9fa; /* สีพื้น กรอบใหญ่  */
    border: 1px solid #ff9900 !important; /* สีกรอบใหญ่ dee2e6*/
    margin-bottom: 1rem;
    border-radius: 0.375rem !important;
}

.menu-group .group-title {
    color: #495057;   /* สีตัวหนังสือ กลุ่มเมนู  495057*/
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* สไตล์สำหรับไอคอนกลุ่มเมนู */
.menu-group-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-right: 8px;
    vertical-align: middle;
}

.group-title {
    display: flex;
    justify-content: center; /* จัดให้อยู่กึ่งกลางในแนวนอน */
    align-items: center; /* จัดให้อยู่กึ่งกลางในแนวตั้ง (ถ้าต้องการ) */
}

/* ถ้าต้องการให้รูปภาพเต็มความกว้าง */
.menu-group-img-title {
    width: 90%;
/*    max-height: 40px;*/
    object-fit: contain;
}

/* เมนูรายการ */
.menu-item {
    background-color: #ffffff;  /* สีพื้นหลัง ปุ่มเมนู */
    border: 1px solid #ff9900 !important;  /*  สีกรอบปุ่มเมนู ced4da*/
    transition: all 0.3s;
    border-radius: 0.375rem !important;
    margin-bottom: 0.5rem;
	font-size: 1rem;
}

.menu-item.active {
    background-color: #e7f1ff;
    border-color: #86b7fe !important;
}

/* ลิงก์เมนู */
.main-menu-link, .sub-menu-link {
    color: #333;
    font-size: 1rem;
	font-weight: bold;
    transition: all 0.3s;
  /*  padding: 0.1rem; /* ความสูงเมนูแต่ละตัว */
}
.menu-item:hover {
	border: 1px solid #0000ff !important;
	background-color: #ccffff;
}
.main-menu-link:hover, .sub-menu-link:hover {
    color: #0000ff;
    font-size: 1rem;
    transition: all 0.3s;	
    text-decoration: none;
}

.menu-item.active .main-menu-link {
    color: #0d6efd;
    font-weight: 500;
}

/* ซับเมนู */
.submenu-container {
    display: none;
    padding-left: 15px;
    margin-top: 0.5rem;
    animation: fadeIn 0.3s ease-in-out;
}

.submenu-container.show {
    display: block;
}

.submenu-item {
    background-color: #f8f9fa;
    border: 1px solid #ddd !important;
    border-radius: 0.25rem !important;
    margin-bottom: 0.25rem;
    transition: all 0.3s;
}

.submenu-item:hover {
    background-color: #ffffcc; /* สีพื้น เมนูย่อย เวลาถูกชี้ */
    border-color: #0033ff !important;
}

/* เอฟเฟกต์ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* สำหรับ Desktop */
@media (min-width: 768px) {
    .left-menu {
        position: sticky;
        top: 0;
        left: 0;
    }
}

/* สำหรับ Mobile และ Tablet */
@media (max-width: 767.98px) {
    .left-menu {
        position: fixed;
        left: -85%;
        top: 0;
        width: 85%;
        max-width: 350px; /* ความกว้างสูงสุด */
        height: 100vh;
        transition: left 0.3s ease;
    }

    .left-menu.menu-open {
        left: 0;
    }

    /* ปรับปรุงส่วน wrapper ของเมนู */
    .menu-wrapper {
        height: calc(100vh - 40px); /* ลบส่วนหัว */
        overflow-y: auto;
    }

    /* ปรับปรุงปุ่มเมนู mobile */
    .mobile-menu-btn {
        display: block;
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 1100;
    }

    /* ปรับปรุง overlay */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.5);
        z-index: 900;
        display: none;
    }

    .menu-overlay.active {
        display: block;
    }
}

/* ปรับปรุงสไตล์ scrollbar */
/* ========== Firefox ========== */
.left-menu .menu-wrapper {
  scrollbar-width: thin;                      /* ทำให้ scrollbar บางลง thin=บาง auto=ปรกติ none=ซ่อน*/
  scrollbar-color: #c0c0c0 #f0f0f0;           /* thumb = เทาอ่อน, track = ขาวอมเทา */
}

/* ========== Chrome / Edge / Safari ========== */
.left-menu .menu-wrapper::-webkit-scrollbar {
  width: 10px;                                /* ความกว้างของ scrollbar */
}

.left-menu .menu-wrapper::-webkit-scrollbar-thumb {
  background-color: #c0c0c0;                  /* สีของตัวเลื่อน */
  border-radius: 5px;                         /* ทำให้โค้งมน */
  border: 2px solid #f0f0f0;                  /* เว้นขอบดูนุ่มนวล */
}

.left-menu .menu-wrapper::-webkit-scrollbar-track {
  background-color: #f0f0f0;                  /* สีพื้นหลังของราง */
}
