/*
 * File: style.css
 * Version: 5.3 (Final PWA & UX)
 */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --nav-height: 65px;
    --radius: 16px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg-body); color: var(--text-main); height: 100vh; overflow-x: hidden; padding-bottom: 80px; }

/* AUTH SCREEN */
.screen { width: 100%; min-height: 100vh; padding-bottom: 80px; }
.auth-screen {
    position: fixed; top: 0; left: 0; z-index: 2000;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
    background: white; width: 100%; max-width: 360px; padding: 40px 30px;
    border-radius: 24px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); text-align: center;
}
.logo-icon { font-size: 3rem; margin-bottom: 10px; display: block; }
.logo-area h1 { font-size: 1.8rem; margin-bottom: 5px; color: var(--text-main); }
.logo-area p { color: var(--text-muted); margin-bottom: 30px; }
.input-group { margin-bottom: 15px; }
.input-group input {
    width: 100%; padding: 15px; border: 2px solid var(--border); border-radius: 12px;
    font-size: 1rem; transition: 0.3s; background: #f8fafc;
}
.input-group input:focus { border-color: var(--primary); background: white; outline: none; }
.auth-note { margin-top: 20px; font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

/* APP LAYOUT */
.app-screen { max-width: 600px; margin: 0 auto; padding: 20px; }
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding: 0 5px; }
.app-header h1 { font-size: 1.8rem; font-weight: 800; }
.user-badge { font-size: 0.9rem; color: var(--primary); font-weight: 600; background: #eff6ff; padding: 5px 12px; border-radius: 20px; }

/* DASHBOARD */
.balance-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.card { background: white; padding: 20px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); }
.card.balance { grid-column: span 2; background: var(--primary); color: white; }
.card.balance .card-label { color: rgba(255,255,255,0.9); }
.card.balance p { color: white; }
.card-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 5px; display: block; }
.card p { font-size: 1.4rem; font-weight: 700; margin-top: 5px; white-space: nowrap; }
.card.income p { color: var(--success); } .card.expense p { color: var(--danger); }

.charts-section { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.charts-section h2 { font-size: 1rem; color: var(--text-muted); margin-bottom: 20px; }
.chart-wrapper { display: flex; align-items: center; justify-content: center; gap: 30px; }
.pie-chart { width: 100px; height: 100px; border-radius: 50%; background: #e2e8f0; position: relative; }
.pie-chart::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 70px; height: 70px; background: white; border-radius: 50%; }
.chart-legend { text-align: left; }
.legend-item { display: flex; align-items: center; font-size: 0.9rem; margin-bottom: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-right: 10px; }
.dot.income { background: var(--success); } .dot.expense { background: var(--danger); }

/* FILTERS */
.filters-container { background: white; padding: 15px; border-radius: var(--radius); margin-bottom: 20px; box-shadow: var(--shadow); }
.search-input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; flex: 1; min-width: 100px; }
.filter-group.full { flex: 100%; }
.filter-group label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.filter-group input, .filter-group select { padding: 8px; border: 1px solid var(--border); border-radius: 8px; width: 100%; background: #f8fafc; }

/* TABLES */
.table-container { background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #f8fafc; font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.data-table td strong { display: block; font-size: 1rem; color: var(--text-main); }
.data-table td small { color: var(--text-muted); font-size: 0.8rem; }
.text-right { text-align: right; }
.val-plus { color: var(--success); font-weight: 600; }
.val-minus { color: var(--danger); font-weight: 600; }
.btn-icon { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 5px; opacity: 0.6; }
.empty-state { padding: 40px; text-align: center; color: var(--text-muted); }

/* UI ELEMENTS */
.btn-primary { background: var(--primary); color: white; width: 100%; padding: 14px; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; font-size: 1rem; }
.btn-secondary { background: white; border: 1px solid var(--border); width: 100%; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.btn-danger { background: #fee2e2; color: var(--danger); width: 100%; padding: 14px; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; }

.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: white; display: flex; justify-content: space-around; padding: 10px 0; border-top: 1px solid var(--border); z-index: 100; }
.nav-item { border: none; background: none; display: flex; flex-direction: column; align-items: center; color: #94a3b8; font-size: 0.7rem; cursor: pointer; width: 100%; }
.nav-item.active { color: var(--primary); }
.nav-item .icon { font-size: 1.3rem; margin-bottom: 2px; }

.fab-btn { position: fixed; bottom: 85px; right: 20px; width: 60px; height: 60px; border-radius: 50%; background: var(--primary); color: white; border: none; font-size: 2rem; box-shadow: 0 10px 20px rgba(37,99,235,0.4); z-index: 99; display: flex; align-items: center; justify-content: center; padding-bottom: 5px; cursor: pointer; transition: transform 0.2s; }
.fab-btn:active { transform: scale(0.9); }

/* MODALS & FORMS */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 3000; backdrop-filter: blur(4px); }
.modal-content.slide-up { position: absolute; bottom: 0; width: 100%; background: white; border-radius: 24px 24px 0 0; padding: 30px 20px; animation: slideUp 0.3s ease-out; max-height: 90vh; overflow-y: auto; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.btn-close { background: none; border: none; font-size: 2rem; color: var(--text-muted); cursor: pointer; }
.form-group { margin-bottom: 20px; } .form-row { display: flex; gap: 15px; }
label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; }
input, select { width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; font-size: 1rem; }
.chip-select { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 10px 16px; border: 1px solid var(--border); border-radius: 20px; background: white; font-size: 0.9rem; cursor: pointer; transition: 0.2s; }
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }
.chip.expense.active { background: var(--danger); border-color: var(--danger); }

/* NOTIFICATIONS & SETTINGS */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #333; color: white; padding: 12px 24px; border-radius: 30px; display: none; z-index: 4000; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.update-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px); background: #334155; color: white; padding: 15px 20px; border-radius: 50px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); display: flex; align-items: center; gap: 15px; z-index: 5000; transition: transform 0.3s; width: max-content; max-width: 90%; }
.update-toast.show { transform: translateX(-50%) translateY(0); }
.update-toast button { background: var(--primary); color: white; border: none; padding: 8px 16px; border-radius: 20px; font-weight: 600; cursor: pointer; font-size: 0.85rem; }

.settings-list { display: flex; flex-direction: column; gap: 15px; }
.setting-item { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.setting-item h3 { font-size: 1rem; margin-bottom: 5px; }
.setting-item p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 15px; }

.view { display: none; animation: fadeIn 0.3s; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
