/* CSS Variables untuk Tema Dark & Glassmorphism */
:root {
    --bg-dark: #0b0f19;
    --bg-glow: radial-gradient(circle at 50% -20%, #1a2a42, #0b0f19 60%);
    
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --neon-blue: #00f0ff;
    --neon-blue-dim: rgba(0, 240, 255, 0.2);
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    
    --income: #10b981; /* Hijau */
    --income-dim: rgba(16, 185, 129, 0.2);
    --expense: #ef4444; /* Merah */
    --expense-dim: rgba(239, 68, 68, 0.2);
    
    --font-family: 'Poppins', sans-serif;
    --transition: all 0.3s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-dark);
    background-image: var(--bg-glow);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar kustom */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-blue); }

/* Utilitas Glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

/* Layout Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Navbar */
nav {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 30px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

.user-profile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--neon-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover {
    box-shadow: 0 0 15px var(--neon-blue-dim);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    filter: blur(40px);
    z-index: -1;
}

.stat-card.balance::before { background: var(--neon-blue); }
.stat-card.income::before { background: var(--income); }
.stat-card.expense::before { background: var(--expense); }

.stat-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-amount {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.balance .stat-amount { color: var(--neon-blue); text-shadow: 0 0 15px var(--neon-blue-dim); }

/* Target Tabungan Progress */
.savings-target {
    padding: 20px;
    margin-bottom: 30px;
}
.savings-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.9rem;
}
.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-blue), #0077ff);
    width: 0%;
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--neon-blue);
}

/* Layout Utama Konten */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.form-section, .chart-section {
    padding: 25px;
    height: fit-content;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 8px var(--neon-blue-dim);
}

::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

select.form-control option {
    background: var(--bg-dark);
    color: var(--text-main);
}

.radio-group {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.radio-label {
    flex: 1;
    padding: 10px;
    text-align: center;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

input[type="radio"] { display: none; }

input[type="radio"]:checked + .radio-label.income-label {
    background: var(--income-dim);
    border-color: var(--income);
    color: var(--income);
}

input[type="radio"]:checked + .radio-label.expense-label {
    background: var(--expense-dim);
    border-color: var(--expense);
    color: var(--expense);
}

.btn {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--neon-blue);
    border: 1px solid var(--neon-blue);
    border-radius: 8px;
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.btn:hover {
    background: var(--neon-blue);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--neon-blue-dim);
}

/* Chart Section */
.canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 250px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-center-text {
    position: absolute;
    text-align: center;
    pointer-events: none;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    font-size: 0.85rem;
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.inc { background: var(--income); }
.dot.exp { background: var(--expense); }

/* Transaction History */
.history-section {
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.tab.active {
    background: var(--glass-border);
    color: var(--text-main);
    border-color: var(--text-muted);
}

.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    max-height: 500px;
    padding-right: 5px;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    border-left: 4px solid transparent;
    transition: var(--transition);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.transaction-item:hover {
    background: rgba(255,255,255,0.05);
}

.transaction-item.inc { border-left-color: var(--income); }
.transaction-item.exp { border-left-color: var(--expense); }

.trans-info { display: flex; align-items: center; gap: 15px; }

.trans-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255,255,255,0.05);
}

.trans-item-title { font-weight: 500; font-size: 0.95rem; margin-bottom: 3px; }
.trans-item-date { font-size: 0.75rem; color: var(--text-muted); }

.trans-amount-wrapper { text-align: right; }
.trans-item-amount { font-weight: 600; font-size: 1rem; }
.transaction-item.inc .trans-item-amount { color: var(--income); }
.transaction-item.exp .trans-item-amount { color: var(--expense); }

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    margin-top: 5px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-delete:hover { color: var(--expense); }

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 240, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--neon-blue);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

/* Animasi Keyframes */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Media Queries */
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .main-content { grid-template-columns: 350px 1fr; }
    .right-column { display: flex; flex-direction: column; gap: 30px; }
    .content-row-desktop { display: grid; grid-template-columns: 1fr 2fr; gap: 30px;}
}

@media (min-width: 1024px) {
    .content-row-desktop { grid-template-columns: 300px 1fr; }
}