﻿

#overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 999;
}


#sidebar.expand + #overlay {
    display: block;
}

@media (min-width: 769px) {
    #overlay {
        display: none !important;
    }
}

::after,
::before {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
}

li {
    list-style: none;
}

h1 {
    font-weight: 600;
    font-size: 1.5rem;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8f9fa;
    color: #343a40;
}


.wrapper {
    display: flex;
}

.main {
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    background-color: #f8f9fa;
    margin-left: 70px; /* สำหรับ sidebar แบบ mini */
    transition: margin-left 0.3s ease;
}

#sidebar.expand ~ .main {
    margin-left: 260px; /* สำหรับ sidebar แบบเต็ม */
}

#sidebar {
    width: 70px;
    min-width: 70px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #ffffff;
    border-right: 1px solid #dee2e6;
    color: #343a40;
    transition: all .25s ease-in-out;
    justify-content: space-between; /* 👈 ทำให้ footer ไปอยู่ล่าง */

    position: fixed;
    top: 0px;
    bottom: 0;
    left: 0;
}

@media (max-width: 768px) {
    .main {
        margin-left: 0 !important; /* สำหรับซ่อนพื้นที่ว่าง sidebar mini  */
    }
}

#sidebar.expand {
    width: 260px;
    min-width: 260px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.08);
}

.toggle-btn {
    background-color: transparent;
    cursor: pointer;
    border: 0;
    padding: 1rem 1.5rem;
}

    .toggle-btn i {
        font-size: 1.5rem;
        color: gray;
    }

.sidebar-logo {
    margin: auto 0;
}

    .sidebar-logo a {
        color: gray;
        font-size: 1.15rem;
        font-weight: 600;
    }

#sidebar:not(.expand) .sidebar-logo,
#sidebar:not(.expand) a.sidebar-link span {
    display: none;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1 1 auto;
}

a.sidebar-link {
    padding: .625rem 1.625rem;
    color: #343a40;
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.sidebar-link i {
    font-size: 1.1rem;
    margin-right: .75rem;
}

a.sidebar-link:hover {
    background-color: #e9ecef;
    border-left: 3px solid #0d6efd;
}

.sidebar-item {
    position: relative;
}

#sidebar:not(.expand) .sidebar-item .sidebar-dropdown {
    position: absolute;
    top: 0;
    left: 70px;
    background-color: #0e2238;
    padding: 0;
    min-width: 15rem;
    display: none;
}

#sidebar:not(.expand) .sidebar-item:hover .has-dropdown + .sidebar-dropdown {
    display: block;
    max-height: 15em;
    width: 100%;
    opacity: 1;
}

#sidebar.expand .sidebar-link[data-bs-toggle="collapse"]::after {
    border: solid;
    border-width: 0 .075rem .075rem 0;
    content: "";
    display: inline-block;
    padding: 2px;
    position: absolute;
    right: 1.5rem;
    top: 1.4rem;
    transform: rotate(-135deg);
    transition: all .2s ease-out;
}

#sidebar.expand .sidebar-link[data-bs-toggle="collapse"].collapsed::after {
    transform: rotate(45deg);
    transition: all .2s ease-out;
}


.sidebar-dropdown {
    transition: all 0.3s ease;
}

/*begin top bar*/



.navbar .navbar-brand,
.navbar .text-white {
    color: #343a40 !important;
}

.navbar {
    z-index: 1050;
    position: sticky;
    top: 0;
    height: 65px;
    width: 100%;
    background-color: #ffffff !important;
    border-bottom: 1px solid #dee2e6;
    color: #343a40;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.dropdown-menu {
    min-width: 180px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.dropdown-item {
    color: #343a40;
}


.dropdown-menu a.dropdown-item:hover {
    background-color: #e9ecef;
}
/*end top bar*/
/* ซ่อน sidebar บนหน้าจอเล็ก (mobile) จนกว่าจะ expand */
@media (max-width: 768px) {
    #sidebar {
        display: none !important;
    }

        #sidebar.expand {
            display: flex !important;
            position: fixed;
            top: 65px; /* ความสูงของ navbar */
            left: 0;
            height: calc(100% - 65px);
            z-index: 1050;
        }

    .main {
        width: 100% !important;
    }
}

@media (min-width: 769px) {
    #sidebar {
        top: 65px; /* ✅ ดันให้ sidemenu อยู่ใต้ navbar */
        height: calc(100vh - 65px); /* ✅ ลดความสูงไม่ให้ทะลุ navbar */
    }
}

@media (max-width: 768px) {
    .floating-pin-btn {
        display: none !important;
    }
}
/*begin css ปุ่ม pin*/
.floating-pin-btn {
    position: fixed;
    top: 80px;
    left: calc(260px - 17px); /* 260px คือความกว้าง sidebar - ครึ่งปุ่ม */
    z-index: 1101;
    color: white;
    background-color: #696cff;
    border: 1px solid #ced4da;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: left 0.3s ease, transform 0.3s ease;
}

    /* ขยับเล็กน้อยตอน hover */
    .floating-pin-btn:hover {
        transform: translateX(5px);
        background-color: #696cff;
    }

/*end css ปุ่ม pin*/

/*begin scroll bar*/
#sidebar {
    overflow-y: auto; /* ✅ เพิ่ม scroll แนวตั้ง */
    scrollbar-width: thin; /* ✅ สำหรับ Firefox */
}

    /* ✅ เพิ่มสไตล์ scrollbar แบบเนียน ๆ ใน Chrome */
    #sidebar::-webkit-scrollbar {
        width: 6px;
    }

    #sidebar::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

/*end scroll bar*/


