/* ==========================================================================
   VARIABEL CSS (TEMA DAN WARNA UTAMA)
   Kita gunakan variabel agar mudah membuat Dark Mode nantinya
   ========================================================================== */
   :root {
    /* Palet Warna Terang (Light Mode) */
    --bg-main: #f3f4f6; /* Warna latar belakang body */
    --bg-glass: rgba(255, 255, 255, 0.7); /* Warna efek kaca transparan */
    --border-glass: rgba(255, 255, 255, 0.5); /* Garis batas efek kaca */
    --text-primary: #1e293b; /* Warna teks utama (Gelap) */
    --text-secondary: #64748b; /* Warna teks pudar */
    
    /* Warna Identitas (Primary) */
    --primary-color: #4f46e5; /* Biru Indigo */
    --primary-hover: #4338ca;
    
    /* Warna Status */
    --success-color: #10b981; /* Hijau */
    --warning-color: #f59e0b; /* Kuning */
    --danger-color: #ef4444; /* Merah */
    
    /* Efek Bayangan Lembut */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    
    /* Jarak dan Ukuran (Spasi) */
    --sidebar-width: 260px;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   TEMA GELAP (DARK MODE) - Variabel otomatis berubah jika class .dark-mode aktif
   ========================================================================== */
.dark-mode {
    --bg-main: #0f172a; /* Biru sangat gelap */
    --bg-glass: rgba(30, 41, 59, 0.7); /* Kaca mode gelap */
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc; /* Putih terang */
    --text-secondary: #94a3b8; /* Abu-abu pudar */
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   RESET CSS & PENGATURAN DASAR
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition), color var(--transition);
}

a {
    text-decoration: none;
}

ul {
    list-style: none;
}

/* ==========================================================================
   ELEMEN DEKORASI (LATAR BELAKANG) - Efek Gelembung Berwarna
   ========================================================================== */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background-color: rgba(79, 70, 229, 0.4);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background-color: rgba(16, 185, 129, 0.3);
    bottom: -50px;
    right: -50px;
}

/* ==========================================================================
   UTILITY CLASS (GLASSMORPHISM)
   Efek kaca buram (blur) yang memberikan kesan modern premium
   ========================================================================== */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   STRUKTUR LAYOUT (GRID / FLEX)
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    padding: 1rem;
    gap: 1.5rem;
}

/* ==========================================================================
   SIDEBAR (NAVIGASI KIRI)
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 1rem;
    height: calc(100vh - 2rem);
    overflow-y: auto;
}

/* Sembunyikan scrollbar tapi tetap bisa di-scroll */
.sidebar::-webkit-scrollbar {
    width: 0;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
    padding-left: 0.5rem;
}

/* Link Navigasi */
.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a i {
    font-size: 1.25rem;
}

/* Efek Hover (Saat kursor di atas menu) */
.nav-links a:hover, .nav-links li.active a {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Dropdown Akordion Submenu */
.nav-links .arrow {
    margin-left: auto;
    transition: transform var(--transition);
}

.nav-links .has-submenu.open > a .arrow {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding-left: 1.5rem;
}

.nav-links .has-submenu.open .submenu {
    max-height: 400px;
}

.submenu a {
    padding: 10px 16px;
    font-size: 0.9rem;
    margin-top: 5px;
}

.logout-menu {
    margin-top: auto;
    border-top: 1px solid var(--border-glass);
    padding-top: 1rem;
}

.logout-menu a:hover {
    background: var(--danger-color);
}

/* ==========================================================================
   AREA KONTEN UTAMA
   ========================================================================== */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Mencegah overflow flexbox */
}

/* TOPBAR (BILAH ATAS) */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.toggle-sidebar {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    display: none; /* Disembunyikan di desktop */
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

/* Tombol Mode Gelap & Notifikasi */
.theme-toggle, .notification-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 50%;
    padding: 5px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover, .notification-toggle:hover {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background-color: var(--danger-color);
    border-radius: 50%;
    border: 2px solid var(--bg-glass);
}

/* Profil Pengguna di Kanan Atas */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* ==========================================================================
   ISI HALAMAN (DASHBOARD)
   ========================================================================== */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
}

/* KARTU STATISTIK (Grid Layout) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px); /* Animasi melayang saat dihover */
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
}

.stat-details h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-details h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* ==========================================================================
   TABEL MODERN (UNTUK DAFTAR DATA)
   ========================================================================== */
.recent-card {
    padding: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.btn-sm {
    padding: 6px 12px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm:hover {
    background: var(--primary-color);
    color: white;
}

.table-responsive {
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.modern-table th, .modern-table td {
    padding: 12px 1rem;
    border-bottom: 1px solid var(--border-glass);
}

.modern-table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.modern-table tbody tr {
    transition: var(--transition);
}

.modern-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.dark-mode .modern-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Lencana/Badge Status */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.bg-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.bg-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

/* ==========================================================================
   RESPONSIVE DESIGN (UNTUK HP & TABLET)
   ========================================================================== */
@media (max-width: 992px) {
    .app-container {
        padding: 0.5rem;
    }
    
    .sidebar {
        display: flex;
        position: fixed;
        top: 0;
        left: -320px; /* Sembunyikan ke luar layar kiri */
        height: 100vh;
        z-index: 1000;
        border-radius: 0;
        transition: left var(--transition);
        background: var(--bg-main);
    }
    
    /* Kelas tambahan untuk memunculkan sidebar via JavaScript */
    .sidebar.show {
        left: 0;
    }
    
    /* Konten utama bergeser seiring dengan kemunculan sidebar */
    .main-content {
        transition: transform var(--transition);
        width: 100%;
    }
    
    .sidebar.show + .main-content {
        transform: translateX(var(--sidebar-width));
    }
    
    .toggle-sidebar {
        display: block; /* Munculkan ikon menu hamburger */
    }
}
