@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #38bdf8;
    --secondary: #818cf8;
    --income: #34d399;
    --expense: #fb7185;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

.light-mode {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.7);
    --primary: #0ea5e9;
    --secondary: #6366f1;
    --income: #10b981;
    --expense: #ef4444;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass-border: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 80px; /* Space for bottom nav on mobile */
    transition: background-color 0.3s, color 0.3s;
}

/* Background Decoration */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.15) 0%, transparent 70%);
    z-index: -1;
}

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

/* Header updates for mobile */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.user-profile .avatar {
    font-size: 1.5rem;
    color: var(--primary);
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 0.25rem;
    transition: 0.3s;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item.active, .nav-item:hover {
    color: var(--primary);
}

.nav-item.fab {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    justify-content: center;
    transform: translateY(-20px);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}
.nav-item.fab i { font-size: 1.5rem; }

/* Cards & Glassmorphism */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.2rem;
}

.stat-card h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

/* Main Content Grid */
.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.section-title {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Transactions Table */
.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid transparent;
    transition: 0.2s;
}

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

.t-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.t-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

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

.t-amount {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

/* Forms & Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

input, select {
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: 0.2s;
    cursor: pointer;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .bottom-nav {
        display: flex;
    }
    
    .container {
        padding: 1rem;
        padding-bottom: 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .transaction-item > div:last-child {
        width: 100%;
        justify-content: space-between;
    }
    
    .app-header .logo {
        font-size: 1.25rem;
    }
    
    .user-profile span {
        display: none; /* hide name on mobile to save space */
    }
}

/* Calendar View */
.calendar-wrapper {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: none; /* hidden by default */
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.2rem;
    transition: background 0.2s;
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.08); /* slight highlight on hover */
}

.calendar-day.empty {
    background: transparent;
    border-color: transparent;
}

.day-number {
    font-size: 0.9rem;
    font-weight: 600;
}

.day-summary {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.3rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.dot.income { background: var(--income); }
.dot.expense { background: var(--expense); }

/* View Toggle Component */
.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.2rem;
    gap: 0.2rem;
}

.view-toggle button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 1rem;
}

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