/* CSS Variables for easy theming */
:root {
    --primary-color: #4A90E2;
    --background-color: #f0f2f5;
    --card-background: #ffffff;
    --text-color: #333;
    --light-text-color: #777;
    --border-color: #e0e0e0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    overscroll-behavior-y: none;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    padding-bottom: 70px; /* Space for bottom nav */
}

/* Header */
.app-header {
    background: var(--card-background);
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}
.profile-info { display: flex; align-items: center; }
.profile-pic { width: 40px; height: 40px; border-radius: 50%; margin-right: 10px; }
.profile-details { display: flex; flex-direction: column; }
#username-display { font-weight: bold; }
#balance-display { color: var(--primary-color); font-weight: 500; }

/* Main Content */
.main-content { padding: 15px; }

/* Page display logic */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Cards styling */
.welcome-card, .stat-card, .earn-card, .refer-card, .withdraw-form {
    background: var(--card-background);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.greeting-text {
    background-color: #e9e9ff;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* Home Page */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.stat-card p { margin: 0; color: var(--light-text-color); }
.stat-card h3 { margin: 5px 0 0; }

/* Earn Page */
.progress-bar-container { margin: 20px 0; }

/* Refer Page */
.referral-link-box { display: flex; margin: 10px 0; }
#referral-link { flex-grow: 1; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px 0 0 8px; background: #f9f9f9; }
#copy-link-btn { padding: 10px; border: 1px solid var(--border-color); background: #eee; border-left: none; border-radius: 0 8px 8px 0; cursor: pointer; }

/* Withdraw & Profile Page */
.withdraw-form .form-group { margin-bottom: 15px; }
.withdraw-form label { display: block; margin-bottom: 5px; font-weight: 500; }
.withdraw-form input, .withdraw-form select { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; box-sizing: border-box; }

.profile-summary { text-align: center; padding: 20px; }
.profile-pic-large { width: 80px; height: 80px; border-radius: 50%; margin-bottom: 10px; }
.profile-stats div { display: flex; justify-content: space-between; padding: 15px; border-bottom: 1px solid var(--border-color); }
.profile-stats div:last-child { border-bottom: none; }

/* History Page */
#history-container .history-item { display: flex; justify-content: space-between; padding: 12px; border-bottom: 1px solid var(--border-color); }
#history-container .history-item:last-child { border-bottom: none; }
.history-item .status-pending { color: #f39c12; }
.history-item .status-approved { color: #2ecc71; }
.history-item .status-rejected { color: #e74c3c; }

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    background: var(--card-background);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    border-top: 1px solid var(--border-color);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    text-decoration: none;
    color: var(--light-text-color);
    flex-grow: 1;
    font-size: 24px;
}
.nav-item span { font-size: 10px; }
.nav-item.active { color: var(--primary-color); }