/* Smart Expense Tracker - Design System */
/* Palette: Copper & Slate - Premium fintech aesthetic */

:root {
    /* Primary Colors */
    --color-copper: #B87333;
    --color-copper-light: #D4A574;
    --color-copper-dark: #8B5A2B;
    
    /* Slate Colors */
    --color-slate-900: #0F172A;
    --color-slate-800: #1E293B;
    --color-slate-700: #334155;
    --color-slate-600: #475569;
    --color-slate-500: #64748B;
    --color-slate-400: #94A3B8;
    --color-slate-300: #CBD5E1;
    --color-slate-200: #E2E8F0;
    --color-slate-100: #F1F5F9;
    --color-slate-50: #F8FAFC;
    
    /* Semantic Colors */
    --color-success: #10B981;
    --color-success-light: #D1FAE5;
    --color-danger: #EF4444;
    --color-danger-light: #FEE2E2;
    --color-warning: #F59E0B;
    --color-warning-light: #FEF3C7;
    
    /* Background Colors */
    --bg-primary: #FAFAFA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    
    /* Typography */
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-slate-800);
    background-color: var(--bg-primary);
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--color-slate-200);
    display: flex;
    flex-direction: column;
    padding: var(--space-xl);
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-copper) 0%, var(--color-copper-dark) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-md);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--color-slate-900);
    letter-spacing: -0.02em;
}

/* Navigation */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    color: var(--color-slate-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-base);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--color-slate-100);
    color: var(--color-slate-800);
}

.nav-item.active {
    background: var(--color-slate-900);
    color: white;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--color-slate-200);
}

.user-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-copper-light) 0%, var(--color-copper) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--color-slate-900);
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    color: var(--color-copper);
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: var(--space-2xl);
    max-width: calc(100% - 280px);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2xl);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.page-title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 400;
    color: var(--color-slate-900);
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--color-slate-500);
    font-size: 1rem;
}

.header-right {
    display: flex;
    gap: var(--space-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    border: none;
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--color-slate-900);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--color-slate-800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--color-slate-700);
    border: 1px solid var(--color-slate-200);
}

.btn-secondary:hover {
    background: var(--color-slate-100);
    border-color: var(--color-slate-300);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-slate-200);
    transition: all var(--transition-base);
}

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-slate-500);
    font-weight: 500;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-icon.income {
    background: var(--color-success-light);
    color: var(--color-success);
}

.stat-icon.expense {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.stat-icon.savings {
    background: #E0E7FF;
    color: #6366F1;
}

.stat-icon.category {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.875rem;
    font-weight: 400;
    color: var(--color-slate-900);
    margin-bottom: var(--space-sm);
}

.stat-change {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8rem;
    font-weight: 500;
}

.stat-change svg {
    width: 14px;
    height: 14px;
}

.stat-change.positive {
    color: var(--color-success);
}

.stat-change.negative {
    color: var(--color-danger);
}

.progress-bar {
    height: 6px;
    background: var(--color-slate-200);
    border-radius: var(--radius-full);
    margin: var(--space-md) 0 var(--space-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-copper) 0%, var(--color-copper-light) 100%);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.stat-sublabel {
    font-size: 0.8rem;
    color: var(--color-slate-400);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

/* Section Styles */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--color-slate-900);
}

.time-filter {
    display: flex;
    gap: var(--space-xs);
    background: var(--color-slate-100);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
}

.filter-btn {
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--color-slate-600);
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    color: var(--color-slate-900);
}

.filter-btn.active {
    background: var(--bg-secondary);
    color: var(--color-slate-900);
    box-shadow: var(--shadow-sm);
}

/* Chart Section */
.chart-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-slate-200);
}

.chart-container {
    height: 300px;
    position: relative;
}

/* Category Section */
.category-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-slate-200);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.category-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.category-item:hover {
    background: var(--color-slate-50);
}

.category-color {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.category-info {
    flex: 1;
}

.category-name {
    font-weight: 600;
    color: var(--color-slate-800);
    font-size: 0.9rem;
}

.category-amount {
    font-size: 0.8rem;
    color: var(--color-slate-500);
}

.category-percentage {
    font-weight: 600;
    color: var(--color-slate-700);
    font-size: 0.9rem;
}

/* Transactions Section */
.transactions-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-slate-200);
}

.view-all {
    color: var(--color-copper);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.view-all:hover {
    color: var(--color-copper-dark);
}

.transactions-table-container {
    overflow-x: auto;
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
}

.transactions-table th {
    text-align: left;
    padding: var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-slate-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-slate-200);
}

.transactions-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-slate-100);
    font-size: 0.9rem;
}

.transaction-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.transaction-icon svg {
    width: 20px;
    height: 20px;
}

.transaction-details {
    display: flex;
    flex-direction: column;
}

.transaction-name {
    font-weight: 600;
    color: var(--color-slate-900);
}

.transaction-method {
    font-size: 0.8rem;
    color: var(--color-slate-500);
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
}

.category-badge.food {
    background: #FEF3C7;
    color: #D97706;
}

.category-badge.transport {
    background: #DBEAFE;
    color: #2563EB;
}

.category-badge.shopping {
    background: #FCE7F3;
    color: #DB2777;
}

.category-badge.entertainment {
    background: #E0E7FF;
    color: #4F46E5;
}

.category-badge.bills {
    background: #D1FAE5;
    color: #059669;
}

.category-badge.health {
    background: #FEE2E2;
    color: #DC2626;
}

.category-badge.travel {
    background: #E0E7FF;
    color: #7C3AED;
}

.category-badge.other {
    background: var(--color-slate-100);
    color: var(--color-slate-600);
}

.transaction-date {
    color: var(--color-slate-500);
    font-size: 0.85rem;
}

.transaction-amount {
    font-weight: 600;
    color: var(--color-slate-900);
}

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

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

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.completed {
    background: var(--color-success-light);
    color: var(--color-success);
}

.status-badge.pending {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--color-slate-400);
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--color-slate-100);
    color: var(--color-slate-600);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xl);
    border-bottom: 1px solid var(--color-slate-200);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--color-slate-900);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-slate-100);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-slate-500);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-slate-200);
    color: var(--color-slate-700);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

/* Form Styles */
.expense-form {
    padding: var(--space-xl);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-label {
    font-weight: 600;
    color: var(--color-slate-700);
    font-size: 0.875rem;
}

.form-input,
.form-select {
    padding: var(--space-md);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-slate-900);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-copper);
    box-shadow: 0 0 0 3px rgba(184, 115, 51, 0.1);
}

.form-input::placeholder {
    color: var(--color-slate-400);
}

.payment-methods {
    display: flex;
    gap: var(--space-md);
}

.payment-method {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border: 2px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.payment-method:hover {
    border-color: var(--color-slate-300);
}

.payment-method input {
    display: none;
}

.payment-method input:checked + .payment-icon + span,
.payment-method:has(input:checked) {
    border-color: var(--color-copper);
    background: rgba(184, 115, 51, 0.05);
}

.payment-method:has(input:checked) {
    border-color: var(--color-copper);
}

.payment-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-slate-600);
}

.payment-icon svg {
    width: 24px;
    height: 24px;
}

.payment-method span:last-child {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-slate-700);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--color-slate-200);
}

/* Responsive Design */
@media (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: var(--space-lg);
    }
    
    .logo-text,
    .nav-item span,
    .user-info {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: var(--space-md);
    }
    
    .main-content {
        margin-left: 80px;
        max-width: calc(100% - 80px);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: var(--space-lg);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: var(--space-lg);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .payment-methods {
        flex-direction: column;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: fadeIn 0.5s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-slate-100);
}

::-webkit-scrollbar-thumb {
    background: var(--color-slate-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-slate-400);
}