/* ==========================================================================
   RESET & GLOBAL FIXES (Kunci Utama Stabilitas Layout)
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --sidebar-bg: #ffffff;
  --sidebar-width: 260px;
  --accent-color: #8C57FF; /* Ungu Materio */
  --text-muted: #6B6C7E;
}

body {
  font-family: 'Public Sans', sans-serif;
  background-color: #F4F5FA !important;
  color: #4C4E64;
  min-height: 100vh;
  display: flex; /* Memisahkan area sidebar dan main-content secara global */
  overflow-x: auto;
}

/* ==========================================================================
   STYLING SIDEBAR (Bergaya Materio)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg) !important;
  display: flex !important; /* Memaksa flexbox kustom kita bekerja */
  flex-direction: column;
  padding: 20px 0;
  position: fixed;
  left: 0;
  top: 0;
  flex-shrink: 0; /* Mengunci lebar sidebar agar anti-gepeng saat di-zoom */
  border-right: 1px solid #EAEAEF;
  z-index: 1000;
}

/* Judul Kategori Menu (User Interface, Database, Auth) */
.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #A3A4AE;
  font-weight: 600;
  padding: 15px 24px 8px 24px;
}

/* 1. Kondisi Menu Standar (Disamakan dengan kelas di HTML Anda) */
.nav-custom-link {
  display: flex;
  align-items: center;
  padding: 10px 20px 10px 24px !important;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted) !important;
  text-decoration: none;
  border-top-right-radius: 50px;
  border-bottom-right-radius: 50px;
  margin-bottom: 4px;
  margin-right: 15px; /* Memberi jarak di kanan sebelum lengkungan */
  transition: all 0.2s ease;
  white-space: nowrap; /* Teks tidak akan turun ke bawah saat browser di-zoom */
  cursor: pointer;
}

/* Menu Aktif saat ini (Dashboard) */
.nav-custom-link.active-menu {
  background: linear-gradient(72.47deg, #8C57FF 22.16%, #9E70FF 76.47%) !important;
  color: #ffffff !important;
  box-shadow: 0px 4px 8px rgba(140, 87, 255, 0.25);
  font-weight: 600;
}

/* 2. Efek Hover Menu */
.nav-custom-link:hover:not(.active-menu) {
  background-color: rgba(140, 87, 255, 0.08) !important; /* Efek hover soft ala Materio */
  color: var(--accent-color) !important;
}

/* Khusus hover untuk tombol logout */
.nav-custom-link.text-danger:hover {
  background: linear-gradient(72.47deg, #FF4C51 22.16%, #FF6F73 76.47%) !important;
  color: #ffffff !important;
  box-shadow: 0px 4px 8px rgba(255, 76, 81, 0.25);
}

/* Khusus hover untuk tombol login */
.nav-custom-link.text-primary:hover {
  background: linear-gradient(72.47deg, #56ca00 22.16%, #6be319 76.47%) !important;
  color: #ffffff !important;
  box-shadow: 0px 4px 8px rgba(86, 202, 0, 0.25);
}

.sidebar-badge-style {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  color: #ffffff;
  background-color: #FF4C51;
  border-radius: 10px;
  margin-left: auto; /* Memaksa badge terdorong rapi ke sisi kanan mendampingi teks menu */
}

/* ==========================================================================
   KONTEN UTAMA (Aman & Responsif Terhadap Zoom)
   ========================================================================== */
.main-content {
  padding-left: calc(var(--sidebar-width) + 40px); /* Presisi di sebelah kanan sidebar */
  padding-right: 40px;
  padding-top: 40px;
  padding-bottom: 40px;
  flex-grow: 1;
  width: 100%;
  min-width: 320px;
}

/* Profil Header Kanan Atas */
.user-profile-header {
  border-left: 2px solid #EAEAEF;
  padding-left: 15px;
  text-align: right;
}

.user-profile-header .name {
  font-size: 14px;
  font-weight: bold;
  color: #4C4E64;
  margin-bottom: -2px;
}

.user-profile-header .access {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   LOADING SCREEN EFFECTS
   ========================================================================== */
.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(255, 255, 255, 0.9); 
  display: flex; 
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999; 
}

.loader {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3; 
  border-top: 5px solid var(--accent-color); 
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   LOGO BERPUTAR
   ========================================================================== */
   
/* 1. Opsi jika ingin logo BERPUTAR TERUS-MENERUS */
.logo-berputar-loop {
    animation: putarHorizontal 6s linear infinite;
}

/* 2. Opsi jika ingin logo HANYA BERPUTAR SAAT DI-HOVER (Disarankan agar tidak pusing) */
.logo-berputar-hover {
    transition: transform 6s ease-in-out;
}
.logo-berputar-hover:hover {
    transform: rotateY(360deg);
}

/* Logic gerakan berputar 360 derajat (untuk opsi 1) */
@keyframes putarHorizontal {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* ==========================================================================
   TABLE MODEL KLIK MUNCUL BARIS KEBAWAH
   ========================================================================== */
/* Efek saat baris utama di-hover */
tr[data-bs-toggle="collapse"]:hover {
    filter: brightness(0.95);
}

/* Animasi halus saat baris anak muncul */
tr.collapse.show {
    display: table-row !important;
}