/* =========================================
   1. STYLE GLOBAL (DEFAULT: CLEAN / PUTIH)
   ========================================= */
:root {
    --primary: #2563eb;
    --secondary: #10b981;
    --bg-light: #f3f4f6;
    --text-dark: #1f2937;
    --white: #ffffff;
    --sidebar-width: 260px;
    --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body { 
    background-color: var(--bg-light); 
    color: var(--text-dark); 
    display: flex; 
    min-height: 100vh; 
    overflow-x: hidden; 
}

/* Sidebar Default */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    position: fixed;
    height: 100%;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    padding: 20px;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

/* Header Sidebar (Judul) */
.sidebar-header {
    position: relative; /* Penting agar tombol X posisinya pas */
    text-align: center;
    margin-bottom: 30px;
}
.sidebar h2 { color: var(--primary); font-size: 1.4rem; margin: 0; }

/* --- PERBAIKAN TOMBOL X --- */
/* Secara default (Desktop), tombol close disembunyikan */
.close-sidebar-btn { 
    display: none; 
}

/* Nav Link */
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 15px;
    color: #6b7280; text-decoration: none; border-radius: 8px; margin-bottom: 5px; transition: 0.3s; font-weight: 500;
}
.nav-link:hover, .nav-link.active { background-color: var(--primary); color: var(--white); transform: translateX(5px); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1; padding: 30px; width: calc(100% - var(--sidebar-width)); transition: margin 0.3s;
}

/* Card Default */
.card {
    background: var(--white); padding: 25px; border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); margin-bottom: 20px; border: 1px solid #e5e7eb;
}

/* Stat Card */
.stat-card {
    background: var(--white); padding: 20px; border-radius: 10px;
    border-left: 5px solid var(--primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.stat-card h3 { font-size: 2rem; margin-bottom: 5px; color: var(--text-dark); }
.stat-card p { font-size: 0.9rem; color: #6b7280; }

/* Buttons & Inputs */
.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; color: white; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--primary); }
.btn-success { background: var(--secondary); }
.btn-danger { background: var(--danger); }
input, select, textarea { width: 100%; padding: 12px; margin: 8px 0 20px; border: 1px solid #d1d5db; border-radius: 8px; }

/* Mobile Topbar */
.topbar-mobile { display: none; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.toggle-btn { background: none; border: none; font-size: 1.5rem; color: var(--primary); cursor: pointer; }

/* =========================================
   2. KHUSUS DASHBOARD THEME
   ========================================= */
body.dashboard-theme {
/* Ganti 'cover' menjadi '100% 100%' */
    background: linear-gradient(to right, rgba(89, 139, 247, 0.85), rgba(118, 167, 245, 0.7)),
                url('../images/bg.png') no-repeat center center fixed;
                
    background-size: 100% 100%; /* <-- INI KUNCINYA */
    
    color: #fff;
}
body.dashboard-theme h1, 
body.dashboard-theme h2, 
body.dashboard-theme h3, 
body.dashboard-theme .topbar-mobile h3 { color: #fff !important; }
body.dashboard-theme p { color: #e5e7eb; }

/* Sidebar Dashboard */
body.dashboard-theme .sidebar {
    background: rgba(23, 37, 84, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255,255,255,0.1);
}
body.dashboard-theme .sidebar h2 { color: #fff; }
body.dashboard-theme .nav-link { color: #bfdbfe; }
body.dashboard-theme .nav-link:hover, 
body.dashboard-theme .nav-link.active { background-color: rgba(255,255,255,0.2); color: #fff; }
body.dashboard-theme .toggle-btn { color: #fff !important; }
body.dashboard-theme .close-sidebar-btn { color: #fff !important; }

/* Card Dashboard */
body.dashboard-theme .card, 
body.dashboard-theme .stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    color: #fff;
}
body.dashboard-theme .stat-card h3 { color: #fff !important; }
body.dashboard-theme .stat-card p { color: #dbeafe; }

/* =========================================
   3. LOGIN PAGE
   ========================================= */
body.login-page {
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0;
}
.login-card {
    background: #fff; width: 100%; max-width: 400px; padding: 40px; border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1); text-align: center; animation: fadeInUp 0.6s ease-out;
}
.login-header i { font-size: 3rem; color: var(--primary); margin-bottom: 15px; background: #eff6ff; padding: 20px; border-radius: 50%; }
.input-wrapper input { width: 100%; padding: 12px 15px 12px 45px; border: 2px solid #e5e7eb; border-radius: 10px; outline: none; }
.input-wrapper i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.btn-login { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 10px; cursor: pointer; margin-top: 10px; }

/* =========================================
   4. RESPONSIVE (MOBILE)
   ========================================= */
.flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.hidden { display: none; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
table.dataTable thead th { background-color: #f8fafc; color: #334155; }
.logout-btn { color: #ef4444 !important; }

@media screen and (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; padding: 20px; }
    .topbar-mobile { display: flex; }
    
    /* --- MUNCULKAN TOMBOL X HANYA DI HP --- */
    .close-sidebar-btn { 
        display: block;          /* Munculkan */
        position: absolute;      /* Posisikan bebas */
        right: 0; top: 0;        /* Pojok kanan atas dari header */
        background: none; 
        border: none; 
        font-size: 1.2rem; 
        color: inherit; 
        cursor: pointer; 
    }

    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 900; }
    .sidebar-overlay.active { display: block; }
}

@media print {
    body { background: white !important; color: black !important; }
    .sidebar, .topbar-mobile, .no-print { display: none !important; }
    .main-content { margin: 0; width: 100%; }
    .card { border: 1px solid black; box-shadow: none; background: white !important; color: black !important; }
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }