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

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

:root {
    /* Pastel Colors from Design */
    --primary-blue: #5B9BD5;
    --light-blue: #7EB8E8;
    --lighter-blue: #A8D1F5;
    --lightest-blue: #E8F4FC;
    --pastel-bg: #F0F7FC;
    --white: #FFFFFF;
    --light-gray: #F5F7FA;
    --gray: #A0AEC0;
    --dark-gray: #718096;
    --text-dark: #2D3748;
    --text-medium: #4A5568;
    --success: #68D391;
    --danger: #FC8181;
    --warning: #F6E05E;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #5B9BD5 0%, #7EB8E8 100%);
    --gradient-card: linear-gradient(135deg, #5B9BD5 0%, #8ECAE6 50%, #A8D1F5 100%);
    --gradient-header: linear-gradient(180deg, #5B9BD5 0%, #7EB8E8 100%);

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(91, 155, 213, 0.1);
    --shadow: 0 4px 12px rgba(91, 155, 213, 0.15);
    --shadow-lg: 0 8px 24px rgba(91, 155, 213, 0.2);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.08);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    background: var(--pastel-bg);
    min-height: 100vh;
    color: var(--text-dark);
    padding-bottom: 90px;
    overflow-x: hidden;
    font-weight: 500;
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    color: var(--white);
    font-size: 16px;
    font-weight: 600;
    margin-top: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Main Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* Page Transitions with Swipe Animation */
.pages-container {
    position: relative;
    overflow: hidden;
}

.page {
    display: none;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.page.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.page.slide-left {
    animation: slideLeft 0.35s ease forwards;
}

.page.slide-right {
    animation: slideRight 0.35s ease forwards;
}

.page.slide-out-left {
    animation: slideOutLeft 0.35s ease forwards;
}

.page.slide-out-right {
    animation: slideOutRight 0.35s ease forwards;
}

@keyframes slideLeft {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-100%); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

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

/* Header */
.page-header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 8px;
}

.page-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--gray);
}

/* Icon Styles */
.icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
}

.icon-sm {
    width: 18px;
    height: 18px;
}

.icon-lg {
    width: 32px;
    height: 32px;
}

.icon-xl {
    width: 48px;
    height: 48px;
}

/* Task Card (Main Page Captcha Card) */
.task-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.task-card:active {
    transform: translateY(0);
}

.task-icon {
    width: 56px;
    height: 56px;
    background: var(--lightest-blue);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.task-icon svg {
    width: 28px;
    height: 28px;
    color: var(--primary-blue);
}

.task-info {
    flex: 1;
}

.task-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.task-reward {
    font-size: 13px;
    color: var(--success);
    font-weight: 500;
}

.task-arrow {
    color: var(--gray);
}

.task-arrow svg {
    width: 20px;
    height: 20px;
}

/* Captcha Button (Legacy - hidden) */
.captcha-wrapper {
    display: none;
}

/* Captcha Modal */
.captcha-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.captcha-modal.active {
    opacity: 1;
    visibility: visible;
}

.captcha-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.captcha-modal.active .captcha-content {
    transform: scale(1);
}

.captcha-image {
    background: var(--lightest-blue);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.captcha-image img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.captcha-input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-md);
    font-size: 16px;
    text-align: center;
    margin-bottom: 12px;
    transition: border-color 0.3s ease;
}

.captcha-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.captcha-submit {
    width: 100%;
    padding: 14px;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.captcha-submit:hover {
    opacity: 0.9;
}

.captcha-remaining {
    margin-top: 12px;
    color: var(--gray);
    font-size: 13px;
}

/* Achievements Section */
.achievements-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title svg {
    width: 20px;
    height: 20px;
    color: var(--primary-blue);
}

.achievement-item {
    margin-bottom: 14px;
}

.achievement-item:last-child {
    margin-bottom: 0;
}

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

.achievement-name {
    font-size: 13px;
    color: var(--text-medium);
}

.achievement-progress-text {
    font-size: 12px;
    color: var(--gray);
}

.progress-bar {
    background: var(--light-gray);
    border-radius: var(--radius-full);
    height: 6px;
    overflow: hidden;
}

.progress-fill {
    background: var(--gradient-primary);
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

/* Features Section */
.features-section {
    margin-bottom: 16px;
}

.features-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-btn {
    display: flex;
    align-items: center;
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    padding: 16px;
    width: 100%;
    margin-bottom: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

.feature-btn:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.feature-icon {
    width: 44px;
    height: 44px;
    background: var(--lightest-blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
}

.feature-icon svg {
    width: 22px;
    height: 22px;
    color: var(--primary-blue);
}

.feature-text {
    text-align: left;
    flex: 1;
}

.feature-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.feature-desc {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

.feature-arrow {
    color: var(--gray);
}

.feature-arrow svg {
    width: 18px;
    height: 18px;
}

/* Notification Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--white);
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.4s ease;
    min-width: 260px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast-icon {
    font-size: 22px;
}

.toast-content {
    flex: 1;
}

.toast-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.toast-amount {
    font-size: 12px;
    color: var(--gray);
}

/* Profile Page */
.profile-header {
    background: var(--gradient-header);
    margin: -16px -16px 20px -16px;
    padding: 32px 20px 24px;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    text-align: center;
    position: relative;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 12px;
    box-shadow: var(--shadow);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--white);
    font-weight: 600;
}

.profile-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 4px;
}

.profile-username {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

/* Referral Link */
.referral-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}

.referral-label {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 8px;
}

.referral-link-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.referral-link-text {
    flex: 1;
    font-size: 13px;
    color: var(--primary-blue);
    background: var(--lightest-blue);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.referral-copy-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.referral-copy-btn:hover {
    opacity: 0.9;
}

.referral-copy-btn svg {
    width: 18px;
    height: 18px;
    color: var(--white);
}

/* Balance Card */
.balance-card {
    background: var(--gradient-card);
    border-radius: var(--radius-xl);
    padding: 24px;
    color: var(--white);
    margin-bottom: 16px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.balance-label {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.balance-amount {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 16px;
}

.balance-actions {
    display: flex;
    gap: 10px;
}

.balance-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.balance-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.balance-btn svg {
    width: 16px;
    height: 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: var(--lightest-blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
    color: var(--primary-blue);
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-blue);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--gray);
}

/* Conditions Links */
.conditions-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 4px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}

.condition-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--light-gray);
    color: var(--text-dark);
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.condition-link:last-child {
    border-bottom: none;
}

.condition-link:hover {
    opacity: 0.7;
}

.condition-link span {
    font-size: 14px;
}

.condition-link .arrow {
    color: var(--gray);
}

.condition-link .arrow svg {
    width: 16px;
    height: 16px;
}

/* Bonus Page */
.bonus-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bonus-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.bonus-arrow {
    color: var(--gray);
    flex-shrink: 0;
}

.bonus-arrow svg {
    width: 20px;
    height: 20px;
}

.bonus-icon {
    width: 48px;
    height: 48px;
    background: var(--lightest-blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bonus-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary-blue);
}


.bonus-info {
    flex: 1;
}

.bonus-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 3px;
}

.bonus-desc {
    font-size: 12px;
    color: var(--gray);
}


/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--light-gray);
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 14px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: center;
    padding: 10px 20px 20px;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 360px;
    width: 100%;
    position: relative;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    border-radius: var(--radius-full);
}

.nav-item.active {
    color: var(--white);
    background: var(--gradient-primary);
}

.nav-icon {
    width: 22px;
    height: 22px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 22px;
    height: 22px;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
}

/* Modal for Knowledge Base & Conditions */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.info-modal.active {
    opacity: 1;
    visibility: visible;
}

.info-modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 90%;
    max-width: 380px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.info-modal.active .info-modal-content {
    transform: scale(1);
}

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

.info-modal-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-dark);
}

.info-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--gray);
    cursor: pointer;
    padding: 4px;
}

.info-modal-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-medium);
}

/* Withdrawal Section */
.withdrawal-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}

.withdrawal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 14px;
}

.withdrawal-input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-md);
    font-size: 15px;
    margin-bottom: 12px;
    transition: border-color 0.3s ease;
}

.withdrawal-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.withdrawal-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.withdrawal-btn:hover {
    opacity: 0.9;
}

.withdrawal-btn:disabled {
    background: var(--gray);
    cursor: not-allowed;
}

/* Withdrawal History */
.withdrawal-history {
    margin-top: 20px;
}

.withdrawal-history-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.withdrawal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--light-gray);
}

.withdrawal-item:last-child {
    border-bottom: none;
}

.withdrawal-info {
    flex: 1;
}

.withdrawal-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.withdrawal-date {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

.withdrawal-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-icon.pending { background: #F6AD55; }
.status-icon.approved { background: var(--success); }
.status-icon.rejected { background: var(--danger); }

.status-text.pending { color: #F6AD55; }
.status-text.approved { color: var(--success); }
.status-text.rejected { color: var(--danger); }

/* Responsive */
@media (max-width: 380px) {
    .container {
        padding: 12px;
    }

    .page-title {
        font-size: 18px;
    }

    .balance-amount {
        font-size: 28px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 14px;
    }

    .nav-item {
        padding: 8px 18px;
    }
}

/* Safe area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: calc(90px + env(safe-area-inset-bottom));
    }

    .bottom-nav {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}
