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

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --success: #059669;
    --success-light: #10b981;
    --danger: #dc2626;
    --danger-light: #ef4444;
    --warning: #d97706;
    --warning-light: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: linear-gradient(135deg, #f0f4ff 0%, #fdf2ff 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 14px;
}

/* Navbar */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 200;
    backdrop-filter: blur(10px);
}

.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.navbar-logo {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.hamburger {
    display: none;
    font-size: 1.6rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px;
    color: var(--gray-700);
    z-index: 300;
}

.nav-links-desktop {
    display: flex;
    gap: 6px;
    align-items: center;
}

.nav-links-desktop a {
    color: var(--gray-600);
    text-decoration: none;
    padding: 9px 14px;
    border-radius: var(--radius);
    transition: all 0.25s ease;
    font-weight: 600;
    font-size: 0.88rem;
}

.nav-links-desktop a:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.nav-links-desktop a.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
    color: var(--primary);
}

/* Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -290px;
    width: 290px;
    height: 100%;
    background: var(--white);
    z-index: 300;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
}

.sidebar.show {
    left: 0;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-close {
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--gray-500);
    background: none;
    border: none;
    padding: 6px;
    transition: all 0.2s;
}

.sidebar-close:hover {
    color: var(--gray-800);
}

.sidebar-links {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-links a {
    color: var(--gray-700);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--radius);
    transition: all 0.25s ease;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-links a:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.sidebar-links a.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
    color: var(--primary);
}

/* Container & Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.03em;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-100);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-light) 0%, var(--success) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-light) 0%, var(--danger) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-light) 0%, var(--warning) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}

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

.btn-secondary:hover {
    background: var(--white);
    border-color: var(--gray-300);
    color: var(--gray-900);
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.88rem;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: inherit;
    transition: all 0.25s ease;
    background: var(--white);
    color: var(--gray-800);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

/* Grid */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Stat Cards */
.stat-card {
    text-align: center;
    padding: 26px 22px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--primary) 0%, #ec4899 100%);
}

.stat-card .icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: inline-block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.stat-card h3 {
    font-size: 1.7rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--gray-900);
    letter-spacing: -0.03em;
}

.stat-card p {
    color: var(--gray-500);
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    font-size: 0.9rem;
}

table thead {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

table th {
    padding: 14px 16px;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    font-weight: 500;
}

table tbody tr {
    transition: all 0.2s ease;
}

table tbody tr:hover {
    background: var(--gray-50);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.badge-income {
    background: #dcfce7;
    color: var(--success);
}

.badge-expense {
    background: #fee2e2;
    color: var(--danger);
}

.income {
    color: var(--success) !important;
}

.expense {
    color: var(--danger) !important;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid;
    font-size: 0.9rem;
}

.alert-success {
    background: #dcfce7;
    color: var(--success);
    border-color: #86efac;
}

.alert-danger {
    background: #fee2e2;
    color: var(--danger);
    border-color: #fca5a5;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 24px 16px;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
}

@keyframes slideUp {
    from {
        transform: translateY(20px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.close {
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--gray-500);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

/* Month & Other Cards */
.month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.month-card {
    padding: 20px 16px;
    text-align: center;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--white);
    text-decoration: none;
    display: block;
}

.month-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.month-card .month-name {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--gray-900);
    font-size: 1rem;
}

.month-card .amount {
    font-size: 0.95rem;
    font-weight: 700;
}

/* Entry Row */
.entry-row {
    animation: fadeIn 0.3s ease;
}

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

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }
    
    .nav-links-desktop {
        display: none;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-header h2 {
        font-size: 1.15rem;
    }
    
    table {
        font-size: 0.84rem;
    }
    
    table th,
    table td {
        padding: 10px 10px;
    }
    
    .stat-card {
        padding: 20px 16px;
    }
    
    .stat-card h3 {
        font-size: 1.4rem;
    }
    
    .container {
        padding: 18px 14px;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h1 {
        font-size: 1.35rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .btn-sm {
        width: auto;
    }
}
