/* assets/mobile.css - Mobile-specific styles and responsive breakpoints */

/* === UNIVERSAL MOBILE OVERFLOW PREVENTION === */
@media (max-width: 768px) {
    /* Prevent any horizontal overflow on mobile */
    body {
        overflow-x: hidden !important;
    }

    /* All containers must not overflow */
    .container,
    .container-fluid,
    .row,
    .col,
    [class*="col-"] {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    /* All cards must contain their content */
    .card,
    .card-body,
    .card-header {
        overflow-x: hidden !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
    }

    /* All tables must be in responsive containers */
    table:not(.table-responsive table) {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-width: 100% !important;
    }

    /* Ensure Bootstrap columns don't cause overflow */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Modal bodies must not overflow horizontally */
    .modal-body,
    .modal-content {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
}

/* Responsive Breakpoints */
@media (max-width: 991px) {

    /* Mobile Navigation */
    .navbar-collapse {
        position: absolute;
        top: 56px;
        /* Height of the navbar */
        left: 0;
        right: 0;
        width: 100%;
        background-color: var(--primary-color, #1976D2);
        z-index: 1050;
        padding: 0.5rem 1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        max-height: calc(100vh - 56px);
        overflow-y: auto;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        display: block !important;
    }

    .navbar-collapse.show {
        transform: translateY(0);
    }

    /* Adjust nav items for mobile */
    .navbar-nav {
        flex-direction: column;
        width: 100%;
    }

    .nav-item,
    .dropdown {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Ensure dropdown menus are visible */
    .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100%;
        background-color: rgba(0, 0, 0, 0.1);
        border: none;
        box-shadow: none;
        margin-top: 0;
        margin-bottom: 0.5rem;
    }

    .dropdown-item {
        color: white !important;
        padding: 0.5rem 1rem;
    }

    .dropdown-item:hover,
    .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.1);
    }

    /* Improve readability for nav links */
    .nav-link {
        /* color: white !important; */
        /* Let specific tab rules handle color */
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Ensure mobile nav links inherit color */
    .navbar-dark .navbar-nav .nav-link {
        color: rgba(255, 255, 255, 0.75);
        /* Adjust as needed */
    }

    .navbar-dark .navbar-nav .nav-link:hover,
    .navbar-dark .navbar-nav .nav-link:focus {
        color: #fff;
    }


    .navbar-brand {
        margin-right: auto;
    }
}

@media (max-width: 768px) {
    .filter-components {
        flex-direction: column;
        gap: 10px;
    }

    .filter-item {
        width: 100%;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .chart-container {
        min-height: 250px;
    }

    /* Make filter rows stack on smaller screens */
    .filter-row {
        flex-direction: column;
    }

    .filter-row>div {
        width: 100%;
        max-width: none !important;
    }
}

@media (max-width: 576px) {
    .dashboard-content {
        padding: 10px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    /* Adjust filter container padding */
    .filter-container {
        padding: 10px;
    }

    /* Make cards more compact */
    .card-header,
    .card-body {
        padding: 0.75rem;
    }

    /* Handle smaller input controls */
    .date-picker-wrapper,
    .dropdown,
    input,
    select {
        width: 100%;
        min-width: 100%;
    }
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 991px) {
    .user-dropdown {
        margin-left: 0 !important;
        margin-top: 0.5rem;
    }
    
    .user-dropdown .dropdown-toggle {
        width: 100%;
        text-align: left;
        justify-content: space-between;
        display: flex;
        align-items: center;
    }
    
    .user-dropdown .dropdown-menu {
        width: 100%;
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        border: 1px solid rgba(0, 0, 0, 0.125) !important;
        margin-top: 0.5rem !important;
    }
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 768px) {
    .dash-table-container {
        font-size: 0.8rem;
    }
    
    .dash-table-container .dash-spreadsheet-container {
        max-height: 500px;
    }
}

/* === MLB PITCHER RANKINGS MOBILE STYLES === */
/* Fix mobile table scrolling for pitcher rankings */
.pitcher-rankings-table-container {
    width: 100%;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}

/* Mobile-specific pitcher rankings table styling */
@media (max-width: 768px) {
    /* Fix table container scrolling on mobile */
    .pitcher-rankings-table-container {
        width: 100%;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Ensure the DataTable container is scrollable */
    .pitcher-rankings-table-container .dash-table-container {
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
    }
    
    /* Fix viewport constraints that lock scrolling */
    .pitcher-rankings-table-container .dash-spreadsheet-container {
        max-height: none !important; /* Remove height constraint */
        overflow-x: auto !important;
        overflow-y: visible !important;
    }
    
    /* Ensure the table itself is scrollable */
    .pitcher-rankings-table-container .dash-spreadsheet {
        overflow-x: auto !important;
        overflow-y: visible !important;
        max-height: none !important;
    }
    
    /* Make table take minimum width for horizontal scroll */
    .pitcher-rankings-table-container table {
        min-width: 600px; /* Force horizontal scroll on small screens */
    }
    
    /* Sticky pitcher name column handled by main CSS rules above */
    
    /* Mobile sort button styling */
    .mobile-sort-controls {
        position: sticky;
        top: 0;
        background-color: white;
        z-index: 10;
        padding: 0.5rem 0;
        border-bottom: 2px solid #dee2e6;
        margin-bottom: 0.5rem;
    }
    
    .mobile-sort-btn {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
        white-space: nowrap;
    }
    
    .mobile-sort-btn:focus,
    .mobile-sort-btn:active {
        box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25) !important;
    }
    
    /* Active sort button styling */
    .mobile-sort-btn.active {
        background-color: var(--primary-color) !important;
        color: white !important;
        border-color: var(--primary-color) !important;
    }
    
    .mobile-sort-btn.btn-outline-danger.active {
        background-color: var(--danger-color) !important;
        border-color: var(--danger-color) !important;
    }
    
    .mobile-sort-btn.btn-outline-info.active {
        background-color: var(--info-color) !important;
        border-color: var(--info-color) !important;
    }
    
    /* Adjust tab content to prevent overflow issues */
    #mlb_daily_barrels_pitcher_rankings_tabs .tab-content {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
    
    /* Smaller text on mobile for better fit */
    .pitcher-rankings-table-container .dash-cell {
        font-size: 0.75rem !important;
        padding: 4px !important;
    }
    
    /* Smaller header text */
    .pitcher-rankings-table-container .dash-header {
        font-size: 0.7rem !important;
        padding: 4px !important;
    }
    
    /* Hide tooltip on mobile to prevent overlap */
    .pitcher-rankings-table-container .dash-table-tooltip {
        display: none !important;
    }

    /* Mobile tooltip positioning - center on screen outside table area */
    #mlb_daily_barrels_strikeout_predictions_table .dash-table-tooltip,
    .strikeout-predictions-table-container .dash-table-tooltip {
        position: fixed !important;
        left: 5% !important;
        right: 5% !important;
        bottom: 10px !important;
        max-width: none !important;
        width: 90% !important;
        font-size: 0.8rem !important;
        top: auto !important;
        margin: 0 !important;
        transform: none !important;
        z-index: 99999 !important;
        pointer-events: auto !important;
        box-shadow: 0 8px 24px rgba(0,0,0,0.9) !important;
        border: 2px solid #4a90e2 !important;
        animation: fadeInUp 0.3s ease-out !important;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            bottom: -20px;
        }
        to {
            opacity: 1;
            bottom: 10px;
        }
    }
}

/* === STRIKEOUT PREDICTIONS TOOLTIP STYLES === */
/* Basic tooltip styles for strikeout predictions */
#mlb_daily_barrels_strikeout_predictions_table .dash-table-tooltip,
.strikeout-predictions-table-container .dash-table-tooltip {
    background-color: #000000 !important;
    color: #ffffff !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    font-size: 0.85rem !important;
    font-family: monospace !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.8) !important;
    white-space: pre-wrap !important;
    max-width: 450px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Mobile-specific strikeout predictions table styling */
.strikeout-predictions-table-container {
    width: 100%;
}

/* Strikeout predictions mobile sort controls */
.strikeout-mobile-sort-controls {
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
    padding: 0.5rem 0;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 0.5rem;
}

.strikeout-mobile-sort-controls .mobile-sort-btn {
    font-size: 0.7rem !important;
    padding: 0.2rem 0.4rem !important;
    white-space: nowrap;
}

.strikeout-mobile-sort-controls .mobile-sort-btn:focus,
.strikeout-mobile-sort-controls .mobile-sort-btn:active {
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25) !important;
}

/* Active strikeout sort button styling */
.strikeout-mobile-sort-controls .mobile-sort-btn.active {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

.strikeout-mobile-sort-controls .mobile-sort-btn.btn-outline-warning.active {
    background-color: var(--warning-color) !important;
    border-color: var(--warning-color) !important;
    color: black !important;
}

@media (max-width: 768px) {
    /* === COMPREHENSIVE MOBILE TABLE OPTIMIZATIONS === */
    
    /* Fix strikeout predictions table scrolling on mobile */
    .strikeout-predictions-table-container {
        width: 100%;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        position: relative !important;
    }

    .strikeout-predictions-table-container .dash-table-container {
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        position: relative !important;
    }

    .strikeout-predictions-table-container .dash-spreadsheet-container {
        max-height: 60vh !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        margin-bottom: 120px !important;
    }
    
    .strikeout-predictions-table-container .dash-spreadsheet {
        overflow-x: auto !important;
        overflow-y: visible !important;
        max-height: none !important;
        min-width: 650px; /* Force horizontal scroll for better mobile experience */
    }
    
    .strikeout-predictions-table-container table {
        min-width: 650px;
    }
    
    /* === ENHANCED STICKY COLUMNS === */
    .pitcher-rankings-table-container td[data-dash-column="pitcher_name"],
    .pitcher-rankings-table-container th[data-dash-column="pitcher_name"],
    .strikeout-predictions-table-container td[data-dash-column="pitcher_name"],
    .strikeout-predictions-table-container th[data-dash-column="pitcher_name"] {
        position: sticky !important;
        left: 0 !important;
        background-color: white !important;
        z-index: 3 !important;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
        border-right: 1px solid #dee2e6 !important;
        min-width: 120px !important;
        max-width: 120px !important;
    }
    
    /* Ensure other columns are visible and scrollable */
    .pitcher-rankings-table-container .dash-spreadsheet,
    .strikeout-predictions-table-container .dash-spreadsheet {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
    }
    
    /* Make sure table cells don't get hidden */
    .pitcher-rankings-table-container td:not([data-dash-column="pitcher_name"]),
    .pitcher-rankings-table-container th:not([data-dash-column="pitcher_name"]),
    .strikeout-predictions-table-container td:not([data-dash-column="pitcher_name"]),
    .strikeout-predictions-table-container th:not([data-dash-column="pitcher_name"]) {
        position: relative !important;
        background-color: transparent !important;
        z-index: 1 !important;
    }
    
    /* === MOBILE TABLE CELL OPTIMIZATION === */
    .pitcher-rankings-table-container .dash-cell,
    .strikeout-predictions-table-container .dash-cell {
        font-size: 0.7rem !important;
        padding: 4px 6px !important;
        line-height: 1.2 !important;
    }
    
    .pitcher-rankings-table-container .dash-header,
    .strikeout-predictions-table-container .dash-header {
        font-size: 0.65rem !important;
        padding: 6px 4px !important;
        line-height: 1.1 !important;
    }
    
    /* === MOBILE TOUCH IMPROVEMENTS === */
    .mobile-sort-btn {
        min-height: 44px !important; /* Apple's recommended touch target size */
        min-width: 44px !important;
        margin: 2px !important;
    }
    
    /* === MOBILE SCROLL INDICATORS === */
    .pitcher-rankings-table-container::after,
    .strikeout-predictions-table-container::after {
        content: "← Scroll horizontally for more columns →";
        display: block;
        text-align: center;
        font-size: 0.7rem;
        color: #6c757d;
        padding: 0.5rem;
        background-color: #f8f9fa;
        border-top: 1px solid #dee2e6;
    }
    
    /* Hide scroll indicator when not needed */
    @media (min-width: 769px) {
        .pitcher-rankings-table-container::after,
        .strikeout-predictions-table-container::after {
            display: none;
        }
    }
}

/* === LANDSCAPE MODE OPTIMIZATIONS === */
@media (max-width: 812px) and (orientation: landscape) {
    .pitcher-rankings-table-container .dash-spreadsheet-container {
        max-height: 60vh !important; /* Use more screen in landscape */
    }
    
    .mobile-sort-controls {
        padding: 0.25rem 0;
    }
    
    .mobile-sort-btn {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.4rem !important;
    }
    
    .strikeout-predictions-table-container .dash-spreadsheet-container {
        max-height: 55vh !important;
    }
    
    .strikeout-mobile-sort-controls {
        padding: 0.25rem 0;
    }
    
    .strikeout-mobile-sort-controls .mobile-sort-btn {
        font-size: 0.65rem !important;
        padding: 0.15rem 0.3rem !important;
    }
}

/* === PORTRAIT MODE OPTIMIZATIONS === */
@media (max-width: 768px) and (orientation: portrait) {
    .pitcher-rankings-table-container .dash-spreadsheet-container {
        max-height: 70vh !important; /* More height in portrait */
    }
    
    /* Stack sort buttons 2x2 in portrait mode */
    .mobile-sort-controls .btn-group {
        flex-wrap: wrap !important;
        width: 100%;
        justify-content: center;
    }
    
    .mobile-sort-controls .btn-group .btn {
        width: 45%;
        margin: 2px;
    }
    
    .strikeout-predictions-table-container .dash-spreadsheet-container {
        max-height: 65vh !important;
    }
    
    /* Stack strikeout sort buttons 2x2 in portrait mode */
    .strikeout-mobile-sort-controls .btn-group {
        flex-wrap: wrap !important;
        width: 100%;
        justify-content: center;
    }
    
    .strikeout-mobile-sort-controls .btn-group .btn {
        width: 45%;
        margin: 2px;
    }
}

/* === UNIVERSAL MOBILE TABLE IMPROVEMENTS === */
@media (max-width: 768px) {
    /* Ensure all pitcher ranking related tables are mobile optimized */
    #mlb_daily_barrels_pitcher_rankings_tabs .tab-content {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
    
    /* Better mobile tab navigation */
    #mlb_daily_barrels_pitcher_rankings_tabs .nav-link {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    /* Improve mobile table performance */
    .dash-table-container {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    /* Custom scrollbar for mobile webkit browsers */
    .dash-table-container::-webkit-scrollbar {
        height: 8px;
        width: 8px;
    }
    
    .dash-table-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    .dash-table-container::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }
    
    .dash-table-container::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
}

/* === SOCCER TEAM STATS TAB MOBILE STYLES === */
/* Team stats first half analytics mobile optimization */
.first-half-analytics-row {
    margin: 0;
}

.team-stats-column {
    padding: 0.75rem;
}

.team-header {
    font-size: 1.1rem !important;
    font-weight: bold;
    border-bottom: 2px solid;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem !important;
}

.home-team-column .team-header {
    border-bottom-color: #28a745;
}

.away-team-column .team-header {
    border-bottom-color: #007bff;
}

.stat-section {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.75rem;
    border-left: 4px solid;
}

.home-team-column .stat-section {
    border-left-color: #28a745;
}

.away-team-column .stat-section {
    border-left-color: #007bff;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.25rem !important;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #495057;
}

@media (max-width: 768px) {
    /* Stack team columns vertically on mobile */
    .first-half-analytics-row {
        flex-direction: column !important;
    }

    .team-stats-column {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 1.5rem;
        padding: 1rem;
    }

    .over-under-column {
        width: 100% !important;
        max-width: 100% !important;
        border-top: 2px solid #dee2e6;
        padding-top: 1.5rem;
        margin-top: 1rem;
    }

    /* Larger touch targets for mobile */
    .team-header {
        font-size: 1.25rem !important;
        padding: 0.75rem;
        text-align: center !important;
        margin-bottom: 1.25rem !important;
        background-color: rgba(248, 249, 250, 0.8);
        border-radius: 0.5rem;
        border: 2px solid;
    }

    .home-team-column .team-header {
        border-color: #28a745;
        background-color: rgba(40, 167, 69, 0.1);
    }

    .away-team-column .team-header {
        border-color: #007bff;
        background-color: rgba(0, 123, 255, 0.1);
    }

    /* Enhanced stat sections for mobile */
    .stat-section {
        padding: 1rem;
        margin-bottom: 1rem !important;
        border-radius: 0.5rem;
        border-left-width: 5px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .stat-label {
        font-size: 1rem !important;
        font-weight: 700;
        margin-bottom: 0.5rem !important;
    }

    .stat-value {
        font-size: 1.3rem !important;
        font-weight: bold;
        min-height: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: white;
        border-radius: 0.25rem;
        padding: 0.5rem;
        border: 1px solid #e9ecef;
    }

    /* Visual separators between teams */
    .home-team-column::after {
        content: "";
        display: block;
        width: 80%;
        height: 3px;
        background: linear-gradient(90deg, #28a745, transparent);
        margin: 1.5rem auto 0;
        border-radius: 2px;
    }

    .away-team-column::after {
        content: "";
        display: block;
        width: 80%;
        height: 3px;
        background: linear-gradient(90deg, #007bff, transparent);
        margin: 1.5rem auto 0;
        border-radius: 2px;
    }
}

@media (max-width: 576px) {
    /* Extra small screens - more compact layout */
    .team-stats-column {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    .team-header {
        font-size: 1.1rem !important;
        padding: 0.5rem;
        margin-bottom: 1rem !important;
    }

    .stat-section {
        padding: 0.75rem;
        margin-bottom: 0.75rem !important;
    }

    .stat-label {
        font-size: 0.9rem !important;
    }

    .stat-value {
        font-size: 1.15rem !important;
        min-height: 1.75rem;
        padding: 0.375rem;
    }

    /* Smaller visual separators */
    .home-team-column::after,
    .away-team-column::after {
        width: 60%;
        height: 2px;
        margin: 1rem auto 0;
    }
}

/* === CRITICAL MOBILE OVERFLOW FIX - MAXIMUM SPECIFICITY === */
/* These rules MUST override Bootstrap - placed at end for maximum specificity */
@media (max-width: 768px) {
    /* FORCE no horizontal overflow on ALL NBA daily exploit content */
    #nba_daily_overview_home_team_stats *,
    #nba_daily_overview_away_team_stats *,
    .card-body *,
    .p-2 *,
    .mb-3 * {
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Exploit player cards - FORCE containment */
    .mb-3.p-2.border-start,
    .mb-3.border-start,
    div[class*="border-start"] {
        overflow: hidden !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* All flex containers must wrap */
    .d-flex,
    div[class*="d-flex"],
    .flex-wrap,
    div[class*="flex-wrap"] {
        flex-wrap: wrap !important;
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    /* Badge containers - FORCE wrapping */
    .badge,
    span[class*="badge"] {
        display: inline-flex !important;
        flex-wrap: wrap !important;
        max-width: fit-content !important;
        overflow: visible !important;
    }

    /* Player name buttons - FORCE truncation */
    .player-name-btn,
    button[class*="player-name"] {
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        word-wrap: normal !important;
    }

    /* All rows must not overflow */
    .row,
    div[class*="row"] {
        margin-left: 0 !important;
        margin-right: 0 !important;
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    /* All columns must fit */
    [class*="col-"],
    .col {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    /* Disable any transforms that might cause overflow */
    * {
        transform: none !important;
    }

    /* NUCLEAR OPTION - body and html must not allow horizontal scroll */
    body,
    html {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        position: relative !important;
    }

    /* Container fluid - force 100% width */
    .container-fluid {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
}

/* === LANDSCAPE MODE OPTIMIZATIONS FOR TEAM STATS === */
@media (max-width: 812px) and (orientation: landscape) {
    .first-half-analytics-row {
        flex-direction: row !important;
    }

    .team-stats-column {
        width: 33.333% !important;
        margin-bottom: 0;
    }

    .over-under-column {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }

    .team-header {
        font-size: 1rem !important;
        padding: 0.5rem;
        margin-bottom: 0.75rem !important;
    }

    .stat-section {
        padding: 0.5rem;
        margin-bottom: 0.5rem !important;
    }

    .stat-label {
        font-size: 0.8rem !important;
    }

    .stat-value {
        font-size: 1rem !important;
        min-height: 1.5rem;
        padding: 0.25rem;
    }

    /* Remove separators in landscape */
    .home-team-column::after,
    .away-team-column::after {
        display: none;
    }
}

/* === NBA DAILY OVERVIEW TAB MOBILE OPTIMIZATIONS === */
/* Stat selector buttons for Top 5 Players chart */
@media (max-width: 768px) {
    /* Make stat selector buttons wrap and be touch-friendly */
    .nba-stat-selector-group {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.5rem !important;
    }

    .stat-selector-btn {
        flex: 0 0 calc(50% - 0.5rem) !important; /* 2 buttons per row */
        min-height: 44px !important; /* Apple's recommended touch target */
        font-size: 0.9rem !important;
        padding: 0.5rem 0.75rem !important;
        white-space: nowrap !important;
        border-radius: 0.375rem !important;
    }

    /* Ensure active state is visible on mobile */
    .stat-selector-btn:not(.btn-outline-primary) {
        background-color: var(--primary-color, #1976D2) !important;
        border-color: var(--primary-color, #1976D2) !important;
        color: white !important;
        font-weight: 600 !important;
    }

    /* Chart container mobile optimization */
    #nba_daily_overview_performance_chart .dcc-graph {
        min-height: 400px !important;
    }

    /* Better spacing for chart cards on mobile */
    #nba_daily_overview_performance_chart .col-12 {
        margin-bottom: 1.5rem !important;
    }

    /* Improve chart legend on mobile */
    .js-plotly-plot .plotly .legend {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 576px) {
    /* Extra small screens - 3 buttons per row for better fit */
    .stat-selector-btn {
        flex: 0 0 calc(33.333% - 0.5rem) !important;
        min-height: 42px !important;
        font-size: 0.8rem !important;
        padding: 0.4rem 0.5rem !important;
    }

    /* Smaller chart height on very small screens */
    #nba_daily_overview_performance_chart .dcc-graph {
        min-height: 350px !important;
    }
}

/* Landscape mode - keep buttons in single row */
@media (max-width: 812px) and (orientation: landscape) {
    .nba-stat-selector-group {
        flex-wrap: nowrap !important;
        gap: 0.25rem !important;
    }

    .stat-selector-btn {
        flex: 1 1 auto !important;
        min-height: 36px !important;
        font-size: 0.75rem !important;
        padding: 0.3rem 0.5rem !important;
    }
}

/* === NBA DAILY PLAYER DETAIL MODAL MOBILE OPTIMIZATIONS === */
@media (max-width: 768px) {
    /* Player detail modal sizing */
    .player-detail-modal-body {
        padding: 0.75rem !important;
        overflow-x: hidden !important;
    }

    /* Mobile card view for game history - NO horizontal scrolling! */
    .player-detail-modal-body .d-md-none .p-2 {
        background-color: white !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 0.375rem !important;
        margin-bottom: 0.5rem !important;
        padding: 0.75rem !important;
    }

    /* Alternating card backgrounds for better readability */
    .player-detail-modal-body .d-md-none .p-2:nth-child(even) {
        background-color: #f8f9fa !important;
    }

    /* Stat value prominence on mobile */
    .player-detail-modal-body .d-md-none .h4 {
        font-size: 1.75rem !important;
        color: #0d6efd !important;
        font-weight: 700 !important;
    }

    /* Modal dialog sizing */
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }

    .modal-content {
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    .modal-body {
        overflow-x: hidden !important;
        padding: 0.75rem !important;
    }

    /* Touch-friendly card interactions */
    .player-detail-modal-body .d-md-none .border:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* === NBA DAILY EXPLOIT COMPONENT MOBILE OPTIMIZATIONS === */
@media (max-width: 768px) {
    /* Exploit player cards - card-based layout on mobile */
    .mb-3.p-2.border-start.border-3.rounded {
        overflow: hidden !important;
        margin-bottom: 0.75rem !important;
        padding: 0.75rem !important;
        border-left-width: 4px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    }

    /* Player name button - prevent overflow */
    .player-name-btn {
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 0.95rem !important;
    }

    /* Factor indicators - icon-only badges on mobile */
    .badge.me-1 {
        min-width: 32px !important;
        height: 28px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.3rem 0.4rem !important;
        margin-bottom: 0.25rem !important;
    }

    /* Hide factor value text on mobile, show only icon */
    .factor-value.d-none.d-sm-inline {
        display: none !important;
    }

    /* Factor icon sizing */
    .factor-icon {
        font-size: 1rem !important;
    }

    /* Stat value prominence */
    .mb-3.p-2.border-start .text-primary.fw-bold {
        font-size: 1.2rem !important;
    }

    /* Stars display */
    .exploit-stars {
        font-size: 1rem !important;
    }

    /* Overview team stats cards - prevent all overflow */
    #nba_daily_overview_home_team_stats,
    #nba_daily_overview_away_team_stats {
        overflow-x: hidden !important;
        overflow-y: visible !important;
        word-wrap: break-word !important;
        max-width: 100% !important;
    }

    /* Overview tab cards - contain all content */
    #nba_daily_overview_home_team_stats .card-body,
    #nba_daily_overview_away_team_stats .card-body,
    #nba_daily_overview_home_team_stats > div,
    #nba_daily_overview_away_team_stats > div {
        overflow-x: hidden !important;
        max-width: 100% !important;
        word-break: break-word !important;
    }

    /* Exploit view container - prevent overflow */
    #nba_daily_overview_home_team_stats .p-2,
    #nba_daily_overview_away_team_stats .p-2 {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    /* All tables in overview tab */
    #nba_daily_overview_home_team_stats table,
    #nba_daily_overview_away_team_stats table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: auto !important;
    }

    /* Prevent any exploit content overflow */
    .mb-3.border-start.border-4 {
        overflow: hidden !important;
        word-wrap: break-word !important;
    }
}

/* Extra small screens - more compact exploit cards */
@media (max-width: 576px) {
    .mb-3.p-2.border-start.border-3.rounded {
        padding: 0.6rem !important;
        margin-bottom: 0.6rem !important;
    }

    .badge.me-1 {
        min-width: 28px !important;
        height: 24px !important;
        font-size: 0.8rem !important;
    }

    .player-name-btn {
        font-size: 0.9rem !important;
    }
}

/* Extra small screens - card view optimizations */
@media (max-width: 576px) {
    /* More compact cards on very small screens */
    .player-detail-modal-body .d-md-none .p-2 {
        padding: 0.6rem !important;
        margin-bottom: 0.4rem !important;
    }

    /* Slightly smaller stat value on tiny screens */
    .player-detail-modal-body .d-md-none .h4 {
        font-size: 1.5rem !important;
    }

    /* Modal full width on extra small screens */
    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
    }

    .modal-content {
        border-radius: 0 !important;
        max-height: 100vh !important;
    }

    /* Ensure cards don't overflow */
    .card-body {
        overflow-x: hidden !important;
        padding: 0.5rem !important;
    }

    /* Exploit component - more compact */
    .mb-3.border-start.border-4 .p-3 {
        padding: 0.5rem !important;
    }
}

/* === NBA DAILY GAME CARDS MOBILE OPTIMIZATIONS === */
/* Sticky selected game indicator */
@media (max-width: 768px) {
    .selected-game-indicator {
        position: sticky !important;
        top: 56px !important; /* Below navbar */
        z-index: 1020 !important;
        background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%) !important;
        color: white !important;
        padding: 0.75rem 1rem !important;
        margin: -1rem -1rem 1rem -1rem !important; /* Negative margins to extend to container edges */
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        border-radius: 0 !important;
        animation: slideInDown 0.3s ease-out !important;
    }

    .selected-game-indicator .selected-game-content {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .selected-game-indicator .game-matchup {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        flex: 1 !important;
    }

    .selected-game-indicator .loading-badge {
        background-color: rgba(255, 255, 255, 0.2) !important;
        padding: 0.25rem 0.5rem !important;
        border-radius: 0.25rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap !important;
    }

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

    /* Game card loading overlay */
    .game-card-loading-overlay {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(13, 110, 253, 0.95) !important;
        border-radius: 0.375rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 10 !important;
        animation: fadeIn 0.2s ease-in !important;
    }

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

    /* Enhanced selected card state on mobile */
    .nba-game-card {
        position: relative !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Add pulse animation to selected card */
    .game-card[style*="borderWidth: 3px"] .nba-game-card {
        animation: pulseGlow 2s infinite !important;
    }

    @keyframes pulseGlow {
        0%, 100% {
            box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.3);
        }
        50% {
            box-shadow: 0 0 0 0.4rem rgba(13, 110, 253, 0.5);
        }
    }

    /* Smooth scroll behavior for mobile */
    html {
        scroll-behavior: smooth !important;
    }

    /* Add scroll margin to game details section for mobile */
    #nba_daily_game_details_section {
        scroll-margin-top: 120px !important; /* Account for sticky header + indicator */
    }

    /* Improve touch feedback on game cards */
    .game-card:active {
        transform: scale(0.98) !important;
        opacity: 0.9 !important;
    }

    /* Make game cards easier to tap */
    .game-card {
        min-height: 140px !important;
        touch-action: manipulation !important; /* Prevents double-tap zoom */
    }
}

/* Extra small screens - adjust indicator size */
@media (max-width: 576px) {
    .selected-game-indicator {
        padding: 0.6rem 0.75rem !important;
    }

    .selected-game-indicator .game-matchup {
        font-size: 0.85rem !important;
    }

    .selected-game-indicator .loading-badge {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.4rem !important;
    }
}

/* === SOCCER H2H TAB MOBILE STYLES === */
/* Card-based mobile view matching global lookback style - NO horizontal scrolling */
@media (max-width: 768px) {
    /* Mobile card styling - clean and simple like global lookback */
    .soccer-h2h-mobile-cards .card {
        border: none;
        border-radius: 0.375rem;
    }

    /* Clean card body spacing - matches global lookback py-2 */
    .soccer-h2h-mobile-cards .card-body {
        padding: 0.75rem;
    }

    /* Icon styling - consistent with global lookback */
    .soccer-h2h-mobile-cards .fa-home,
    .soccer-h2h-mobile-cards .fa-plane,
    .soccer-h2h-mobile-cards .fa-futbol {
        font-size: 0.875rem;
    }

    /* Text size consistency */
    .soccer-h2h-mobile-cards .small {
        font-size: 0.875rem;
        line-height: 1.4;
    }

    /* Badge styling - match global lookback */
    .soccer-h2h-mobile-cards .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        font-weight: 500;
    }

    /* Wrapper for mobile cards */
    .soccer-h2h-table-mobile-wrapper {
        overflow-x: hidden !important;
        width: 100% !important;
    }

    /* Success icon color */
    .soccer-h2h-mobile-cards .text-success {
        color: #28a745 !important;
    }
}

@media (max-width: 576px) {
    /* More compact on very small screens */
    .soccer-h2h-mobile-cards .card-body {
        padding: 0.6rem;
    }

    .soccer-h2h-mobile-cards .small {
        font-size: 0.8rem;
    }
}

/* === WEBHOOK PAGE MOBILE OPTIMIZATIONS === */
@media (max-width: 768px) {
    /* Mobile-optimized touch targets for webhook page */
    .checkbox-group-mobile .form-check {
        min-height: 48px;
        padding: 12px 8px;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
    }

    .checkbox-group-mobile .form-check-input {
        width: 24px !important;
        height: 24px !important;
        margin-right: 12px !important;
        flex-shrink: 0;
    }

    .checkbox-group-mobile .form-check-label {
        font-size: 16px !important;
        line-height: 1.5;
        padding: 4px 0;
        flex-grow: 1;
    }

    /* Larger filter labels for better readability */
    .filter-label {
        font-size: 1.1rem !important;
        font-weight: 600 !important;
        margin-bottom: 12px !important;
    }

    /* Status banner mobile styling */
    #webhook_status_banner {
        position: sticky;
        top: 0;
        z-index: 1000;
        margin-bottom: 1rem;
    }

    /* Webhook buttons full width on mobile */
    .w-100.w-md-auto {
        width: 100% !important;
    }

    /* Card hover effects for bulk execution */
    .cursor-pointer {
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .hover-shadow:active {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
        transform: scale(0.98);
    }

    /* Switch sizes for better tapping */
    .form-switch-lg .form-check-input {
        width: 3rem !important;
        height: 1.5rem !important;
        min-width: 3rem;
    }

    /* Accordion items mobile spacing */
    .accordion-item {
        margin-bottom: 0.5rem !important;
    }

    .accordion-button {
        font-size: 1rem !important;
        padding: 1rem !important;
        min-height: 56px;
    }

    /* Date inputs mobile optimization */
    input[type="date"] {
        font-size: 16px !important;
        padding: 0.75rem !important;
        min-height: 48px;
    }

    /* Dropdown mobile optimization */
    .Select-control {
        min-height: 48px !important;
    }

    /* Terminal output mobile sizing */
    .terminal-output {
        font-size: 0.75rem !important;
        height: 300px !important;
    }

    /* History cards mobile spacing */
    .mb-2 {
        margin-bottom: 0.75rem !important;
    }

    /* Small text readability */
    .small,
    small {
        font-size: 0.875rem !important;
    }

    /* Badge sizing */
    .badge {
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
    }
}

/* Prevent iOS zoom on input focus */
@media (max-width: 768px) {
    input,
    select,
    textarea,
    .Select-control,
    .form-control,
    .dropdown button {
        font-size: 16px !important;
    }
}

/* Extra small screens - webhook optimizations */
@media (max-width: 576px) {
    .checkbox-group-mobile .form-check {
        min-height: 44px;
        padding: 10px 6px;
    }

    .checkbox-group-mobile .form-check-input {
        width: 20px !important;
        height: 20px !important;
    }

    .checkbox-group-mobile .form-check-label {
        font-size: 15px !important;
    }

    .filter-label {
        font-size: 1rem !important;
    }

    .accordion-button {
        font-size: 0.9rem !important;
        padding: 0.75rem !important;
    }

    .terminal-output {
        height: 250px !important;
    }
}

/* === SOCCER MOBILE OVER/UNDER INTERACTIVE CARDS === */
@media (max-width: 768px) {
    /* Allow box-shadow to show - ensure parent containers don't clip */
    .mobile-over-under,
    .mobile-over-under .card-body,
    .mobile-over-under .row {
        overflow: visible !important;
    }

    /* Add padding to columns containing O/U cards */
    .mobile-over-under .row .col-6 {
        padding: 5px !important;
        overflow: visible !important;
    }

    /* Wrapper divs for O/U cards - allow space for box-shadow */
    .mobile-over-under [id*="mobile_ou_"] {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        overflow: visible !important;
    }

    /* Cards inside wrappers - fill wrapper completely with visible default border */
    .mobile-over-under [id*="mobile_ou_"] .card {
        margin: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border: 2px solid #dee2e6 !important; /* Light gray border by default */
    }

    /* Smooth transition for all mobile over/under cards */
    .mobile-over-under .card {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Active touch feedback */
    .mobile-over-under .card:active {
        transform: scale(0.97) !important;
        opacity: 0.95 !important;
    }

    /* Hover shadow effect for mobile cards - keep subtle */
    .mobile-over-under .hover-shadow {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
        transition: all 0.3s ease !important;
    }

    .mobile-over-under .hover-shadow:hover,
    .mobile-over-under .hover-shadow:active {
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12) !important;
    }

    /* Game log text contrast - ensure readable on white background */
    .mobile-over-under .text-dark {
        color: #212529 !important;
    }

    /* Game log rows - ensure white background */
    .mobile-over-under .card-body .row {
        background-color: transparent !important;
    }

    /* Game info text styling */
    .mobile-over-under .fw-normal {
        color: #495057 !important;
        font-weight: 500 !important;
    }

    /* Smooth slide-in animation for game log */
    .mobile-over-under [id*="mobile_ou_"][id*="game_log"] > div,
    #soccer_daily_mobile_ou_home_game_log > div,
    #soccer_daily_mobile_ou_away_game_log > div {
        animation: slideInFromTop 0.3s ease-out !important;
    }

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

    /* Active card border pulse animation */
    .mobile-over-under .border-success.border-3,
    .mobile-over-under .border-primary.border-3 {
        animation: borderPulse 2s infinite ease-in-out !important;
    }

    @keyframes borderPulse {
        0%, 100% {
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        50% {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        }
    }

    /* Ensure no white space gaps */
    .mobile-over-under {
        margin: 0 !important;
        padding: 0 !important;
    }

    .mobile-over-under > div {
        margin-bottom: 0 !important;
    }

    /* Game log badge text contrast */
    .mobile-over-under .badge.bg-success,
    .mobile-over-under .badge.bg-danger {
        color: white !important;
        font-weight: 600 !important;
    }

    /* Ensure proper spacing between elements */
    .mobile-over-under .mt-3 {
        margin-top: 0.75rem !important;
    }

    /* Team header colors with good contrast */
    .mobile-over-under .text-success {
        color: #1e7e34 !important; /* Darker green for better contrast */
    }

    .mobile-over-under .text-primary {
        color: #0056b3 !important; /* Darker blue for better contrast */
    }

    /* Card body text contrast */
    .mobile-over-under .text-dark {
        color: #212529 !important;
        font-weight: 500 !important;
    }

    /* Touch-friendly card sizing */
    .mobile-over-under .card {
        min-height: 80px !important;
        touch-action: manipulation !important;
    }

    /* Prevent zoom on double tap */
    .mobile-over-under * {
        touch-action: manipulation !important;
    }
}

/* Extra small screens - more compact */
@media (max-width: 576px) {
    .mobile-over-under .card {
        min-height: 70px !important;
    }

    .mobile-over-under .card-body {
        padding: 0.5rem !important;
    }

    .mobile-over-under h4 {
        font-size: 1.25rem !important;
    }

    .mobile-over-under .badge {
        font-size: 0.8rem !important;
        padding: 0.3rem 0.5rem !important;
    }
}