/* ===================================
   BIAS - COMPREHENSIVE MOBILE RESPONSIVE STYLES
   Optimized for all devices and screen sizes
   =================================== */

/* ===================================
   BASE MOBILE OPTIMIZATIONS
   =================================== */

/* Touch-friendly targets (minimum 44px) */
@media (max-width: 768px) {
    button, 
    .btn, 
    a.btn,
    .nav-link,
    .nav-pill,
    input[type="submit"],
    input[type="button"],
    .clickable,
    .tab-btn,
    .toggle-switch {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Improve text readability */
    body {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }
    
    /* Better tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(0, 240, 255, 0.2);
    }
}

/* ===================================
   PREMIUM TOP NAV - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .premium-top-nav .nav-container {
        padding: 10px 16px;
        gap: 10px;
    }
    
    .premium-top-nav .nav-left-section {
        gap: 8px;
    }
    
    .premium-top-nav .brand-logo {
        padding: 6px 10px 6px 6px;
        gap: 8px;
        border-radius: 10px;
    }
    
    .premium-top-nav .brand-icon {
        width: 34px;
        height: 34px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    .premium-top-nav .brand-title {
        font-size: 16px;
        letter-spacing: 2px;
    }
    
    .premium-top-nav .brand-subtitle {
        display: none;
    }
    
    .premium-top-nav .nav-divider {
        display: none;
    }
    
    .premium-top-nav .gamification-badges {
        display: none;
    }
    
    .premium-top-nav .nav-center-section {
        display: none;
    }
    
    .premium-top-nav .live-indicator {
        display: none;
    }
    
    .premium-top-nav .user-details {
        display: none;
    }
    
    .premium-top-nav .user-profile {
        padding: 4px;
        border-radius: 10px;
    }
    
    .premium-top-nav .user-avatar-ring {
        width: 36px;
        height: 36px;
        position: relative;
        flex-shrink: 0;
    }
    
    /* Scale the SVG properly on mobile */
    .premium-top-nav .user-avatar-ring .avatar-progress,
    .premium-top-nav .avatar-progress {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        transform: rotate(-90deg);
    }
    
    /* Adjust SVG circle stroke for smaller size */
    .premium-top-nav .progress-bg,
    .premium-top-nav .progress-fill {
        stroke-width: 2.5;
    }
    
    .premium-top-nav .avatar-inner {
        width: 26px;
        height: 26px;
        font-size: 11px;
        font-weight: 700;
        border-radius: 6px;
        /* Ensure proper centering */
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(176, 38, 255, 0.2));
        color: var(--electric-blue, #00F0FF);
        line-height: 1;
    }
    
    .premium-top-nav .notification-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 14px;
    }
    
    .premium-top-nav .settings-btn {
        width: 32px;
        height: 32px;
    }
    
    /* Dropdowns full width on mobile */
    .premium-top-nav .notifications-dropdown,
    .premium-top-nav .user-menu-dropdown {
        position: fixed;
        width: calc(100vw - 20px);
        left: 10px;
        right: 10px;
        max-height: 70vh;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .premium-top-nav .nav-container {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .premium-top-nav .brand-logo {
        padding: 5px 8px 5px 5px;
    }
    
    .premium-top-nav .brand-icon {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .premium-top-nav .brand-title {
        font-size: 14px;
        letter-spacing: 1px;
    }
    
    .premium-top-nav .notification-btn {
        width: 34px;
        height: 34px;
    }
    
    .premium-top-nav .user-avatar-ring {
        width: 34px;
        height: 34px;
        flex-shrink: 0;
    }
    
    /* Adjust SVG circle stroke for smaller size */
    .premium-top-nav .progress-bg,
    .premium-top-nav .progress-fill {
        stroke-width: 2;
    }
    
    .premium-top-nav .avatar-inner {
        width: 24px;
        height: 24px;
        font-size: 10px;
        border-radius: 5px;
    }
}

/* ===================================
   BOTTOM NAV - MOBILE OPTIMIZED
   =================================== */

@media (max-width: 968px) {
    .bottom-nav,
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(10, 14, 26, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(0, 240, 255, 0.15);
        padding: 8px 12px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        z-index: 1000;
        justify-content: space-around;
        gap: 4px;
    }
    
    .bottom-nav a,
    .bottom-nav .nav-item,
    .bottom-nav .bottom-nav-item,
    .mobile-bottom-nav a,
    .mobile-bottom-nav .nav-item,
    .mobile-bottom-nav .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 12px;
        border-radius: 12px;
        text-decoration: none;
        color: var(--text-secondary, #a0aec0);
        font-size: 10px;
        font-weight: 500;
        transition: all 0.3s ease;
        flex: 1;
        max-width: 72px;
        min-height: 56px;
    }
    
    .bottom-nav a i,
    .bottom-nav .nav-item i,
    .bottom-nav .bottom-nav-item i,
    .mobile-bottom-nav a i,
    .mobile-bottom-nav .nav-item i,
    .mobile-bottom-nav .bottom-nav-item i {
        font-size: 20px;
        margin-bottom: 2px;
    }
    
    .bottom-nav a.active,
    .bottom-nav .nav-item.active,
    .bottom-nav .bottom-nav-item.active,
    .mobile-bottom-nav a.active,
    .mobile-bottom-nav .nav-item.active,
    .mobile-bottom-nav .bottom-nav-item.active {
        color: var(--electric-blue, #00F0FF);
        background: rgba(0, 240, 255, 0.12);
    }
    
    .bottom-nav a:hover,
    .bottom-nav .nav-item:hover,
    .bottom-nav .bottom-nav-item:hover,
    .mobile-bottom-nav a:hover,
    .mobile-bottom-nav .nav-item:hover,
    .mobile-bottom-nav .bottom-nav-item:hover {
        color: var(--electric-blue, #00F0FF);
        background: rgba(0, 240, 255, 0.08);
    }
    
    /* Add safe area for content above bottom nav */
    main,
    .dashboard-main,
    .page-content,
    .main-content,
    .subscriptions-main,
    .orb-main,
    .journal-main,
    .analytics-main,
    .settings-main,
    .levels-main,
    .xp-main,
    .marketplace-main,
    .algo-detail-main {
        padding-bottom: 80px !important;
    }
}

/* ===================================
   DASHBOARD - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .dashboard-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    /* Hide separate Passive Investments and Manual Trading sections on mobile */
    /* Keep only the Portfolio Allocation section visible */
    .combined-portfolio-grid {
        display: none !important;
    }
    
    .portfolio-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .welcome-title {
        font-size: 24px;
        line-height: 1.2;
    }
    
    .portfolio-selector {
        width: 100%;
    }
    
    .selector-btn {
        flex: 1;
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .portfolio-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .balance-main {
        font-size: 36px;
    }
    
    .portfolio-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .stat-item {
        padding: 12px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .orb-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .orb-card {
        padding: 16px;
    }
    
    .strategy-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .dashboard-main {
        padding: 12px 10px;
    }
    
    .welcome-title {
        font-size: 20px;
    }
    
    .balance-main {
        font-size: 28px;
    }
    
    .portfolio-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .chart-container {
        height: 200px;
    }
}

/* ===================================
   SIGNUP/ONBOARDING - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .signup-container {
        padding: 20px 16px;
    }
    
    .brand-header {
        margin-bottom: 24px;
    }
    
    .logo {
        font-size: 48px;
        letter-spacing: 4px;
    }
    
    .tagline {
        font-size: 13px;
        letter-spacing: 1px;
    }
    
    .progress-tracker {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 16px;
        justify-content: center;
    }
    
    .progress-step {
        flex: 0 1 auto;
    }
    
    .step-circle {
        width: 44px;
        height: 44px;
    }
    
    .step-circle i {
        font-size: 16px;
    }
    
    .step-label {
        font-size: 10px;
        display: none;
    }
    
    .step-sublabel {
        display: none;
    }
    
    .progress-line {
        width: 20px;
        height: 2px;
        margin: 0 4px;
    }
    
    .step-content {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .step-title {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .step-description {
        font-size: 14px;
        margin-bottom: 24px;
    }
    
    .signup-form {
        gap: 20px;
    }
    
    .form-group input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-row {
        flex-direction: column;
        gap: 20px;
    }
    
    .btn-primary,
    .btn-continue,
    .btn-complete {
        padding: 16px 24px;
        font-size: 15px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .signup-container {
        padding: 16px 12px;
    }
    
    .logo {
        font-size: 36px;
    }
    
    .tagline {
        font-size: 11px;
    }
    
    .step-content {
        padding: 20px 16px;
    }
    
    .step-title {
        font-size: 20px;
    }
    
    .step-description {
        font-size: 13px;
    }
}

/* ===================================
   JOURNAL PAGE - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .journal-container {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .journal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .journal-title {
        font-size: 24px;
    }
    
    .calendar-grid {
        gap: 4px;
    }
    
    .calendar-day {
        padding: 8px 4px;
        font-size: 12px;
        min-height: 40px;
    }
    
    .day-indicator {
        width: 6px;
        height: 6px;
    }
    
    .journal-filters {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100%;
    }
    
    .journal-entry {
        padding: 16px;
    }
    
    .entry-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .entry-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stat-card {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .calendar-day {
        padding: 6px 2px;
        font-size: 11px;
        min-height: 36px;
    }
    
    .journal-entry {
        padding: 12px;
    }
    
    .entry-stats {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   ANALYTICS PAGE - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .analytics-container,
    .analytics-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .analytics-title {
        font-size: 24px;
    }
    
    .time-filter-group {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .time-filter-group .btn-group {
        display: flex;
        gap: 4px;
    }
    
    .time-filter-group button {
        flex-shrink: 0;
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .metric-card {
        padding: 16px;
    }
    
    .metric-value {
        font-size: 24px;
    }
    
    .chart-section {
        padding: 16px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-value {
        font-size: 20px;
    }
    
    .chart-container {
        height: 200px;
    }
}

/* ===================================
   ORB PAGE - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .orb-container,
    .orb-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .orb-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .orb-title {
        font-size: 24px;
    }
    
    .orb-visualization {
        height: 250px;
        margin: 20px 0;
    }
    
    .orb-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .orb-stat-card {
        padding: 16px;
    }
    
    .orb-agents-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .agent-card {
        padding: 16px;
    }
    
    .conversation-container {
        max-height: 60vh;
    }
    
    .message-input-area {
        padding: 12px;
    }
    
    .message-input {
        padding: 12px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .orb-visualization {
        height: 200px;
    }
    
    .orb-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .orb-stat-value {
        font-size: 24px;
    }
}

/* ===================================
   SETTINGS PAGE - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .settings-container,
    .settings-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .settings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .settings-title {
        font-size: 24px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .settings-card {
        padding: 20px;
    }
    
    .settings-section {
        padding: 16px;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .setting-control {
        width: 100%;
    }
    
    .setting-control select,
    .setting-control input {
        width: 100%;
    }
    
    .toggle-group {
        width: 100%;
        justify-content: space-between;
    }
}

/* ===================================
   LEVELS & XP PAGES - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .levels-container,
    .xp-container,
    .levels-main,
    .xp-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .levels-header,
    .xp-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .level-badge-large {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    
    .level-progress-section {
        padding: 20px;
    }
    
    .xp-breakdown-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .rewards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .reward-card {
        padding: 16px;
    }
    
    .achievement-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .rewards-grid {
        grid-template-columns: 1fr;
    }
    
    .level-badge-large {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
}

/* ===================================
   ALGO MARKETPLACE - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .marketplace-container,
    .marketplace-main {
        padding: 80px 12px 90px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Header Section */
    .marketplace-header {
        margin-bottom: 20px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .header-title-section {
        width: 100%;
    }
    
    .back-to-dashboard-btn {
        padding: 8px 12px;
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .page-title {
        font-size: 24px;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .page-title i {
        font-size: 22px;
    }
    
    .page-subtitle {
        font-size: 14px;
    }
    
    .header-stats {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stat-badge {
        flex: 1;
        min-width: calc(50% - 5px);
        padding: 12px 14px;
        border-radius: 12px;
    }
    
    .stat-badge i {
        font-size: 18px;
    }
    
    .stat-badge .stat-value {
        font-size: 18px;
    }
    
    .stat-badge .stat-label {
        font-size: 10px;
    }
    
    /* Controls & Filters */
    .marketplace-controls {
        padding: 16px;
        border-radius: 16px;
        margin-bottom: 20px;
        gap: 14px;
    }
    
    .search-container {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
        padding: 14px 16px 14px 46px;
        font-size: 14px;
        border-radius: 10px;
    }
    
    .search-container i {
        left: 16px;
        font-size: 16px;
    }
    
    .filter-controls {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        flex-wrap: nowrap;
        gap: 8px;
    }
    
    .filter-dropdown {
        flex-shrink: 0;
    }
    
    .filter-btn {
        flex-shrink: 0;
        padding: 10px 14px;
        font-size: 12px;
        border-radius: 10px;
        white-space: nowrap;
    }
    
    .filter-dropdown-menu {
        min-width: 180px;
        padding: 10px;
        border-radius: 10px;
    }
    
    .active-filters {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 16px;
    }
    
    /* Strategy Cards Grid */
    .strategies-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .strategy-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .strategy-header {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .strategy-icon {
        width: 42px;
        height: 42px;
        font-size: 20px;
        border-radius: 10px;
    }
    
    .strategy-badge {
        padding: 5px 10px;
        font-size: 10px;
    }
    
    .strategy-name {
        font-size: 18px;
        margin: 10px 0 6px 0;
    }
    
    .strategy-type {
        font-size: 11px;
        margin-bottom: 10px;
    }
    
    .strategy-description {
        font-size: 13px;
        min-height: auto;
        margin-bottom: 16px;
        line-height: 1.5;
    }
    
    .strategy-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .stat-item {
        padding: 10px 8px;
        border-radius: 8px;
    }
    
    .stat-item .stat-label {
        font-size: 9px;
        margin-bottom: 3px;
    }
    
    .stat-item .stat-value {
        font-size: 14px;
    }
    
    .strategy-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .strategy-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 14px;
        border-radius: 10px;
    }
    
    .view-details-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 13px;
        border-radius: 10px;
        text-align: center;
    }
    
    /* Modal Adjustments */
    .modal-overlay {
        padding: 16px;
    }
    
    .modal-content {
        padding: 24px;
        border-radius: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-close {
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .marketplace-container,
    .marketplace-main {
        padding: 75px 10px 90px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .strategy-card {
        padding: 16px;
    }
    
    .strategy-stats {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 6px;
    }
    
    .stat-item {
        padding: 8px 6px;
    }
    
    .stat-item .stat-value {
        font-size: 13px;
    }
    
    .stat-badge {
        min-width: 100%;
    }
}

/* ===================================
   ALGO DETAIL PAGE - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .algo-detail-container,
    .algo-detail-main,
    .detail-container {
        padding: 80px 12px 90px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .algo-detail-header,
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .algo-detail-title {
        font-size: 24px;
    }
    
    .algo-detail-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .algo-detail-card {
        padding: 20px;
    }
    
    /* Performance Section Mobile */
    .performance-section {
        padding: 20px 16px;
        border-radius: 16px;
        margin-bottom: 20px;
    }
    
    .performance-section .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        margin-bottom: 16px;
    }
    
    .performance-section .section-header h2 {
        font-size: 18px;
        gap: 10px;
    }
    
    .performance-section .section-header h2 i {
        font-size: 16px;
    }
    
    /* Chart Tabs Mobile */
    .chart-tabs {
        width: 100%;
        display: flex;
        gap: 6px;
        padding: 3px;
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chart-tab {
        flex: 1;
        padding: 10px 12px;
        font-size: 13px;
        text-align: center;
        white-space: nowrap;
        border-radius: 6px;
    }
    
    /* Chart Container Mobile - Fixed height for proper rendering */
    .chart-container {
        position: relative;
        height: 280px !important;
        min-height: 280px;
        padding: 10px 0;
        width: 100%;
        overflow: hidden;
    }
    
    .chart-container canvas {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .performance-chart {
        height: 250px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* Statistics Section Mobile */
    .statistics-section,
    .risk-metrics-section,
    .parameters-section,
    .monthly-performance-section {
        padding: 20px 16px;
        border-radius: 16px;
        margin-bottom: 16px;
    }
    
    .section-title {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-card-header {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .stat-card-value {
        font-size: 20px;
    }
    
    .stat-card-subtitle {
        font-size: 11px;
    }
    
    /* Subscribe Section Fixed Bottom */
    .subscribe-section {
        position: fixed;
        bottom: 70px;
        left: 0;
        right: 0;
        background: rgba(10, 14, 26, 0.98);
        backdrop-filter: blur(20px);
        padding: 16px;
        border-top: 1px solid var(--border-color);
        z-index: 99;
    }
    
    .subscribe-btn {
        width: 100%;
        padding: 16px;
        font-size: 16px;
    }
    
    /* Monthly Performance Table Mobile */
    .monthly-performance-section .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .monthly-performance-section table {
        min-width: 500px;
    }
    
    /* Parameters Grid Mobile */
    .parameters-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .parameter-item {
        padding: 14px;
    }
}

@media (max-width: 480px) {
    .algo-detail-container,
    .algo-detail-main,
    .detail-container {
        padding: 75px 10px 90px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 240px !important;
        min-height: 240px;
    }
    
    .performance-chart {
        height: 200px;
    }
    
    .stat-card-value {
        font-size: 18px;
    }
    
    .chart-tab {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ===================================
   MY SUBSCRIPTIONS - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .subscriptions-container,
    .subscriptions-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .subscriptions-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .subscriptions-title {
        font-size: 24px;
    }
    
    .subscriptions-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .subscription-card {
        padding: 20px;
    }
    
    .subscription-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .subscription-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .subscription-actions .btn {
        width: 100%;
    }
}

/* ===================================
   LINK ACCOUNT PAGE - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .link-account-container,
    .link-account-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .link-account-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .link-account-title {
        font-size: 24px;
    }
    
    .broker-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .broker-card {
        padding: 20px;
    }
    
    .account-form {
        gap: 16px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* ===================================
   DAY DETAIL PAGE - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .day-detail-container,
    .day-detail-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .day-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .day-detail-title {
        font-size: 24px;
    }
    
    .day-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .trades-list {
        gap: 12px;
    }
    
    .trade-card {
        padding: 16px;
    }
    
    .trade-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .trade-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .day-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .trade-details {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   ORB AGENT DETAIL - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .agent-detail-container,
    .agent-detail-main {
        padding: 16px 12px;
        padding-bottom: 90px;
    }
    
    .agent-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .agent-avatar {
        width: 80px;
        height: 80px;
    }
    
    .agent-detail-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .capabilities-list {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* ===================================
   MODALS - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .modal,
    .modal-overlay {
        padding: 10px;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        margin: auto;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
    }
    
    .modal-body {
        padding: 20px;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .modal-footer,
    .modal-actions {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-footer .btn,
    .modal-actions .btn {
        width: 100%;
    }
}

/* ===================================
   CARDS & CONTAINERS - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .card,
    .premium-card,
    .glass-card,
    .stat-card,
    .info-card {
        padding: 16px;
        border-radius: 14px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .card-actions {
        width: 100%;
    }
    
    .card-actions .btn {
        flex: 1;
    }
}

/* ===================================
   TABLES - MOBILE ENHANCED (Card View)
   =================================== */

@media (max-width: 768px) {
    .data-table {
        display: block;
    }
    
    .data-table thead {
        display: none;
    }
    
    .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .data-table tr {
        display: flex;
        flex-direction: column;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 16px;
    }
    
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .data-table td:last-child {
        border-bottom: none;
    }
    
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 12px;
        text-transform: uppercase;
    }
}

/* ===================================
   FORMS - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        width: 100%;
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 10px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group-append {
        width: 100%;
    }
    
    .input-group-append .btn {
        width: 100%;
        border-radius: 10px;
        margin-top: 8px;
    }
}

/* ===================================
   BUTTONS - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .btn {
        padding: 14px 20px;
        font-size: 14px;
        border-radius: 10px;
        min-height: 48px;
    }
    
    .btn-sm {
        padding: 10px 14px;
        font-size: 12px;
        min-height: 40px;
    }
    
    .btn-lg {
        padding: 16px 24px;
        font-size: 16px;
        min-height: 52px;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* Horizontal scroll for button groups when needed */
    .btn-group.horizontal-scroll {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }
    
    .btn-group.horizontal-scroll .btn {
        flex-shrink: 0;
        width: auto;
    }
}

/* ===================================
   FAB BUTTON - MOBILE ENHANCED
   =================================== */

@media (max-width: 968px) {
    .fab-button {
        display: flex !important;
        position: fixed;
        bottom: 90px;
        right: 16px;
        width: 56px;
        height: 56px;
        border-radius: 28px;
        z-index: 99;
    }
    
    .fab-button i {
        font-size: 22px;
    }
    
    /* Adjust FAB when bottom nav is present */
    .fab-button.with-bottom-nav {
        bottom: 90px;
    }
}

/* ===================================
   SCROLLBAR - MOBILE OPTIMIZED
   =================================== */

@media (max-width: 768px) {
    /* Thin scrollbars for mobile */
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    
    ::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.2);
        border-radius: 2px;
    }
}

/* ===================================
   ANIMATIONS - OPTIMIZED FOR MOBILE
   =================================== */

@media (max-width: 768px) {
    /* Smooth, natural animation timing for mobile */
    
    /* Transitions - slightly faster but still smooth */
    .btn,
    .card,
    .nav-item,
    .bottom-nav a,
    .modal-content,
    .dropdown,
    .toggle-switch,
    a,
    button {
        transition-duration: 0.25s !important;
        transition-timing-function: ease-out !important;
    }
    
    /* Hover/active states - quick response */
    *:active {
        transition-duration: 0.1s !important;
    }
    
    /* Keyframe animations - moderate speed */
    .fade-in,
    .slide-in,
    .scale-in,
    [class*="animate"] {
        animation-duration: 0.4s !important;
        animation-timing-function: ease-out !important;
    }
    
    /* Pulse and glow effects - slower for subtlety */
    .pulse,
    .glow,
    .icon-pulse,
    [class*="pulse"],
    [class*="glow"] {
        animation-duration: 2.5s !important;
    }
    
    /* Loading spinners - keep normal speed */
    .spinner,
    .loading,
    [class*="spin"],
    [class*="loader"] {
        animation-duration: 1s !important;
    }
    
    /* Background animations - much slower for performance */
    .background-animation,
    .particle,
    .matrix-bg,
    #matrixContainer,
    .comet-follower {
        animation-duration: 12s !important;
    }
    
    /* Floating elements - gentle, slow movement */
    .float,
    [class*="float"] {
        animation-duration: 6s !important;
        animation-timing-function: ease-in-out !important;
    }
    
    /* Staggered entrance animations */
    .stagger-1 { animation-delay: 0.05s !important; }
    .stagger-2 { animation-delay: 0.1s !important; }
    .stagger-3 { animation-delay: 0.15s !important; }
    .stagger-4 { animation-delay: 0.2s !important; }
    .stagger-5 { animation-delay: 0.25s !important; }
    
    /* Modal and overlay animations */
    .modal-overlay,
    .modal-content {
        animation-duration: 0.3s !important;
        animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    /* Card hover effects - smooth */
    .card:hover,
    .orb-card:hover,
    .algo-card:hover,
    .strategy-card:hover {
        transition-duration: 0.3s !important;
    }
    
    /* Progress bars and charts */
    .progress-bar,
    .progress-fill,
    [class*="progress"] {
        transition-duration: 0.5s !important;
        transition-timing-function: ease-out !important;
    }
    
    /* Notification/toast animations */
    .toast,
    .notification,
    .alert {
        animation-duration: 0.35s !important;
    }
    
    /* ===== SPECIFIC ANIMATION OVERRIDES ===== */
    
    /* Premium icon pulse - slower, more subtle */
    .icon-pulse,
    .brand-icon .icon-pulse {
        animation: premiumIconPulse 3.5s ease-in-out infinite !important;
    }
    
    /* Live indicator pulse */
    .live-indicator::before,
    .live-dot {
        animation: premiumLivePulse 2.5s ease-in-out infinite !important;
    }
    
    /* Badge pulse - gentle */
    .badge,
    .notification-badge {
        animation: badgePulse 3s ease-in-out infinite !important;
    }
    
    /* Fire/flame flicker - slower */
    .streak-counter i,
    .fire-icon,
    [class*="fire"] {
        animation: flicker 2.5s ease-in-out infinite !important;
    }
    
    /* Shimmer effects - much slower */
    .shimmer,
    [class*="shimmer"] {
        animation: shimmer 4s ease-in-out infinite !important;
    }
    
    /* Step circle pulse */
    .step-circle.active::after {
        animation: pulse 3s ease-in-out infinite !important;
    }
    
    /* Logo glow */
    .logo-glow {
        animation: pulse 4s ease-in-out infinite !important;
    }
    
    /* ORB loading pulse */
    .orb-loading,
    [class*="orb-pulse"] {
        animation: orbLoadingPulse 2.5s ease-in-out infinite !important;
    }
    
    /* Checkmark pop - keep snappy but not too fast */
    .checkmark,
    .check-icon {
        animation: checkmarkPop 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    /* Shake animation - moderate */
    .shake,
    .error-shake {
        animation: shake 0.5s ease-in-out !important;
    }
    
    /* Spin/rotate - keep normal for loading */
    .spin,
    .rotating,
    .fa-spin {
        animation-duration: 1.2s !important;
    }
    
    /* Fade in animations - smooth entrance */
    [class*="fadeIn"],
    .fade-in-up,
    .fade-in-down {
        animation-duration: 0.4s !important;
        animation-timing-function: ease-out !important;
    }
    
    /* Glow line move - slower sweep */
    .glow-line,
    [class*="glow-line"] {
        animation: premiumGlowLineMove 4s ease-in-out infinite !important;
    }
    
    /* Level/XP related animations */
    .level-up-animation,
    .xp-gain-animation {
        animation-duration: 0.6s !important;
    }
    
    /* Chart animations */
    .chart-bar,
    .chart-line {
        transition-duration: 0.8s !important;
    }
    
    /* Tooltip animations */
    .tooltip,
    [data-tooltip]::after {
        transition-duration: 0.2s !important;
    }
}

/* Even gentler animations for smaller screens */
@media (max-width: 480px) {
    /* Slightly slower transitions for small screens */
    .btn,
    .card,
    .nav-item,
    a,
    button {
        transition-duration: 0.3s !important;
    }
    
    /* Reduce complex animations */
    .particle,
    .background-animation {
        animation-duration: 18s !important;
        opacity: 0.4 !important;
    }
    
    /* Even slower pulse effects on small screens */
    .icon-pulse,
    .pulse,
    .glow {
        animation-duration: 4s !important;
    }
    
    /* Simpler entrance animations */
    .fade-in,
    .slide-in,
    .scale-in {
        animation-duration: 0.35s !important;
    }
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .particle,
    .background-animation,
    .matrix-bg,
    .comet-follower,
    .pulse,
    .glow {
        animation: none !important;
        opacity: 0.3 !important;
    }
}

/* ===================================
   LANDSCAPE MODE ADJUSTMENTS
   =================================== */

@media (max-width: 896px) and (orientation: landscape) {
    .bottom-nav {
        padding: 6px 16px;
    }
    
    .bottom-nav a,
    .bottom-nav .nav-item {
        flex-direction: row;
        gap: 8px;
        padding: 8px 16px;
    }
    
    .bottom-nav a i,
    .bottom-nav .nav-item i {
        font-size: 16px;
        margin-bottom: 0;
    }
    
    .modal-content {
        max-height: 85vh;
    }
    
    .modal-body {
        max-height: 50vh;
    }
}

/* ===================================
   SAFE AREA INSETS (iOS)
   =================================== */

@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    main,
    .dashboard-main,
    .page-content,
    .main-content {
        padding-bottom: max(90px, calc(70px + env(safe-area-inset-bottom)));
    }
    
    .premium-top-nav .nav-container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

/* ===================================
   PORTFOLIO SPLIT - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    /* Hide combined desktop section on mobile */
    .portfolio-combined-section {
        display: none !important;
    }
    
    /* Show mobile sections on mobile */
    .portfolio-mobile-sections {
        display: block !important;
    }
    
    .portfolio-mobile-sections .main-balance-card {
        margin-bottom: 16px;
    }
    
    .portfolio-mobile-sections .quick-stats-grid {
        margin-bottom: 16px;
    }
    
    .portfolio-overview-optimized {
        grid-template-columns: 1fr;
    }
    
    /* Hidden on mobile - see earlier rule */
    .combined-portfolio-grid {
        display: none !important;
    }
    
    .quick-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .quick-stat-card {
        padding: 12px;
    }
    
    .balance-main-amount .amount-value {
        font-size: 32px;
    }
    
    .allocation-cards {
        grid-template-columns: 1fr;
    }
    
    .portfolio-quick-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .quick-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .balance-main-amount .amount-value {
        font-size: 28px;
    }
}

/* ===================================
   ACCOUNT MANAGEMENT - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .portfolio-zones-grid {
        grid-template-columns: 1fr;
    }
    
    .accounts-grid {
        grid-template-columns: 1fr;
    }
    
    .account-assignment-card {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .assignment-toggles {
        justify-content: center;
    }
    
    .account-stats-panel {
        grid-template-columns: 1fr;
    }
    
    .zone-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .zone-balance {
        width: 100%;
        text-align: center;
    }
    
    .assignment-actions {
        flex-direction: column;
    }
    
    .assignment-actions button {
        width: 100%;
    }
}

/* ===================================
   ALGO CARDS - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .algo-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .algo-mini-card {
        padding: 14px;
    }
    
    .algo-mini-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .algo-mini-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* ===================================
   GLOBAL MOBILE FIXES - ALL PAGES
   Comprehensive overflow and layout fixes
   =================================== */

@media (max-width: 768px) {
    /* Prevent horizontal overflow on all main containers */
    main,
    .main-content,
    .page-content,
    .container,
    .marketplace-container,
    .subscriptions-container,
    .orb-container,
    .journal-container,
    .analytics-container,
    .settings-container,
    .levels-container,
    .xp-container,
    .link-account-container,
    .day-detail-container,
    .algo-detail-container,
    .agent-detail-container {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Ensure all content respects container boundaries */
    .header-content,
    .page-header,
    .section-header,
    .card-header {
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
    }
    
    /* Fix text overflow in cards */
    .strategy-name,
    .algo-name,
    .card-title,
    .section-title,
    h1, h2, h3, h4 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Ensure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Fix grid layouts to single column where needed */
    .two-column-grid,
    .three-column-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===================================
   MY SUBSCRIPTIONS - ENHANCED MOBILE
   =================================== */

@media (max-width: 768px) {
    .subscriptions-page-container {
        padding: 80px 12px 90px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .subscriptions-header-section {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .subscriptions-header-section .page-title {
        font-size: 22px;
    }
    
    .algo-subscription-card {
        padding: 16px;
        border-radius: 14px;
    }
    
    .algo-subscription-card .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .subscription-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .subscription-actions-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .subscription-actions-row .btn {
        width: 100%;
    }
}

/* ===================================
   XP SYSTEM & LEVELS - ENHANCED MOBILE
   =================================== */

@media (max-width: 768px) {
    .xp-container,
    .levels-container {
        padding: 80px 12px 90px;
    }
    
    .xp-header,
    .levels-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .xp-progress-card,
    .level-progress-card {
        padding: 20px;
    }
    
    .xp-stats-grid,
    .levels-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .achievement-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .achievement-card {
        padding: 14px;
        text-align: center;
    }
    
    .achievement-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
        margin: 0 auto 10px;
    }
    
    .streak-calendar {
        gap: 4px;
    }
    
    .streak-day {
        width: 32px;
        height: 32px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .achievement-grid {
        grid-template-columns: 1fr;
    }
    
    .streak-day {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
}

/* ===================================
   ORB PAGE - ENHANCED MOBILE
   =================================== */

@media (max-width: 768px) {
    .orb-main-container {
        padding: 80px 12px 90px;
    }
    
    .orb-central-display {
        height: 200px;
        margin: 16px 0;
    }
    
    .orb-sphere {
        width: 120px;
        height: 120px;
    }
    
    .agent-cards-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .orb-agent-card {
        padding: 16px;
    }
    
    .orb-agent-card .agent-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .orb-chat-container {
        height: calc(100vh - 200px);
        max-height: 500px;
    }
    
    .orb-message {
        max-width: 90%;
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .orb-input-area {
        padding: 12px;
    }
    
    .orb-input-area input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 16px;
    }
}

/* ===================================
   JOURNAL PAGE - ENHANCED MOBILE
   =================================== */

@media (max-width: 768px) {
    .journal-main-container {
        padding: 80px 12px 90px;
    }
    
    .journal-heatmap-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }
    
    .journal-heatmap {
        min-width: 300px;
    }
    
    .heatmap-day {
        width: 12px;
        height: 12px;
    }
    
    .journal-entry-card {
        padding: 16px;
    }
    
    .entry-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .entry-trade-list {
        gap: 10px;
    }
    
    .trade-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }
    
    .trade-details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        width: 100%;
    }
    
    .add-entry-fab {
        bottom: 90px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
}

/* ===================================
   ANALYTICS PAGE - ENHANCED MOBILE
   =================================== */

@media (max-width: 768px) {
    .analytics-main-container {
        padding: 80px 12px 90px;
    }
    
    .analytics-period-selector {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        flex-wrap: nowrap;
    }
    
    .period-btn {
        flex-shrink: 0;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .analytics-cards-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .analytics-card {
        padding: 18px;
    }
    
    .chart-container {
        height: 220px;
        min-height: 200px;
    }
    
    .metrics-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .metric-item {
        width: 100%;
        padding: 14px;
    }
    
    .insights-list {
        gap: 10px;
    }
    
    .insight-item {
        padding: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ===================================
   SETTINGS PAGE - ENHANCED MOBILE
   =================================== */

@media (max-width: 768px) {
    .settings-page-container {
        padding: 80px 12px 90px;
    }
    
    .settings-nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        gap: 8px;
    }
    
    .settings-tab {
        flex-shrink: 0;
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .settings-section {
        padding: 20px;
    }
    
    .settings-section-title {
        font-size: 18px;
    }
    
    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .setting-row .setting-label {
        width: 100%;
    }
    
    .setting-row .setting-control {
        width: 100%;
    }
    
    .toggle-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .profile-avatar-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
    
    .danger-zone {
        padding: 16px;
    }
    
    .danger-zone .btn {
        width: 100%;
    }
}

/* ===================================
   LINK ACCOUNT - ENHANCED MOBILE
   =================================== */

@media (max-width: 768px) {
    .link-account-page-container {
        padding: 80px 12px 90px;
    }
    
    .broker-selection-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .broker-card {
        padding: 18px;
    }
    
    .broker-card .broker-logo {
        width: 48px;
        height: 48px;
    }
    
    .connection-form {
        padding: 20px;
    }
    
    .form-field {
        margin-bottom: 16px;
    }
    
    .connected-accounts-list {
        gap: 12px;
    }
    
    .connected-account-card {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .connected-account-card .account-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ===================================
   Z-INDEX FIXES FOR MOBILE
   =================================== */

@media (max-width: 768px) {
    /* Ensure proper stacking */
    .premium-top-nav {
        z-index: 1000;
    }
    
    .bottom-nav {
        z-index: 999;
    }
    
    .modal-overlay {
        z-index: 10000;
    }
    
    .toast-notification {
        z-index: 10001;
    }
    
    .dropdown-menu,
    .filter-dropdown-menu,
    .user-menu-dropdown {
        z-index: 1001;
    }
    
    /* Ensure content doesn't go under fixed elements */
    .page-content,
    main {
        position: relative;
        z-index: 1;
    }
}

/* ===================================
   TEXT OVERFLOW PREVENTION
   =================================== */

@media (max-width: 768px) {
    .truncate-mobile {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .wrap-mobile {
        white-space: normal;
        word-wrap: break-word;
    }
    
    /* Long text in cards */
    .strategy-description,
    .algo-description,
    .card-description {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* ===================================
   TOUCH FRIENDLY IMPROVEMENTS
   =================================== */

@media (max-width: 768px) {
    /* Larger touch targets */
    .icon-btn,
    .close-btn,
    .action-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Better spacing for list items */
    .list-item,
    .menu-item,
    .dropdown-item {
        padding: 14px 16px;
        min-height: 48px;
    }
    
    /* Checkbox and radio larger */
    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
    }
}

/* ===================================
   COMPLIANCE SECTION - MOBILE ENHANCED
   =================================== */

@media (max-width: 768px) {
    .compliance-section {
        padding: 20px 16px;
    }
    
    .compliance-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .compliance-items {
        gap: 12px;
    }
    
    .compliance-item {
        padding: 14px;
    }
    
    .compliance-checkbox {
        width: 24px;
        height: 24px;
    }
    
    .compliance-text {
        font-size: 13px;
    }
}

/* ===================================
   HIDE DESKTOP-ONLY ELEMENTS ON MOBILE
   =================================== */

@media (max-width: 968px) {
    .desktop-only,
    .hide-mobile {
        display: none !important;
    }
    
    .mobile-only,
    .show-mobile {
        display: block !important;
    }
    
    .mobile-only.flex,
    .show-mobile.flex {
        display: flex !important;
    }
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
    .bottom-nav,
    .fab-button,
    .premium-top-nav,
    .notification-btn,
    .settings-btn {
        display: none !important;
    }
    
    main,
    .dashboard-main,
    .page-content {
        padding-bottom: 0 !important;
    }
}
