/* Custom Sidebar Styles */
.sidebar {
    width: 280px; /* Lebar sidebar yang optimal */
    height: 100vh; /* Tinggi penuh viewport */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Mencegah scrollbar horizontal */
    background: linear-gradient(180deg, #2c3e50 0%, #4e73df 100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    padding-top: 0; /* Reset padding atas */
}

/* Sticky header untuk sidebar */
.sidebar .text-center {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, #2c3e50 0%, #4e73df 100%);
    padding: 1rem 0;
    margin: -1rem -1rem 1rem -1rem;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.sidebar a {
    color: white;
    text-decoration: none;
}

.sidebar .nav-link {
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sidebar .dropdown-icon {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.sidebar .nav-link[aria-expanded="true"] .dropdown-icon {
    transform: rotate(180deg);
}

.sidebar .collapse.show {
    visibility: visible;
    display: block;
}

.sidebar .list-unstyled {
    margin: 0;
    padding-left: 1.5rem;
    margin-top: 0.25rem;
}

.sidebar .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: block;
    position: relative;
}

.sidebar .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding-left: 1rem;
}

.sidebar .dropdown-item.active {
    color: #fff;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.15);
}

.sidebar .dropdown-item:before {
    content: "•";
    margin-right: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar .dropdown-item.active:before {
    color: #fff;
}

.main-content {
    margin-left: 280px; /* Space for the sidebar */
    padding: 1.5rem; /* Add padding to prevent content from touching the edge */
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

/* User profile section */
.sidebar .mt-auto {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
    margin-top: 1rem; /* Tambah margin atas */
}

.sidebar .dropdown-toggle::after {
    display: none;
}

/* Mobile styles */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    /* Navbar mobile */
    .navbar {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        z-index: 1001;
    }
}

/* Animasi untuk submenu */
.sidebar .collapse {
    transition: max-height 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

.sidebar .collapse.show {
    max-height: 500px;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Pastikan container dalam sidebar memiliki tinggi yang tepat */
.sidebar .d-flex.flex-column.h-100 {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Atur padding untuk container dalam sidebar */
.sidebar .p-3 {
    padding: 1rem;
    height: calc(100% - 2rem); /* Tinggi total dikurangi padding atas dan bawah */
    display: flex;
    flex-direction: column;
}