/* ========================================= */
/* 1. FONT & GLOBAL RESET                    */
/* ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

h1, h2, h3, h4, h5, h6, .brand-text, .tagline { 
    font-family: 'Poppins', sans-serif; 
}

body {
    background-color: #f1f5f9; 
    color: #1e293b;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================= */
/* 2. SCROLLBAR PREMIUM (HALUS & MEMBULAT)   */
/* ========================================= */
/* Scrollbar Global (Body, Modal, Table) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    border: 2px solid #f1f5f9; /* Efek padding agar tidak kaku menempel di tepi */
}
::-webkit-scrollbar-thumb:hover {
    background: #10B981;
}

/* PENGECUALIAN: Scrollbar Sidebar (Tetap pakai desain asli Anda) */
.sidebar-menu::-webkit-scrollbar { width: 5px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb { 
    background: rgba(255, 255, 255, 0.15); 
    border: none;
    border-radius: 10px; 
}
.sidebar-menu::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }


/* ========================================= */
/* 3. HALAMAN LOGIN (AUTHENTICATION)         */
/* ========================================= */
body.login-page {
    height: 100vh;
    overflow: hidden; /* Kunci agar tidak bisa discroll di laptop */
    display: flex;
    flex-direction: row;
    background-color: #ffffff;
}

.brand-section {
    flex: 6;
    height: 100vh;
    background: linear-gradient(135deg, #022C22 0%, #064E3B 50%, #10B981 100%);
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    position: relative;
    color: white;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.glass-ornament {
    position: absolute;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    z-index: 1;
}
.ornament-1 { width: 600px; height: 600px; top: -200px; left: -200px; }
.ornament-2 { width: 400px; height: 400px; bottom: -100px; right: -100px; }

.brand-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; max-width: 85%; }
.brand-content img.logo { width: 220px; margin-bottom: 35px; filter: drop-shadow(0 0 15px rgba(255,255,255,0.2)); }
.tagline { padding: 8px 24px; background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 50px; font-size: 0.8rem; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 25px; backdrop-filter: blur(5px); }
.brand-content h1 { font-size: 3rem; font-weight: 700; line-height: 1.2; margin-bottom: 15px; }
.brand-content p.vision { font-size: 1rem; font-weight: 500; letter-spacing: 2px; color: #A7F3D0; margin-bottom: 20px;}
.brand-content p.desc { font-size: 0.95rem; opacity: 0.9; font-weight: 300; line-height: 1.7; }

.login-section { 
    flex: 4; 
    height: 100vh;
    background-color: #ffffff; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    padding: 0 8%; 
    position: relative; 
    box-shadow: -15px 0 30px rgba(0,0,0,0.05); 
    z-index: 5; 
    overflow-y: auto; /* Antisipasi jika layar laptopnya pendek */
}
.form-wrapper { width: 100%; max-width: 420px; margin: 0 auto; animation: slideLeft 0.8s ease-out; }

@keyframes slideLeft {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.login-header { margin-bottom: 40px; text-align: left; }
.login-header h2 { color: #064E3B; font-size: 2.2rem; font-weight: 700; margin-bottom: 8px; }
.login-header p { color: #6b7280; font-size: 1rem; }

.input-group { position: relative; margin-bottom: 28px; }
.input-group input { width: 100%; padding: 20px 50px 10px 50px; font-size: 1.05rem; color: #111827; background-color: #f9fafb; border: none; border-bottom: 2px solid #e5e7eb; border-radius: 8px 8px 0 0; outline: none; transition: all 0.3s ease; }
.input-group .icon-decor { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 1.2rem; transition: all 0.3s ease; }
.input-group label { position: absolute; top: 50%; left: 50px; transform: translateY(-50%); color: #9ca3af; font-size: 1rem; pointer-events: none; transition: all 0.3s ease; }

.input-group input:hover { background-color: #f3f4f6; }
.input-group input:focus { background-color: #ECFDF5; border-bottom-color: #059669; }
.input-group input:focus ~ label, .input-group input:valid ~ label { top: 12px; font-size: 0.75rem; color: #059669; font-weight: 600; }
.input-group input:focus ~ .icon-decor, .input-group input:valid ~ .icon-decor { color: #059669; }
.toggle-password { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #9ca3af; transition: 0.3s; display: flex; }
.toggle-password:hover { color: #059669; }

.btn-login { width: 100%; padding: 18px; background: #059669; color: white; border: none; border-radius: 12px; font-size: 1.1rem; font-weight: 600; cursor: pointer; box-shadow: 0 8px 15px rgba(5, 150, 105, 0.2); transition: all 0.3s ease; margin-top: 10px; }
.btn-login:hover { background: #047857; transform: translateY(-2px); box-shadow: 0 12px 20px rgba(5, 150, 105, 0.3); }

.alert { background-color: #fef2f2; color: #b91c1c; padding: 15px 20px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 25px; border-left: 4px solid #ef4444; display: flex; align-items: center; }

/* ============================================== */
/* RESPONSIVE LAYAR HP (Bentuk seperti Gambar 3)  */
/* ============================================== */
@media (max-width: 900px) {
    body.login-page {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-y: auto; /* Izinkan scroll vertikal di HP */
        background-color: #f1f5f9;
    }

    .brand-section {
        flex: none;
        height: auto;
        min-height: 50vh; /* Setengah layar atas */
        padding: 40px 20px 80px 20px; /* Padding bawah ekstra untuk ditarik form putih */
        justify-content: center;
    }
    
    .brand-content img.logo { width: 150px; margin-bottom: 20px; }
    .brand-content h1 { font-size: 2rem; margin-bottom: 10px;}
    .tagline { margin-bottom: 15px; }
    .brand-content p.desc { display: none; } /* Sembunyikan deskripsi panjang di HP agar rapi */

    .login-section {
        flex: none;
        height: auto;
        padding: 40px 25px;
        background-color: #ffffff;
        box-shadow: 0 -10px 25px rgba(0,0,0,0.1);
        border-radius: 35px 35px 0 0; /* Lengkungan mulus di bagian atas */
        margin-top: -60px; /* EFEK OVERLAP: Menarik form putih ke atas menindih hijau */
        z-index: 10;
        min-height: 55vh; /* Menutup area bawah */
    }
}
/* ========================================= */
/* 4. LAYOUT UTAMA (SIDEBAR & TOPBAR)        */
/* ========================================= */
.sidebar { width: 280px; background-color: #021f18; color: white; height: 100vh; position: fixed; top: 0; left: 0; display: flex; flex-direction: column; box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08); z-index: 100; transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.sidebar-brand { padding: 25px 30px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.sidebar-brand h2 { font-size: 1.5rem; font-weight: 700; color: #ffffff; letter-spacing: 0.5px; }
.sidebar-brand h2 span { color: #10B981; }
.sidebar-brand p { font-size: 0.8rem; color: #94a3b8; margin-top: 5px; font-weight: 400; }
.sidebar-menu { flex: 1; overflow-y: auto; padding: 20px 0; }
.menu-category { padding: 15px 30px 10px; font-size: 0.7rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 1.5px; }
.menu-item { display: flex; align-items: center; padding: 12px 30px; color: #cbd5e1; text-decoration: none; font-size: 0.95rem; font-weight: 500; border-left: 4px solid transparent; transition: all 0.3s ease; }
.menu-item i { width: 25px; font-size: 1.1rem; margin-right: 12px; color: #64748b; transition: all 0.3s ease; }
.menu-item:hover, .menu-item.active { background: rgba(16, 185, 129, 0.1); color: #ffffff; border-left-color: #10B981; }
.menu-item:hover i, .menu-item.active i { color: #10B981; }
.sidebar-footer { padding: 20px 25px; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.btn-logout { display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(239, 68, 68, 0.05); color: #fca5a5; text-decoration: none; border-radius: 10px; font-weight: 600; font-size: 0.95rem; transition: all 0.3s ease; }
.btn-logout i { margin-right: 10px; font-size: 1.1rem; }
.btn-logout:hover { background: #ef4444; color: white; box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3); }

.main-wrapper { flex: 1; margin-left: 280px; display: flex; flex-direction: column; min-height: 100vh; width: calc(100% - 280px); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.topbar { background: #ffffff; height: 75px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 10px rgba(0,0,0,0.03); position: sticky; top: 0; z-index: 99; }
.user-info { font-weight: 500; color: #64748b; font-size: 0.9rem; display: flex; align-items: center; cursor: pointer; }
.content-area { padding: 30px; flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }

/* ========================================= */
/* 5. MODAL & FORM CONTROL (FIX POSISI ICON) */
/* ========================================= */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(6px); z-index: 1000; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; padding: 20px;}
.modal.active { display: flex; opacity: 1; }

.modal-content { background: white; width: 100%; max-width: 420px; border-radius: 24px; padding: 35px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); transform: scale(0.95) translateY(20px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); max-height: 90vh; overflow-y: auto;}
.modal.active .modal-content { transform: scale(1) translateY(0); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.modal-header h3 { color: #1e293b; font-size: 1.3rem; }
.close-btn { background: none; border: none; font-size: 1.5rem; color: #94a3b8; cursor: pointer; transition: color 0.3s; }
.close-btn:hover { color: #ef4444; transform: rotate(90deg); }

.form-group { position: relative; margin-bottom: 25px; }
.form-group label { display: block; font-size: 0.85rem; color: #475569; margin-bottom: 8px; font-weight: 600; }

/* FIX ICON MENGAMBANG DISINI */
.input-icon-wrap { position: relative; width: 100%; }
.input-icon-wrap i {
    position: absolute !important;
    left: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #94a3b8; 
    font-size: 1.1rem; 
    transition: all 0.3s;
    pointer-events: none; /* Agar tidak memblokir ketikan user */
}

.form-control {
    width: 100%; 
    padding: 14px 16px 14px 45px !important; /* Padding kiri ditingkatkan agar text tidak menabrak icon */
    border: 2px solid #e2e8f0; 
    border-radius: 12px;
    font-size: 0.95rem; 
    color: #1e293b; 
    transition: all 0.3s; 
    outline: none; 
    background: #f8fafc;
}
.form-control:focus { border-color: #10B981; background: white; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1); }
.form-control:focus + i, .form-control:valid + i { color: #10B981; }

select.form-control { padding-left: 16px !important; appearance: auto; }
select.form-control:focus { border-color: #10B981; }

/* ========================================= */
/* 6. TABEL & PANEL (WILAYAH & REKAP)        */
/* ========================================= */
.grid-container { display: grid; grid-template-columns: 1fr 1.5fr; gap: 25px; margin-top: 25px; }
.panel-card { background: #ffffff; border-radius: 16px; border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.03); overflow: hidden; animation: slideUpFade 0.6s ease-out; }
@keyframes slideUpFade { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.panel-header { padding: 20px 25px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; background: #ffffff; }
.panel-header h3 { font-size: 1.1rem; color: #1e293b; font-weight: 600; }
.panel-body { padding: 25px; flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.action-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.btn { padding: 10px 18px; border-radius: 10px; border: none; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: linear-gradient(135deg, #10B981, #059669); color: white; box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3); }
.btn-edit { background: #e0e7ff; color: #4338ca; padding: 8px 12px; font-size: 0.85rem; }
.btn-edit:hover { background: #4338ca; color: white; box-shadow: 0 4px 10px rgba(67, 56, 202, 0.2); }
.btn-danger { background: #fee2e2; color: #ef4444; padding: 8px 12px; font-size: 0.85rem; }
.btn-danger:hover { background: #ef4444; color: white; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2); }

.table-responsive { 
    overflow-x: auto; 
    flex: 1; 
    width: 100%; 
    -webkit-overflow-scrolling: touch; /* Membuat scroll di HP terasa sangat licin/smooth */
}
table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 600px; /* Lebarkan batas minimal agar memaksa munculnya scrollbar horizontal */
}
th, td { 
    padding: 16px 15px; 
    text-align: left; 
    font-size: 0.9rem; 
    border-bottom: 1px solid #f1f5f9; 
    white-space: nowrap; /* KUNCI UTAMA: Mencegah teks, tombol, atau badge terlipat/hancur ke bawah */
}

.badge-desa { background: #e0e7ff; color: #4338ca; padding: 5px 12px; border-radius: 50px; font-size: 0.75rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }


/* ========================================= */
/* 7. RESPONSIVE UTILITY & SWEETALERT        */
/* ========================================= */
.swal2-title { font-family: 'Poppins', sans-serif !important; }
.swal2-html-container { font-family: 'Inter', sans-serif !important; }

.d-none-mobile { display: inline-block; }
.only-mobile { display: none; }
@media (max-width: 992px) { .only-mobile { display: inline-block; } }

.hamburger-btn { display: none; background: #ECFDF5; border: none; color: #059669; cursor: pointer; padding: 8px 12px; border-radius: 10px; transition: all 0.3s; box-shadow: 0 2px 8px rgba(5, 150, 105, 0.15); }
.hamburger-btn:hover, .hamburger-btn:active { background: #10B981; color: white; transform: scale(1.05); }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); z-index: 90; opacity: 0; transition: opacity 0.3s ease; }

@media (max-width: 992px) {
    .sidebar { left: -320px !important; transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important; } 
    .sidebar.active { left: 0 !important; }
    .main-wrapper { margin-left: 0 !important; width: 100% !important; }
    .hamburger-btn { display: flex !important; align-items: center; justify-content: center; }
    .sidebar-overlay.active { display: block !important; opacity: 1 !important; }
    .topbar { padding: 0 20px; }
    .content-area { padding: 20px 15px; }
    .d-none-mobile { display: none !important; }
    .grid-container { grid-template-columns: 1fr; }
}
/* ============================================== */
/* PERBAIKAN GRID PEMETAAN WILAYAH (TABLET/LAPTOP KECIL) */
/* ============================================== */
@media (max-width: 1200px) {
    .grid-container { 
        grid-template-columns: 1fr !important; /* Memaksa kotak menjadi atas-bawah */
    }
}
@media (max-width: 900px) {
    /* Khusus Halaman Login HP */
    .brand-section { flex: none; padding: 60px 20px 40px; }
    .brand-content h1 { font-size: 2.2rem; }
    .login-section { flex: none; padding: 50px 20px; box-shadow: none; border-radius: 30px 30px 0 0; margin-top: -30px; }
    .form-wrapper { padding: 0 10px; }
}