/* ============================================================
   SPK BLT Dana Desa - Global Stylesheet
   Berisi: variabel CSS, layout utama, sidebar, navbar, utilitas
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --navbar-height: 60px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --bg-body: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active-bg: #2563eb;
    --sidebar-heading-color: #64748b;
    --card-radius: 12px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: #1e293b;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}

a { text-decoration: none; }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.25s ease;
    z-index: 1050;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.sidebar-brand { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid #334155; }
.sidebar-brand a { display: flex; align-items: center; gap: 0.75rem; color: #fff; font-weight: 700; font-size: 0.92rem; line-height: 1.3; }
.sidebar-logo { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,0.1); padding: 4px; flex-shrink: 0; }
.sidebar-brand-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-divider { border-top: 1px solid #334155; margin: 0; }

.sidebar-nav { list-style: none; padding: 0.75rem 0; margin: 0; flex: 1; }
.sidebar-heading { color: var(--sidebar-heading-color); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.75rem 1.25rem 0.25rem; }
.sidebar-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.25rem; color: var(--sidebar-text); transition: background 0.15s, color 0.15s; font-size: 0.875rem; }
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-item.active .sidebar-link { background: var(--sidebar-active-bg); color: #fff; font-weight: 600; border-right: 3px solid #60a5fa; }
.sidebar-link i { font-size: 1.05rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid #334155; }

.sidebar-dusun-badge {
    background: rgba(37,99,235,0.3);
    color: #93c5fd;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin: 0 1.25rem 0.5rem;
    display: inline-block;
    border: 1px solid rgba(96,165,250,0.3);
}

/* ============================================================
   Layout Main Content
   ============================================================ */
.main-content { margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left 0.25s ease; }
.main-navbar { height: var(--navbar-height); position: sticky; top: 0; z-index: 1040; border-bottom: 1px solid #e2e8f0; }
.content-area { padding: 1.5rem; flex: 1; }

body.sidebar-collapsed .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
body.sidebar-collapsed .main-content { margin-left: 0; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
    .main-content { margin-left: 0; }
    body.sidebar-open .sidebar { transform: translateX(0); }
}

/* ============================================================
   Cards
   ============================================================ */
.card { border-radius: var(--card-radius) !important; }
.stat-card .stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bg-primary-soft { background: rgba(37,99,235,0.12); }
.bg-success-soft { background: rgba(22,163,74,0.12); }
.bg-info-soft    { background: rgba(6,182,212,0.12); }
.bg-warning-soft { background: rgba(245,158,11,0.12); }

/* ============================================================
   Tables
   ============================================================ */
.table { font-size: 0.875rem; }
.table thead th { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: #475569; white-space: nowrap; }

/* ============================================================
   Buttons
   ============================================================ */
.btn-xs { padding: 0.2rem 0.55rem; font-size: 0.78rem; border-radius: 6px; line-height: 1.4; }

/* ============================================================
   Forms
   ============================================================ */
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(37,99,235,0.2); }

/* ============================================================
   Misc
   ============================================================ */
.badge { font-size: 0.73rem; font-weight: 600; }
.alert { border-radius: 10px; }
.main-footer { background: #fff; border-top: 1px solid #e2e8f0; }
.page-header { margin-bottom: 1.25rem; }

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

/* ============================================================
   Dusun Badge (Global)
   ============================================================ */

.dusun-badge {
    background: #f5f7fb !important;
    color: #2c3e50 !important;
    font-weight: 600;
    border-radius: 10px;
    font-size: 13px;
    letter-spacing: 0.2px;
    padding: 6px 14px;
    box-shadow: none;
    border: none !important;
    display: inline-block;
    white-space: nowrap;
}

/* ============================================================
   Global Badge Style
   Atribut • Tipe • Status • Dusun
   ============================================================ */

.table-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    height: 34px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    border: none !important;
    box-shadow: none !important;
    white-space: nowrap;
}

/* Cost */
.badge-cost {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

/* Benefit */
.badge-benefit {
    background: #dcfce7 !important;
    color: #16a34a !important;
}

/* Numerik */
.badge-numeric {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

/* Skala */
.badge-scale {
    background: #cffafe !important;
    color: #0891b2 !important;
}

/* Aktif */
.badge-active {
    background: #dcfce7 !important;
    color: #15803d !important;
}

/* Nonaktif */
.badge-inactive {
    background: #f1f5f9 !important;
    color: #64748b !important;
}
