/* ============================================================
   assets/css/style.css — Stok Kintakun v2 (gaya UI stokis lama)
   ============================================================ */

:root {
    --nb-h: 56px;
    --sb-w: 235px;
    --primary: #2563eb;
    --primary-d: #1d4ed8;
    --sb-bg: #0f172a;
    --border: #e2e8f0;
    --surface: #fff;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.12), 0 4px 6px -2px rgba(0,0,0,.05);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: .9rem;
    background: #f1f5f9;
    color: #0f172a;
}
a { text-decoration: none; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── NAVBAR ── */
#appNavbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--nb-h);
    background: var(--sb-bg);
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center;
    padding: 0 1rem; gap: .75rem;
    z-index: 1040;
}
.brand-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
}
.navbar-brand-text { color: #f1f5f9; font-weight: 700; font-size: .95rem; letter-spacing: -.01em; white-space: nowrap; }
.nav-action-btn {
    background: rgba(255,255,255,.07); border: none; border-radius: 8px;
    color: #94a3b8; padding: .35rem .55rem; cursor: pointer; font-size: .9rem;
    display: inline-flex; align-items: center; gap: .3rem;
    transition: background .15s, color .15s;
}
.nav-action-btn:hover { background: rgba(255,255,255,.12); color: #e2e8f0; }
.nav-action-btn.danger { color: #f87171; background: rgba(248,113,113,.1); }
.nav-action-btn.danger:hover { background: rgba(248,113,113,.2); }
#navClock { color: #64748b; font-size: .78rem; white-space: nowrap; }
.nav-user {
    display: inline-flex; align-items: center; gap: .45rem;
    color: #cbd5e1; font-size: .78rem;
    background: rgba(255,255,255,.05);
    padding: .3rem .6rem; border-radius: 8px;
}
.nav-user .role-badge {
    font-size: .62rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; padding: .15em .5em; border-radius: 5px;
}
.role-admin { background: rgba(250,204,21,.15); color: #facc15; }
.role-staf  { background: rgba(148,163,184,.15); color: #cbd5e1; }

/* ── LAYOUT SHELL ── */
#appShell { display: flex; padding-top: var(--nb-h); min-height: 100vh; }

/* ── SIDEBAR ── */
#sidebar {
    width: var(--sb-w); flex-shrink: 0;
    background: var(--sb-bg);
    border-right: 1px solid rgba(255,255,255,.05);
    position: sticky;
    top: var(--nb-h);
    height: calc(100vh - var(--nb-h));
    overflow-y: auto;
    padding: .75rem 0 2rem;
}
.sb-section {
    padding: .7rem .875rem .2rem;
    font-size: .65rem; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    color: #334155;
}
#sidebar .nav-link {
    display: flex; align-items: center; gap: .55rem;
    padding: .45rem .875rem;
    margin: 1px .5rem;
    border-radius: 7px;
    color: #94a3b8;
    font-size: .825rem; font-weight: 500;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
#sidebar .nav-link i { font-size: .95rem; flex-shrink: 0; width: 16px; text-align: center; }
#sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #cbd5e1; }
#sidebar .nav-link.active { background: rgba(59,130,246,.2); color: #93c5fd; font-weight: 600; }

/* ── MAIN ── */
#mainContent { flex: 1; min-width: 0; padding: 1.5rem; background: #f1f5f9; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem; }
.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; color: #0f172a; }
.page-title i { color: var(--primary); }

/* ── CARDS ── */
.card { background: var(--surface); border: 1px solid var(--border) !important; border-radius: var(--radius) !important; box-shadow: var(--shadow); }
.card-header { background: transparent !important; border-bottom: 1px solid var(--border); padding: .875rem 1.25rem .75rem; font-weight: 600; font-size: .875rem; }
.card-body { padding: 1.25rem; }
.card-footer { background: #f8fafc !important; border-top: 1px solid var(--border); }

/* ── STAT CARDS ── */
.stat-card { transition: transform .2s, box-shadow .2s; overflow: hidden; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg) !important; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 1.2rem;
}
.stat-label { font-size: .75rem; color: #64748b; font-weight: 500; }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; color: #0f172a; }
.stat-badge { font-size: .72rem; color: #64748b; margin-top: .2rem; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-icon.cyan   { background: #cffafe; color: #0891b2; }

/* ── TABLES ── */
.table { font-size: .84rem; margin-bottom: 0; }
.table th {
    font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: #64748b; background: #f8fafc;
    border-bottom: 2px solid var(--border) !important;
    white-space: nowrap; padding: .7rem 1rem;
}
.table td { padding: .7rem 1rem; vertical-align: middle; border-color: var(--border); }
.table tbody tr:hover td { background: #f8fafc; }
.table tfoot td { padding: .7rem 1rem; }

/* ── BADGES ── */
.badge { font-weight: 600; font-size: .7rem; padding: .28em .6em; border-radius: 6px; }
.badge-masuk    { background: #dcfce7; color: #15803d; }
.badge-keluar   { background: #fee2e2; color: #b91c1c; }
.badge-aman     { background: #dcfce7; color: #15803d; }
.badge-minim    { background: #fee2e2; color: #b91c1c; }
.badge-telegram { background: #e0f2fe; color: #0369a1; }
.badge-web      { background: #f1f5f9; color: #475569; }
.badge-kategori { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }

/* ── BUTTONS ── */
.btn { border-radius: 8px; font-weight: 600; font-size: .84rem; padding: .45rem .9rem; }
.btn-sm { padding: .3rem .65rem; font-size: .78rem; border-radius: 6px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-d); border-color: var(--primary-d); }
.btn-success { background: #16a34a; border-color: #16a34a; }
.btn-success:hover { background: #15803d; border-color: #15803d; }
.btn-danger { background: #dc2626; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ── FORMS ── */
.form-control, .form-select {
    border-radius: 8px; border-color: var(--border);
    font-size: .875rem; padding: .5rem .875rem;
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-label { font-weight: 600; font-size: .8rem; color: #374151; margin-bottom: .3rem; }
.input-group-text { border-color: var(--border); background: #f8fafc; border-radius: 8px 0 0 8px; }
.form-text { font-size: .74rem; color: #64748b; }

/* ── ALERTS ── */
.alert { border-radius: var(--radius); border: none; font-size: .875rem; }
.alert-success { background: #f0fdf4; color: #15803d; border-left: 4px solid #16a34a; }
.alert-danger  { background: #fff1f2; color: #be123c; border-left: 4px solid #e11d48; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #d97706; }
.alert-info    { background: #f0f9ff; color: #075985; border-left: 4px solid #0ea5e9; }

/* ── CODE ── */
code { background: #f1f5f9; color: var(--primary); padding: .15em .4em; border-radius: 5px; font-size: .82em; }

/* ── TABEL SCROLL PANJANG ── */
.table-scroll {
    max-height: 520px;
    overflow-y: auto;
    overflow-x: auto;
}
.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
}

/* ── AUTOCOMPLETE ── */
#hasilCari { width: 100%; }

/* ── MOBILE OVERLAY ── */
#sbOverlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1035; }
#sbOverlay.show { display: block; }

/* ── MOBILE ── */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: calc(-1 * var(--sb-w));
        top: var(--nb-h);
        z-index: 1036;
        height: calc(100vh - var(--nb-h));
        transition: left .25s cubic-bezier(.4,0,.2,1);
        box-shadow: none;
    }
    #sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.4); }
    #mainContent { padding: 1rem; }
}

/* ── LOGIN ── */
.login-wrapper {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1d4ed8 130%);
    padding: 1rem;
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 2.25rem;
}
.login-logo {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem; color: #fff;
}
.login-title { text-align: center; font-weight: 700; font-size: 1.15rem; color: #0f172a; margin-bottom: .25rem; }
.login-sub { text-align: center; font-size: .8rem; color: #64748b; margin-bottom: 1.5rem; }

/* ── PRINT ── */
@media print {
    #appNavbar, #sidebar, #sbOverlay, .btn, form, .alert, .page-header .btn { display: none !important; }
    #appShell { padding-top: 0; }
    #mainContent { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd !important; }
    body { background: #fff; }
}
