/* Income Management Styles - Matching Loan PowerSuite Design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    /* Slightly different gradient to distinguish from loan app */
    background: linear-gradient(315deg, #1e3a8a 0%, #312e3e 74%);
    min-height: 100vh;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding-top: 20px;
}

.header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.4);
    font-weight: 700;
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.user-info {
    color: white;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

#userEmail {
    font-weight: 600;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

#signOutBtn {
    background: #dc3545;
    color: white;
    border-radius: 8px;
}

/* App Switcher Buttons */
.app-switcher-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.app-switcher-buttons .btn {
    flex: 1 1 45%;
    padding: 20px 25px;
    font-size: 1.2em;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    color: white;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    min-width: 200px;
}

.app-switcher-buttons .btn-primary {
    background: #4b5563;
}

.app-switcher-buttons .btn-income-active {
    background: linear-gradient(45deg, #1e3a8a, #3b82f6);
}

.app-switcher-buttons .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

/* Dashboard and Detail Views */
.dashboard, .loan-detail {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    margin-bottom: 30px;
}

/* Stats Grid */
.stats-grid, .loan-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 0 1 220px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    font-size: 1em;
    margin-bottom: 10px;
    opacity: 0.95;
    font-weight: 600;
}

.stat-card .value {
    font-size: 2.2em;
    font-weight: 700;
    color: white;
}

.stat-card .small-text {
    font-size: 0.75em;
    opacity: 0.9;
    margin-top: 8px;
    display: block;
}

#netBalance {
    color: #FFD700;
}

#monthIncome {
    color: #90EE90;
}

#monthExpense {
    color: #FFB6C1;
}

/* Action Buttons */
.actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.btn {
    padding: 18px 35px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(45deg, #27AE60, #229954);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #E74C3C, #C0392B);
    color: white;
}

.btn-info {
    background: linear-gradient(45deg, #FFC107, #FFA000);
    color: #333;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Charts */
.charts-container {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
    grid-template-columns: 1fr;
}

.chart-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.chart-card h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.chart-wrapper {
    position: relative;
    height: 350px;
}

/* Transactions Section */
.transactions {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    margin-top: 30px;
}

.transactions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.transactions h3 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background-color: #f8f9fa;
    color: #333;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.95em;
}

.btn-filter:hover {
    background-color: #e9ecef;
    border-color: #667eea;
}

.btn-filter.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
}

/* Transaction Items */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 10px;
    margin-bottom: 10px;
    background: white;
}

.transaction-item:hover {
    background: linear-gradient(to right, #f0f9ff, #e0f2fe);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateX(5px);
}

.transaction-item-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 5px;
}

.transaction-item-details strong {
    font-size: 1.2em;
    color: #333;
}

.transaction-detail-info {
    font-size: 0.9em;
    color: #666;
    line-height: 1.6;
}

.transaction-amount-total {
    font-weight: 700;
    font-size: 1.3em;
    margin-top: 8px;
}

.transaction-amount-total.income {
    color: #27AE60;
}

.transaction-amount-total.expense {
    color: #E74C3C;
}

.transaction-item-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.edit-btn, .delete-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.edit-btn {
    background: #FFC107;
    color: #333;
}

.edit-btn:hover {
    background: #FFB300;
    transform: translateY(-2px);
}

.delete-btn {
    background: #E74C3C;
    color: white;
}

.delete-btn:hover {
    background: #C0392B;
    transform: translateY(-2px);
}

/* Detail View */
.loan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

.loan-header h2 {
    font-size: 2.2em;
    color: #333;
}

.back-btn {
    background: #7F8C8D;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #5D6D7E;
    transform: translateX(-5px);
}

.payment-history {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.payment-history h3 {
    margin-bottom: 20px;
    color: #333;
}

.payment-item {
    background: white;
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.payment-item-details {
    flex-grow: 1;
}

.payment-item-details strong {
    font-size: 1.1em;
    color: #333;
}

.payment-date, .payment-comment {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}

.payment-amount .amount {
    font-size: 1.3em;
    font-weight: 700;
}

.paid-status {
    font-size: 0.85em;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}

.paid-status.paid {
    color: #27AE60;
    background: #D5F4E6;
}

.paid-status.unpaid {
    color: #E67E22;
    background: #FCF3CF;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 35px;
    border-radius: 15px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.modal-header h2 {
    color: #333;
    font-size: 1.8em;
}

.close {
    color: #999;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

#transactionPaid {
    width: auto;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2.2em;
    }

    .app-switcher-buttons {
        flex-direction: column;
    }

    .app-switcher-buttons .btn {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .stats-grid, .loan-info {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex: 1 1 100%;
    }

    .transaction-item,
    .payment-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .transaction-item-actions {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
    }

    .transactions-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-buttons {
        width: 100%;
    }

    .chart-card {
        padding: 20px;
    }

    .chart-wrapper {
        height: 280px;
    }

    .loan-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .dashboard,
    .transactions,
    .loan-detail {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .modal-content {
        padding: 25px;
    }

    .chart-wrapper {
        height: 250px;
    }
}