/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ===========================
   FUNDEASE - Global Stylesheet
   =========================== */

:root {
    --primary:     #BF4646;
    --primary-dark:#a33a3a;
    --primary-light:#f5e0e0;
    --accent:      #7EACB5;
    --accent-dark: #6a9aa3;
    --bg:          #FFF4EA;
    --border:      #EDDCC6;
    --text:        #333;
    --muted:       #888;
    --white:       #ffffff;
    --sidebar-w:   240px;
    --radius:      10px;
    --shadow:      0 2px 12px rgba(191,70,70,0.07);
    --shadow-md:   0 4px 24px rgba(191,70,70,0.12);
    --transition:  0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(160deg, #BF4646 0%, #8B2E2E 100%);
    padding: 0;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(139,46,46,0.25);
    z-index: 100;
}

.sidebar-brand {
    padding: 28px 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-brand .logo-text {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
    line-height: 1;
}

.sidebar-brand .logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
    border-radius: 0;
}

.sidebar-nav a .nav-icon {
    font-size: 8px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    padding-left: 28px;
}

.sidebar-nav a.aktif {
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-weight: 600;
}

.sidebar-nav a.aktif::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #fff;
    border-radius: 0 4px 4px 0;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    text-decoration: none;
    padding: 8px;
    border-radius: 8px;
    transition: background var(--transition);
    cursor: pointer;
}
.sidebar-user:hover,
.sidebar-user-active {
    background: rgba(255,255,255,0.12);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-username {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.35);
}

/* ═══════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════ */
.main {
    margin-left: var(--sidebar-w);
    padding: 36px 40px;
    flex: 1;
    min-width: 0;
}

/* ═══════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 14px;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 400;
}

h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

/* ═══════════════════════════════════════
   GRID
═══════════════════════════════════════ */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════
   STATS CARDS (DASHBOARD)
═══════════════════════════════════════ */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-box::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius) var(--radius) 0 0;
}

.stat-box.accent::after  { background: var(--accent); }
.stat-box.success::after { background: #27ae60; }
.stat-box.danger::after  { background: #e74c3c; }

.stat-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
}

.stat-box.accent  .stat-value { color: var(--accent); }
.stat-box.success .stat-value { color: #27ae60; }
.stat-box.danger  .stat-value { color: #e74c3c; }

/* ═══════════════════════════════════════
   CARD
═══════════════════════════════════════ */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* ═══════════════════════════════════════
   TABLE
═══════════════════════════════════════ */
.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th {
    background: linear-gradient(135deg, var(--primary) 0%, #a33a3a 100%);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

table th:first-child { border-radius: 8px 0 0 0; }
table th:last-child  { border-radius: 0 8px 0 0; }

table td {
    padding: 13px 16px;
    border-bottom: 1px solid #f5ece4;
    color: var(--text);
    vertical-align: middle;
}

table tbody tr:last-child td { border-bottom: none; }

table tbody tr:hover td {
    background-color: #fff9f5;
}

.table-actions {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.tbl-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.tbl-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════
   BADGE
═══════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge.pemasukan  { background: #e8f5e9; color: #2e7d32; }
.badge.pengeluaran{ background: #fce8e8; color: var(--primary); }
.badge.aktif      { background: #e3f2fd; color: #1565c0; }
.badge.selesai    { background: #f5f5f5; color: #616161; }

/* ═══════════════════════════════════════
   FORM
═══════════════════════════════════════ */
.form-width { max-width: 560px; }

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 7px;
    font-weight: 600;
}

.required { color: var(--primary); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--white);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(191,70,70,0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 90px;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #a33a3a 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(191,70,70,0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #8B2E2E 100%);
    box-shadow: 0 4px 16px rgba(191,70,70,0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-secondary {
    background: var(--bg);
    color: var(--muted);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    background: #f5e6d3;
    color: #555;
    border-color: #ddc9af;
}

.btn-view {
    background: #f0f7ff;
    color: #1565c0;
    font-size: 12px;
    padding: 7px 14px;
    border: 1px solid #bbdefb;
}
.btn-view:hover {
    background: #e3f2fd;
    color: #0d47a1;
}

.btn-edit {
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    padding: 7px 14px;
    box-shadow: 0 2px 6px rgba(126,172,181,0.3);
}
.btn-edit:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 12px rgba(126,172,181,0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    padding: 7px 14px;
    box-shadow: 0 2px 6px rgba(231,76,60,0.3);
    border: none;
}
.btn-danger:hover {
    background: #c0392b;
    box-shadow: 0 4px 12px rgba(231,76,60,0.4);
    transform: translateY(-1px);
    color: #fff;
}

/* ═══════════════════════════════════════
   ALERT / FLASH MESSAGE
═══════════════════════════════════════ */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.alert-error {
    background: #fce8e8;
    color: var(--primary);
    border: 1px solid #f5c6cb;
}

/* ═══════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════ */
.kosong {
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* ═══════════════════════════════════════
   FILTER BAR
═══════════════════════════════════════ */
.filter-bar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.filter-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-input,
.filter-select {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--white);
    color: var(--text);
    transition: border-color var(--transition);
    min-width: 140px;
    appearance: none;
}
.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}
.filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.filter-date {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.filter-date .filter-input { min-width: 130px; }

/* ═══════════════════════════════════════
   SUMMARY ROW
═══════════════════════════════════════ */
.summary-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.summary-item {
    flex: 1;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}
.summary-item.success { border-left: 4px solid #27ae60; }
.summary-item.danger  { border-left: 4px solid #e74c3c; }
.summary-item.accent  { border-left: 4px solid var(--accent); }
.summary-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.summary-val   { font-size: 16px; font-weight: 800; color: var(--text); }

/* ═══════════════════════════════════════
   PAGINATION
═══════════════════════════════════════ */
.pagination-wrap {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}
.pagination-wrap nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pagination-wrap a,
.pagination-wrap span {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--text);
}
.pagination-wrap a:hover { border-color: var(--primary); color: var(--primary); }
.pagination-wrap span[aria-current] {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ═══════════════════════════════════════
   DELETE MODAL
═══════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.modal-box {
    background: var(--white);
    border-radius: 14px;
    padding: 36px 32px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    animation: slideUp 0.25s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
}
.modal-msg {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 28px;
    line-height: 1.6;
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ═══════════════════════════════════════
   DETAIL LIST
═══════════════════════════════════════ */
.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid #f5ece4;
    gap: 16px;
}
.detail-item:last-child { border-bottom: none; }
.detail-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 130px;
}
.detail-value {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
    text-align: right;
}

/* ═══════════════════════════════════════
   REKAP KEUANGAN
═══════════════════════════════════════ */
.rekap-keuangan {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.rekap-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f5ece4;
}
.rekap-row:last-child { border-bottom: none; }
.rekap-total {
    font-weight: 700;
    padding-top: 16px;
    margin-top: 4px;
    border-top: 2px solid var(--border);
}
.rekap-label { font-size: 14px; color: var(--muted); }
.rekap-val   { font-size: 15px; font-weight: 700; color: var(--text); }

/* ═══════════════════════════════════════
   TEXT COLORS
═══════════════════════════════════════ */
.text-success { color: #27ae60; }
.text-danger  { color: #e74c3c; }
.text-muted   { color: var(--muted); }

/* ═══════════════════════════════════════
   PROFIL
═══════════════════════════════════════ */
.profil-avatar-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #fff5f5 0%, #fff4ea 100%);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.profil-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.profil-username {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.profil-since {
    font-size: 13px;
    color: var(--muted);
    margin-top: 3px;
}

/* ═══════════════════════════════════════
   AUTH PAGES
═══════════════════════════════════════ */
.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #fff4ea 0%, #ffe8cc 100%);
}

.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 44px;
    width: 400px;
    box-shadow: 0 8px 40px rgba(191,70,70,0.12);
}

.auth-logo {
    text-align: center;
    margin-bottom: 8px;
}

.auth-logo .logo-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.auth-logo .logo-dot {
    color: var(--accent);
}

.auth-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 32px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.auth-footer a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════
   VALIDATION ERRORS
═══════════════════════════════════════ */
.invalid-feedback {
    display: block;
    font-size: 12px;
    color: var(--primary);
    margin-top: 5px;
    font-weight: 500;
}

.form-group input.is-invalid,
.form-group select.is-invalid,
.form-group textarea.is-invalid {
    border-color: var(--primary);
}

/* ═══════════════════════════════════════
   PRINT STYLES
═══════════════════════════════════════ */
@media print {
    .sidebar, .page-header .btn, .filter-bar, .no-print {
        display: none !important;
    }
    .main {
        margin-left: 0;
        padding: 0;
    }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .page-title { color: #000; }
    table th { background: #333 !important; }
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 1200px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; padding: 24px 20px; }
    .stats { grid-template-columns: 1fr; }
    .filter-form { flex-direction: column; }
    .summary-row { flex-direction: column; }
}
