/* Modern Sidebar - Blue Theme Matching Login Page */
#wrapper {
    padding-left: 0;
    -webkit-transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    -moz-transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    -o-transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#wrapper.toggled {
    padding-left: 240px;
}

#sidebar-wrapper {
    z-index: 1000;
    position: fixed;
    left: 0;
    width: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    /* Modern Blue Gradient matching login page EXACTLY */
    background: linear-gradient(to bottom, #5B6FFF 0%, #3D4FE0 50%, #2A3BC7 100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

/* Diagonal pattern overlay like login page - using ::before pseudo-element */
#sidebar-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.03) 100px,
            rgba(255, 255, 255, 0.03) 200px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.02) 100px,
            rgba(255, 255, 255, 0.02) 200px
        );
    pointer-events: none;
    z-index: 0;
}

/* Ensure sidebar content is above the pattern */
#sidebar-wrapper .sidebar-nav {
    position: relative;
    z-index: 1;
}

/* Custom scrollbar for sidebar */
#sidebar-wrapper::-webkit-scrollbar {
    width: 6px;
}

#sidebar-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#sidebar-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

#sidebar-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

#wrapper.toggled #sidebar-wrapper {
    width: 240px;
}

#page-content-wrapper {
    width: 100%;
    position: absolute;
}

#wrapper.toggled #page-content-wrapper {
    position: absolute;
    margin-right: -240px;
}

/* Modern Sidebar Navigation */
.sidebar-nav {
    top: 0;
    margin: 0;
    padding: 15px 12px;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 6px;
}

/* Logo section styling */
.sidebar-nav li:first-child {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav li:first-child div {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 15px !important;
    background: transparent !important;
    border-radius: 0;
    backdrop-filter: none;
    border: none;
    margin: 0 12px;
}

.sidebar-nav li:first-child img {
    /* Keep original logo colors - don't invert */
    opacity: 1;
    height: 32px !important;
    width: auto;
    max-width: 100%;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

/* Modern icon styling */
.sidebar-nav li a span {
    margin-right: 14px;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    opacity: 0.85;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav li a.active span,
.sidebar-nav li a:hover span {
    opacity: 1;
    transform: scale(1.1);
}

/* Modern link styling */
.sidebar-nav li a {
    font-size: 14px;
    padding: 13px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    letter-spacing: 0.3px;
    margin: 0 4px;
}

/* Active state with modern glow effect */
.sidebar-nav li a.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-left: 4px solid #ffffff;
    padding-left: 12px;
}

.sidebar-nav li a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #ffffff, rgba(255, 255, 255, 0.7));
    border-radius: 0 4px 4px 0;
}

/* Hover state with smooth transition */
.sidebar-nav li a:hover {
    text-decoration: none;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-nav li a:active,
.sidebar-nav li a:focus {
    text-decoration: none;
    outline: none;
}

/* Submenu styling (Dashboard, Leave Management, etc.) */
#demo, #demo1, #demo2, #open-projects-submenu {
    background: rgba(0, 0, 0, 0.15);
    margin: 4px 8px;
    padding: 8px 0;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

#demo ul, #demo1 ul, #demo2 ul, #open-projects-submenu ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#demo li, #demo1 li, #demo2 li, #open-projects-submenu li {
    margin: 0;
    padding: 0;
}

#demo li a, #demo1 li a, #demo2 li a, #open-projects-submenu li a {
    color: rgba(255, 255, 255, 0.75) !important;
    background: transparent !important;
    padding: 10px 16px 10px 44px !important;
    display: block;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    border: none !important;
    border-left: 3px solid transparent !important;
    margin: 2px 8px;
}

#demo li a:hover, #demo1 li a:hover, #demo2 li a:hover, #open-projects-submenu li a:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    padding-left: 48px !important;
    border-left: 3px solid rgba(255, 255, 255, 0.6) !important;
    transform: translateX(2px);
}

#demo li a:focus, #demo1 li a:focus, #demo2 li a:focus,
#demo li a:active, #demo1 li a:active, #demo2 li a:active,
#open-projects-submenu li a:focus, #open-projects-submenu li a:active {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Collapse button styling */
.sidebar-nav li a[data-toggle="collapse"] {
    position: relative;
}

.sidebar-nav li a[data-toggle="collapse"]::after {
    content: '\f107';
    font-family: 'FontAwesome';
    position: absolute;
    right: 16px;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.sidebar-nav li a[data-toggle="collapse"]:not(.collapsed)::after {
    transform: rotate(180deg);
}

/* Special styling for logout button */
.sidebar-nav li:last-child {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav li:last-child a {
    color: rgba(255, 255, 255, 0.9) !important;
}

.sidebar-nav li:last-child a:hover {
    background: rgba(231, 76, 60, 0.2) !important;
    color: #ffffff !important;
}

/* Dark mode adjustments */
body.dark-mode #sidebar-wrapper {
    /* Darker blue gradient for dark mode with richer tones */
    background: linear-gradient(to bottom, #4A5DD9 0%, #3142B8 50%, #1E2A8A 100%);
}

body.dark-mode #sidebar-wrapper::before {
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.025) 100px,
            rgba(255, 255, 255, 0.025) 200px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.015) 100px,
            rgba(255, 255, 255, 0.015) 200px
        );
}

body.dark-mode .sidebar-nav li a {
    color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .sidebar-nav li a.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

body.dark-mode .sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Responsive adjustments */
@media(min-width:768px) {
    #wrapper {
        padding-left: 240px;
    }

    #wrapper.toggled {
        padding-left: 0;
    }

    #sidebar-wrapper {
        width: 240px;
    }

    #wrapper.toggled #sidebar-wrapper {
        width: 0;
    }

    #page-content-wrapper {
        position: relative;
    }

    #wrapper.toggled #page-content-wrapper {
        position: relative;
        margin-right: 0;
    }
}

/* Mobile responsive */
@media(max-width:767px) {
    #sidebar-wrapper {
        width: 240px;
        margin-left: -240px;
    }
    
    #wrapper.toggled #sidebar-wrapper {
        width: 240px;
        margin-left: 0;
    }
}
