/* public/css/style.css
   Desain mengikuti identitas smkmuh1jatinom.sch.id:
   navy #0a4d8c / #073b6b, latar #eff6fc, kartu putih rounded + bayangan lembut,
   tombol pill, aksen amber #f59e0b, font Inter. */

:root {
    --bg: #eff6fc;
    --bg-card: #ffffff;
    --fg: #1f2937;
    --fg-muted: #64748b;
    --border: #e3edf7;
    --primary: #0a4d8c;
    --primary-dark: #073b6b;
    --primary-deep: #073b6b;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;
    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3d9ef; border-radius: 3px; }

/* ===== Sidebar (navy seperti seksi gelap situs sekolah) ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #073b6b 0%, #0d5aa0 100%);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0.125rem 0.75rem;
    padding: 0.625rem 0.875rem;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    border-radius: 0.5rem;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Menu aktif: pill putih + teks navy (meniru tombol pill situs) */
.nav-item.active {
    background: #ffffff;
    color: var(--primary-dark);
    font-weight: 600;
}

.nav-item.active svg { color: var(--primary); }

/* Judul seksi menu: kicker amber kecil seperti situs */
.nav-section-title {
    padding: 0.75rem 1.5rem 0.375rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(252,211,77,0.85);
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    /* Penting di layar kecil: tanpa min-width:0, lebar minimum tabel
       memaksa halaman melebar dan muncul scroll horizontal */
    min-width: 0;
}

.top-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem;
}

/* Tombol hamburger: hanya tampil di layar kecil (lihat media query bawah).
   Dibuat otomatis oleh public/js/app.js di dalam .top-header. */
.menu-toggle { display: none; }

/* Latar gelap di belakang sidebar saat drawer terbuka di layar kecil.
   Elemen dibuat otomatis oleh public/js/app.js. */
.sidebar-backdrop { display: none; }

.main-content {
    padding: 1.25rem;
    max-width: 1600px;
}

/* ===== Kartu putih rounded + bayangan lembut ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    box-shadow: 0 1px 2px rgba(7,59,107,.05), 0 4px 14px rgba(7,59,107,.06);
    overflow: hidden;
}

.card-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-body { padding: 1rem; }

/* Tabel lebar di dalam kartu bisa digeser horizontal di layar sempit,
   supaya tidak merusak tata letak halaman di layar HP */
.card-body { overflow-x: auto; }

.card-footer {
    background: var(--bg);
}

/* ===== Tombol pill seperti situs sekolah ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.125rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

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

.btn-secondary { background: var(--bg-card); color: var(--primary-dark); border: 1px solid #c9def1; }
.btn-secondary:hover { background: var(--bg); }

.btn-accent { background: #2e86c1; color: white; }
.btn-accent:hover { background: #2470a5; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.75rem; }
.btn-icon { padding: 0.4rem; border-radius: 0.5rem; }

/* ===== Form ===== */
.form-group { margin-bottom: 0.875rem; }

.form-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--fg-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid #d6e4f3;
    border-radius: 0.5rem;
    background: var(--bg-card);
    color: var(--fg);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,134,193,.15);
}

/* ===== Tabel ===== */
.table { width: 100%; border-collapse: collapse; }

.table th {
    text-align: left;
    padding: 0.625rem 0.875rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 0.875rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--bg); }

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ===== Kartu statistik ===== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    box-shadow: 0 1px 2px rgba(7,59,107,.05), 0 4px 14px rgba(7,59,107,.06);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.125rem;
    color: var(--primary-dark);
}

.stat-label { font-size: 0.6875rem; color: var(--fg-muted); }

.progress-bar {
    height: 6px;
    border-radius: 3px;
    background: #dbe9f6;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
}

.search-box { position: relative; }
.search-box input { padding-left: 2.25rem; border-radius: 9999px; }
.search-box .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fg-muted);
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--fg-muted);
}

.qr-container {
    padding: 0.5rem;
    background: white;
    border-radius: 0.25rem;
    display: inline-block;
}

/* ===== Responsif =====
   Layar ≤1024px (tablet/HP): sidebar menjadi drawer off-canvas.
   Dibuka lewat tombol hamburger di header atas, ditutup lewat latar
gelap, tombol, atau setelah menekan salah satu menu.
   Tanpa animasi (langsung tampil/sembunyi) agar tetap ringan. */
@media (max-width: 1024px) {
    :root { --sidebar-width: 0px; }
    .main-wrapper { margin-left: 0; }

    .sidebar {
        width: 270px;
        max-width: 82vw;
        transform: translateX(-100%);
        box-shadow: 0 12px 32px rgba(7,59,107,.35);
    }

    body.sidebar-open .sidebar { transform: translateX(0); }

    /* Kunci scroll halaman saat drawer terbuka */
    body.sidebar-open { overflow: hidden; }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(7,59,107,.55);
        z-index: 90;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 0.625rem;
        border: 1px solid #c9def1;
        background: var(--bg-card);
        color: var(--primary-dark);
        cursor: pointer;
        flex-shrink: 0;
    }

    .menu-toggle:hover { background: var(--bg); }
}

/* Pengaman: bila jendela diperbesar saat drawer terbuka,
   hamburger & latar tetap tersembunyi di layar desktop */
@media (min-width: 1025px) {
    .menu-toggle, .sidebar-backdrop { display: none !important; }
}

@media (max-width: 640px) {
    .main-content { padding: 0.875rem; }
    .top-header { padding: 0.75rem 0.875rem; }
    .top-header h1 { font-size: 0.9375rem; }
    .card-header { flex-direction: column; align-items: stretch; }
}
