/* =================================================================
   1. GLOBAL & PENGATURAN DASAR
==================================================================== */
* { box-sizing: border-box; }
body { 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    color: #333; 
    background: #f0f4f3; 
    scroll-behavior: smooth;
}

.app-container { padding-bottom: 80px; } 

/* =================================================================
   2. CARD & SECTION (JARAK DIRAPIKAN)
==================================================================== */
.panel-fitur {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Jarak antar card yang rapi dan konsisten */
}

.card-section { 
    background: white; 
    padding: 20px; 
    border-radius: 12px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    overflow: hidden; 
}

.section-title { 
    background: #1b5e20; 
    color: white; 
    padding: 12px 20px; 
    font-weight: bold; 
    margin: -20px -20px 20px -20px; 
    font-size: 15px; 
    text-align: center; /* Judul ditengah agar lebih rapi */
}

/* =================================================================
   3. HEADER & DASHBOARD
==================================================================== */
.app-header { background-color: #1b5e20; }

.stat-box { flex: 1; text-align: center; border-right: 1px solid #eee; padding: 5px; }
.stat-box:last-child { border-right: none; }
.stat-label { font-size: 10px; color: #888; display: block; font-weight: bold; margin-bottom: 5px;}
.stat-value { font-size: 16px; color: #1b5e20; font-weight: bold; display: block; }

/* =================================================================
   4. FORM INPUT & TOMBOL
==================================================================== */
.card-section input, .card-section select { 
    width: 100%; padding: 12px 15px; margin-bottom: 15px; 
    border: 1.5px solid #ced4da; border-radius: 8px; font-size: 14px; 
    background-color: #f8f9fa; transition: all 0.3s ease; box-sizing: border-box; 
}
.card-section input:focus, .card-section select:focus { 
    outline: none; border-color: #1b5e20; background-color: #ffffff; box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15); 
}
label { font-size: 12px; font-weight: 600; color: #555; margin-bottom: 6px; display: block; text-transform: uppercase; }

.btn-primary { 
    width: 100%; background: #1b5e20; color: white; padding: 14px; 
    border: none; border-radius: 8px; font-weight: bold; cursor: pointer; 
    transition: 0.2s ease-in-out; font-size: 14px;
}
.btn-primary:hover { background: #14452F; }
.btn-aksi { 
    background-color: #e74c3c; color: #ffffff; border: none; padding: 6px 12px; 
    border-radius: 5px; cursor: pointer; font-size: 11px; font-weight: bold; transition: 0.2s; 
}
.btn-aksi:hover { transform: scale(1.05); background-color: #c0392b; }

/* =================================================================
   5. TABEL & GRAFIK
==================================================================== */
#historiTransaksi table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 500px; }
#historiTransaksi th { background-color: #1b5e20; color: #ffffff; padding: 12px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; }
#historiTransaksi td { padding: 12px; border-bottom: 1px solid #f0f0f0; font-size: 13px; color: #444; }
#historiTransaksi tr:hover td { background-color: #e8f5e9; }
.chart-wrapper { position: relative; height: 260px; width: 100%; }

/* =================================================================
   6. RESPONSIVE MOBILE (MAKSIMAL 767PX)
==================================================================== */
@media only screen and (max-width: 767px) {
    /* Header merangkul dashboard melayang */
    .app-header { padding: 20px 20px 40px 20px; border-radius: 0 0 25px 25px; }
    .stats-container { 
        background: white; border-radius: 12px; padding: 15px; 
        display: flex; margin: 0 auto -55px auto; /* Membuat efek melayang */
        box-shadow: 0 5px 15px rgba(0,0,0,0.1); position: relative; z-index: 10; width: 90%;
    }
    
    .app-body { padding: 50px 20px 20px 20px; display: flex; flex-direction: column; gap: 20px;}

    /* Navigasi Bawah Mengambang (Hanya Ikon) */
    .bottom-nav { 
        position: fixed; bottom: 0; left: 0; width: 100%; 
        display: flex; justify-content: space-around; align-items: center; 
        padding: 10px 0; background: white; 
        box-shadow: 0 -2px 15px rgba(0,0,0,0.08); 
        border-radius: 20px 20px 0 0; z-index: 1000; 
    }
    .nav-item { color: #A0A0A0; padding: 10px 20px; cursor: pointer; text-decoration: none;}
    .nav-item i { font-size: 22px; } /* Ukuran ikon dibesarkan */
    .nav-item.active { color: #1b5e20; }
    
    .nav-fab { 
        background: #1b5e20; color: white; width: 55px; height: 55px; 
        border-radius: 50%; display: flex; justify-content: center; align-items: center; 
        font-size: 24px; margin-top: -30px; border: 4px solid #f0f4f3; box-shadow: 0 4px 10px rgba(27,94,32,0.3);
    }
}

/* =================================================================
   7. RESPONSIVE DESKTOP (MINIMAL 768PX)
==================================================================== */
@media only screen and (min-width: 768px) {
    body { padding: 30px 40px; } 
    .app-container { max-width: 1200px; margin: 0 auto; }
    
    /* Header tanpa judul, Dashboard memanjang rapi */
    .app-header { background-color: transparent; padding: 0; margin-bottom: 25px; }
    .stats-container { display: flex; gap: 20px; background: transparent; }
    .stat-box { 
        background: white; padding: 20px; border-radius: 12px; flex: 1; border: none;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05); text-align: left; position: relative;
    }
    .stat-box::before {
        content: ""; position: absolute; left: 0; top: 15%; height: 70%; width: 4px;
        background-color: #1b5e20; border-radius: 0 4px 4px 0;
    }
    .stat-label { color: #888; font-size: 12px;}
    .stat-value { font-size: 24px; margin-top: 8px;} 

    /* Menghilangkan navigasi hp */
    .bottom-nav { display: none; }
    
    /* Memecah layar menjadi 2 panel (Kiri: Form, Kanan: Data) */
    #mainWorkspace { display: flex; gap: 25px; flex-direction: row; }
    #panelForm { width: 340px; flex-shrink: 0; }
    #panelData { flex: 1; min-width: 0; }
}

/* =================================================================
   8. SISTEM MENU (NAVIGASI HALAMAN) & KARTU MENU
==================================================================== */
.view-section { display: none; animation: fadeIn 0.3s ease-in-out; }
.view-section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn-kembali {
    background: transparent; border: none; color: #1b5e20;
    font-size: 14px; font-weight: bold; margin-bottom: 15px;
    cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.btn-kembali:hover { color: #14452F; text-decoration: underline; }

.menu-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px;
}

.menu-card {
    background: white; border-radius: 12px; padding: 20px;
    display: flex; align-items: center; gap: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); cursor: pointer;
    border: 1px solid #f0f0f0; transition: 0.2s ease-in-out;
}
.menu-card:hover { transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); border-color: #1b5e20; }

.menu-icon {
    width: 50px; height: 50px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}

.menu-text h3 { margin: 0; font-size: 15px; color: #333; }
.menu-text p { margin: 5px 0 0 0; font-size: 12px; color: #888; 
}

/* =================================================================
   9. UTILITY CLASSES & KOMPONEN (HASIL CLEANUP DARI INLINE CSS)
==================================================================== */
/* Text & Colors */
.text-income { color: #4CAF50 !important; }
.text-expense { color: #e74c3c !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-bold { font-weight: bold; }

/* Backgrounds */
.bg-dark-blue { background-color: #2c3e50 !important; }
.bg-pink { background-color: #e91e63 !important; }
.bg-dark { background-color: #333 !important; }
.bg-green { background-color: #4caf50 !important; }

/* Menu Icons */
.icon-blue { color: #2196f3; background-color: #e3f2fd; }
.icon-green { color: #4caf50; background-color: #e8f5e9; }
.icon-pink { color: #e91e63; background-color: #fce4ec; }


/* Forms, Inputs & Buttons */
.form-group-inline { display: flex; gap: 10px; margin-bottom: 15px; }
.input-no-margin { margin-bottom: 0 !important; }
.btn-icon { width: auto; padding: 12px 15px; }
.input-filter { width: auto !important; margin: 0 !important; padding: 4px 10px !important; border-radius: 5px; }
.input-color { height: 40px; padding: 2px !important; }

/* Tables & Containers */
.table-container { max-height: 180px; overflow-y: auto; border: 1px solid #eee; border-radius: 8px; }
.table-custom { width: 100%; border-collapse: collapse; font-size: 13px; }
.td-manage { padding: 10px; border-bottom: 1px solid #eee; }
.title-flex { display: flex; justify-content: space-between; align-items: center; }
.wallet-list { display: flex; flex-direction: column; gap: 10px; }
.empty-state { text-align: center; padding: 20px; background: white; border-radius: 10px; color: #888; }

/* Layout Flex */
.flex-between { display: flex; justify-content: space-between; }
.flex-between-center { display: flex; justify-content: space-between; align-items: center; }
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }

/* Komponen Card di JavaScript */
.badge-category { background: #e8f5e9; color: #1b5e20; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; }
.history-card { background: #fff; padding: 15px; border-radius: 10px; margin-bottom: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.card-title-small { margin: 0; font-size: 14px; }
.card-date-small { margin: 4px 0 0 0; font-size: 11px; color: #888; }
.card-amount { font-weight: bold; font-size: 14px; }
.btn-small { padding: 4px 10px !important; font-size: 10px !important; }
.btn-warning { background-color: #ffc107 !important; color: #000 !important; padding: 5px 8px !important; margin-right: 2px; }
.btn-delete-small { padding: 5px 8px !important; }

.debt-card { background: #fff; padding: 15px; border-radius: 10px; margin-bottom: 15px; border: 1px solid #eee; }
.debt-type-label { font-size: 11px; font-weight: bold; margin-bottom: 5px; }
.debt-name { margin: 0; font-size: 16px; }
.debt-amount { font-weight: bold; font-size: 16px; }

.wallet-card { background: #fff; padding: 15px; border-radius: 10px; border: 1px solid #eee; }
.wallet-name { margin: 0; font-size: 16px; color: #333; }
.wallet-balance { margin: 5px 0 0 0; font-size: 14px; font-weight: bold; }

/* =================================================================
   10. LAYOUT GRAFIK MULTIPEL (ANALISIS)
==================================================================== */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default mobile: 1 kolom tumpuk ke bawah */
    gap: 30px;
    margin-top: 15px;
}
.chart-container h4 { margin: 0 0 10px 0; color: #555; font-size: 13px; text-transform: uppercase; }

/* Desktop view untuk grafik */
@media only screen and (min-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr 1fr; /* Jadi 2 kolom kiri-kanan */
    }
    .cashflow-span {
        grid-column: span 2; /* Grafik arus kas memanjang memenuhi layar atas */
    }
}