/* =========================================================
   DOMPET PINTAR - Design System
   Mobile-first, premium banking-app aesthetic
   ========================================================= */

:root {
    --brand-navy: #0B1F3A;
    --brand-navy-light: #163156;
    --brand-primary: #2563EB;
    --brand-primary-dark: #1D4ED8;
    --brand-success: #16A34A;
    --brand-danger: #DC2626;
    --brand-warning: #F59E0B;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-soft: 0 4px 20px rgba(11, 31, 58, 0.06);
    --shadow-card: 0 2px 12px rgba(11, 31, 58, 0.08);
    --bg-app: #F4F6FB;
    --bg-card: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --border-color: #E5E9F0;

    --bs-primary: var(--brand-primary);
    --bs-primary-rgb: 37, 99, 235;
}

[data-bs-theme="dark"] {
    --bg-app: #0A0E1A;
    --bg-card: #131A2C;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --border-color: #232E45;
    --shadow-soft: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-card: 0 2px 12px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    padding-bottom: 90px;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.app-main { animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ===== TOP BAR ===== */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 40;
    padding-top: env(safe-area-inset-top);
}
.topbar-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; }
.brand-icon {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-navy));
    color: #fff; display: flex; align-items: center; justify-content: center;
}
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-app); border: none; color: var(--text-primary);
    font-size: 1.1rem; text-decoration: none; transition: transform 0.15s ease;
}
.icon-btn:active { transform: scale(0.9); }

/* ===== AUTH PAGES ===== */
.auth-body {
    background: linear-gradient(160deg, var(--brand-navy) 0%, #1E3A5F 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    padding: 20px;
}
.auth-wrapper { width: 100%; max-width: 420px; }
.auth-card {
    background: #fff; border-radius: var(--radius-lg);
    padding: 32px 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeIn 0.4s ease;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
    width: 60px; height: 60px; margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-navy));
    border-radius: 18px; color: #fff; font-size: 1.6rem;
    display: flex; align-items: center; justify-content: center;
}
.auth-brand h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 2px; }
.auth-brand p { color: var(--text-secondary); font-size: 0.85rem; }

/* ===== GREETING ===== */
.greeting-block { padding-top: 8px; }
.greeting-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0; }
.greeting-title { font-weight: 700; margin-bottom: 0; }

/* ===== LEVEL / GAMIFICATION ===== */
.level-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 10px 14px; box-shadow: var(--shadow-card);
}
.level-badge {
    background: linear-gradient(135deg, #FBBF24, #F59E0B);
    color: #78350F; font-weight: 800; font-size: 0.75rem;
    padding: 6px 12px; border-radius: 20px; white-space: nowrap;
}
.level-info { flex: 1; }
.level-progress-bar { height: 6px; background: var(--border-color); border-radius: 10px; overflow: hidden; margin-bottom: 4px; }
.level-progress-fill { height: 100%; background: linear-gradient(90deg, #FBBF24, #F59E0B); border-radius: 10px; transition: width 0.6s ease; }
.level-info small { color: var(--text-secondary); font-size: 0.72rem; }
.level-badge-link { color: var(--brand-warning); font-size: 1.2rem; }

/* ===== HERO BALANCE CARD ===== */
.hero-balance-card {
    background: linear-gradient(135deg, var(--brand-navy) 0%, #1E3A5F 60%, #2C5282 100%);
    border-radius: var(--radius-lg); padding: 24px 20px; color: #fff;
    margin-top: 14px; position: relative; overflow: hidden;
    box-shadow: 0 12px 30px rgba(11,31,58,0.3);
}
.hero-balance-card::after {
    content: ''; position: absolute; top: -60px; right: -60px;
    width: 160px; height: 160px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%);
}
.hero-debt { background: linear-gradient(135deg, #7C2D12 0%, #9A3412 60%, #C2410C 100%); }
.hero-label { font-size: 0.8rem; opacity: 0.8; margin-bottom: 4px; }
.hero-amount { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.hero-meta { display: flex; gap: 16px; font-size: 0.82rem; opacity: 0.9; flex-wrap: wrap; }
.hero-meta-item { display: flex; align-items: center; gap: 6px; }

/* ===== STAT MINI CARDS ===== */
.stat-mini-card {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 14px; box-shadow: var(--shadow-card); height: 100%;
}
.stat-mini-icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; margin-bottom: 8px;
}
.stat-mini-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 2px; }
.stat-mini-value { font-size: 1rem; font-weight: 700; }

/* ===== SMART ALERT ===== */
.smart-alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius-md); font-size: 0.85rem;
}
.smart-alert-warning { background: #FEF3C7; color: #92400E; }
.smart-alert-danger { background: #FEE2E2; color: #991B1B; }
[data-bs-theme="dark"] .smart-alert-warning { background: #422006; color: #FCD34D; }
[data-bs-theme="dark"] .smart-alert-danger { background: #450A0A; color: #FCA5A5; }
.smart-alert i { font-size: 1.2rem; margin-top: 2px; }

/* ===== SECTION CARD ===== */
.section-card {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 16px; box-shadow: var(--shadow-card);
}
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h6 { font-weight: 700; margin: 0; font-size: 0.92rem; }
.section-link { font-size: 0.8rem; color: var(--brand-primary); text-decoration: none; font-weight: 600; }

.page-title-row { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; }
.page-title-row h5 { font-weight: 700; margin: 0; }

/* ===== PROGRESS BARS ===== */
.progress-track {
    height: 10px; background: var(--border-color); border-radius: 20px; overflow: hidden;
}
.progress-track.sm { height: 6px; }
.progress-fill-debt { height: 100%; background: linear-gradient(90deg, #F97316, #16A34A); border-radius: 20px; transition: width 0.7s ease; }
.progress-fill-wish { height: 100%; background: linear-gradient(90deg, #8B5CF6, #EC4899); border-radius: 20px; transition: width 0.7s ease; }
.progress-fill-emergency { height: 100%; background: linear-gradient(90deg, #06B6D4, #16A34A); border-radius: 20px; transition: width 0.7s ease; }

.overall-debt-progress { }
.debt-mini-item { padding: 10px 0; border-top: 1px solid var(--border-color); }
.debt-mini-item:first-child { border-top: none; }
.debt-mini-name { font-weight: 600; font-size: 0.88rem; }
.debt-mini-pct { font-weight: 700; font-size: 0.85rem; color: var(--brand-primary); }

/* ===== DEBT CARDS (halaman debts.php) ===== */
.debt-card {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 16px; box-shadow: var(--shadow-card); margin-bottom: 12px;
}
.debt-card-paid { opacity: 0.7; }
.debt-card-name { font-weight: 700; font-size: 0.95rem; }
.debt-card-source { font-size: 0.75rem; color: var(--text-secondary); }
.debt-card-pct { font-weight: 800; color: var(--brand-primary); }
.badge-lunas {
    background: #DCFCE7; color: #15803D; font-size: 0.72rem; font-weight: 700;
    padding: 4px 10px; border-radius: 20px;
}
[data-bs-theme="dark"] .badge-lunas { background: #052E16; color: #4ADE80; }

/* ===== WISH CARDS ===== */
.wish-card {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 16px; box-shadow: var(--shadow-card);
}
.wish-card-done { opacity: 0.75; }
.wish-name { font-weight: 700; font-size: 0.92rem; }
.wish-priority-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ===== EMPTY STATES ===== */
.empty-state, .empty-state-mini {
    text-align: center; padding: 40px 20px; color: var(--text-secondary);
}
.empty-state-mini { padding: 20px; }
.empty-state i, .empty-state-mini i { font-size: 2.2rem; opacity: 0.4; margin-bottom: 10px; display: block; }
.empty-state-mini i { font-size: 1.6rem; }

/* ===== TRANSACTION LIST ===== */
.tx-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-color); }
.tx-item:first-child { border-top: none; }
.tx-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.tx-detail { flex: 1; }
.tx-label { font-weight: 600; font-size: 0.88rem; }
.tx-date { font-size: 0.75rem; color: var(--text-secondary); }
.tx-amount { font-weight: 700; font-size: 0.88rem; white-space: nowrap; }

/* ===== FAB & QUICK ADD SHEET ===== */
.fab {
    position: fixed; bottom: 82px; right: 20px; z-index: 50;
    width: 58px; height: 58px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-navy));
    color: #fff; font-size: 1.5rem; box-shadow: 0 8px 24px rgba(37,99,235,0.4);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s ease;
}
.fab:active { transform: scale(0.9) rotate(90deg); }

.quick-add-sheet { position: fixed; inset: 0; z-index: 100; display: none; }
.quick-add-sheet.active { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.sheet-content {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: var(--bg-card); border-radius: 24px 24px 0 0;
    padding: 12px 20px 24px; max-height: 80vh; overflow-y: auto;
    transform: translateY(100%); transition: transform 0.3s cubic-bezier(.32,.72,0,1);
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.quick-add-sheet.active .sheet-content { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; background: var(--border-color); border-radius: 10px; margin: 8px auto 16px; }
.sheet-title { font-weight: 700; margin-bottom: 14px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-cat-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: var(--bg-app); border: 2px solid transparent; border-radius: var(--radius-sm);
    padding: 12px 4px; font-size: 0.7rem; color: var(--text-primary); font-weight: 600;
    transition: all 0.15s ease;
}
.quick-cat-btn i { font-size: 1.3rem; color: var(--cat-color); }
.quick-cat-btn.selected { border-color: var(--cat-color); background: color-mix(in srgb, var(--cat-color) 12%, transparent); }
.quick-cat-btn:active { transform: scale(0.94); }
.quick-amount-row { display: flex; gap: 10px; margin-top: 16px; }
.quick-amount-input {
    flex: 1; border: 2px solid var(--border-color); border-radius: var(--radius-sm);
    padding: 12px 16px; font-size: 1.3rem; font-weight: 700; background: var(--bg-app); color: var(--text-primary);
}
.quick-amount-input:focus { outline: none; border-color: var(--brand-primary); }
.btn-quick-confirm {
    width: 52px; border-radius: var(--radius-sm); border: none;
    background: var(--brand-success); color: #fff; font-size: 1.3rem;
}
.quick-income-row { display: flex; gap: 8px; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
    background: var(--bg-card); border-top: 1px solid var(--border-color);
    display: flex; justify-content: space-around; padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--text-secondary); text-decoration: none; font-size: 0.65rem; font-weight: 600;
    padding: 4px 8px; border-radius: 10px; transition: color 0.2s ease;
}
.nav-item i { font-size: 1.2rem; }
.nav-item.active { color: var(--brand-primary); }

/* ===== FLASH TOAST ===== */
.toast-flash {
    position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
    z-index: 200; display: flex; align-items: center; gap: 8px;
    padding: 12px 18px; border-radius: 14px; font-size: 0.85rem; font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2); animation: slideDown 0.3s ease;
    max-width: 90vw;
}
.toast-success { background: #16A34A; color: #fff; }
.toast-danger { background: #DC2626; color: #fff; }
@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== CHARTS ===== */
.chart-card { background: var(--bg-card); border-radius: var(--radius-md); padding: 14px; box-shadow: var(--shadow-card); }
.stats-tabs .nav-link { color: var(--text-secondary); font-weight: 600; font-size: 0.85rem; border-radius: 20px; }
.stats-tabs .nav-link.active { background: var(--brand-primary); color: #fff; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ===== FINANCE CALENDAR ===== */
.finance-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 0.7rem; color: var(--text-secondary); font-weight: 700; padding: 4px 0; }
.cal-cell {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: 0.75rem; background: var(--bg-app); color: var(--text-secondary);
}
.cal-empty { background: transparent; }
.cal-low { background: #DBEAFE; color: #1E40AF; }
.cal-mid { background: #FDE68A; color: #92400E; }
.cal-high { background: #FECACA; color: #991B1B; }
.cal-today { border: 2px solid var(--brand-primary); font-weight: 800; }

/* ===== PROFILE ===== */
.profile-header { padding-top: 8px; }
.profile-avatar {
    width: 80px; height: 80px; margin: 0 auto 10px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-navy));
    color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center;
}
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 14px 6px; border-radius: var(--radius-sm); font-size: 0.68rem; text-align: center; font-weight: 600;
}
.badge-item i { font-size: 1.6rem; }
.badge-earned { background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #92400E; }
.badge-locked { background: var(--bg-app); color: var(--text-secondary); opacity: 0.5; }

/* Utility */
.gap-2 { gap: 8px; }
