/* 
 * 🎨 Premium Glassmorphism Dark Theme
 * Typography: Plus Jakarta Sans
 * Palette: Slate, Deep Blue, Indigo, Emerald, Rose, Amber
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-dark: #090d16;
    --bg-deep: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --primary-gradient: linear-gradient(135deg, #6366f1, #4f46e5);
    
    --income: #10b981;
    --income-glow: rgba(16, 185, 129, 0.2);
    --income-gradient: linear-gradient(135deg, #34d399, #059669);
    
    --expense: #f43f5e;
    --expense-glow: rgba(244, 63, 94, 0.2);
    --expense-gradient: linear-gradient(135deg, #fb7185, #e11d48);
    
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #fbbf24, #d97706);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --blur: blur(16px);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

body {
    background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, var(--bg-dark) 70%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Helper Classes */
.glass {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

/* Animation Keyframes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.animate-fade {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 🔐 Auth Screen */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    z-index: 10;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    text-align: center;
}

.auth-logo {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: var(--transition);
}

.form-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    padding: 14px 16px 14px 46px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(15, 23, 42, 0.8);
}

.form-input:focus + i {
    color: var(--primary);
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-toggle {
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-toggle a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* 📱 Main App Layout */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* 🧭 Sidebar Navigation */
.sidebar {
    width: 260px;
    height: 100vh;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    border-radius: 0 24px 24px 0;
    border-left: none;
    border-top: none;
    border-bottom: none;
    z-index: 100;
}

.brand {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.nav-item a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-item.active a, .nav-item a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active a {
    background: var(--primary-gradient);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-glass);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-logout:hover {
    color: var(--expense);
    background: rgba(244, 63, 94, 0.1);
}

/* 🏢 Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 40px;
    max-width: 1400px;
    min-height: 100vh;
}

.content-section {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.content-section.active {
    display: block;
}

/* Header styling */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* 📊 Widgets Grid */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.widget-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

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

.widget-icon.balance { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.widget-icon.income { background: rgba(16, 185, 129, 0.15); color: var(--income); }
.widget-icon.expense { background: rgba(244, 63, 94, 0.15); color: var(--expense); }

.widget-info h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.widget-value {
    font-size: 1.6rem;
    font-weight: 800;
}

/* 💳 Wallet Cards UI */
.wallets-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.wallet-card {
    height: 180px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.wallet-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
}

.wallet-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-active);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

.wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.wallet-name {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.wallet-type-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.wallet-balance {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 20px;
}

.wallet-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.wallet-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.wallet-delete-btn:hover {
    color: var(--expense);
    background: rgba(244, 63, 94, 0.1);
}

.wallet-edit-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.wallet-edit-btn:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.budget-edit-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.budget-edit-btn:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.budget-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.budget-delete-btn:hover {
    color: var(--expense);
    background: rgba(244, 63, 94, 0.1);
}

/* 📊 Visual Statistics Section */
.stats-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    padding: 24px;
    min-height: 380px;
}

.chart-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

/* 📝 Transactions List UI */
.transactions-card {
    padding: 24px;
}

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

.transactions-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transaction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    transition: var(--transition);
}

.transaction-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.tx-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tx-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.tx-icon.income { background: rgba(16, 185, 129, 0.1); color: var(--income); }
.tx-icon.expense { background: rgba(244, 63, 94, 0.1); color: var(--expense); }

.tx-details h4 {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

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

.tx-amount-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tx-amount {
    font-weight: 800;
    font-size: 1.1rem;
}

.tx-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}

.tx-action-btn:hover {
    color: var(--expense);
    background: rgba(244, 63, 94, 0.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

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

/* 💸 Budgets List UI */
.budgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.budget-card {
    padding: 24px;
}

.budget-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.budget-cat {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

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

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.8s ease-out;
}

.progress-bar-fill.normal { background: var(--income); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--expense); }

.budget-footer-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 🚪 Modals UI */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 16, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 480px;
    padding: 32px;
    position: relative;
    transform: translateY(-24px);
    transition: var(--transition);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 24px;
}

/* Grid layout for buttons in forms */
.form-buttons-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Select Form Element Styling */
.form-select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    appearance: none;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-wrapper select {
    padding-left: 46px;
}

/* Toast Alerts Styling */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.success {
    background: rgba(16, 185, 129, 0.9);
    color: white;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.toast.error {
    background: rgba(244, 63, 94, 0.9);
    color: white;
    box-shadow: 0 10px 30px rgba(244, 63, 94, 0.3);
}

/* 📱 Responsive Adjustments */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        border-radius: 20px 20px 0 0;
        padding: 10px 16px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    }
    
    .brand {
        display: none;
    }
    
    .nav-links {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        gap: 0;
    }
    
    .nav-item a {
        flex-direction: column;
        gap: 4px;
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .nav-item a i {
        font-size: 1.2rem;
    }
    
    .user-profile {
        display: none; /* Hide on mobile footer bar to save space */
    }
    
    .main-content {
        margin-left: 0;
        padding: 24px 16px 100px 16px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .section-header h1 {
        font-size: 1.5rem;
    }
}
