/* Mobile Main Content Styles - For home and dashboard pages */

/* ========== MOBILE HOME PAGE STYLING ========== */
@media (max-width: 767.98px) {
    /* Jumbotron mobile adjustments */
    .jumbotron {
        padding: 2rem 1rem;
        margin-bottom: 2rem;
        text-align: center;
        background: rgba(0, 0, 0, 0.02);
        border-radius: 12px;
        border: 1px solid var(--border-color);
    }

    .jumbotron .display-4 {
        font-size: 1.75rem !important;
        font-weight: 700;
        margin-bottom: 1rem;
        line-height: 1.3;
    }

    .jumbotron .lead {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        color: var(--text-muted);
        line-height: 1.5;
    }

    .jumbotron hr {
        margin: 1.5rem 0;
        border-color: var(--border-color);
        opacity: 0.5;
    }

    .jumbotron p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        color: var(--text-color);
        line-height: 1.6;
    }

    /* Mobile button styling for home page */
    .jumbotron .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 10px;
        margin: 0.25rem;
        min-width: 140px;
        transition: all 0.2s ease;
    }

    .jumbotron .btn-lg:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);
    }

    /* Stack buttons vertically on small screens */
    .jumbotron .mt-4 {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .jumbotron .btn-lg.me-2 {
        margin-right: 0 !important;
        margin-bottom: 0;
    }
}

/* ========== MOBILE DASHBOARD STYLING ========== */
@media (max-width: 767.98px) {
    /* Dashboard header */
    .dashboard h1 {
        font-size: 1.75rem !important;
        margin-bottom: 1.5rem;
        text-align: center;
    }

    /* Welcome alert mobile styling */
    .welcome-alert {
        padding: 1rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
        text-align: center;
        font-size: 0.95rem;
        background: rgba(106, 17, 203, 0.05);
        border: 1px solid rgba(106, 17, 203, 0.1);
        color: var(--text-color);
    }

    .welcome-alert img {
        width: 28px;
        height: 28px;
        margin-right: 0.75rem;
        border: 2px solid rgba(106, 17, 203, 0.2);
    }

    /* Dashboard cards mobile adjustments */
    .dashboard .card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border: 1px solid var(--border-color);
    }

    .dashboard .card-header {
        padding: 1rem;
        background: rgba(0, 0, 0, 0.02);
        border-bottom: 1px solid var(--border-color);
        border-radius: 12px 12px 0 0;
    }

    .dashboard .card-body {
        padding: 1rem;
    }

    .dashboard .card-title {
        font-size: 1.1rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }

    .dashboard .card-text {
        font-size: 0.9rem;
        color: var(--text-muted);
        line-height: 1.5;
    }
}

/* ========== SMALL MOBILE DEVICES ========== */
@media (max-width: 575.98px) {
    /* Extra small adjustments for jumbotron */
    .jumbotron {
        padding: 1.5rem 0.75rem;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .jumbotron .display-4 {
        font-size: 1.5rem !important;
    }

    .jumbotron .lead {
        font-size: 0.95rem;
    }

    .jumbotron p {
        font-size: 0.9rem;
    }

    .jumbotron .btn-lg {
        padding: 0.65rem 1.25rem;
        font-size: 0.95rem;
        min-width: 120px;
    }

    /* Dashboard adjustments for extra small screens */
    .dashboard h1 {
        font-size: 1.5rem !important;
    }

    .welcome-alert {
        padding: 0.75rem;
        font-size: 0.9rem;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }

    .welcome-alert img {
        width: 24px;
        height: 24px;
        margin-right: 0.5rem;
    }

    .dashboard .card {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }

    .dashboard .card-header,
    .dashboard .card-body {
        padding: 0.75rem;
    }

    .dashboard .card-title {
        font-size: 1rem;
    }

    .dashboard .card-text {
        font-size: 0.85rem;
    }
}

/* ========== MOBILE CONTAINER ADJUSTMENTS ========== */
@media (max-width: 767.98px) {
    /* Main container mobile spacing */
    main.container {
        padding-left: 1rem;
        padding-right: 1rem;
        margin-top: 1.5rem !important;
    }

    /* Row adjustments */
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .row > * {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    main.container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        margin-top: 1rem !important;
    }

    .row {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }

    .row > * {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* ========== MOBILE MARKET STATUS BAR ========== */
@media (max-width: 767.98px) {
    .market-status-bar {
        padding: 0.75rem 0;
        font-size: 0.85rem;
        min-height: auto;
        overflow: hidden;
    }

    .market-status-bar .container {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100%;
    }

    .market-status-bar .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
        width: 100%;
    }

    .market-status-info {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        overflow: hidden;
    }

    .market-status-text,
    .market-time-text {
        font-size: 0.85rem;
        line-height: 1.4;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .market-time-text {
        margin-left: 0 !important;
    }

    .market-selector-mini {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.5rem;
        flex-wrap: wrap;
        overflow: hidden;
    }

    .market-selector-mini .me-3 {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 0 0 auto;
        min-width: fit-content;
    }

    .market-selector-mini select {
        max-width: 200px;
        min-width: 160px;
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
        flex-shrink: 0;
        border-radius: 6px;
        border: 1px solid rgba(0, 0, 0, 0.15);
    }

    /* Hide "Change Market:" label on mobile to save space */
    .market-selector-mini .me-2 {
        display: none !important;
    }

    /* Hide "Market:" label on very small screens to save space */
    @media (max-width: 375px) {
        .market-selector-mini select {
            min-width: 140px;
            max-width: 180px;
        }
    }
}

@media (max-width: 575.98px) {
    .market-status-bar {
        padding: 0.5rem 0;
        font-size: 0.8rem;
    }

    .market-status-bar .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .market-status-text,
    .market-time-text {
        font-size: 0.8rem;
    }

    .market-selector-mini select {
        max-width: 180px;
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }
}

/* ========== MOBILE FOOTER ADJUSTMENTS ========== */
@media (max-width: 767.98px) {
    footer {
        margin-top: 2rem !important;
        padding: 1.5rem 0 !important;
        font-size: 0.85rem;
    }

    footer .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 575.98px) {
    footer {
        margin-top: 1.5rem !important;
        padding: 1rem 0 !important;
        font-size: 0.8rem;
    }

    footer .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ========== MOBILE GENERAL PAGE IMPROVEMENTS ========== */
@media (max-width: 767.98px) {
    /* General container adjustments */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Card adjustments for mobile */
    .card {
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 1rem;
        border-radius: 12px 12px 0 0;
    }

    .card-body {
        padding: 1rem;
    }

    /* Typography adjustments */
    h1, .h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    h2, .h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    h3, .h3 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    /* Button adjustments */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    /* Table responsiveness */
    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .table {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        vertical-align: middle;
    }

    /* Badge adjustments */
    .badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }

    /* Breadcrumb adjustments */
    .breadcrumb {
        padding: 0.5rem 0;
        margin-bottom: 1rem;
        font-size: 0.85rem;
        background: transparent;
    }

    .breadcrumb-item + .breadcrumb-item::before {
        content: "›";
        font-size: 1rem;
        color: var(--text-muted);
    }

    /* Track Record Page Mobile Improvements */
    .card-header .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }

    .card-header .badge {
        margin-top: 0.25rem;
        margin-left: 0;
    }

    /* About Page Mobile Improvements */
    .col-md-3, .col-md-9 {
        text-align: center;
    }

    .col-md-9 {
        margin-top: 1rem;
    }

    .d-flex.gap-2 {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Blog Page Mobile Improvements */
    .card-title {
        font-size: 1.1rem;
        line-height: 1.4;
        word-wrap: break-word;
        hyphens: auto;
    }

    .card-text {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    /* Improve text wrapping for long titles */
    .card-header h1,
    .card-header h2,
    .card-header h3 {
        word-wrap: break-word;
        hyphens: auto;
        text-align: center;
    }

    /* Better mobile spacing for card headers */
    .card-header .h3,
    .card-header .h5 {
        margin-bottom: 0.5rem;
    }

    /* Mobile-friendly flex layouts */
    .d-flex.align-items-center {
        flex-direction: column;
        align-items: center !important;
        text-align: center;
        gap: 0.5rem;
    }

    /* Keep some flex layouts horizontal on mobile */
    .card-header .d-flex.align-items-center {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Hero headers: ensure subtitle sits below title on mobile (About, Track Record, Blog) */
    .card > .card-header {
        flex-wrap: wrap !important; /* allow items to move to next line */
    }
    .card > .card-header p {
        flex: 0 0 100% !important; /* take full width below heading */
        margin-top: 0.35rem !important;
        text-align: center !important;
    }
    .card > .card-header h1,
    .card > .card-header .h1,
    .card > .card-header .h3 {
        flex: 0 0 100% !important;
        text-align: center !important;
    }

}

/* ===== Track Record: Mobile-only fixes ===== */
@media (max-width: 767.98px) {
  /* Stats cards (AI Advisor, Pro Model) - Fix header alignment */
  .track-record-page .stats-card .card-header {
    background: rgba(0,0,0,0.02) !important;
    border-bottom: 1px solid var(--border-color) !important;
    text-align: center !important;
    padding: 0.75rem !important;
  }
  .track-record-page .stats-card .card-header .d-flex {
    justify-content: center !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
  }

  /* Ensure icon and text are properly aligned */
  .track-record-page .stats-card .card-header .d-flex > * {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .track-record-page .stats-card .card-header .rounded-circle {
    flex-shrink: 0 !important;
  }

  .track-record-page .stats-card .card-header h3 {
    margin: 0 !important;
    text-align: center !important;
  }

  .track-record-page .stats-card .card-header .badge {
    margin-left: 0.5rem !important;
  }
  /* Arrange metrics horizontally in a 2-column grid like desktop */
  .track-record-page .stats-card .card-body .row.text-center {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem 0.75rem !important;
    justify-items: center !important;
    align-items: center !important;
    text-align: center !important;
  }
  /* Center the last odd item (5th) */
  .track-record-page .stats-card .card-body .row.text-center > :nth-child(5) {
    grid-column: 1 / -1 !important;
    justify-self: center !important;
  }

  .track-record-page .stats-card .card-body .row.text-center > [class^="col-"] {
    padding: 0.6rem 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .track-record-page .stats-card .h4,
  .track-record-page .stats-card .h6 {
    margin-bottom: 0.15rem !important;
    display: block !important;
  }
  .track-record-page .stats-card .text-muted.small {
    display: block !important;
    margin-top: 0.15rem !important;
  }

  /* Prediction tables: enable horizontal scroll and readable width */
  .track-record-page .predictions-card .table-responsive {
    overflow-x: auto !important;
    overflow-y: auto !important; /* allow vertical scroll for >10 rows */
    -webkit-overflow-scrolling: touch !important;
  }
  /* Ensure there's enough width for all columns without squashing */
  .track-record-page .predictions-card .table {
    min-width: 740px !important;
  }
}

