/* =====================================================
   KANG GURU - Sistem Buku Nilai Digital v2
   Stylesheet utama (tema navy/biru, sidebar gelap)
   ===================================================== */

:root {
    --navy-900: #1a2332;
    --navy-800: #1e2a3d;
    --navy-700: #243044;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-50: #eff6ff;
    --red-600: #dc2626;
    --amber-500: #f59e0b;
    --green-600: #16a34a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-400: #94a3b8;
    --gray-600: #475569;
    --gray-800: #1e293b;
    --white: #ffffff;
    --sidebar-width: 250px;
    --radius: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    font-size: 14px;
}

a { text-decoration: none; color: inherit; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--navy-900);
    color: var(--gray-200);
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.2s ease;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px; font-size: 18px; font-weight: 700;
    color: var(--white); border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .brand-icon { color: var(--red-600); font-size: 20px; }

.sidebar-nav { list-style: none; margin: 0; padding: 10px 0; }
.sidebar-nav li { margin: 0; }
.sidebar-nav a, .sidebar-nav .nav-group-toggle {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 20px; color: var(--gray-400); font-size: 13.5px;
    cursor: pointer; border-left: 3px solid transparent; transition: all 0.15s ease;
}
.sidebar-nav a:hover, .sidebar-nav .nav-group-toggle:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.sidebar-nav a.active { background: rgba(59,130,246,0.15); color: var(--blue-500); border-left-color: var(--blue-500); }
.sidebar-nav .nav-icon { width: 16px; text-align: center; }

.nav-submenu { list-style: none; margin: 0; padding: 0; background: rgba(0,0,0,0.15); max-height: 0; overflow: hidden; transition: max-height 0.2s ease; }
.nav-submenu.open { max-height: 500px; }
.nav-submenu a { padding: 9px 20px 9px 48px; font-size: 13px; }

.nav-divider { border-top: 1px solid rgba(255,255,255,0.08); margin: 10px 0; }
.nav-logout a { color: #f87171; }

.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    background: var(--white); padding: 14px 24px; display: flex; align-items: center;
    justify-content: space-between; border-bottom: 1px solid var(--gray-200);
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.topbar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-600); }

.kelas-badge-select {
    background: var(--blue-50); color: var(--blue-600); border: 1px solid var(--blue-500);
    padding: 6px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}

.content-area { padding: 24px; flex: 1; }

.page-header { margin-bottom: 18px; }
.page-header h1 { font-size: 19px; font-weight: 600; color: var(--gray-800); margin: 0 0 8px 0; display: flex; align-items: center; gap: 8px; }
.page-header hr { border: none; border-top: 2px solid var(--blue-600); width: 100%; margin-top: 8px; }
.page-subtext { color: var(--gray-600); font-size: 13px; margin-bottom: 14px; }

.panel { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-200); margin-bottom: 20px; }
.panel-header { padding: 14px 18px; border-bottom: 1px solid var(--gray-200); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-body { padding: 18px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 6px; }
.form-control { width: 100%; padding: 9px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 13.5px; color: var(--gray-800); background: var(--white); }
.form-control:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
textarea.form-control { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; border: none; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--blue-600); color: var(--white); }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: var(--green-600); color: var(--white); }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--amber-500); color: var(--white); }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--red-600); color: var(--white); }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--white); }
table.data-table thead th { background: var(--blue-600); color: var(--white); padding: 11px 12px; text-align: left; font-weight: 600; white-space: nowrap; }
table.data-table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
table.data-table tbody tr:hover { background: var(--gray-50); }
table.data-table input.cell-input, table.data-table select.cell-input { width: 100%; border: 1px solid var(--gray-200); border-radius: 4px; padding: 6px 8px; font-size: 12.5px; }

.text-center { text-align: center; }
.text-muted { color: var(--gray-400); }

.search-box { position: relative; margin-bottom: 16px; }
.search-box input { width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 13.5px; }
.search-box .search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--white); border-radius: var(--radius); max-width: 600px; width: 100%; max-height: 85vh; overflow-y: auto; }
.modal-box.modal-lg { max-width: 820px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; background: var(--white); }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-600); }
.modal-body { padding: 20px; }

.rapor-doc { font-size: 13px; line-height: 1.6; }
.rapor-doc h2, .rapor-doc h3 { text-align: center; margin: 4px 0; }
.rapor-doc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.rapor-doc table th, .rapor-doc table td { border: 1px solid #333; padding: 6px 8px; font-size: 12.5px; }
.rapor-doc .ttd-block { display: flex; justify-content: space-between; margin-top: 30px; }
.rapor-doc .ttd-block .ttd-item { text-align: center; width: 45%; }
.rapor-doc .signature-name { text-decoration: underline; font-weight: 600; }
.kop-rapor { text-align: center; margin-bottom: 16px; }
.kop-rapor img { width: 70px; height: 70px; margin-bottom: 8px; }

@media print { .no-print { display: none !important; } body { background: var(--white); } }
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar-toggle { display: block; }
}

.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: var(--blue-50); color: #1e40af; border: 1px solid #bfdbfe; }

/* === Dashboard Pengaturan & Data Sistem === */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 18px; text-align: center; }
.stat-card .stat-number { font-size: 28px; font-weight: 700; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-top: 14px; }
.guide-col h4 { font-size: 13.5px; margin-bottom: 8px; color: var(--blue-600); }
.guide-col ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--gray-600); }
.guide-col li { margin-bottom: 4px; }

/* === Master TP Modal checklist === */
.master-tp-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: var(--radius); }
.master-tp-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.master-tp-item input[type="checkbox"] { margin-top: 3px; }

/* === Dimensi P5 cards === */
.dimensi-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.dimensi-tab { padding: 8px 14px; border-radius: 20px; background: var(--gray-100); font-size: 12.5px; font-weight: 600; cursor: pointer; border: 1px solid var(--gray-200); }
.dimensi-tab.active { background: var(--blue-600); color: var(--white); border-color: var(--blue-600); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-sd { background: #dbeafe; color: #1e40af; }
.badge-smp { background: #fef3c7; color: #92400e; }
.badge-sma { background: #fce7f3; color: #9d174d; }
