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

:root {
    --bg-color: #070b14;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --text-main: #f1f5f9;
    --text-muted: #64748b;
    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ----------------------------------
   LAYOUT: SIDEBAR & MAIN
----------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 15, 30, 0.95);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 0 20px 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-menu {
    flex: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-menu li a:hover, .sidebar-menu li.active a {
    background: var(--surface);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    width: calc(100% - var(--sidebar-width));
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ----------------------------------
   CARDS & STATS
----------------------------------- */
.card {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

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

.stat-card {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }

/* ----------------------------------
   FORMS & BUTTONS
----------------------------------- */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: 13px; }
.form-control {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 14px;
}
.form-control:focus { outline: none; border-color: var(--primary); }

/* Make date picker calendar icon white */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Quick Add Bar */
.quick-add-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--surface);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.quick-add-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }

/* ----------------------------------
   TABLES
----------------------------------- */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 15px; color: var(--text-muted); font-size: 12px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 15px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:hover { background: var(--surface-hover); }
tr:last-child td { border-bottom: none; }

.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-income { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid var(--success); }
.badge-expense { background: rgba(244, 63, 94, 0.1); color: var(--danger); border: 1px solid var(--danger); }

/* Mobile Bottom Nav */
.mobile-nav { display: none; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; width: 100%; padding: 15px; margin-bottom: 70px; }
    .stats-grid { grid-template-columns: 1fr; }
    
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(10, 15, 30, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--border);
        z-index: 1000;
        justify-content: space-around;
        padding: 10px 0;
    }
    .mobile-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-muted);
        font-size: 11px;
        gap: 4px;
    }
}

/* ----------------------------------
   MODAL, SWITCHES & CHIPS
----------------------------------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    padding: 25px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    0% { transform: scale(0.95) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

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

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: 0.2s;
}
.close-btn:hover { color: white; }

/* Switch Toggle */
.type-switch {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border);
    margin-bottom: 15px;
}

.type-switch label {
    flex: 1;
    text-align: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s;
    color: var(--text-muted);
}

.type-switch input[type="radio"] { display: none; }

.type-switch input[type="radio"]:checked + label.income-label {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}
.type-switch input[type="radio"]:checked + label.expense-label {
    background: rgba(244, 63, 94, 0.2);
    color: var(--danger);
}

/* Chips */
.chips-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.chip {
    padding: 4px 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}
.chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
