/* ==========================================================
   1. GLOBAL & LAYOUT UTAMA
   ================================================---------- */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 56px;    /* Jarak aman untuk Navbar Fixed Top */
  padding-bottom: 40px; /* Jarak aman untuk Footer Fixed Bottom */
  background-color: #f8f9fa;
}

.main-wrapper {
  display: flex;
  flex: 1;
  position: relative;
}

/* ==========================================================
   2. NAVBAR & FOOTER KUSTOM
   ================================================---------- */
/* Pastikan Navbar Paling Atas (di atas Sidebar & Footer) */
.navbar, .navbar.fixed-top {
  z-index: 1040 !important; 
}

/* Warna Hijau Kalem (Tidak Menyala) untuk Navbar */
.bg-custom-green {
  background-color: #2c5e4b !important; 
}

/* Warna Hitam Muda (Soft Dark) untuk Footer */
.bg-soft-dark {
  background-color: #212529 !important;
  color: #d1d5db !important;
}

.footer {
  font-size: 0.85rem;
  z-index: 1035; /* Berada di atas konten, di bawah navbar */
}

/* ==========================================================
   3. SIDEBAR FIXED & MENU SCROLL
   ================================================---------- */
.sidebar {
  position: fixed;
  top: 56px;   /* Tepat di bawah navbar */
  left: 0;
  width: 250px;
  height: calc(100vh - 56px - 40px); /* Pas di antara navbar dan footer */
  background-color: #f8f9fa;
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease; /* Animasi buka-tutup halus */
  z-index: 1030; /* Di bawah Navbar (1040) dan di bawah Footer (1035) */
}

/* Kondisi saat Sidebar Ditutup */
.sidebar.toggled {
  transform: translateX(-250px);
}

/* Header Profil di dalam Sidebar (Fixed di atas sidebar) */
.sidebar-header {
  flex-shrink: 0;
  background-color: #f8f9fa;
}

/* Area Menu Sidebar dengan Scroll Mandiri */
.sidebar-menu {
  flex-grow: 1;
  overflow-y: auto;
}

/* Kustomisasi Tampilan Link Sidebar */
.sidebar-link {
  display: block;
  padding: 10px 15px;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  margin-bottom: 2px;
}

.sidebar-link:hover, .sidebar-link.active {
  background-color: #e9ecef;
  color: #0d6efd;
  font-weight: 500;
}

.submenu .sidebar-link {
  font-size: 0.9em;
  padding-left: 20px;
}

/* Kustomisasi Scrollbar Sidebar */
.sidebar-menu::-webkit-scrollbar {
  width: 5px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background-color: #aaa;
}

/* ==========================================================
   4. KONTEN UTAMA
   ================================================---------- */
.content-body {
  flex: 1;
  margin-left: 250px; /* Beri jarak selebar sidebar */
  transition: margin-left 0.3s ease;
  padding: 24px;
  background-color: #f8f9fa;
}

/* Jika sidebar ditutup, konten melebar penuh */
.sidebar.toggled ~ .content-body {
  margin-left: 0;
}

/* ==========================================================
   5. RESPONSIF LAYAR KECIL (MOBILE)
   ================================================---------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-250px); /* Sembunyikan default di mobile */
  }
  
  .sidebar.toggled {
    transform: translateX(0); /* Muncul menumpuk (overlay) saat dibuka */
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
  }

  .content-body {
    margin-left: 0 !important; /* Konten tidak bergeser di layar kecil */
  }
}

/* ==========================================================
   0. OVERFLOW LOCK (Mencegah Seluruh Layar Ikut Scroll)
   ================================================---------- */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.main-wrapper, 
.content-body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Container Pembungkus Tabel Berisolasi Mandiri */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* Halus saat di-swipe di iOS/Android */
}