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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #0f0f23;
    --surface: #1a1b2e;
    --surface-light: #2d2e44;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --border: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
.header {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo h1 {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
    margin-bottom: 5px;
}

.logo span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.stat-value.income {
    color: var(--secondary-color);
}

.stat-value.expense {
    color: var(--danger-color);
}

/* Main Content */
.main-content {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section {
    display: none;
    padding: 20px;
}

.section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-full {
    width: 100%;
}

/* Forms */
.transaction-form {
    background: var(--surface-light);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

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

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

label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text-primary);
    font-size: 0.9rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.toggle-group {
    display: flex;
    background: var(--background);
    border-radius: 8px;
    padding: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Transactions */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filters select, .filters input {
    flex: 1;
    min-width: 150px;
}

.transactions-container {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    background: var(--surface-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid transparent;
}

.transaction-item.income {
    border-left-color: var(--secondary-color);
}

.transaction-item.expense {
    border-left-color: var(--danger-color);
}

.transaction-info {
    flex: 1;
}

.transaction-amount {
    font-weight: bold;
    font-size: 1.1rem;
}

.transaction-amount.income {
    color: var(--secondary-color);
}

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

.transaction-category {
    color: var(--text-secondary);
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 5px;
}

.transaction-actions {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* Charts */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    background: var(--surface-light);
    padding: 20px;
    border-radius: 12px;
}

.chart-container h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.stat-item {
    background: var(--surface-light);
    padding: 20px;
    border-radius: 12px;
}

.stat-item h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* Budgets and Goals */
.budgets-grid,
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.budget-card,
.goal-card {
    background: var(--surface-light);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.budget-card.over-budget {
    border-left-color: var(--danger-color);
}

.goal-card h4,
.budget-card h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
}

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

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .nav {
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters {
        flex-direction: column;
    }
}
