/* =========================================================
   Buku Kerja Guru - gaya antarmuka
   ========================================================= */
:root {
    --bkg-primary: #1f4e79;
    --bkg-primary-2: #2e75b6;
    --bkg-sidebar: #12304d;
    --bkg-sidebar-text: #c9d6e3;
    --bkg-bg: #f3f6f9;
    --bkg-sidebar-w: 268px;
    --bs-primary: #1f4e79;
    --bs-primary-rgb: 31, 78, 121;
    --bs-link-color: #1f4e79;
    --bs-link-color-rgb: 31, 78, 121;
}

body {
    background: var(--bkg-bg);
    font-size: .935rem;
}

.btn-primary {
    --bs-btn-bg: var(--bkg-primary);
    --bs-btn-border-color: var(--bkg-primary);
    --bs-btn-hover-bg: #183f62;
    --bs-btn-hover-border-color: #183f62;
    --bs-btn-active-bg: #143552;
}
.btn-outline-primary {
    --bs-btn-color: var(--bkg-primary);
    --bs-btn-border-color: var(--bkg-primary);
    --bs-btn-hover-bg: var(--bkg-primary);
    --bs-btn-hover-border-color: var(--bkg-primary);
}
.text-primary { color: var(--bkg-primary-2) !important; }

/* ---------- Kerangka ---------- */
.app-wrap { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--bkg-sidebar-w);
    background: var(--bkg-sidebar) !important;
    color: var(--bkg-sidebar-text);
    display: flex;
    flex-direction: column;
}
@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        flex-shrink: 0;
    }
}
.sidebar-brand {
    display: flex; align-items: center; gap: .75rem;
    padding: 1rem 1.1rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand > .bi { font-size: 1.7rem; color: #7fb8ec; }
.sidebar-brand small { color: var(--bkg-sidebar-text); font-size: .75rem; }

.sidebar-nav { overflow-y: auto; flex: 1; padding: .5rem 0 1rem; }
.sidebar-group, .sidebar-link {
    display: flex; align-items: center; gap: .65rem;
    width: 100%;
    padding: .5rem 1.1rem;
    color: var(--bkg-sidebar-text);
    text-decoration: none;
    background: none; border: 0; text-align: left;
    font-size: .9rem;
}
.sidebar-group { font-weight: 600; color: #fff; margin-top: .35rem; }
.sidebar-group .chev { transition: transform .2s; font-size: .75rem; }
.sidebar-group.collapsed .chev { transform: rotate(-90deg); }
.sidebar-link.sub { padding-left: 2.1rem; font-size: .86rem; }
.sidebar-link:hover, .sidebar-group:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-link.active {
    color: #fff;
    background: rgba(127,184,236,.18);
    box-shadow: inset 3px 0 0 #7fb8ec;
}
.sidebar-link .badge { font-size: .65rem; font-weight: 500; opacity: .75; }
.sidebar-foot { font-size: .72rem; padding: .6rem 1.1rem; color: #7d93a8; border-top: 1px solid rgba(255,255,255,.08); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e3e8ee;
}
.ctx-form { display: flex; align-items: center; gap: .4rem; }
.ctx-form .form-select { width: auto; max-width: 160px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.avatar-initial {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bkg-primary); color: #fff; font-weight: 600;
}

.app-content { padding: 1.25rem; flex: 1; }
@media (min-width: 768px) { .app-content { padding: 1.75rem; } }
.app-footer { padding: .75rem 1.75rem; font-size: .75rem; color: #7b8794; }

/* ---------- Komponen ---------- */
.page-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: 1.25rem;
}
.page-head .breadcrumb { margin-bottom: .2rem; font-size: .8rem; }

.card { border: 1px solid #e3e8ee; border-radius: .6rem; }
.card-header { background: #fff; border-bottom-color: #e9edf2; padding: .8rem 1rem; }

.stat-card {
    display: block; height: 100%;
    background: #fff; border: 1px solid #e3e8ee; border-radius: .6rem;
    padding: .9rem 1rem; text-decoration: none; color: inherit;
    transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: 0 .25rem .75rem rgba(18,48,77,.08); transform: translateY(-1px); }
.stat-card .bi { font-size: 1.3rem; color: var(--bkg-primary-2); }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-top: .25rem; }
.stat-label { font-size: .78rem; color: #6c757d; }

.jam-badge {
    min-width: 58px; text-align: center;
    background: #eef4fa; color: var(--bkg-primary);
    border-radius: .5rem; padding: .3rem .4rem; line-height: 1.15;
}
.doc-progress { display: block; color: inherit; text-decoration: none; margin-bottom: .65rem; }
.doc-progress:hover span:first-child { color: var(--bkg-primary-2); text-decoration: underline; }

.img-thumb {
    max-width: 160px; max-height: 160px; object-fit: contain;
    border: 1px dashed #c8d1db; border-radius: .5rem; padding: .35rem; background: #fff;
}
.img-ttd { background: repeating-conic-gradient(#f1f3f5 0% 25%, #fff 0% 50%) 50% / 16px 16px; }

.table > :not(caption) > * > * { vertical-align: middle; }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; color: #52606d; background: #f6f8fa; }
.table-actions { white-space: nowrap; width: 1%; }

.form-label { font-weight: 500; font-size: .875rem; }
.form-text { font-size: .78rem; }
.required::after { content: ' *'; color: #dc3545; }

.drag-handle { cursor: grab; width: 28px; }
.drag-handle:active { cursor: grabbing; }
.atp-table td { font-size: .85rem; }
.note-editor.note-frame { border-color: #dee2e6; }
.note-editor .note-editable { background: #fff; }
.rubrik-table textarea { min-width: 160px; font-size: .82rem; }
.modul-tabs .nav-link { font-size: .88rem; }
.prinsip-badge { font-size: .7rem; }
.rte-content img { max-width: 100%; height: auto; }
.rte-content table { border-collapse: collapse; }
.rte-content td, .rte-content th { border: 1px solid #adb5bd; padding: 2px 6px; }
.metode-card { cursor: pointer; }
.btn-check:checked + .metode-card { border-color: var(--bkg-primary-2); box-shadow: 0 0 0 .2rem rgba(46,117,182,.2); }

.hari-check.form-check-input:checked + .btn { background: var(--bkg-primary); color: #fff; }

/* ---------- Kalender ---------- */
.kal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; }
.kal-bulan { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: .78rem; text-align: center; }
.kal-bulan caption { caption-side: top; text-align: center; font-weight: 600; color: #12304d; padding: 0 0 .25rem; }
.kal-bulan th { color: #6c757d; font-weight: 500; }
.kal-bulan td { border-radius: 4px; padding: 3px 0; }
.kal-bulan .libur-pekan { color: #dc3545; background: #f6f7f9; }
.kal-bulan .tdk-efektif { color: #fff; font-weight: 600; }
.kal-bulan td[title] { cursor: help; }
.legend-box { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.libur-pekan-box { background: #f6f7f9; border: 1px solid #dc3545; }

/* ---------- Promes ---------- */
.promes-wrap { overflow: auto; max-height: 75vh; }
.promes { font-size: .78rem; border-collapse: separate; border-spacing: 0; }
.promes th, .promes td { border: 1px solid #dee2e6; padding: 2px 3px; text-align: center; white-space: nowrap; background: #fff; }
.promes thead th { position: sticky; top: 0; z-index: 2; background: #f6f8fa; }
.promes thead tr:nth-child(2) th { top: 26px; }
.promes .col-tp { position: sticky; left: 0; z-index: 1; text-align: left; white-space: normal; min-width: 240px; max-width: 320px; }
.promes thead .col-tp { z-index: 3; }
.promes input { width: 34px; border: 0; text-align: center; background: transparent; font-size: .8rem; padding: 0; }
.promes input:focus { outline: 2px solid var(--bkg-primary-2); background: #fff; }
.promes td.arsir { background: repeating-linear-gradient(45deg, #f1f3f5, #f1f3f5 4px, #dee2e6 4px, #dee2e6 8px); }
.promes td.terisi { background: #e7f1fb; font-weight: 600; }
.promes td.lebih { background: #f8d7da !important; }
.arsir-box { background: repeating-linear-gradient(45deg, #f1f3f5, #f1f3f5 3px, #adb5bd 3px, #adb5bd 5px); border: 1px solid #ced4da; }

/* ---------- Jadwal ---------- */
.jadwal-grid select { min-width: 120px; font-size: .78rem; }
.jadwal-grid td, .jadwal-grid th { vertical-align: middle; }

/* ---------- Presensi cepat ---------- */
.presensi-row .btn { width: 38px; padding: .2rem 0; font-weight: 600; }
.btn-check:checked + .btn-hadir-H { background: #198754; color: #fff; border-color: #198754; }
.btn-check:checked + .btn-hadir-S { background: #0dcaf0; color: #000; border-color: #0dcaf0; }
.btn-check:checked + .btn-hadir-I { background: #ffc107; color: #000; border-color: #ffc107; }
.btn-check:checked + .btn-hadir-A { background: #dc3545; color: #fff; border-color: #dc3545; }

/* ---------- Login ---------- */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #12304d 0%, #1f4e79 55%, #2e75b6 100%);
}
.auth-card { width: 100%; max-width: 420px; border: 0; border-radius: 1rem; }
.auth-logo { max-height: 84px; }

/* ---------- Cetak dasar ---------- */
@media print {
    .app-sidebar, .app-topbar, .app-footer, .no-print, .btn { display: none !important; }
    .app-content { padding: 0; }
    body { background: #fff; }
}
