:root {
    --primary: #4361ee;
    --primary-dark: #3a0ca3;
    --secondary: #7209b7;
    --success: #06d6a0;
    --danger: #ef476f;
    --warning: #ffd166;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --white: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 16px;
    --radius-sm: 8px;
    --font-main: 'Poppins', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: #f0f2f5;
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* UTILITIES */
.hidden { display: none !important; }

/* LOGIN SECTION */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: fadeInUp 0.6s ease-out;
}

.brand-logo {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.login-card h2 {
    margin-bottom: 10px;
    font-weight: 600;
}

.login-card p {
    color: var(--gray);
    margin-bottom: 30px;
}

.btn-google {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-light);
    background: var(--white);
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-google:hover {
    background: var(--gray-light);
    transform: translateY(-2px);
}

.login-footer {
    margin-top: 20px;
    font-size: 0.8rem;
    color: var(--gray);
}

/* APP LAYOUT */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 80px; /* Space for mobile scroll */
}

/* NAVBAR */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

#user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

#user-name {
    font-weight: 500;
    display: none; /* Hidden on mobile */
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--gray);
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s;
}

.btn-icon:hover {
    color: var(--danger);
}

/* MAIN CONTENT */
.main-content {
    padding: 24px;
}

/* SUMMARY CARDS */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

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

.balance-card .card-icon { background: rgba(67, 97, 238, 0.1); color: var(--primary); }
.income-card .card-icon { background: rgba(6, 214, 160, 0.1); color: var(--success); }
.expense-card .card-icon { background: rgba(239, 71, 111, 0.1); color: var(--danger); }

.card-info h3 {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 500;
    margin-bottom: 4px;
}

.card-info h2, .card-info p {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.income-card p { color: var(--success); }
.expense-card p { color: var(--danger); }

/* CONTENT GRID (FORM & LIST) */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr; /* Form 40%, List 60% */
    gap: 24px;
}

/* FORM STYLING */
.form-wrapper, .list-wrapper {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.section-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--gray-light);
    padding-bottom: 15px;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Custom Radio Toggle */
.toggle-group {
    display: flex;
    background: var(--gray-light);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

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

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    color: var(--gray);
}

#type-expense:checked + .toggle-btn.expense {
    background: var(--white);
    color: var(--danger);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#type-income:checked + .toggle-btn.income {
    background: var(--white);
    color: var(--success);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray);
    margin-bottom: 6px;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: border-color 0.3s;
    background: var(--light);
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* LIST STYLING */
.list-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-wrapper select {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--gray-light);
    font-size: 0.9rem;
}

.transaction-list-container {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar */
.transaction-list-container::-webkit-scrollbar {
    width: 6px;
}
.transaction-list-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.transaction-list {
    list-style: none;
}

.transaction-list li {
    background: var(--white);
    border-bottom: 1px solid var(--gray-light);
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.transaction-list li:last-child {
    border-bottom: none;
}

.transaction-list li:hover {
    background: #fafafa;
}

.li-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cat-icon {
    width: 40px;
    height: 40px;
    background: var(--gray-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--gray);
}

.li-info {
    display: flex;
    flex-direction: column;
}

.li-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--dark);
}

.li-sub {
    font-size: 0.8rem;
    color: #999;
}

.li-right {
    text-align: right;
}

.li-amount {
    font-weight: 700;
    font-size: 1rem;
    display: block;
}

.amount-income { color: var(--success); }
.amount-expense { color: var(--danger); }

.li-actions {
    margin-top: 4px;
}

.btn-delete-mini {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 2px 5px;
}

.btn-delete-mini:hover {
    opacity: 1;
    background: #fee;
    border-radius: 4px;
}

/* ANIMATIONS */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE DESIGN */
@media (min-width: 768px) {
    #user-name { display: block; }
}

@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .card {
        padding: 20px;
    }

    .two-col {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 16px;
    }
}
