/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --color-primary: #1e3a8a; /* Biru gelap untuk Sidebar/Aksen (Easion) */
    --color-secondary: #f3f4f6; /* Abu-abu terang untuk background */
    --color-text: #4b5563; /* Warna teks standar */
    --color-white: #ffffff;
    --sidebar-width: 250px;
    --header-height: 60px;
}

/* Reset dan Font Dasar */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--color-secondary);
    color: var(--color-text);
}

/* --- LAYOUT UTAMA --- */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-primary);
    color: var(--color-white);
    padding-top: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: width 0.3s ease; 
}

/* Styling saat sidebar di-collapse (disembunyikan oleh JS) */
.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    padding: 10px 0 30px 0;
    overflow: hidden; 
    cursor: pointer;
}

.sidebar-header i {
    margin-right: 10px;
}

.sidebar.collapsed .sidebar-header {
    font-size: 0; 
    padding: 10px 0 30px 0;
}
.sidebar.collapsed .sidebar-header i {
    margin-right: 0;
    font-size: 1.5rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
    font-weight: 400;
    white-space: nowrap; /* Mencegah teks menu turun baris */
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

.nav-item.active {
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--color-white);
    font-weight: 600;
    border-left: 4px solid var(--color-white);
}

.nav-item i {
    width: 25px;
    text-align: center;
    margin-right: 10px;
}

/* Menyembunyikan teks menu saat sidebar collapsed */
.sidebar.collapsed .nav-item span {
    display: none;
}
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 15px 0;
}
.sidebar.collapsed .nav-item i {
    margin-right: 0;
}


/* --- TOP BAR (HEADER UTAMA) --- */
.main-header {
    height: var(--header-height);
    background-color: var(--color-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: #f7f7f7;
    padding: 8px 15px;
    border-radius: 5px;
}

.search-bar input {
    border: none;
    outline: none;
    background: transparent;
    margin-left: 10px;
    width: 250px;
}

.search-bar i {
    color: #9ca3af;
}

.header-icons {
    display: flex;
    align-items: center;
}

.header-icons i {
    font-size: 1.2rem;
    margin-left: 20px;
    color: var(--color-text);
    cursor: pointer;
    position: relative;
}

/* Badge Notifikasi */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: red;
    color: var(--color-white);
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* --- PROFILE DROPDOWN STYLING (BARU) --- */
.profile-dropdown-container {
    position: relative;
    margin-left: 20px;
}

.profile-icon {
    cursor: pointer;
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 15px); 
    right: 0;
    width: 200px;
    background-color: var(--color-white);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    
    /* Animasi dan visibility */
    display: none; 
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.profile-dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.profile-info {
    padding: 10px 15px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 5px;
}

.profile-info small {
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
}

.profile-dropdown-menu a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.95rem;
    transition: background-color 0.1s;
}

.profile-dropdown-menu a:hover {
    background-color: var(--color-secondary);
}

.profile-dropdown-menu .logout-link {
    color: #ef4444; 
    border-top: 1px solid #e5e7eb;
}

.profile-dropdown-menu .logout-link i {
    margin-right: 8px;
}

/* --- KONTEN HALAMAN --- */
.page-content {
    padding: 30px;
    flex-grow: 1;
}

/* --- CARDS (Kotak Informasi Atas) --- */
.card-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.info-card {
    background-color: var(--color-white);
    padding: 20px;
    border-radius: 8px;
    color: var(--color-white); 
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.8;
    margin-bottom: 10px;
}

.info-card.blue { background-color: #3b82f6; } 
.info-card.green { background-color: #10b981; } 
.info-card.red { background-color: #ef4444; } 

.card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-content i {
    font-size: 3rem;
    opacity: 0.5;
}

.card-content .data {
    text-align: right;
}

.card-content .value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.card-content .change {
    display: block;
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.9;
}

/* --- CHART DAN NOTIFIKASI LAYOUT --- */
.charts-and-notifications {
    display: grid;
    grid-template-columns: 2fr 1fr; 
    gap: 30px;
}

.chart-panel,
.notifications-panel {
    background-color: var(--color-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    min-height: 350px;
}

.chart-panel h3,
.notifications-panel h3 {
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.chart-placeholder {
    border: 1px dashed #ccc;
    height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #999;
}

/* Styling Notifikasi */
.notification-list {
    list-style: none;
}

.notification-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
    color: var(--color-text);
    font-size: 0.9rem;
}

.notification-list li i {
    margin-right: 10px;
    color: #4b5563;
}

.notification-list li:last-child {
    border-bottom: none;
}

.time-ago {
    font-size: 0.75rem;
    color: #9ca3af;
}

.show-all {
    display: block;
    text-align: center;
    margin-top: 15px;
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- Styling Halaman Keuangan --- */

.page-container h1 {
    color: #1f2937;
    margin-bottom: 20px;
}
.page-container p {
    margin-bottom: 30px;
}

.financial-controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

/* Tombol Dasar */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn i {
    margin-right: 5px;
}

.btn-primary {
    background-color: #1e3a8a;
    color: var(--color-white);
}

.btn-primary:hover {
    background-color: #1e40af;
}

.btn-secondary {
    background-color: #d1d5db;
    color: #1f2937;
}

.btn-secondary:hover {
    background-color: #9ca3af;
}

/* Panel Konten */
.panel {
    background-color: var(--color-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.data-table-panel h3 {
    margin-bottom: 15px;
    color: #1f2937;
}

/* Tabel Styling */
.financial-table {
    width: 100%;
    border-collapse: collapse;
}

.financial-table th,
.financial-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.financial-table th {
    background-color: #f9fafb;
    color: #4b5563;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.financial-table tbody tr:hover {
    background-color: #f3f4f6;
}

/* Badge (Pemasukan/Pengeluaran) */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.income {
    background-color: #d1fae5; /* Hijau muda */
    color: #065f46; /* Hijau tua */
}

.badge.expense {
    background-color: #fee2e2; /* Merah muda */
    color: #991b1b; /* Merah tua */
}

/* --- Styling Formulir Tambah Transaksi --- */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #1f2937;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-sizing: border-box; 
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
    outline: none;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

/* --- Styling Slip Gaji A4 (Layar) --- */

.slip-gaji-panel {
    max-width: 900px;
    margin: 30px auto;
    padding: 30px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.slip-controls {
    text-align: right;
    margin-bottom: 20px;
}

.header-yayasan-print {
    display: none; /* Sembunyikan di layar, hanya muncul saat cetak */
}

.slip-header-info {
    text-align: center;
    border-bottom: 2px solid #1e3a8a;
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.slip-header-info h2 {
    color: #1e3a8a;
    margin: 0 0 5px 0;
    font-size: 1.8rem;
}

/* Info Guru Table */
.slip-info-table {
    width: 100%;
    margin-bottom: 25px;
    border: 1px solid #e5e7eb;
}
.slip-info-table td {
    padding: 8px 12px;
    font-size: 0.95rem;
}
.slip-info-table td:nth-child(even) { /* Kolom nilai */
    font-weight: 500;
    width: 30%;
}

/* Body (Pemasukan vs Potongan) */
.slip-body-a4 {
    display: flex;
    gap: 20px;
}
.slip-col-a4 {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 15px;
}
.slip-col-a4 h4 {
    border-bottom: 1px dashed #d1d5db;
    padding-bottom: 5px;
    margin-top: 0;
    color: #4b5563;
}
.slip-detail-table-a4 {
    width: 100%;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.slip-detail-table-a4 td {
    padding: 4px 0;
}
.slip-detail-table-a4 .amount-val {
    text-align: right;
    font-weight: 600;
}
.slip-detail-table-a4 .subheader td {
    font-style: italic;
    color: #6b7280;
    padding-top: 8px;
}

/* Summary Box */
.slip-summary-a4 {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
}
.summary-gajikotor { background-color: #f0fdf4; color: #10b981; border: 1px solid #dcfce7; }
.summary-potongan { background-color: #fef2f2; color: #ef4444; border: 1px solid #fee2e2; }


/* Footer (TTD & Take Home Pay) */
.slip-footer-a4 {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 30px;
    padding-top: 20px;
}

/* TTD Area */
.ttd-area {
    display: flex;
    gap: 50px;
    font-size: 0.9rem;
}
.ttd-box {
    text-align: center;
}
.ttd-label {
    margin-bottom: 50px;
    margin-top: 0;
}
.ttd-line {
    border-bottom: 1px solid #4b5563;
    width: 150px;
    margin: 5px 0;
}
.ttd-name {
    font-style: italic;
    margin: 0;
}

/* Take Home Pay Box */
.take-home-pay-box {
    text-align: right;
    background-color: #e0f2f1;
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid #0d9488;
}
.take-home-pay-box p {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    color: #047876;
}
.take-home-pay-box span {
    font-size: 2.5rem;
    font-weight: 900;
    color: #047876;
    display: block;
}

/* --- Styling Slip Gaji A4 (Layar) --- */

.slip-gaji-panel {
    max-width: 900px;
    margin: 30px auto;
    padding: 30px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.slip-controls {
    text-align: right;
    margin-bottom: 20px;
}

.header-yayasan-print {
    display: none; /* Sembunyikan di layar, hanya muncul saat cetak */
}

.slip-header-info {
    text-align: center;
    border-bottom: 2px solid #1e3a8a;
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.slip-header-info h2 {
    color: #1e3a8a;
    margin: 0 0 5px 0;
    font-size: 1.8rem;
}

/* Info Guru Table */
.slip-info-table {
    width: 100%;
    margin-bottom: 25px;
    border: 1px solid #e5e7eb;
}
.slip-info-table td {
    padding: 8px 12px;
    font-size: 0.95rem;
}
.slip-info-table td:nth-child(even) { /* Kolom nilai */
    font-weight: 500;
    width: 30%;
}

/* Body (Pemasukan vs Potongan) */
.slip-body-a4 {
    display: flex;
    gap: 20px;
}
.slip-col-a4 {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 15px;
}
.slip-col-a4 h4 {
    border-bottom: 1px dashed #d1d5db;
    padding-bottom: 5px;
    margin-top: 0;
    color: #4b5563;
}
.slip-detail-table-a4 {
    width: 100%;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.slip-detail-table-a4 td {
    padding: 4px 0;
}
.slip-detail-table-a4 .amount-val {
    text-align: right;
    font-weight: 600;
}
.slip-detail-table-a4 .subheader td {
    font-style: italic;
    color: #6b7280;
    padding-top: 8px;
}

/* Summary Box */
.slip-summary-a4 {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
}
.summary-gajikotor { background-color: #f0fdf4; color: #10b981; border: 1px solid #dcfce7; }
.summary-potongan { background-color: #fef2f2; color: #ef4444; border: 1px solid #fee2e2; }


/* Footer (TTD & Take Home Pay) */
.slip-footer-a4 {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 30px;
    padding-top: 20px;
}

/* TTD Area */
.ttd-area {
    display: flex;
    gap: 50px;
    font-size: 0.9rem;
}
.ttd-box {
    text-align: center;
}
.ttd-label {
    margin-bottom: 50px;
    margin-top: 0;
}
.ttd-line {
    border-bottom: 1px solid #4b5563;
    width: 150px;
    margin: 5px 0;
}
.ttd-name {
    font-style: italic;
    margin: 0;
}

/* Take Home Pay Box */
.take-home-pay-box {
    text-align: right;
    background-color: #e0f2f1;
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid #0d9488;
}
.take-home-pay-box p {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    color: #047876;
}
.take-home-pay-box span {
    font-size: 2.5rem;
    font-weight: 900;
    color: #047876;
    display: block;
}

/* =======================================
   1. STYLING DEFAULT (LAYAR)
   ======================================= */

/* Footer (TTD & Take Home Pay) */
.slip-footer-a4 {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Memastikan kotak gaji sejajar di bawah */
    margin-top: 30px;
    padding-top: 20px;
}

/* TTD Area di LAYAR */
.ttd-area {
    width: 60%; 
}
.ttd-grid-table {
    width: 100%;
    border-collapse: collapse;
}
.ttd-col-cell {
    width: 50%;
    text-align: center;
    padding: 0 10px;
}
/* Hanya untuk tampilan cetak */
.ttd-line-space-print { 
    display: none; 
} 
.ttd-name {
    font-style: italic;
    margin: 0;
}


/* Perbaikan Kotak Gaji Bersih di LAYAR */
.take-home-pay-box {
    text-align: center; /* Rata tengah agar rapi */
    width: 35%; 
    padding: 15px 20px;
    border: 3px solid #0d9488; 
    background-color: #e0f2f1; 
    border-radius: 8px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    color: #0d9488;
}

.take-home-pay-box p {
    font-size: 10pt;
    margin-bottom: 5px;
    font-weight: 600;
}

.take-home-pay-box span {
    font-size: 24pt; 
    font-weight: 900;
    display: block;
}


/* =======================================
   2. STYLING KHUSUS CETAK (A4) - OPTIMASI 1 LEMBAR
   ======================================= */
@media print {
    
    /* 1. Aturan Kertas A4 Mutlak & Pengecilan Margin */
    @page {
        size: A4;
        margin: 5mm 5mm 5mm 5mm; 
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        font-family: Arial, sans-serif !important;
        font-size: 9pt !important; 
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    /* Sembunyikan Elemen Non-Slip */
    .form-panel, .print-button, .slip-controls, .sidebar, .header, 
    .page-container > h1, .page-container > p, .financial-controls, hr {
        display: none !important;
    }
    
    .page-container {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    .panel.slip-gaji-panel {
        box-shadow: none !important;
        border: 1px solid #999; 
        width: 100%;
        max-width: 100%;
        padding: 5mm; 
        page-break-after: avoid !important; 
    }

    /* 3. Header & Info Guru */
    .header-yayasan-print {
        gap: 10px; 
        margin-bottom: 5px; 
        padding-bottom: 3px;
        font-size: 8.5pt;
    }
    .header-yayasan-print p { margin: 1px 0; }
    .header-yayasan-print .logo-yayasan { width: 30px; height: 30px; }
    .slip-header-info h2 { font-size: 13pt; margin: 5px 0 2px 0; }
    .slip-info-table { margin-bottom: 10px; font-size: 8.5pt; }
    .slip-info-table td { padding: 2px 4px; }

    /* 4. Rincian Gaji (2 Kolom) */
    .slip-body-a4 {
        gap: 10px; 
        margin-top: 5px;
    }
    .slip-col-a4 {
        padding: 6px; 
        page-break-inside: avoid; 
    }
    .slip-col-a4 h4 { font-size: 10pt; }
    .slip-detail-table-a4 {
        font-size: 8.5pt; 
    }
    .slip-detail-table-a4 tr td { padding: 1px 0; }
    .slip-summary-a4 { margin-top: 8px; }


    /* 5. Footer dan TTD (Kunci Kerapihan) */
    .slip-footer-a4 {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        margin-top: 20px; 
    }

    .ttd-area {
        flex: 2; 
        font-size: 8.5pt; 
        line-height: 1.1;
    }
    
    /* Kotak Gaji Bersih saat Cetak: Rata Tengah dan Padat */
    .take-home-pay-box {
        flex: 1; 
        padding: 5px 10px !important; 
        border: 2px solid #0d9488 !important;
        background-color: #e0f2f1 !important;
        color: #047876 !important;
        text-align: center !important; /* Kunci kerapihan: Rata tengah */
        border-radius: 0 !important;
        box-shadow: none !important;
        max-width: 35%;
    }
    .take-home-pay-box p {
        font-size: 8pt !important;
        margin-bottom: 3px !important;
    }
    .take-home-pay-box span {
        font-size: 16pt !important;
        font-weight: 900 !important;
        display: block;
        margin-top: 3px; 
    }

    /* Detail TTD */
    .ttd-grid-table { margin-top: 5px; }
    .ttd-line-space-print {
        height: 40px !important; 
        margin-top: 3px;
        margin-bottom: 3px;
    }
}

