html, body {
    overflow-x: hidden !important;
}

#menu {
    width: 245px !important; 
    height: 100vh !important;
    position: fixed !important;
    transition: all 0.3s ease;
}

#side-menu {
    height: calc(100vh - 63px) !important; 
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 110px !important; 
}

#side-menu::-webkit-scrollbar { width: 0px; }
#side-menu::-webkit-scrollbar-thumb { background: #dfdfdf; border-radius: 10px; }


#setup-menu-wrapper::-webkit-scrollbar { width: 4px; }
#setup-menu-wrapper::-webkit-scrollbar-thumb { background: #dfdfdf; border-radius: 10px; }

/* Base dropdown scroll fix */
.dropdown-menu {
    max-height: 300px !important; 
    overflow-y: auto !important; 
    overflow-x: hidden !important;
    z-index: 9999 !important; 
}

/* Allow Perfex JS to move the dropdown during scroll */
.dropdown-menu.open, 
.bootstrap-select .dropdown-menu {
    max-height: 220px !important;
    overflow-y: auto !important;
    z-index: 999999 !important;
    /* Removed: position absolute and top 100% from here */
}

/* Inner dropdown scroll styling */
.bootstrap-select .dropdown-menu.inner {
    max-height: 200px !important;
    overflow-y: auto !important;
}

/* Standard anchor for the button */
.bootstrap-select.btn-group {
    position: relative !important; 
}

/* This was causing the 'stuck' behavior - fixed now */
.bootstrap-select .dropdown-menu {
    /* Removed: top: 100% !important and transform: none !important */
    /* We let the library handle the exact pixel position */
    min-width: 100%;
}

/* Critical: Ensure the table doesn't clip the dropdown */
/* .table-responsive {
    overflow: visible !important; 
} */

/* .table td, .table th {
    position: relative;
} */

/* Handle automatic dropup when near the bottom of the screen */
.bootstrap-select.dropup .dropdown-menu {
    top: auto;
    bottom: 100%;
}

body:not(.customers) #wrapper {
    margin-left: 245px !important; 
    width: calc(100% - 245px) !important;
    height: 100vh !important;
    overflow: visible !important;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

body:not(.customers) #wrapper .content {
    height: calc(100vh - 63px) !important;
    overflow-y: auto !important;
    overflow-x: visible !important;
    padding-bottom: 250px !important;
    -webkit-overflow-scrolling: touch;
}


body.hide-sidebar:not(.customers) #wrapper {
    margin-left: 0 !important;
    width: 100% !important;
}

body.hide-sidebar:not(.customers) #menu {
    transform: translateX(-245px);
}

body.show-sidebar:not(.customers) #wrapper {
    margin-left: 245px !important;
    width: calc(100% - 245px) !important;
}

@media (min-width: 769px) {
    body.sidebar-collapsible:not(.customers) #menu {
        width: 64px !important;
    }

    body.sidebar-collapsible:not(.customers) #wrapper {
        margin-left: 64px !important;
        width: calc(100% - 64px) !important; 
    }

    body.sidebar-collapsible:not(.customers) #side-menu li a i {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 768px) {
    body:not(.customers) #wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

body:not(.customers) .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
}

/* Fix Login Page Logo */
.company-logo img {
    max-height: 180px !important;
    width: auto !important;
    margin: 0 auto;
}

/* Fix Admin Header Logo */
#logo img {
    max-height: 52px !important;
    width: auto !important;
    padding-top: 5px;
    padding-bottom: 5px;
}

/* Split Login Layout Styles */
.split-login-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    background-color: #fff;
    overflow: hidden;
}

.split-login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #F8F9FA;
    /* Using an image similar to the user's request (Financial planning/project management) */
    background-image: url('https://images.unsplash.com/photo-1552664730-d307ca884978?q=80&w=2070&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    position: relative;
}

.split-login-left::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6); /* Black overlay */
}

.split-login-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background-color: #fff;
}

.split-login-form-wrapper {
    width: 100%;
    max-width: 450px;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

/* Hide header and footer for client login/forgot password */
body.customers_login, body.customers_forgot_password {
    overflow: hidden !important;
}

body.customers_login #wrapper,
body.customers_login .container,
body.customers_login #content,
body.customers_forgot_password #wrapper,
body.customers_forgot_password .container,
body.customers_forgot_password #content {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.customers_login .navbar,
body.customers_login footer,
body.customers_login #wrapper > #content > .container:first-child,
body.customers_forgot_password .navbar,
body.customers_forgot_password footer,
body.customers_forgot_password #wrapper > #content > .container:first-child {
    display: none !important;
}

@media (max-width: 991px) {
    .split-login-left {
        display: none;
    }
    .split-login-right {
        padding: 20px;
    }
    .split-login-form-wrapper {
        max-width: 100%;
    }
}

.split-login-left .company-logo {
    background-color: #ffffff;
    padding: 12px 24px;
    border-radius: 12px;
    display: inline-block;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.split-login-left .company-logo img {
    max-height: 70px !important;
    max-width: 200px !important;
    object-fit: contain;
}