:root {
    --primary-color: #1677ff;
    --primary-dark: #0958d9;
    --secondary-color: #64748b;
    --accent-color: #52c41a;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --bg-gray: #f5f5f5;
    --border-color: #e2e8f0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --gradient-blue: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
    --gradient-green: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
    --gradient-red: linear-gradient(135deg, #ff4d4f 0%, #cf1322 100%);
    --gradient-orange: linear-gradient(135deg, #fa8c16 0%, #d46b08 100%);
    --gradient-purple: linear-gradient(135deg, #722ed1 0%, #531dab 100%);
    --gradient-pink: linear-gradient(135deg, #eb2f96 0%, #c41d7f 100%);
    --gradient-teal: linear-gradient(135deg, #13c2c2 0%, #08979c 100%);
    --gradient-yellow: linear-gradient(135deg, #fadb14 0%, #d4b106 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
    max-width: 430px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    padding-bottom: 80px; /* Space for bottom navigation */
}

/* Header */
.header {
    background: var(--gradient-blue);
    color: white;
    padding: 20px 16px;
    position: relative;
}

.search-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-bar {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    outline: none;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-icon, .mic-icon {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.add-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

/* Main Actions */
.main-actions {
    background: white;
    margin: -10px 16px 16px;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative; /* Ensure proper layering */
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.action-item {
    text-align: center;
    cursor: pointer;
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 20px;
    color: white;
}

.action-icon.scan {
    background: var(--gradient-blue);
}

.action-icon.pay {
    background: var(--gradient-green);
}

.action-icon.collect {
    background: var(--gradient-orange);
}

.action-icon.pocket {
    background: var(--gradient-purple);
}

.action-label {
    font-size: 12px;
    color: var(--text-dark);
    font-weight: 500;
}

/* Services Grid */
.services {
    background: white;
    margin: 0 16px 16px;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.service-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.service-item:active {
    transform: scale(0.95);
}

.service-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 18px;
    color: white;
}

.service-icon.green {
    background: var(--gradient-green);
}

.service-icon.blue {
    background: var(--gradient-blue);
}

.service-icon.red {
    background: var(--gradient-red);
}

.service-icon.orange {
    background: var(--gradient-orange);
}

.service-icon.pink {
    background: var(--gradient-pink);
}

.service-icon.teal {
    background: var(--gradient-teal);
}

.service-icon.purple {
    background: var(--gradient-purple);
}

.service-icon.gray {
    background: linear-gradient(135deg, #8c8c8c 0%, #595959 100%);
}

/* Mobile App Icon Styles */

/* Red Cross App Icon */
.red-cross-app {
    background: #ffffff !important;
    border: 2px solid #e5e5e5;
}

.red-cross-icon {
    width: 100%;
    height: 100%;
    background: #e31e24;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cross-symbol {
    color: white;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

.red-cross-icon.small .cross-symbol {
    font-size: 12px;
}

/* Uber App Icon */
.uber-app {
    background: #000000 !important;
}

.uber-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.uber-circle {
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-radius: 50%;
    position: absolute;
}

.uber-square {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 1px;
    position: absolute;
    bottom: 8px;
    right: 8px;
}

.uber-icon.small .uber-circle {
    width: 10px;
    height: 10px;
    border-width: 1px;
}

.uber-icon.small .uber-square {
    width: 4px;
    height: 4px;
    bottom: 4px;
    right: 4px;
}

/* Chase App Icon */
.chase-app {
    background: #117aca !important;
}

.chase-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chase-squares {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    width: 16px;
    height: 16px;
}

.chase-square {
    background: white;
    border-radius: 1px;
}

.chase-icon.small .chase-squares {
    width: 10px;
    height: 10px;
    gap: 1px;
}

/* Lime App Icon */
.lime-app {
    background: #00e602 !important;
}

.lime-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lime-circle {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.lime-l {
    color: white;
    font-weight: bold;
    font-size: 14px;
    font-family: 'Arial', sans-serif;
}

.lime-icon.small .lime-circle {
    width: 16px;
    height: 16px;
}

.lime-icon.small .lime-l {
    font-size: 9px;
}

.service-label {
    font-size: 11px;
    color: var(--text-dark);
    font-weight: 400;
    line-height: 1.2;
}

/* Logo Image Styles */
.service-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.fav-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.recent-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.recommend-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.service-expanded-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

/* News Section */
.news-section {
    background: white;
    margin: 0 16px 16px;
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.news-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    cursor: pointer;
}

.news-item:first-child {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.news-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.news-content {
    flex: 1;
}

.news-text {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.news-time {
    font-size: 12px;
    color: var(--text-lighter);
}

.news-status {
    position: relative;
}

.red-dot {
    width: 8px;
    height: 8px;
    background: #ff4d4f;
    border-radius: 50%;
}

/* Promotions */
.promotions {
    margin: 0 16px 16px;
}

.promo-card {
    background: linear-gradient(135deg, #fa8c16 0%, #d46b08 100%);
    border-radius: 16px;
    padding: 16px;
    color: white;
    box-shadow: var(--shadow);
}

.promo-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.promo-flag {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
    background: white;
    padding: 4px;
}

.promo-text {
    flex: 1;
}

.promo-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.promo-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.promo-button {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Financial Services */
.financial-services {
    background: white;
    margin: 0 16px 16px;
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

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

.exchange-rate {
    background: var(--bg-gray);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}

.rate-badge {
    display: inline-block;
    background: var(--gradient-red);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    margin-bottom: 8px;
}

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

.rate-sub {
    font-size: 12px;
    color: var(--text-light);
}

.upgrade-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upgrade-text {
    font-size: 12px;
    color: var(--text-light);
    flex: 1;
}

.upgrade-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

/* Overseas Benefits */
.overseas-benefits {
    background: white;
    margin: 0 16px 24px; /* Extra bottom margin */
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.benefit-item {
    text-align: center;
}

.benefit-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 10px;
    font-weight: 500;
    color: white;
}

.benefit-icon.blue-circle {
    background: var(--gradient-blue);
}

.benefit-icon.teal-circle {
    background: var(--gradient-teal);
}

.benefit-icon.pink-circle {
    background: var(--gradient-pink);
}

.benefit-text {
    text-align: center;
    line-height: 1.2;
}

.benefit-label {
    font-size: 11px;
    color: var(--text-light);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    padding: 8px 0 safe-area-inset-bottom;
    z-index: 100;
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-item i {
    font-size: 18px;
    margin-bottom: 4px;
    display: block;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
}

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

.nav-item:not(.active) {
    color: var(--text-lighter);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-light);
    z-index: 1001; /* Higher than bottom nav */
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-header {
    background: white;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 430px;
    margin: 0 auto;
}

.back-button {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    font-size: 16px;
    cursor: pointer;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    padding-bottom: 100px; /* Space for bottom nav */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    max-height: calc(100vh - 60px); /* Account for modal header */
    min-height: 0; /* Allow flexbox to shrink */
    max-width: 430px;
    margin: 0 auto;
}

/* Favorites Section */
.favorites-section {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.favorites-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
}

.fav-item {
    text-align: center;
}

.fav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 14px;
    color: white;
}

.fav-item.edit {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-light);
}

/* Recent Section */
.recent-section {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.recent-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.recent-item {
    text-align: center;
    cursor: pointer;
}

.recent-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 16px;
    color: white;
}

.recent-icon.yellow {
    background: var(--gradient-yellow);
}

.recent-icon.blue {
    background: var(--gradient-blue);
}

.recent-icon.orange {
    background: var(--gradient-orange);
}

.recent-icon.red {
    background: var(--gradient-red);
}

.recent-icon.purple {
    background: var(--gradient-purple);
}

.recent-icon.green {
    background: var(--gradient-green);
}

.recent-icon.gray {
    background: linear-gradient(135deg, #8c8c8c 0%, #595959 100%);
}

.recent-item span {
    font-size: 11px;
    color: var(--text-dark);
    line-height: 1.2;
}

/* Recommend Section */
.recommend-section {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.recommend-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.recommend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.recommend-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.recommend-icon.yellow {
    background: var(--gradient-yellow);
}

.recommend-icon.blue {
    background: var(--gradient-blue);
}

.recommend-icon.green {
    background: var(--gradient-green);
}

.recommend-icon.red {
    background: var(--gradient-red);
}

.recommend-text {
    flex: 1;
}

.recommend-title {
    font-size: 12px;
    color: var(--text-dark);
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
}

.recommend-category {
    font-size: 10px;
    color: var(--text-lighter);
}

/* Tabs Section */
.tabs-section {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.tabs {
    display: flex;
    margin-bottom: 16px;
    background: var(--bg-gray);
    border-radius: 8px;
    padding: 4px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow);
}

.tab:not(.active) {
    color: var(--text-light);
}

.services-expanded-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.service-expanded-item {
    text-align: center;
    cursor: pointer;
}

.service-expanded-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 16px;
    color: white;
}

.service-expanded-icon.orange {
    background: var(--gradient-orange);
}

.service-expanded-icon.blue {
    background: var(--gradient-blue);
}

.service-expanded-icon.green {
    background: var(--gradient-green);
}

.service-expanded-icon.red {
    background: var(--gradient-red);
}

.service-expanded-icon.yellow {
    background: var(--gradient-yellow);
}

.service-expanded-icon.teal {
    background: var(--gradient-teal);
}

.service-expanded-icon.purple {
    background: var(--gradient-purple);
}

.service-expanded-icon.pink {
    background: var(--gradient-pink);
}

.service-expanded-item span {
    font-size: 11px;
    color: var(--text-dark);
    line-height: 1.2;
}

/* Responsive */
@media (max-width: 375px) {
    .action-grid {
        gap: 12px;
    }
    
    .action-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .services-grid {
        gap: 16px;
    }
    
    .service-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .service-label {
        font-size: 10px;
    }
}

/* Safe area for notched devices */
@supports (padding-bottom: safe-area-inset-bottom) {
    .bottom-nav {
        padding-bottom: calc(8px + safe-area-inset-bottom);
    }
    
    body {
        padding-bottom: calc(80px + safe-area-inset-bottom);
    }
}

/* Animation for modal */
.modal.active {
    opacity: 1;
}

/* Utility classes */
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* Hide scrollbar but maintain functionality */
.modal-body::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.modal-body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Force hardware acceleration for smooth scrolling */
.modal-body {
    transform: translateZ(0);
    will-change: scroll-position;
} 