/* ============================================
   MOBILE APP UI - Light Theme
   ============================================ */

/* CRITICAL: Ensure body and html are properly sized for mobile */
html.mobile-app,
body.mobile-app {
    width: 100%;
    max-width: 100vw;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh; /* Dynamic viewport height for mobile */
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Ensure desktop AI agent widget is visible when NOT in mobile app */
/* This applies to both desktop and mobile browsers (but not mobile app) */
body:not(.mobile-app) .ai-agent-widget {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure widget is visible on mobile browsers (responsive) */
@media (max-width: 768px) {
    body:not(.mobile-app) .ai-agent-widget {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 99999 !important;
    }
}

/* Mobile App Detection */
.mobile-app {
    padding-bottom: 80px;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    max-height: 100vh;
    max-height: 100dvh; /* Dynamic viewport height for mobile */
    width: 100%;
    max-width: 100vw;
    background: #fefefe;
    overflow-x: hidden; /* Prevent horizontal scroll */
    box-sizing: border-box;
}

/* Hide desktop AI agent widget in mobile app (use mobile version instead) */
.mobile-app .ai-agent-widget {
    display: none !important;
}

/* Hide desktop navigation in mobile app */
.mobile-app .navbar-dark {
    display: none !important;
}

.mobile-app .footer-dark {
    display: none !important;
}

/* Hide desktop main content sections in mobile app */
.mobile-app .main-content-dark .section:not(.mobile-stocks-container) {
    display: none !important;
}

.mobile-app .main-content-dark .header-section-dark {
    display: none !important;
}

.mobile-app .main-content-dark .premium-banner {
    display: none !important;
}

.mobile-app .main-content-dark #bestStocksSection {
    display: none !important;
}

.mobile-app .main-content-dark .stocks-table {
    display: none !important;
}

.mobile-app .main-content-dark .table-container {
    display: none !important;
}

/* Mobile Header - Light Theme */
.mobile-header {
    display: none;
    background: #fefefe;
    border-bottom: 1px solid #e5e7eb;
    padding: var(--space-md) var(--space-lg);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(20px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-app .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: #1f2937;
}

.mobile-header-logo img {
    height: 32px;
    width: auto;
}

.mobile-header-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: #1f2937;
}

.mobile-header-search-btn {
    display: none; /* Removed - search is available in bottom navigation */
}

/* Bottom Navigation - Modern iOS Style */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* Modern iOS: Semi-transparent with strong blur */
    background: rgba(251, 251, 253, 0.8); /* iOS system background with transparency */
    border-top: 0.5px solid rgba(60, 60, 67, 0.29); /* Subtle border like iOS */
    z-index: var(--z-fixed);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    /* Strong blur for modern iOS glass effect */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    /* Subtle shadow for depth */
    box-shadow: 0 -0.5px 0 rgba(0, 0, 0, 0.1);
}

.mobile-app .bottom-nav {
    display: flex;
}

.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    width: 100%;
    padding: 0 8px; /* Consistent padding like iOS */
    height: 49px; /* Standard iOS tab bar height (49pt) */
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px; /* Tight gap between icon and label like iOS */
    flex: 1;
    padding: 6px 8px; /* Modern iOS spacing */
    background: none;
    border: none;
    color: rgba(60, 60, 67, 0.85); /* Darker text for better visibility */
    cursor: pointer;
    transition: color 0.2s ease, transform 0.1s ease;
    text-decoration: none;
    min-width: 0;
    position: relative;
    /* Ensure minimum touch target (44x44pt iOS standard) */
    min-height: 44px;
    min-width: 44px;
}

.bottom-nav-item:active {
    transform: scale(0.96);
    opacity: 0.6;
}

.bottom-nav-item.active {
    color: #007AFF; /* iOS system blue */
}

.bottom-nav-item-icon {
    width: 28px; /* iOS standard icon size */
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.bottom-nav-item-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    /* Darker icons for better visibility */
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bottom-nav-item.active .bottom-nav-item-icon img {
    /* Modern iOS: Active icons are fully opaque and slightly larger */
    opacity: 1;
    transform: scale(1.05);
}

.bottom-nav-item-label {
    font-size: 10px; /* iOS standard label size (10pt) */
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    letter-spacing: -0.01em; /* Slight letter spacing like iOS */
    line-height: 1.2;
}

/* Modern iOS: Removed top bar indicator - uses filled icon style instead */
/* Active state is now handled by icon opacity and color change */

/* Tab Content Areas */
.tab-content {
    display: none;
    width: 100%;
    min-height: calc(100vh - 60px - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fefefe;
}

.tab-content.active {
    display: block;
}

/* Chat tab content should fill available space without scrolling */
.tab-content#chatTabContent {
    display: none;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    background: #fefefe;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Account for mobile header if visible */
    padding-top: env(safe-area-inset-top, 0px);
}

.tab-content#chatTabContent.active {
    display: flex;
    flex-direction: column;
}

/* Mobile Stock Cards - Light Theme */
.mobile-stock-card {
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-stock-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mobile-stock-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.mobile-stock-company {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.mobile-stock-rank {
    font-size: 14px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 12px;
    border-radius: 12px;
}

.mobile-stock-period {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 12px;
    padding: 4px 8px;
    background: #f9fafb;
    border-radius: 6px;
    display: inline-block;
}

.mobile-stock-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.mobile-stock-metric {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
}

.mobile-stock-metric-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.mobile-stock-metric-value {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.mobile-stock-premium-scores {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e5e7eb;
    width: 100%;
    box-sizing: border-box;
}

.mobile-stock-score {
    text-align: center;
    background: #f9fafb;
    padding: 10px 4px;
    border-radius: 8px;
    min-width: 0;
    overflow: hidden;
}

.mobile-stock-score-label {
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-stock-score-value {
    font-size: 16px;
    font-weight: 700;
    color: #0F62FE;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Home Page Search - Modern iOS Style */
.home-search-container {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: #fefefe;
    position: relative;
}

.home-search-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    min-height: calc(100vh - 120px); /* Full height minus header and bottom nav */
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.home-search-container.focused .home-search-wrapper {
    padding: 1.5rem 1.5rem 0.5rem;
    min-height: auto;
    align-items: flex-start;
}

.home-search-box-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    display: flex;
    align-items: center;
}

.home-search-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.7;
}

.home-search-input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 16px;
    color: #1f2937;
    font-size: 17px;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.home-search-input:focus {
    border-color: #0F62FE;
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.15);
}

.home-search-input::placeholder {
    color: #9ca3af;
}

.home-search-results {
    padding: 0 1.5rem 1rem;
    display: none;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.home-search-results:not(:empty) {
    display: flex;
}

.home-search-results .search-result-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.home-search-results .search-result-item:active {
    transform: scale(0.98);
    background: #f9fafb;
}

/* Search Tab - Light Theme */
.search-tab-content {
    padding: 16px;
    background: #fefefe;
}

.search-input-container {
    position: relative;
    margin-bottom: 16px;
}

.search-input-mobile {
    width: 100%;
    padding: 12px 16px 12px 48px;
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    color: #1f2937;
    font-size: 16px;
    outline: none;
}

.search-input-mobile:focus {
    border-color: #0F62FE;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

.search-input-mobile::placeholder {
    color: #9ca3af;
}

.search-icon-mobile {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.7;
}

.search-results-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-result-item {
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-item:active {
    transform: scale(0.98);
    background: #f9fafb;
}

/* Unified Login Message - Centered */
.mobile-login-message-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 2rem 1rem;
    background: #fefefe;
}

.mobile-login-message-content {
    text-align: center;
    max-width: 320px;
    width: 100%;
}

.mobile-login-message-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mobile-login-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: #0F62FE;
}

.mobile-login-loading-spinner svg {
    width: 100%;
    height: 100%;
    animation: mobile-login-spin 1.5s linear infinite;
}

@keyframes mobile-login-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.mobile-login-message-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.mobile-login-message-text {
    font-size: 0.9375rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.mobile-premium-cta-btn {
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #0F62FE 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.3);
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-premium-cta-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(15, 98, 254, 0.25);
}

/* Best Stocks Tab - Light Theme */
.best-stocks-tab-content {
    padding: 16px;
    background: #fefefe;
}

.best-stocks-category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.best-stocks-category-tabs::-webkit-scrollbar {
    display: none;
}

.best-stocks-category-tab {
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.best-stocks-category-tab.active {
    background: #0F62FE;
    border-color: #0F62FE;
    color: white;
}

/* Announcements Tab Styles */
.announcements-sentiment-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.announcements-sentiment-tabs::-webkit-scrollbar {
    display: none;
}

.announcements-sentiment-tab {
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.announcements-sentiment-tab.active {
    background: #0F62FE;
    border-color: #0F62FE;
    color: white;
}

.announcements-list-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 16px 16px;
}

.announcement-card-mobile {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.announcement-card-mobile:active {
    transform: scale(0.98);
    opacity: 0.9;
}

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

.announcement-company-name {
    font-weight: 600;
    font-size: 1rem;
    color: #1f2937;
    flex: 1;
    min-width: 0;
}

.announcement-company-name.clickable {
    color: #0F62FE;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.announcement-company-name.clickable:active {
    opacity: 0.7;
}

.announcement-sentiment-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.announcement-sentiment-badge.positive {
    background: #d1fae5;
    color: #065f46;
}

.announcement-sentiment-badge.negative {
    background: #fee2e2;
    color: #991b1b;
}

.announcement-headline {
    font-size: 0.9375rem;
    color: #374151;
    margin-bottom: 8px;
    line-height: 1.5;
}

.announcement-summary-container {
    margin-bottom: 12px;
}

.announcement-summary {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
    margin-bottom: 4px;
}

.announcement-summary-toggle {
    background: none;
    border: none;
    color: #0F62FE;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    margin-top: 4px;
    margin-left: -8px;
    border-radius: 4px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.announcement-summary-toggle:hover {
    background-color: rgba(15, 98, 254, 0.05);
}

.announcement-summary-toggle:active {
    background-color: rgba(15, 98, 254, 0.1);
    opacity: 0.8;
}

.announcement-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8125rem;
    color: #9ca3af;
}

.announcement-time {
    flex: 1;
}

.announcement-view-link {
    color: #0F62FE;
    text-decoration: none;
    font-weight: 500;
}

.announcement-view-link:active {
    opacity: 0.7;
}

.announcements-pagination {
    padding: 16px;
    display: flex;
    justify-content: center;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 44px;
}

.pagination-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.pagination-btn.active {
    background: #0F62FE;
    border-color: #0F62FE;
    color: white;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #9ca3af;
}

.best-stocks-grid-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.best-stock-card-mobile {
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.best-stock-card-mobile:active {
    transform: scale(0.98);
    background: #f9fafb;
}

.best-stock-rank-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #0F62FE 0%, #0043CE 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.875rem;
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(15, 98, 254, 0.3);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.best-stock-card-mobile:hover .best-stock-rank-badge {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.4);
}

.best-stock-card-mobile:active .best-stock-rank-badge {
    transform: scale(0.95);
}

/* Social Share Buttons */
.mobile-share-btn {
    transition: all 0.2s ease;
}

.mobile-share-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mobile-share-btn:active {
    transform: translateY(0);
    opacity: 0.8;
}

.mobile-share-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block;
}

/* Profile Tab - Light Theme */
.profile-tab-content {
    padding: 16px;
    background: #fefefe;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 32px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #0F62FE;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: white;
}

.profile-email {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.profile-premium-badge {
    padding: 4px 16px;
    background: #10B981;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.profile-action-btn {
    width: 100%;
    padding: 16px;
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    color: #1f2937;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.profile-action-btn:active {
    transform: scale(0.98);
    background: #f9fafb;
}

.profile-action-btn.primary {
    background: #0F62FE;
    border-color: #0F62FE;
    color: white;
}

.profile-action-btn.danger {
    background: #EF4444;
    border-color: #EF4444;
    color: white;
}

/* Mobile Login Modal - Light Theme */
.mobile-login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.mobile-login-modal-content {
    background: #fefefe;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.mobile-login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.mobile-login-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.mobile-login-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-auth-error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.mobile-btn {
    width: 100%;
    padding: 14px 20px; /* More horizontal padding for better balance */
    border-radius: 12px; /* Modern iOS rounded corners */
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px; /* More space between icon and text */
    min-height: 50px; /* iOS standard button height */
    box-sizing: border-box;
    position: relative;
}

/* Google Sign-In Button - Modern iOS Style */
.mobile-btn-google {
    background: #ffffff;
    border: 1px solid rgba(60, 60, 67, 0.18); /* Subtle border like iOS */
    color: #3c3c43; /* iOS text color */
    font-weight: 500;
    min-height: 50px; /* iOS standard button height */
    /* Modern iOS shadow for depth */
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 0 1px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

/* Press effect overlay */
.mobile-btn-google::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.15s ease;
    pointer-events: none;
}

.mobile-btn-google:active::before {
    background: rgba(0, 0, 0, 0.06); /* iOS-style press effect */
}

.mobile-btn-google:active {
    background: #f5f5f7; /* Slightly darker on press */
    transform: scale(0.98); /* Subtle press animation */
    box-shadow: 
        0 0.5px 2px rgba(0, 0, 0, 0.06),
        0 0 0.5px rgba(0, 0, 0, 0.03);
}

.mobile-btn-google:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Google icon styling */
.mobile-btn-google svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

/* Button text */
.mobile-btn-google span {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.01em; /* iOS typography */
    color: #3c3c43;
}

/* Ensure icon and text are properly aligned */
.mobile-btn-google {
    align-items: center;
    justify-content: center;
}

.mobile-btn-primary {
    background: #0F62FE;
    color: white;
}

.mobile-btn-primary:active {
    background: #0050E6;
}

/* Loading state for primary buttons (modern iOS style) */
.mobile-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.mobile-btn-primary.loading {
    position: relative;
    color: transparent; /* Hide text when loading */
}

.mobile-btn-primary.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Unified Login Button - Standardized across all contexts */
.mobile-login-btn {
    padding: 0.75rem 1.5rem;
    background: #0F62FE;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    min-height: 44px; /* Apple HIG minimum touch target */
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
    transition: all 0.2s;
    text-align: center;
    box-sizing: border-box;
}

.mobile-login-btn:active {
    background: #0050E6;
    transform: scale(0.98);
}

.mobile-login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Context-specific variations (optional, for special cases) */
.mobile-login-btn--full-width {
    max-width: 100%;
}

.mobile-login-btn--compact {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.mobile-form-group {
    margin-bottom: 16px;
}

.mobile-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.mobile-form-group input {
    width: 100%;
    padding: 12px;
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #1f2937;
    font-size: 16px;
    outline: none;
}

.mobile-form-group input:focus {
    border-color: #0F62FE;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

/* Stock Detail - Light Theme */
.stock-detail-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fefefe;
    z-index: 1050; /* Modal level - but bottom nav (1060) will be above it */
    overflow-y: auto;
    padding-bottom: 100px; /* Increased to ensure space for bottom nav */
}

.stock-detail-mobile.active {
    display: block;
}

.stock-detail-header-mobile {
    position: sticky;
    top: 0;
    background: #fefefe;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px;
    z-index: var(--z-sticky);
    backdrop-filter: blur(20px);
}

.stock-detail-content-mobile {
    padding: 0; /* No padding - fullscreen */
    background: #fefefe;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.stock-detail-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fefefe;
    border-top: 1px solid #e5e7eb;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 1060; /* Higher than stock detail (1050) to ensure it's visible */
    display: none;
    gap: 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Show bottom nav when stock detail is active - using JavaScript to control display */
.stock-detail-mobile.active ~ .stock-detail-bottom-nav,
.stock-detail-mobile.active + .stock-detail-bottom-nav {
    display: flex;
}

.stock-detail-btn {
    flex: 1;
    padding: 12px 16px;
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.stock-detail-btn-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stock-detail-btn-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Chat page layout */
/* Chat Page Container - Fits within tab content */
.chat-page-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    background: #fefefe;
    overflow: hidden;
    /* Keep container fixed - never move */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Use viewport height */
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    /* Prevent any movement */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.chat-page-header {
    flex-shrink: 0;
    background: #fefefe;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    padding-top: max(0.75rem, env(safe-area-inset-top, 0.75rem));
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    /* Prevent header from moving with keyboard */
    position: sticky;
    top: 0;
}

.chat-back-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #1f2937;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 1.125rem;
    line-height: 1.4;
}

.chat-header-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
}

.chat-page-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    background: #fefefe;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    /* Prevent messages area from moving when keyboard opens */
    position: relative;
    /* Ensure it takes remaining space */
    height: 0; /* Force flex to work */
}

.chat-page-input-container {
    flex-shrink: 0;
    background: #fefefe;
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0.75rem));
    /* Keep input container at bottom, will be repositioned by JS when keyboard opens */
    position: relative;
    z-index: 100;
}

/* When keyboard is open, fix input container at bottom of visual viewport */
.chat-page-container.keyboard-open .chat-page-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0.75rem));
    /* Remove gap - input should be right above keyboard */
    margin-bottom: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Hide bottom nav when chat tab is active */
.mobile-app .tab-content#chatTabContent.active ~ .bottom-nav,
.mobile-app .tab-content#chatTabContent.active ~ * .bottom-nav {
    display: none !important;
}

.stock-detail-btn:active {
    transform: scale(0.98);
}

.stock-detail-btn.primary {
    background: #0F62FE;
    border-color: #0F62FE;
    color: white;
}

/* Chat Interface - Light Theme */
.chat-interface-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fefefe;
    z-index: calc(var(--z-modal) + 10);
    flex-direction: column;
}

.chat-interface-mobile.active {
    display: flex;
}

.chat-header-mobile {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fefefe;
}

.chat-header-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #1f2937;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

.chat-messages-mobile {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.ai {
    align-self: flex-start;
}

.chat-message-bubble {
    padding: 12px;
    border-radius: 12px;
    font-size: 16px;
    line-height: 1.5;
}

.chat-message.user .chat-message-bubble {
    background: #0F62FE;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.ai .chat-message-bubble {
    background: #fefefe;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.chat-input-container-mobile {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    background: #fefefe;
    display: flex;
    gap: 8px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.chat-input-mobile {
    flex: 1;
    padding: 12px;
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    color: #1f2937;
    font-size: 16px;
    outline: none;
}

.chat-send-btn {
    padding: 12px 24px;
    background: #0F62FE;
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #0F62FE;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    text-align: center;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.empty-state-message {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
}

/* Premium Lock */
.premium-lock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    text-align: center;
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin: 16px;
}

.premium-lock-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.premium-lock-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.premium-lock-message {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 16px;
    line-height: 1.6;
}

/* Mobile Stocks List Container */
.mobile-stocks-list {
    padding: 16px;
    background: #fefefe;
}

/* ============================================
   Stock Market Ticker - Modern iOS Style
   ============================================ */
.mobile-stock-ticker {
    position: relative;
    width: 100%;
    background: #ffffff;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 48px;
    display: flex;
    align-items: center;
}

.mobile-ticker-scroll {
    flex: 1;
    overflow: hidden; /* Hide overflow for seamless scroll */
    height: 100%;
    mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    position: relative;
}

.mobile-ticker-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.mobile-ticker-content {
    display: inline-flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
    padding: 0 16px;
    will-change: transform; /* Optimize for animation */
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%); /* Move half width (since content is duplicated) */
    }
}

.mobile-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    height: 100%;
    font-size: 13px;
    font-weight: 500;
    color: #1d1d1f;
    border-right: 0.5px solid rgba(0, 0, 0, 0.08);
}

.mobile-ticker-item:last-child {
    border-right: none;
}

.mobile-ticker-name {
    font-weight: 600;
    color: #1d1d1f;
    min-width: 80px;
}

.mobile-ticker-price {
    font-weight: 600;
    color: #1d1d1f;
    min-width: 85px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.mobile-ticker-change {
    font-weight: 600;
    min-width: 90px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.mobile-ticker-change.positive {
    color: #34c759; /* iOS green */
}

.mobile-ticker-change.negative {
    color: #ff3b30; /* iOS red */
}

/* Loading indicator */
.mobile-ticker-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10;
}

.mobile-ticker-loader-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #007AFF;
    margin: 0 3px;
    animation: ticker-pulse 1.4s ease-in-out infinite;
}

.mobile-ticker-loader-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.mobile-ticker-loader-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ticker-pulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mobile-app {
        padding-bottom: 80px;
    }
    
    .tab-content {
        min-height: calc(100vh - 60px - 80px);
    }
}

/* Safe area support for notched devices */
@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
    }
    
    .stock-detail-bottom-nav {
        padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
    }
    
    .chat-input-container-mobile {
        padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
    }
    
    .mobile-ai-chat-input-container {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .mobile-ai-agent-chat-header {
        padding-top: max(0.75rem, env(safe-area-inset-top));
    }
}

/* Mobile AI Agent Chat Widget - ChatGPT-like (Only on stock detail page) */
.mobile-ai-agent-widget {
    position: fixed;
    bottom: 80px; /* Above bottom nav */
    right: 20px;
    z-index: 10000;
    display: none; /* Hidden by default, shown only on stock detail page */
    flex-direction: column;
    align-items: flex-end;
    /* Non-movable - fixed position */
    touch-action: none;
}

.mobile-ai-agent-avatar-btn {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.mobile-ai-agent-avatar-btn:active {
    transform: scale(0.95);
}

.mobile-ai-agent-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(15, 98, 254, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
}

/* Typing indicator animation (like ChatGPT, WhatsApp) */
@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.mobile-ai-agent-chat-box {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Fullscreen Chat Box (for stock detail page) - ChatGPT-like */
.mobile-ai-agent-chat-box-fullscreen {
    position: fixed;
    top: 0 !important; /* Force top: 0 to prevent being pushed up */
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    width: 100dvw !important; /* Dynamic viewport width for mobile browsers */
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile browsers (accounts for address bar) */
    max-width: 100vw !important;
    max-width: 100dvw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    background: #fefefe !important; /* Solid background to cover everything */
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: none; /* Hidden by default, shown when opened */
    flex-direction: column;
    z-index: 99999 !important; /* Very high z-index to ensure it's above everything */
    overflow: hidden;
    /* Non-movable - fixed position */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    /* Prevent overflow */
    box-sizing: border-box;
    margin: 0 !important;
    padding: 0 !important;
    /* Ensure it covers entire viewport regardless of scroll position */
    transform: translateZ(0) translateY(0) !important; /* Force hardware acceleration and position */
    -webkit-transform: translateZ(0) translateY(0) !important;
    /* Ensure it stays at top: 0 even when body is fixed */
    inset: 0 !important; /* Modern way to set top/right/bottom/left to 0 */
    /* Prevent any scrolling or movement */
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Prevent body/html scrolling when chat is open - ONLY for mobile app */
/* This rule only applies when body has mobile-app class to avoid affecting desktop */
body.mobile-app.chat-open,
html.mobile-app.chat-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

.mobile-ai-chat-container-fullscreen {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem; /* Reduced vertical padding from 1rem to 0.75rem */
    background: #fefefe;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flex scrolling */
    scroll-behavior: smooth; /* Smooth scrolling */
}

.mobile-ai-agent-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem; /* Reduced vertical padding from 1rem to 0.75rem */
    padding-top: max(0.75rem, env(safe-area-inset-top, 0.75rem)); /* Safe area for notch */
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    cursor: default; /* Not draggable - ChatGPT-like */
    flex-shrink: 0; /* Prevent shrinking */
}

.mobile-ai-agent-chat-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #1f2937;
}

.mobile-ai-agent-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem; /* Increased padding for larger touch target */
    width: 44px; /* Increased from 24px to 44px (Apple HIG minimum) */
    height: 44px; /* Increased from 24px to 44px (Apple HIG minimum) */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.mobile-ai-agent-close-btn:active {
    background-color: #f3f4f6;
}

.mobile-ai-chat-container {
    height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: #fefefe;
}

.mobile-ai-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Reduced from 1rem to 0.75rem (12px) - better spacing */
}

/* Custom scrollbar styling for better UX */
.mobile-ai-chat-container-fullscreen::-webkit-scrollbar {
    width: 4px;
}

.mobile-ai-chat-container-fullscreen::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-ai-chat-container-fullscreen::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.mobile-ai-chat-container-fullscreen::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.mobile-ai-message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mobile-ai-message-user {
    justify-content: flex-end;
}

.mobile-ai-message-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
}

.mobile-ai-message-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.mobile-ai-message-content {
    flex: 1;
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
}

.mobile-ai-message-content p {
    margin: 0;
    white-space: pre-wrap;
}

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

.mobile-ai-message-bot .mobile-ai-message-content {
    background: #f0f0f0; /* Changed from #f9fafb to #f0f0f0 - better contrast */
    color: #1f2937;
    border-bottom-left-radius: 0.25rem; /* Smaller radius on bottom-left (like WhatsApp) */
}

.mobile-ai-message-user .mobile-ai-message-content {
    background: #0F62FE;
    color: white;
    border-bottom-right-radius: 0.25rem; /* Smaller radius on bottom-right (like WhatsApp) */
}

.mobile-ai-chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    border-top: 1px solid #e5e7eb;
    background: #fefefe;
    flex-shrink: 0; /* Prevent shrinking */
}

.mobile-ai-chat-input {
    flex: 1;
    padding: 0.875rem 1rem; /* Increased padding for better touch experience */
    border: 1px solid #e5e7eb;
    border-radius: 1.25rem; /* Increased from 0.5rem to 1.25rem (20px) - more modern */
    font-size: 1rem; /* Increased from 0.875rem to 1rem (16px) - prevents iOS zoom */
    background: #fefefe;
    color: #1f2937;
    outline: none;
    min-height: 44px; /* Minimum touch target size (Apple HIG) */
    box-sizing: border-box;
}

.mobile-ai-chat-input:focus {
    border-color: #0F62FE;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

.mobile-ai-chat-send-btn {
    padding: 0.875rem 1.25rem; /* Increased padding */
    background: #0F62FE;
    color: white;
    border: none;
    border-radius: 1.25rem; /* Match input border radius */
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem; /* Increased from 0.875rem to 1rem */
    min-width: 60px; /* Ensure adequate width */
    min-height: 44px; /* Minimum touch target size (Apple HIG) */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
}

.mobile-ai-chat-send-btn:active {
    transform: scale(0.95);
    background: #0d56e0;
}

.mobile-ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chart Indicators Dropdown */
.mobile-indicators-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    background: #fefefe;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
}

.mobile-indicators-dropdown label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    user-select: none;
    transition: background-color 0.2s;
}

.mobile-indicators-dropdown label:hover {
    background-color: #f9fafb;
}

.mobile-indicators-dropdown input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Chart Action Buttons */
.mobile-chart-action-btn {
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-chart-action-btn:hover {
    background: #e5e7eb;
}

.mobile-chart-action-btn:active {
    transform: scale(0.98);
}

/* Info Indicator Buttons */
.mobile-info-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s;
}

.mobile-info-indicator:hover {
    background: #d1d5db;
    color: #1f2937;
}

.mobile-info-indicator:active {
    transform: scale(0.95);
}

/* Info Modal */
#mobileInfoModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#mobileInfoModal > div {
    background: #fefefe;
    border-radius: 0.75rem;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

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

.mobile-info-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    border: none;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.mobile-info-modal-close:hover {
    background: #d1d5db;
    color: #1f2937;
}
