:root {
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-family: 'Outfit', sans-serif;
    --radius: 16px;
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.15) 0%, transparent 40%);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--primary-color);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-links li {
    cursor: pointer;
}

.nav-links li a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    pointer-events: none;
    /* Let LI handle click */
}

.nav-links li.active a,
.nav-links li:hover a {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Glass Panels */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease;
}

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

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.income .card-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.expense .card-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.balance .card-icon {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
}

.card-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.card-info p {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Chart Container Fix */
.chart-container {
    height: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
    width: 100%;
}

.chart-container h2,
.transaction-form h2,
.recent-transactions h2,
.glass-panel h2 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form */
.form-group {
    margin-bottom: 1rem;
}

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

.form-group input,
.form-group select {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.3s;
}

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

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: var(--secondary-color);
}

/* Recent Transactions List */
.transaction-list {
    list-style: none;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.transaction-item:last-child {
    border-bottom: none;
}

.t-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.t-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.t-details h4 {
    font-size: 1rem;
    font-weight: 500;
}

.t-details span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.t-amount {
    font-weight: 600;
}

.t-amount.income {
    color: var(--success-color);
}

.t-amount.expense {
    color: var(--danger-color);
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 1rem;
    transition: color 0.3s;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
}

/* Views & SPA Logic */
.view-section.hidden {
    display: none;
}

/* Full Transactions Table */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}

.full-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.full-table th,
.full-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.full-table th {
    color: var(--text-muted);
    font-weight: 500;
}

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

/* Goals Grid */
.goals-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.goals-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.goal-card-item {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.goal-header h3 {
    font-size: 1.1rem;
}

.goal-progress {
    margin-top: 1rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.goal-amounts {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Settings */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.setting-group {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.setting-group:last-child {
    border-bottom: none;
}

.danger-zone h2 {
    color: var(--danger-color);
}

.danger-zone h2 i {
    color: var(--danger-color);
}

.btn-danger {
    padding: 0.75rem 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 1rem;
}

.btn-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .goals-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
    }

    .sidebar {
        width: 100%;
        padding: 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }

    .nav-links {
        display: none;
        /* Mobile menu can be added later */
    }
}