/* =============================================
   TEMA: HIJAU TUA + EMAS — BIJAKSANA & ELEGAN
   ============================================= */
:root {
    --kd-primary: #1B5E3B;
    --kd-primary-light: #247A4E;
    --kd-primary-dark: #0F3D26;
    --kd-gold: #C8A84E;
    --kd-gold-light: #E0C872;
    --kd-sidebar: #0B1A10;
    --kd-sidebar-hover: #163520;
    --kd-sidebar-active: #1B5E3B;
    --kd-bg: #F4F1EB;
    --kd-card: #FFFFFF;
    --kd-text: #1A1A1A;
    --kd-text-muted: #6B7280;
    --kd-border: #E2DDD5;
    --kd-danger: #C0392B;
    --kd-success: #1B8A4E;
    --kd-warning: #D4920A;
    --kd-info: #2471A3;
    --kd-radius: 12px;
    --kd-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --kd-shadow-lg: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--kd-bg);
    color: var(--kd-text);
    margin: 0;
    min-height: 100vh;
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0B1A10 0%, #1B5E3B 50%, #0F3D26 100%);
    position: relative;
    overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(200,168,78,0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(27,94,59,0.15) 0%, transparent 40%);
    animation: loginBgFloat 20s ease-in-out infinite;
}
@keyframes loginBgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(20px, -20px) rotate(2deg); }
}
.login-card {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255,255,255,0.2);
}
.login-card .login-logo {
    width: 64px;
    height: 64px;
    background: var(--kd-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px rgba(27,94,59,0.3);
}
.login-card .login-logo i { color: var(--kd-gold); font-size: 28px; }
.login-card h2 {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--kd-primary-dark);
    margin-bottom: 4px;
}
.login-card p.subtitle {
    color: var(--kd-text-muted);
    font-size: 0.875rem;
    margin-bottom: 28px;
}
.form-control.kd-input {
    border: 1.5px solid var(--kd-border);
    border-radius: 10px;
    padding: 11px 14px 11px 42px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: #FAFAF7;
}
.form-control.kd-input:focus {
    border-color: var(--kd-primary);
    box-shadow: 0 0 0 3px rgba(27,94,59,0.12);
    background: #fff;
}
.input-icon-wrapper {
    position: relative;
}
.input-icon-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--kd-text-muted);
    font-size: 16px;
}
.btn-kd-primary {
    background: var(--kd-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s;
    width: 100%;
}
.btn-kd-primary:hover {
    background: var(--kd-primary-light);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(27,94,59,0.3);
}

/* =============================================
   SIDEBAR
   ============================================= */
.kd-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--kd-sidebar);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(255,255,255,0.05);
}
.kd-sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.kd-sidebar-brand .brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.kd-sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: var(--kd-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kd-sidebar-brand .brand-icon i { color: var(--kd-gold); font-size: 20px; }
.kd-sidebar-brand .brand-text h5 {
    color: #F0EBE0;
    font-weight: 800;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.2;
}
.kd-sidebar-brand .brand-text small {
    color: rgba(200,168,78,0.7);
    font-size: 0.7rem;
    font-weight: 500;
}
.kd-sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.kd-sidebar-nav .nav-label {
    color: rgba(240,235,224,0.3);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 12px 6px;
}
.kd-sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: rgba(240,235,224,0.6);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
}
.kd-sidebar-nav .nav-link i {
    font-size: 17px;
    width: 22px;
    text-align: center;
}
.kd-sidebar-nav .nav-link:hover {
    background: var(--kd-sidebar-hover);
    color: rgba(240,235,224,0.9);
}
.kd-sidebar-nav .nav-link.active {
    background: var(--kd-sidebar-active);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(27,94,59,0.3);
}
.kd-sidebar-nav .nav-link.active i { color: var(--kd-gold); }
.kd-sidebar-user {
    padding: 16px 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.kd-sidebar-user .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.kd-sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    background: var(--kd-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--kd-gold);
    font-weight: 800;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.kd-sidebar-user .user-name {
    color: #F0EBE0;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
}
.kd-sidebar-user .user-role {
    color: rgba(200,168,78,0.7);
    font-size: 0.7rem;
}
.btn-logout-sidebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(192,57,43,0.15);
    color: #E74C3C;
    border: 1px solid rgba(192,57,43,0.2);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-decoration: none;
}
.btn-logout-sidebar:hover {
    background: rgba(192,57,43,0.25);
    color: #E74C3C;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.kd-main {
    margin-left: 260px;
    padding: 28px 32px 40px;
    min-height: 100vh;
}
.kd-page-header {
    margin-bottom: 28px;
}
.kd-page-header h3 {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--kd-primary-dark);
    margin: 0 0 4px;
}
.kd-page-header p {
    color: var(--kd-text-muted);
    font-size: 0.85rem;
    margin: 0;
}
.kd-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--kd-text-muted);
    margin-bottom: 6px;
}
.kd-breadcrumb a { color: var(--kd-primary); text-decoration: none; }
.kd-breadcrumb a:hover { text-decoration: underline; }

/* =============================================
   CARDS
   ============================================= */
.kd-card {
    background: var(--kd-card);
    border: 1px solid var(--kd-border);
    border-radius: var(--kd-radius);
    box-shadow: var(--kd-shadow);
    overflow: hidden;
}
.kd-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--kd-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.kd-card-header h6 {
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0;
    color: var(--kd-text);
}
.kd-card-body { padding: 22px; }

/* Stat cards */
.stat-card {
    background: var(--kd-card);
    border: 1px solid var(--kd-border);
    border-radius: var(--kd-radius);
    padding: 22px;
    box-shadow: var(--kd-shadow);
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--kd-shadow-lg);
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 0 0 0 80px;
    opacity: 0.07;
}
.stat-card.stat-penduduk::after { background: var(--kd-primary); }
.stat-card.stat-miskin::after { background: var(--kd-warning); }
.stat-card.stat-kematian::after { background: var(--kd-danger); }
.stat-card.stat-zakat::after { background: var(--kd-info); }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}
.stat-icon.si-penduduk { background: rgba(27,94,59,0.1); color: var(--kd-primary); }
.stat-icon.si-miskin { background: rgba(212,146,10,0.1); color: var(--kd-warning); }
.stat-icon.si-kematian { background: rgba(192,57,43,0.1); color: var(--kd-danger); }
.stat-icon.si-zakat { background: rgba(36,113,163,0.1); color: var(--kd-info); }
.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--kd-text);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--kd-text-muted);
    font-weight: 500;
}

/* =============================================
   TABLES
   ============================================= */
.kd-table {
    width: 100%;
    font-size: 0.85rem;
    margin: 0;
}
.kd-table thead th {
    background: #F8F6F1;
    color: var(--kd-text);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--kd-border);
    white-space: nowrap;
}
.kd-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #F0EDE6;
    vertical-align: middle;
    color: #374151;
}
.kd-table tbody tr:hover { background: #FDFCFA; }
.kd-table tbody tr:last-child td { border-bottom: none; }

/* =============================================
   BUTTONS
   ============================================= */
.btn-kd {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.btn-kd-sm { padding: 5px 10px; font-size: 0.76rem; border-radius: 7px; }
.btn-kd-add {
    background: var(--kd-primary);
    color: #fff;
}
.btn-kd-add:hover { background: var(--kd-primary-light); color: #fff; transform: translateY(-1px); box-shadow: 0 3px 10px rgba(27,94,59,0.25); }
.btn-kd-edit {
    background: rgba(36,113,163,0.1);
    color: var(--kd-info);
}
.btn-kd-edit:hover { background: rgba(36,113,163,0.2); color: var(--kd-info); }
.btn-kd-delete {
    background: rgba(192,57,43,0.1);
    color: var(--kd-danger);
}
.btn-kd-delete:hover { background: rgba(192,57,43,0.2); color: var(--kd-danger); }
.btn-kd-gold {
    background: linear-gradient(135deg, var(--kd-gold), var(--kd-gold-light));
    color: #1a1a1a;
}
.btn-kd-gold:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(200,168,78,0.3); color: #1a1a1a; }

/* =============================================
   MODALS
   ============================================= */
.modal-content.kd-modal {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    overflow: hidden;
}
.modal-header.kd-modal-header {
    background: var(--kd-primary-dark);
    border: none;
    padding: 18px 24px;
}
.modal-header.kd-modal-header .modal-title {
    color: #F0EBE0;
    font-weight: 700;
    font-size: 1rem;
}
.modal-header.kd-modal-header .btn-close { filter: brightness(0) invert(1); opacity: 0.7; }
.modal-body.kd-modal-body { padding: 24px; }
.modal-footer.kd-modal-footer {
    border-top: 1px solid var(--kd-border);
    padding: 16px 24px;
}

/* Form di modal */
.kd-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}
.kd-form-control {
    border: 1.5px solid var(--kd-border);
    border-radius: 8px;
    padding: 9px 13px;
    font-size: 0.85rem;
    transition: all 0.2s;
    background: #FAFAF7;
    width: 100%;
}
.kd-form-control:focus {
    border-color: var(--kd-primary);
    box-shadow: 0 0 0 3px rgba(27,94,59,0.1);
    background: #fff;
    outline: none;
}
select.kd-form-control { cursor: pointer; }

/* =============================================
   SEARCH BAR
   ============================================= */
.kd-search {
    position: relative;
    max-width: 280px;
}
.kd-search input {
    border: 1.5px solid var(--kd-border);
    border-radius: 8px;
    padding: 8px 13px 8px 36px;
    font-size: 0.82rem;
    width: 100%;
    transition: all 0.2s;
    background: #FAFAF7;
}
.kd-search input:focus {
    border-color: var(--kd-primary);
    box-shadow: 0 0 0 3px rgba(27,94,59,0.1);
    background: #fff;
    outline: none;
}
.kd-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--kd-text-muted);
    font-size: 14px;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.kd-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--kd-text-muted);
}
.kd-empty i { font-size: 48px; opacity: 0.3; margin-bottom: 12px; }
.kd-empty p { font-size: 0.9rem; margin: 0; }

/* =============================================
   PAGINATION (simple)
   ============================================= */
.kd-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding-top: 16px;
}
.kd-pagination .page-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--kd-border);
    background: var(--kd-card);
    color: var(--kd-text);
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.kd-pagination .page-btn:hover { border-color: var(--kd-primary); color: var(--kd-primary); }
.kd-pagination .page-btn.active {
    background: var(--kd-primary);
    border-color: var(--kd-primary);
    color: #fff;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 991.98px) {
    .kd-sidebar { transform: translateX(-100%); }
    .kd-sidebar.show { transform: translateX(0); }
    .kd-main { margin-left: 0; padding: 20px 16px 32px; }
    .kd-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
    }
    .kd-sidebar-overlay.show { display: block; }
}

/* =============================================
   ANIMASI
   ============================================= */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in {
    animation: fadeInUp 0.4s ease forwards;
}
.animate-in-delay-1 { animation-delay: 0.05s; opacity: 0; }
.animate-in-delay-2 { animation-delay: 0.1s; opacity: 0; }
.animate-in-delay-3 { animation-delay: 0.15s; opacity: 0; }
.animate-in-delay-4 { animation-delay: 0.2s; opacity: 0; }

/* Scrollbar */
.kd-sidebar-nav::-webkit-scrollbar { width: 4px; }
.kd-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.kd-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Toast fix */
.toast-container { z-index: 9999 !important; }