:root {
    --primary-color: #1a56db; 
    --secondary-color: #475569; 
    --bg-color: #f8fafc;
    --bg-card: #ffffff; 
    --bg-input: #f1f5f9; 
    --text-color: #0f172a; 
    --text-secondary: #64748b;
    --border-color: #e2e8f0; 
    --table-header-bg: #f8fafc; 
    --table-border: #e2e8f0; 
    --table-row-hover: #f1f5f9;
    --success-color: #10b981; 
    --warning-color: #f59e0b; 
    --danger-color: #ef4444; 
    --info-color: #3b82f6;
    --sidebar-width: 260px; 
    --header-height: 70px;
}
[data-theme="dark"] {
    --bg-color: #0f172a; 
    --bg-card: #1e293b; 
    --bg-input: #0f172a;
    --text-color: #f8fafc; 
    --text-secondary: #94a3b8; 
    --border-color: #334155;
    --table-header-bg: #0f172a; 
    --table-border: #334155; 
    --table-row-hover: #334155;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); font-size: 14px; transition: all 0.3s ease; }
h1, h2, h3, h4 { font-family: 'Poppins', sans-serif; color: var(--text-color); }
.text-primary { color: var(--primary-color) !important; } .text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; } .text-warning { color: var(--warning-color) !important; }
.text-secondary { color: var(--text-secondary) !important; } .text-center { text-align: center !important; }
.font-bold { font-weight: bold !important; } .text-sm { font-size: 12px !important; } .mb-2 { margin-bottom: 8px !important; } .mb-3 { margin-bottom: 15px !important; } .mb-4 { margin-bottom: 20px !important; }
.w-100 { width: 100% !important; } .flex-between { display: flex; justify-content: space-between; align-items: center; } .flex-align { display: flex; align-items: center; } .flex-gap { display: flex; gap: 10px; } .flex-1 { flex: 1; }

/* ==========================================
   LOGIN PAGE (BACKGROUND FOTO SEKOLAH BRO)
========================================== */
.login-wrapper { display: flex; height: 100vh; width: 100%; overflow: hidden; background: var(--bg-color); }

.login-split-left {
    flex: 1.2;
    background: linear-gradient(rgba(15, 23, 42, 0.7), rgba(26, 86, 219, 0.8)), url('https://i.ibb.co.com/jkHvrrYF/1.jpg');
    background-size: cover; background-position: center; background-repeat: no-repeat;
    color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 50px; position: relative; overflow: hidden;
}
.login-branding h1 { font-size: 40px; font-weight: 700; margin-bottom: 15px; color: #fff; }
.login-branding p { font-size: 16px; opacity: 0.9; line-height: 1.6; max-width: 80%; color: #fff; }
.login-logo-icon { font-size: 50px; margin-bottom: 20px; color: #fff; }
.login-footer-text { font-size: 13px; opacity: 0.7; color: #fff; }

.login-split-right { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg-color); padding: 40px; }
.login-card { background: var(--bg-card); padding: 40px; border-radius: 16px; width: 100%; max-width: 420px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); border: 1px solid var(--border-color); }
.login-card h2 { font-size: 26px; margin-bottom: 8px; }
.login-header-mobile { display: none; text-align: center; margin-bottom: 30px; }
.input-with-icon { position: relative; }
.input-with-icon i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.input-with-icon input { padding-left: 45px; }
.toggle-password { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-secondary); cursor: pointer; }

/* COMPONENT: BUTTONS & INPUTS */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; font-size: 14px; }
.btn-primary { background: var(--primary-color); color: #fff; } .btn-primary:hover { background: #1d4ed8; }
.btn-success { background: var(--success-color); color: #fff; } .btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger-color); color: #fff; } .btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning-color); color: #fff; } .btn-warning:hover { background: #d97706; }
.btn-info { background: var(--info-color); color: #fff; } .btn-info:hover { background: #2563eb; }
.btn-save { background: #0f172a; color: #fff; } .btn-save:hover { background: #1e293b; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-color); } .btn-outline:hover { background: var(--bg-input); }
.btn-lg { padding: 12px 24px; font-size: 15px; } .sm-btn { padding: 6px 12px; font-size: 12px; }

.modern-input, .modern-select { width: 100%; padding: 10px 15px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input); color: var(--text-color); outline: none; transition: all 0.2s; font-size: 14px; }
.modern-input:focus, .modern-select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
.sm-input { padding: 6px 10px; font-size: 13px; }
.readonly-input { background-color: var(--table-row-hover); cursor: not-allowed; font-weight: 600; }
.input-group-form label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: var(--text-secondary); }

/* LAYOUT: HEADER & NAV */
.top-navbar { height: var(--header-height); background: var(--bg-card); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 25px; position: fixed; top: 0; left: 0; right: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.nav-brand { display: flex; align-items: center; gap: 15px; }
.brand-logo { width: 40px; height: 40px; background: linear-gradient(135deg, var(--primary-color), var(--info-color)); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px; }
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-weight: 700; font-size: 18px; font-family: 'Poppins'; color: var(--text-color); letter-spacing: -0.5px; }
.brand-subtitle { font-size: 11px; color: var(--text-secondary); font-weight: 500; }

.nav-menu { display: flex; gap: 5px; height: 100%; }
.nav-link, .nav-dropbtn { display: flex; align-items: center; gap: 8px; padding: 0 15px; height: 100%; color: var(--text-secondary); font-weight: 500; text-decoration: none; border: none; background: transparent; cursor: pointer; font-size: 14px; transition: color 0.2s; }
.nav-link:hover, .nav-dropbtn:hover { color: var(--primary-color); }
.nav-link.active { color: var(--primary-color); border-bottom: 3px solid var(--primary-color); background: rgba(26,86,219,0.03); }
.nav-dropdown { position: relative; height: 100%; }
.nav-dropdown-content { display: none; position: absolute; top: var(--header-height); left: 0; background: var(--bg-card); min-width: 220px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); border-radius: 0 0 8px 8px; border: 1px solid var(--border-color); border-top: none; padding: 10px 0; z-index: 101; }
.nav-dropdown:hover .nav-dropdown-content { display: block; }
.nav-dropdown-content .nav-link { height: auto; padding: 12px 20px; border: none; }
.nav-dropdown-content .nav-link:hover { background: var(--bg-input); }

.nav-tools { display: flex; align-items: center; gap: 20px; }
.tahun-pelajaran-badge { background: rgba(26,86,219,0.1); color: var(--primary-color); padding: 5px 12px; border-radius: 20px; font-weight: 600; font-size: 12px; border: 1px solid rgba(26,86,219,0.2); }
.theme-toggle { background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-color); width: 35px; height: 35px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; } .theme-toggle:hover { background: var(--border-color); }

.profile-dropdown-wrapper { position: relative; }
.header-profile { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 5px; border-radius: 8px; transition: background 0.2s; } .header-profile:hover { background: var(--bg-input); }
.header-profile .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-color); color: white; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 2px solid var(--bg-card); }
.header-profile .user-info { display: flex; flex-direction: column; }
.header-profile .user-name { font-weight: 600; font-size: 13px; }
.header-profile .user-role { font-size: 11px; color: var(--text-secondary); text-transform: capitalize; }
.dropdown-menu-profile { display: none; position: absolute; top: 110%; right: 0; background: var(--bg-card); min-width: 200px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); border-radius: 12px; border: 1px solid var(--border-color); padding: 8px; z-index: 101; }
.dropdown-menu-profile.show { display: block; animation: slideDown 0.2s ease; }
.dropdown-header { padding: 12px; border-bottom: 1px solid var(--border-color); margin-bottom: 8px; }
.dropdown-header strong { display: block; font-size: 14px; } .dropdown-header span { font-size: 12px; color: var(--text-secondary); text-transform: capitalize; }
.dropdown-menu-profile a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--danger-color); text-decoration: none; border-radius: 6px; font-weight: 500; font-size: 13px; } .dropdown-menu-profile a:hover { background: rgba(239, 68, 68, 0.1); }
.mobile-menu-toggle { display: none; background: none; border: none; font-size: 24px; color: var(--text-color); cursor: pointer; }

/* MAIN CONTENT */
.main-content { margin-top: var(--header-height); padding: 30px; min-height: calc(100vh - var(--header-height)); }
.content-header { margin-bottom: 25px; } .content-header h1 { font-size: 24px; font-weight: 700; }
.page { display: none; animation: fadeIn 0.3s ease; } .page.active { display: block; }
.glass-card { background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border-color); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); padding: 25px; }
.nested-box { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; }

/* DASHBOARD */
.welcome-banner { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, var(--primary-color), var(--info-color)); padding: 35px 40px; border-radius: 16px; color: white; margin-bottom: 25px; border: none; box-shadow: 0 10px 25px rgba(26,86,219,0.2); }
.welcome-banner h2 { color: white; font-size: 28px; margin-bottom: 8px; } .welcome-banner p { font-size: 15px; opacity: 0.9; }
.welcome-illust { font-size: 70px; opacity: 0.2; }
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card { display: flex; align-items: center; gap: 20px; padding: 20px; }
.stat-icon { width: 60px; height: 60px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: white; flex-shrink: 0; }
.stat-info h4 { font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-info h2 { font-size: 28px; font-weight: 700; margin: 0; }
.dashboard-charts { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; } .chart-card h3 { font-size: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; }

/* TABLES */
.modern-table { width: 100%; border-collapse: collapse; background: var(--bg-card); font-size: 13px; }
.modern-table th, .modern-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--table-border); vertical-align: middle; }
.modern-table th { background-color: var(--table-header-bg); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; position: sticky; top: 0; z-index: 10; border-top: 1px solid var(--table-border); }
.modern-table tbody tr { transition: background 0.2s; } .modern-table tbody tr:hover { background-color: var(--table-row-hover); }
.modern-table td[contenteditable="true"] { background-color: rgba(26,86,219,0.03); outline: 1px dashed transparent; transition: all 0.2s; }
.modern-table td[contenteditable="true"]:focus { background-color: #fff; outline: 2px solid var(--primary-color); outline-offset: -2px; }
.status-badge { padding: 5px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-Aktif { background: rgba(16,185,129,0.1); color: var(--success-color); border: 1px solid rgba(16,185,129,0.2); }
.badge-Lulus { background: rgba(59,130,246,0.1); color: var(--info-color); border: 1px solid rgba(59,130,246,0.2); }
.badge-Keluar { background: rgba(239,68,68,0.1); color: var(--danger-color); border: 1px solid rgba(239,68,68,0.2); }
.indicator { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; }
.ind-lengkap { background: var(--success-color); color: #fff; } .ind-sebagian { background: var(--warning-color); color: #fff; } .ind-belum { background: var(--danger-color); color: #fff; }
.progress-badge { font-weight: bold; padding: 6px 12px; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border-color); }
#tabel-container { overflow-x: auto; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); max-height: 600px; }

/* FORMS & GRIDS */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-top: 15px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.col-span-full { grid-column: 1 / -1; }
.form-section { margin-top: 30px; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; background: var(--bg-card); }
.form-section h4 { font-size: 15px; border-bottom: 2px solid var(--bg-input); padding-bottom: 10px; margin-bottom: 15px; }
.form-table td { padding: 6px; border: none; font-size: 13px; } .form-table .label { font-weight: 600; color: var(--text-secondary); width: 180px; }
.foto-box { width: 100%; height: 200px; border: 2px dashed var(--border-color); border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--bg-input); overflow: hidden; margin-bottom: 15px; }
.foto-box.sm-box { height: 150px; }

/* MODALS */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-content { background-color: var(--bg-card); margin: 5% auto; padding: 30px; border: 1px solid var(--border-color); width: 100%; max-width: 500px; border-radius: 16px; position: relative; }
.close { color: var(--text-secondary); font-size: 28px; font-weight: bold; cursor: pointer; transition: 0.2s; } .close:hover { color: var(--danger-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }

/* NOTIFICATION */
.notification-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.notification { display: flex; align-items: center; gap: 15px; padding: 15px 20px; border-radius: 12px; background: var(--bg-card); box-shadow: 0 10px 30px rgba(0,0,0,0.1); border-left: 4px solid; animation: slideInRight 0.3s ease; transition: opacity 0.3s ease; width: 320px; }
.notif-success { border-left-color: var(--success-color); } .notif-success .notif-icon { color: var(--success-color); }
.notif-error { border-left-color: var(--danger-color); } .notif-error .notif-icon { color: var(--danger-color); }
.notif-warning { border-left-color: var(--warning-color); } .notif-warning .notif-icon { color: var(--warning-color); }
.notif-info { border-left-color: var(--info-color); } .notif-info .notif-icon { color: var(--info-color); }
.notif-icon { font-size: 24px; } .notif-content strong { display: block; font-size: 14px; margin-bottom: 3px; } .notif-content span { font-size: 12px; color: var(--text-secondary); line-height: 1.3; }

/* ANIMATIONS */
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.5s ease forwards; } .fade-in-up { animation: fadeInUp 0.5s ease forwards; }

/* MEDIA QUERIES (MOBILE RESPONSIVE) */
@media screen and (max-width: 1024px) { .dashboard-charts { grid-template-columns: 1fr; } .form-grid-3 { grid-template-columns: 1fr; } }
@media screen and (max-width: 900px) {
    .no-mobile { display: none !important; } .mobile-menu-toggle { display: block; }
    .nav-menu { display: none; position: absolute; top: var(--header-height); left: 0; right: 0; background: var(--bg-card); flex-direction: column; height: auto; padding: 15px; border-bottom: 1px solid var(--border-color); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
    .nav-menu.show { display: flex; animation: slideDown 0.3s ease; }
    .nav-link, .nav-dropbtn { padding: 12px 15px; border-radius: 8px; width: 100%; justify-content: flex-start; }
    .nav-dropdown-content { position: static; box-shadow: none; border: none; padding-left: 20px; border-left: 2px solid var(--border-color); margin-left: 15px; display: none; }
    .welcome-banner { flex-direction: column; text-align: center; gap: 20px; padding: 25px; } .welcome-illust { display: none; }
}
@media screen and (max-width: 600px) {
    .login-wrapper { flex-direction: column; } .login-split-left { display: none; } .login-header-mobile { display: block; }
    .form-grid-2, .grid-2, .grid-3 { grid-template-columns: 1fr; } .main-content { padding: 15px; } .glass-card { padding: 15px; }
}

/* ==========================================
   KHUSUS CETAK PRINTER (SETTING F4/FOLIO)
========================================== */
@media print {
    /* 1. Sembunyikan elemen UI web secara paksa */
    .top-navbar, .nav-menu, .nav-tools, .action-buttons, .filter-wrapper, .theme-toggle, .btn, .notification-container, .app-wrapper, .login-wrapper { display: none !important; }
    
    /* 2. Tampilkan HANYA area yang mau di-print */
    body.printing-arsip #print-area-riwayat { display: block !important; }
    body.printing-buku-induk #print-area-buku-induk { display: block !important; }
    
    /* 3. Atur Body menjadi murni kertas putih */
    body { background: #fff !important; color: #000 !important; padding: 0 !important; margin: 0 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    
    /* 4. ATUR UKURAN KERTAS MENJADI F4 (Folio) = 215.9mm x 330.2mm */
    @page { 
        size: 215.9mm 330.2mm portrait; 
        margin: 1.5cm; /* Margin keliling biar rapi */
    }
    
    /* 5. Desain Rapi KOP Surat */
    .print-header { display: flex; align-items: center; justify-content: space-between; border-bottom: none; margin-bottom: 5px; width: 100%; }
    .logo-left, .logo-right { width: 90px; height: 90px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
    .logo-left img, .logo-right img { max-width: 100%; max-height: 100%; object-fit: contain; }
    .kop-surat { flex: 1; text-align: center; padding: 0 15px; }
    .kop-surat h3 { font-size: 13pt; margin: 0; text-transform: uppercase; font-weight: normal; color: #000; }
    .kop-surat h2 { font-size: 15pt; margin: 0; font-weight: bold; text-transform: uppercase; color: #000; }
    .kop-surat h1 { font-size: 18pt; margin: 0; font-weight: bold; text-transform: uppercase; color: #000; line-height: 1.2; }
    .kop-surat p { font-size: 10pt; margin: 0; color: #000; }
    
    /* 6. Garis Hitam Tebal di bawah KOP */
    .garis-kop { border: none !important; border-top: 3px solid #000 !important; border-bottom: 1px solid #000 !important; height: 2px !important; margin-bottom: 20px !important; width: 100% !important; display: block !important; background: transparent !important; }
    
    /* 7. Desain Tabel Raport/Buku Induk */
    .print-title { text-align: center; font-size: 14pt; font-weight: bold; text-decoration: underline; margin-bottom: 15px; color: #000; }
    .print-table { width: 100%; border-collapse: collapse; margin-bottom: 15px; font-size: 10pt; color: #000; }
    .print-table th, .print-table td { border: 1px solid #000 !important; padding: 6px !important; color: #000 !important; vertical-align: middle; }
    .print-table th { background-color: #e0e0e0 !important; text-align: center; font-weight: bold; }
    
    /* 8. Posisi Tanda Tangan */
    .print-ttd { width: 100%; display: flex; justify-content: flex-end; margin-top: 30px; page-break-inside: avoid; }
    .ttd-box { width: 250px; text-align: left; }
    
    /* 9. Desain Kotak QR Code Legalisir */
    .legal-box { border: 2px solid #000; padding: 10px; margin-top: 20px; display: flex; justify-content: space-between; align-items: center; page-break-inside: avoid; } 
    .legal-text { font-size: 9pt; }
    .legal-qr img { width: 80px; height: 80px; }
}