/* ─── Design Tokens ──────────────────────────────────────────────── */
:root {
    --chat-primary: #3b82f6;
    --chat-primary-dark: #1d4ed8;
    --chat-primary-light: #dbeafe;
    --chat-accent: #10b981;
    --chat-accent-dark: #059669;
    --chat-text: #1f2937;
    --chat-text-muted: #6b7280;
    --chat-bg: #f9fafb;
    --chat-card-bg: #ffffff;
    --chat-border: #e5e7eb;
    --chat-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --chat-shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --chat-radius: 12px;
    --chat-radius-sm: 8px;
    --chat-space-xs: 4px;
    --chat-space-sm: 8px;
    --chat-space-md: 16px;
    --chat-space-lg: 24px;
    --chat-space-xl: 32px;
}

/* Login prompt button styling */
.btn-login-prompt:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5) !important;
}

.login-prompt-container {
    text-align: center;
}

/* CRITICAL: Prevent horizontal overflow on ALL devices */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
}

/* Mobile-specific overflow prevention */
@media (max-width: 991px) {
    html, body, .modern-chat-container, .main-content-area, .main-content-box {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100vw !important;
        box-sizing: border-box !important;
    }

    /* Force all containers to stay within viewport */
    div, section, article, main, aside {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Allow chart elements to be visible */
    .bar-chart-wrapper,
    .bar-chart-container,
    .bar-chart-bars,
    .bar-chart-bar {
        overflow: visible !important;
        max-width: none !important;
    }

    /* Ensure bar labels and values are visible on mobile */
    .bar-chart-bar > div {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Histogram and chart optimizations - copied from betting calculator */
    #chart-container,
    [id^="chat-histogram-"] {
        width: 95% !important;
        min-height: 350px !important;
        margin: 1.5rem auto;
        box-sizing: border-box;
        overflow: visible !important;
    }
    
    /* Fix hit rate summary to prevent vertical text display */
    #hit-rate-summary {
        display: block !important;
        width: 100% !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        white-space: normal !important;
        overflow: hidden !important;
        text-align: center !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    
    /* Fix games filter container positioning - ensure it's visible and centered */
    #games-filter-container {
        position: relative !important;
        width: 100% !important;
        margin: 0 auto 1rem auto !important;
        padding: 10px 20px !important;
        z-index: 100 !important;
        display: block !important;
        text-align: center !important;
        background: white !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
        clear: both !important;
        float: none !important;
    }
    
    #games-filter-container .btn-group {
        margin: 0 auto !important;
        display: inline-flex !important;
    }
    
    /* Ensure chart content goes below filter */
    .player-performance-container {
        clear: both !important;
        display: block !important;
        width: 100% !important;
    }

    /* Mobile histogram optimizations */
    @media (max-width: 768px) {
        #chart-container,
        [id^="chat-histogram-"] {
            width: 100% !important;
            margin: 1rem 0 !important;
            padding: 0 !important;
            overflow: visible !important;
        }
        
        /* Force mobile layout for bar chart containers */
        .bar-chart-container {
            overflow: visible !important;
            width: 100% !important;
            max-width: none !important;
            margin: 0 !important;
            padding: 0 !important;
        }
        
        .bar-chart-container.mt-4 {
            margin-top: 1rem !important; /* Reduce top margin */
        }
        
        .bar-chart-container .text-center.mb-4 {
            margin-bottom: 1rem !important; /* Reduce title bottom margin */
        }
        
        /* Force mobile wrapper styles - override any inline styles */
        .bar-chart-wrapper {
            overflow: visible !important;
            width: 100% !important;
            max-width: none !important;
            padding-left: 15px !important; /* Force mobile padding */
            margin: 0 !important;
            position: relative !important;
        }
        
        /* Hide y-axis labels on mobile regardless of JavaScript */
        .y-axis-label {
            display: none !important;
        }
        
        .bar-chart-bars {
            overflow: visible !important;
            width: 100% !important;
            max-width: none !important;
            padding-bottom: 0px !important;
            padding-top: 0px !important;
            margin-bottom: 80px !important; /* Space for bottom labels */
        }

        /* Force mobile bar styling and spacing */
        .bar-chart-bars {
            justify-content: space-between !important;
            width: 100% !important;
        }
        
        /* Force narrower bars on mobile with proper spacing */
        .bar-chart-bar {
            margin: 0 1px !important;
            width: auto !important;
            flex: 1 !important;
            max-width: calc(70% / var(--bar-count, 10)) !important;
            border-right: none !important; /* Remove gray line on right */
        }
        
        /* Force visibility for bar value labels */
        .bar-chart-bar .bar-value-above,
        .bar-chart-bar > .bar-value-above,
        .bar-chart-bar > div[class*="bar-value"] {
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            color: #000000 !important;
            font-size: 12px !important;
            font-weight: 700 !important;
            background: rgba(255,255,255,0.95) !important;
            padding: 2px 4px !important;
            border: 1px solid #ddd !important;
            border-radius: 3px !important;
            z-index: 9999 !important;
            text-shadow: none !important;
            text-align: center !important;
            line-height: 1.2 !important;
            margin-bottom: 5px !important;
            width: fit-content !important;
            margin-left: auto !important;
            margin-right: auto !important;
        }
        
        /* Allow labels to show above and below bars */
        .bar-chart-bar {
            overflow-x: hidden !important;
            overflow-y: visible !important;
        }
        
        /* Allow chart containers to show value labels above bars */
        .bar-chart-container, .bar-chart-wrapper {
            overflow: visible !important;
        }
        
        /* Ensure bar value labels above bars are always visible */
        .bar-value-above {
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            z-index: 1000 !important;
            position: absolute !important;
        }
        
        /* Force mobile bar value labels to be visible with maximum specificity */
        @media (max-width: 768px) {
            .bar-chart-bar .bar-value-above,
            .bar-chart-container .bar-value-above,
            div.bar-value-above {
                display: block !important;
                visibility: visible !important;
                opacity: 1 !important;
                position: static !important;
                z-index: 9999 !important;
                margin-bottom: 8px !important;
                font-size: 11px !important;
                font-weight: bold !important;
                color: #374151 !important;
                text-align: center !important;
                background: rgba(255,255,255,0.95) !important;
                padding: 1px 2px !important;
                border-radius: 3px !important;
                border: 1px solid #d1d5db !important;
                width: fit-content !important;
                margin-left: auto !important;
                margin-right: auto !important;
                transform: none !important;
                top: auto !important;
                left: auto !important;
            }
        }
        
        /* Hide scrollbars on individual bar elements */
        .bar-chart-bar::-webkit-scrollbar {
            display: none !important;
            width: 0 !important;
            height: 0 !important;
        }
        
        /* Ensure chart containers have space and prevent overflow */
        .player-performance-chart,
        .bar-chart-container,
        div[id*="chart"],
        body {
            padding-bottom: 50px !important;
            margin-bottom: 20px !important;
            overflow-x: hidden !important;
            overflow-y: visible !important;
        }
        
        /* Hide all scrollbars on mobile */
        body::-webkit-scrollbar,
        *::-webkit-scrollbar {
            display: none !important;
            width: 0 !important;
        }
        
        /* Override hover transform to prevent scroll */
        .bar-chart-bar:hover {
            transform: none !important;
        }
        
        /* Force override inline hover styles */
        .bar-chart-bar[style*="transform"] {
            transform: none !important;
        }
        
        /* Override inline styles for game labels below bars */
        .bar-chart-bar .bar-label {
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            color: #000000 !important;
            font-size: 9px !important;
            font-weight: 600 !important;
            background: rgba(255,255,255,0.95) !important;
            padding: 3px 5px !important;
            border: 1px solid rgba(0,0,0,0.1) !important;
            border-radius: 4px !important;
            z-index: 2000 !important;
            text-shadow: none !important;
            position: absolute !important;
            bottom: -35px !important;
            left: 50% !important;
            transform: translateX(-50%) !important;
            text-align: center !important;
            line-height: 1.2 !important;
            white-space: nowrap !important;
        }
        
        /* Filter buttons on one row on mobile - make them shorter */
        .games-filter-container .btn-group {
            display: flex !important;
            flex-direction: row !important;
            flex-wrap: nowrap !important;
            justify-content: center !important;
            gap: 6px !important;
        }
        
        .games-filter-container .btn {
            flex: 0 0 auto !important;
            min-width: 45px !important;
            max-width: 50px !important;
            font-size: 0.7rem !important;
            padding: 6px 8px !important;
        }
    }


    /* Ensure x-axis labels are always visible without scrolling */
    .bar-label {
        display: block !important;
        visibility: visible !important;
        position: absolute !important;
    }

    /* Make all blue text black on mobile */
    .sidebar-title,
    .sample-questions-button,
    .quick-question-btn,
    .question-item,
    .category-header,
    .tip-icon,
    .suggestion-pill {
        color: #000 !important;
    }
    
    /* Keep blue backgrounds but make text black on mobile */
    .sample-questions-button:hover {
        color: #000 !important;
    }
    
    .quick-question-btn:hover {
        color: #000 !important;
    }
    
    .category-header:hover {
        color: #000 !important;
    }
    
    .question-item:hover {
        color: #000 !important;
    }
    
    /* Reduce spacing for subtitle on mobile */
    .chat-subtitle {
        font-size: 0.95rem !important;
        line-height: 1.3 !important;
        margin-top: 0.25rem !important;
        margin-bottom: 0.75rem !important;
    }
}

/* Prevent specific elements from causing overflow */
table, img, video, canvas, iframe, pre, code {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* Ensure all elements use proper box-sizing */
* {
    box-sizing: border-box !important;
}

body {
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 25%, #cbd5e1 50%, #e2e8f0 75%, #f0f4f8 100%);
    min-height: 100vh;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(226, 232, 240, 0.5) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(203, 213, 225, 0.5) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(241, 245, 249, 0.5) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.modern-chat-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px;
    padding-left: 290px;
    position: relative;
    min-height: 100vh;
    transition: padding-left 0.3s ease;
    overflow-x: visible;
    overflow-y: auto;
    box-sizing: border-box;
}

.modern-chat-container.sidebar-collapsed {
    padding-left: 90px;
}

/* Floating Toggle Button - Hidden since we now have the sample questions button */
.sidebar-toggle-float {
    display: none;
}

.sidebar-toggle-float:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: scale(1.05);
}

.sidebar-toggle-float.collapsed {
    left: 75px;
}

.sidebar-toggle-float.collapsed i {
    transform: rotate(180deg);
}

/* Mobile menu button - hidden by default, shown only on mobile */
.mobile-menu-button {
    display: none;
    position: fixed;
    top: 90px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.mobile-menu-button:hover {
    background: var(--chat-primary-dark);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* Style for when showing history */
.mobile-menu-button.has-history {
    background: var(--chat-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.mobile-menu-button.has-history:hover {
    background: var(--chat-primary-dark);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.mobile-menu-button i {
    margin: 0;
    font-size: 1.3rem;
}

/* Sidebar Styles */
.sidebar-questions {
    width: 260px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: fit-content;
    position: fixed;
    left: 10px;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 100;
    transition: all 0.3s ease;
}



.history-list {
    padding: 0;
    max-height: 250px;
    overflow-y: auto;
}

.history-item {
    background: rgba(249, 250, 251, 0.8);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 4px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-size: 13px;
}

.history-item:hover {
    background: rgba(243, 244, 246, 1);
    border-color: #10b981;
    transform: translateX(-2px);
}

.history-item-question {
    font-size: 0.9rem;
    color: #1f2937;
    font-weight: 500;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-date {
    font-size: 0.75rem;
    color: #6b7280;
}

.history-item-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: #ef4444;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Additional responsive breakpoint for tablets */
@media (max-width: 1024px) {
    .sidebar-questions {
        width: 220px;
        padding: 15px;
        font-size: 0.9rem;
    }
    
    .question-item {
        font-size: 0.82rem;
        padding: 7px 8px;
    }
}

.sidebar-questions.collapsed {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.sidebar-separator {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #e2e8f0, transparent);
    margin: 20px 0;
    opacity: 0.6;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tip-icon-container {
    display: inline-flex;
    align-items: center;
}

.tip-icon {
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tip-icon:hover {
    color: #3b82f6;
}

/* Mobile: make the icon clickable and show tooltip on click */
@media (max-width: 768px) {
    .tip-icon {
        font-size: 1rem;
    }
}

.sidebar-close-button {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    border: none;
    border-radius: 8px;
    padding: 8px;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.sidebar-close-button:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

.question-category {
    margin-bottom: 8px;
}

.category-header {
    width: 100%;
    background: transparent;
    border: none;
    padding: 10px;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.category-header:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
}

.category-arrow {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
}

/* Removed rotated class - using icon swapping instead */

.category-questions {
    padding: 0 0 0 10px;
    max-height: 1500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-questions.collapsed {
    max-height: 0;
    padding: 0;
}

.question-item {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    padding: 10px 12px;
    text-align: left;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin-bottom: 2px;
}

.question-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    transform: translateX(5px);
}

/* Main Content Area */
.main-content-area {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
    width: 100%;
    padding: 0 10px;
}

/* Allow wider container for tables with many columns */
.modern-chat-container.wide-table {
    max-width: 98%;
}

/* Reduce padding on wide tables to maximize space */
.wide-table .main-content-box {
    padding: 20px 15px;
}

/* Older tablet styles - now handled by the new responsive system above */
/* These rules are kept for sidebar-specific adjustments only */
@media (min-width: 769px) and (max-width: 1024px) {
    .modern-chat-container.sidebar-collapsed .chat-input-wrapper {
        width: calc(100% - 20px) !important;
    }
}

/* Responsive design for small screens */
@media (max-width: 991px) {
    /* Hide sidebar off-screen by default on mobile */
    .sidebar-questions {
        position: fixed;
        left: -280px;
        top: 80px;
        height: calc(100vh - 80px);
        width: 280px;
        background: rgba(255, 255, 255, 0.98);
        z-index: 1000;
        transition: left 0.3s ease;
        padding: 20px;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        border-radius: 0;
    }
    
    /* When sidebar is open */
    .sidebar-questions.open {
        left: 0;
    }
    
    
    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Hide desktop sidebar toggle on mobile */
    .sidebar-toggle-float {
        display: none !important;
    }
    
    /* Show mobile menu button */
    .mobile-menu-button {
        display: flex !important;
    }
    
    .mobile-menu-button i {
        font-size: 1rem !important;
    }
    
    .modern-chat-container {
        flex-direction: column;
        padding: 0;
        margin: 0 auto;
        min-height: 100vh;
        padding-top: 0px; /* Remove all top padding */
        width: 100%;
        max-width: 100%;
        display: flex;
        justify-content: center;
        box-sizing: border-box;
    }
    
    .main-content-area {
        width: 100%;
        margin: 0;
        padding: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        box-sizing: border-box;
    }
    
    .main-content-box {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    
    /* Ensure all main content elements are centered on mobile */
    .main-chat-input,
    .chat-header,
    .sport-selector,
    .chat-results {
        width: 100%;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    /* Center the search bar wrapper specifically */
    .chat-input-wrapper {
        width: calc(100% - 20px) !important;
        max-width: 500px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
    
    /* Override any other padding/margin that might be affecting positioning */
    .main-chat-input {
        padding: 0 !important;
        margin: 0 auto !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .main-content-box,
    .main-content-box::before,
    .main-content-box::after {
        padding: 5px 10px !important;
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        background: transparent !important;
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        backdrop-filter: none !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .chat-header {
        margin-bottom: 8px !important; /* Further reduced for mobile */
        padding: 0 10px !important; /* Add padding back for text */
    }
    
    /* Make query help text wider on mobile to take up less vertical space */
    body .main-content-box .query-help-text {
        max-width: 98% !important;
        padding: 0 5px !important;
        margin: 8px auto 12px auto !important;
        width: 98% !important;
    }
    
    body .main-content-box .query-help-text small {
        line-height: 1.3 !important;
        font-size: 0.8rem !important;
        display: block !important;
        width: 100% !important;
    }
    
    /* Add border to search bar on mobile */
    body .main-content-box .main-chat-input .chat-input-wrapper {
        border: 2px solid #e5e7eb !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }
    
    /* Force wider query help text - override everything */
    body .main-content-area .main-content-box .query-help-text {
        width: 90vw !important;
        max-width: 90vw !important;
        margin-left: calc(-45vw + 50%) !important;
        margin-right: calc(-45vw + 50%) !important;
        padding: 0 5px !important;
        text-align: center !important;
    }
    
    body .main-content-area .main-content-box .query-help-text small {
        width: 100% !important;
        display: block !important;
    }
    
    /* Add padding back to content that needs it */
    .main-content-box > *:not(.main-chat-input) {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    /* Ensure query limit is visible on mobile */
    .query-limit-display {
        display: inline-block !important;
    }
    
    /* Make chat input responsive and centered on mobile */
    .main-chat-input {
        margin: 0 auto 15px auto !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .chat-input-wrapper {
        border-radius: 12px !important;
        position: relative !important;
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-rows: minmax(auto, 1fr) !important;
        align-items: stretch !important;
        background: white !important;
        box-sizing: border-box !important;
        border: 1px solid #d1d5db !important;
        padding: 8px !important;
        gap: 8px !important;
        min-height: auto !important;
        box-sizing: border-box !important;
    }
    
    .main-input {
        grid-column: 1 !important;
        border: none !important;
        outline: none !important;
        background: transparent !important;
        padding: 8px 12px !important;
        min-height: 34px !important;
        resize: none !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: pre-wrap !important;
        line-height: 1.4 !important;
        font-family: inherit !important;
        font-size: inherit !important;
        user-select: text !important;
        -webkit-user-select: text !important;
        cursor: text !important;
        caret-color: #1f2937 !important;
    }
    
    .send-button {
        grid-column: 2 !important;
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        background: #10b981 !important;
        border: none !important;
        cursor: pointer !important;
        margin: 0 !important;
        box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3) !important;
        position: static !important;
        right: unset !important;
        top: unset !important;
        left: unset !important;
        bottom: unset !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
        align-self: center !important;
    }
    
    /* Show close button on mobile */
    .sidebar-close-button {
        display: block !important;
        background: rgba(239, 68, 68, 0.1) !important;
        color: #ef4444 !important;
    }
    
    /* Keep logo full size on mobile */
    .malter-analytics-logo img {
        height: 100px !important;
    }
    
    /* Compact sample questions layout */
    .sidebar-title {
        font-size: 0.95rem;
    }
    
    .category-header {
        padding: 8px;
        font-size: 0.9rem;
    }
    
    /* Keep vertical layout in sidebar for mobile */
    .category-questions:not(.collapsed) {
        display: block;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .question-item {
        display: block;
        width: 100%;
        text-align: left;
        padding: 10px 12px;
        font-size: 0.9rem;
        line-height: 1.4;
        border: 1px solid #e2e8f0;
        background: white;
        margin-bottom: 8px;
        white-space: normal;
    }
    
    /* Keep search bar sticky and always visible */
    .main-chat-input {
        position: sticky;
        top: 10px;
        background: white;
        z-index: 40;
        padding: 10px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        margin-bottom: 15px;
    }
    

    .main-input {
        font-size: 0.95rem;
        padding: 14px 18px;
        user-select: text !important;
        -webkit-user-select: text !important;
        cursor: text !important;
        caret-color: #1f2937 !important;
    }
    
    /* MOBILE FIXES - Show close button and header on mobile */
    .sidebar-header {
        display: flex !important;
        position: sticky !important;
        top: 0 !important;
        background: white !important;
        z-index: 10000 !important;
        margin-bottom: 15px !important;
        padding: 20px 15px 15px 15px !important;
        margin-top: 0 !important;
    }
    
    #sidebar-questions {
        padding-top: 0 !important;
        z-index: 10000 !important;
    }
    
    /* Enable arrows and toggle functionality on mobile */
    .category-arrow {
        display: inline-block !important;
    }
    
    .category-header {
        cursor: pointer !important;
        pointer-events: auto !important;
    }
    
    .category-header span {
        pointer-events: auto !important;
    }
    
    
    .sidebar-close-button {
        display: block !important;
        background: rgba(239, 68, 68, 0.1) !important;
        color: #ef4444 !important;
    }
    
    
    
    /* Keep analytics cards logo consistent on mobile */
    .malter-analytics-logo img {
        height: 30px !important;
        object-fit: contain !important;
        display: block !important;
    }
    
    /* Prevent header overflow on mobile */
    .card-header.bg-primary {
        padding: 6px 8px !important;
        min-height: auto !important;
        overflow: visible !important;
    }
    
    .question-header {
        gap: 4px !important;
        min-height: auto !important;
        flex-wrap: nowrap !important;
    }
    
    .question-header h6 {
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
        flex: 1 !important;
    }
    
    .malter-analytics-logo img {
        height: 25px !important;
        width: auto !important;
    }
    
    .send-button {
        width: 48px;
        height: 48px;
    }
    
    /* Ensure results stay contained */
    .results-content {
        padding: 0 !important;
        overflow-x: hidden !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Prevent analysis response overflow */
    .analysis-response {
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .question-title {
        font-size: 1.1rem;
        margin: 0 10px 15px 10px !important;
        padding: 15px !important;
        background: white !important;
        border-radius: 8px !important;
        border: 1px solid #ddd !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }
    
    .malter-analytics-logo img {
        height: 60px;
        object-fit: contain;
    }
    
    /* Query count button responsive */
    .query-limit-container {
        margin-top: 10px;
    }
    
    .query-limit-display {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        font-size: 0.85rem !important;
        text-align: center !important;
    }
    
    .limit-content {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        justify-content: center;
    }
    
    .upgrade-link {
        padding: 0;
        margin: 0;
        border: none;
        border-left: none !important;
        width: auto;
        display: flex;
        justify-content: center;
    }
    
    .upgrade-link a {
        display: inline-block;
        padding: 12px 32px;
        background: #007bff;
        color: white !important;
        border: none;
        border-radius: 25px;
        font-weight: 600;
        text-decoration: none !important;
        box-shadow: 0 3px 10px rgba(0, 123, 255, 0.3);
        transition: all 0.3s ease;
        font-size: 0.9rem;
    }
    
    .upgrade-link a:hover,
    .upgrade-link a:focus,
    .upgrade-link a:active {
        background: #007bff !important;
        transform: none !important;
        box-shadow: 0 3px 10px rgba(0, 123, 255, 0.3) !important;
    }
}

.main-content-box {
    background: transparent;
    border-radius: 0;
    padding: 0 10px 30px;
    box-shadow: none;
    backdrop-filter: none;
    border: none;
    width: 100%;
    position: relative;
}

.main-content-box::before {
    display: none;
}

.chat-header {
    margin-bottom: 60px;
    padding-top: 20px !important;
    margin-top: 10px !important;
}

/* Override mobile specific rules */
body .main-content-box .chat-header {
    margin: 10px 0 60px 0 !important;
    padding: 20px 20px 0 20px !important;
}

/* Override chat title margin specifically */
body .main-content-box .chat-header .chat-title,
body .main-content-box .chat-header h1.chat-title {
    margin: 10px 0 0 0 !important;
    padding-top: 0 !important;
}

.chat-title {
    font-size: 2.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    margin-top: 20px;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sample-questions-button {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1.5px solid #3b82f6;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.1);
    text-decoration: none;
    position: fixed;
    top: 90px;
    left: 10px;
    z-index: 1000;
    margin-bottom: 20px;
}

.sample-questions-button:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #2563eb !important;
    border-color: #2563eb !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2) !important;
}

.sample-questions-button i {
    font-size: 1.2rem;
}

/* Hide button text on desktop */
.sample-questions-button .button-text {
    display: none;
}

/* Show full button with text on mobile */
@media (max-width: 991px) {
    .sample-questions-button {
        position: absolute;
        border-radius: 6px;
        width: auto;
        height: auto;
        padding: 6px 10px;
        gap: 5px;
        font-size: 0.85rem;
        top: 90px;
        left: 10px;
        z-index: 1000;
    }

    .sample-questions-button .button-text {
        display: inline;
        font-size: 0.85rem;
    }

    .sample-questions-button i {
        font-size: 0.95rem;
    }
}

.chat-subtitle {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 0;
    line-height: 1.4;
}


/* Sidebar Sport Filter Buttons */
.sidebar-sport-filters {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

/* Default visibility - MLB hidden, NFL shown */
.mlb-category {
    display: none;
}

.nfl-category {
    display: block;
}

.sport-filter-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    color: #374151;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.sport-filter-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sport-filter-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}



.query-limit-container {
    text-align: center;
    margin-top: 20px;
}

.query-limit-display {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 25px;
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.query-limit-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.limit-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #495057;
    font-weight: 600;
    flex-wrap: nowrap;
}

.limit-content #queryCount {
    font-size: 14px;
    letter-spacing: 0.5px;
}

.limit-content small {
    opacity: 0.9;
    font-size: 11px;
    display: block;
    margin-top: 4px;
}

.upgrade-link {
    padding-left: 12px;
    margin-left: 12px;
    border-left: 1px solid rgba(73, 80, 87, 0.2);
    display: inline-flex;
    align-items: center;
}

.upgrade-link a {
    background: none;
    padding: 0;
    border-radius: 0;
    text-decoration: underline;
    color: #007bff !important;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
    white-space: nowrap;
}

.upgrade-link a:hover {
    color: #0056b3 !important;
    text-decoration: underline;
}

.query-limit-display.text-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-color: #ffc107;
}

.query-limit-display.text-warning .limit-content {
    color: #856404;
}

.query-limit-display.text-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c2c7 100%);
    border-color: #dc3545;
}

.query-limit-display.text-danger .limit-content {
    color: #721c24;
}

.query-limit-display i {
    margin-right: 8px;
    font-size: 1rem;
}

.query-help-text {
    text-align: center;
    margin: 10px auto 15px auto;
    max-width: 1100px;
    word-wrap: break-word;
}

/* Mobile Quick Questions */
.mobile-quick-questions {
    display: none; /* Hidden by default */
    margin: 15px auto 20px auto;
    max-width: 500px;
    padding: 0 10px;
}

.quick-questions-header {
    margin-bottom: 8px;
    text-align: center;
}

.quick-questions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.quick-question-btn {
    background: var(--chat-primary-light);
    color: var(--chat-primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--chat-radius-sm);
    padding: var(--chat-space-sm) 10px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.quick-question-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--chat-primary-dark);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
    box-shadow: var(--chat-shadow);
}

/* Show mobile quick questions only on mobile */
@media (max-width: 991px) {
    .mobile-quick-questions {
        display: block;
    }
}

.main-chat-input {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 10px !important;
    box-sizing: border-box;
}

/* Force main container to use full width */
@media (max-width: 1200px) {
    .main-chat-input {
        padding: 0 5px !important;
        max-width: calc(100% - 10px) !important;
    }
}


.chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box !important;
    z-index: 200 !important;
    will-change: auto;
    contain: layout style;
}



/* MOBILE PAGE CENTERING FIX - Reset all containers */
@media (max-width: 991.98px) {
    /* Add top padding to prevent navbar overlap */
    .modern-chat-container {
        padding-top: 0px;
    }
    
    /* Reset body and html */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Reset main containers */
    body .modern-chat-container,
    body .main-content-area {
        margin: 0 auto !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        position: relative !important;
    }
    
    /* Main content box with proper padding for header */
    body .main-content-box {
        margin: 0 auto !important;
        padding: 0px 0 0 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        position: relative !important;
    }
    
    /* Specific fix for navbar if it exists */
    body .navbar,
    body .navbar-container {
        margin: 0 !important;
        padding: 0 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Mobile navbar layout - hamburger left, logo center, user icon right */
    html body .navbar .container {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        height: 80px !important;
        padding-top: 0px !important;
        padding-bottom: 0px !important;
    }

    html body .navbar-toggler {
        order: 1 !important;
        margin-right: 15px !important;
        margin-left: 0 !important;
        margin-top: 0px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 40px !important;
        width: 40px !important;
        padding: 8px !important;
    }

    html body .navbar-brand {
        order: 2 !important;
        margin-left: 0 !important;
        margin-right: auto !important;
        margin-top: 0px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 80px !important;
    }

    html body .navbar-brand img {
        height: 65px !important;
        max-height: 65px !important;
        width: auto !important;
        object-fit: contain !important;
        display: block !important;
    }

    html body .mobile-user-icon {
        order: 3 !important;
        margin-left: 15px !important;
        margin-right: 0 !important;
        margin-top: 0px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 40px !important;
        width: 40px !important;
        font-size: 24px !important;
        color: white !important;
        text-decoration: none !important;
    }
    
    /* Restore chat header - force visibility */
    body .main-content-box .chat-header {
        display: block !important;
        text-align: center !important;
        margin: 0 0 10px 0 !important;
        padding: 50px 20px 0 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    body .main-content-box .chat-header .chat-title {
        font-size: 2.2rem !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        margin: 0 0 0 0 !important;
        padding-top: 10px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        line-height: 1.2 !important;
    }

/* PERFECT MOBILE CENTERING - Fixed layout flow */
    body .main-chat-input {
        width: 100% !important;
        padding: 0 20px !important;
        margin: 0 auto !important;
        display: block !important;
        box-sizing: border-box !important;
    }
    
    body .main-chat-input .chat-input-wrapper {
        width: 100% !important;
        max-width: 500px !important;
        margin: 0 auto !important;
        padding: 4px !important;
        position: relative !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        border-radius: 25px !important;
        background: #ffffff !important;
        border: 2px solid rgba(0, 0, 0, 0.1) !important;
        left: 0 !important;
        transform: none !important;
    }
    
    body .main-chat-input .main-input {
        font-size: 0.95rem !important;
        padding: 12px 16px !important;
        flex: 1 !important;
        border: none !important;
        background: transparent !important;
        resize: none !important;
        overflow-x: hidden !important;
        min-height: 44px !important;
        line-height: 1.4 !important;
        vertical-align: top !important;
        user-select: text !important;
        -webkit-user-select: text !important;
        cursor: text !important;
        caret-color: #1f2937 !important;
    }
    
    body .main-chat-input .send-button {
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
        margin-left: 8px !important;
    }
}


.chat-input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.main-input {
    flex: 1;
    border: none;
    background: transparent !important;
    padding: 18px 24px;
    font-size: 1.1rem;
    color: #1f2937;
    outline: none;
    resize: none;
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text !important;
    caret-color: #1f2937 !important;
    will-change: auto;
    contain: layout style paint;
}


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

.send-button {
    background: var(--chat-accent);
    border: none;
    border-radius: 50px;
    width: 56px;
    height: 56px;
    margin: var(--chat-space-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.send-button:hover:not(:disabled) {
    background: var(--chat-accent-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.thinking-status {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 5px;
}

.thinking-status small {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Typing indicator with bouncing dots */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
}
.typing-indicator .typing-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}
.typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}
.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-primary);
    opacity: 0.4;
    animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}
.typing-label {
    font-size: 0.85rem;
    color: var(--chat-text-muted);
    margin-left: 4px;
    transition: opacity 0.2s ease;
}

/* Skeleton loading screen */
.skeleton-loader {
    padding: 24px 28px;
    animation: skeletonFadeIn 0.3s ease;
}
.skeleton-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.skeleton-bar {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite ease-in-out;
    border-radius: 6px;
}
.skeleton-title { width: 45%; height: 22px; }
.skeleton-badge { width: 60px; height: 22px; border-radius: 12px; }
.skeleton-table {
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
}
.skeleton-table-header {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #f0f0f0;
}
.skeleton-table-header .skeleton-bar {
    height: 14px;
    flex: 1;
}
.skeleton-table-row {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5;
}
.skeleton-table-row:last-child { border-bottom: none; }
.skeleton-table-row .skeleton-bar {
    height: 14px;
    flex: 1;
}
.skeleton-table-row .skeleton-bar:first-child {
    flex: 1.5;
}
.skeleton-insight {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.04);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.skeleton-insight .skeleton-bar { height: 12px; }
.skeleton-insight .skeleton-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes skeletonFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Result fade-in animation */
.results-fade-in {
    animation: resultsFadeIn 0.4s ease-out;
}
@keyframes resultsFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* #13: Sport-colored accents - subtle left border on result tables */
.results-content[data-sport="nfl"] .table-responsive { border-left: 3px solid #1a73e8; }
.results-content[data-sport="mlb"] .table-responsive { border-left: 3px solid #e53935; }
.results-content[data-sport="nba"] .table-responsive { border-left: 3px solid #f57c00; }

/* #8: Table improvements - sortable headers and hover */
.results-content table thead th {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.15s;
}
.results-content table thead th:hover {
    background: rgba(0,0,0,0.04);
}
.results-content table thead th .sort-icon {
    font-size: 0.7rem;
    margin-left: 4px;
    opacity: 0.3;
    transition: opacity 0.15s;
}
.results-content table thead th.sorted .sort-icon {
    opacity: 1;
    color: var(--chat-primary);
}
.results-content table tbody tr {
    transition: background 0.12s;
}
.results-content table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

/* #10: Error card with retry */
.error-card {
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 12px;
    overflow: hidden;
    text-align: center;
    padding: 32px 24px;
}
.error-card .error-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fef2f2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.error-card .error-icon i { font-size: 1.4rem; color: #dc2626; }
.error-card h6 { color: #991b1b; margin-bottom: 8px; }
.error-card p { color: #6b7280; font-size: 0.9rem; margin-bottom: 16px; }
.error-card .retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.error-card .retry-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}
.error-card .suggestion {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #9ca3af;
}

/* #6: Sport auto-detection badge */
.sport-detect-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.sport-detect-badge.visible { opacity: 1; }
.sport-detect-badge.nfl { background: rgba(26,115,232,0.1); color: #1a73e8; }
.sport-detect-badge.mlb { background: rgba(229,57,53,0.1); color: #e53935; }
.sport-detect-badge.nba { background: rgba(245,124,0,0.1); color: #f57c00; }

/* #7: Empty state featured insight cards */
.empty-state {
    text-align: center;
    padding: 40px 20px 20px;
}
.empty-state h5 {
    color: var(--chat-text);
    font-weight: 600;
    margin-bottom: 6px;
}
.empty-state p {
    color: var(--chat-text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}
.insight-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    max-width: 720px;
    margin: 0 auto;
}
.insight-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}
.insight-card:hover {
    border-color: var(--chat-primary);
    box-shadow: 0 4px 12px rgba(99,102,241,0.1);
    transform: translateY(-2px);
}
.insight-card .insight-emoji { font-size: 1.5rem; margin-bottom: 8px; }
.insight-card .insight-title { font-size: 0.85rem; font-weight: 600; color: var(--chat-text); margin-bottom: 4px; }
.insight-card .insight-desc { font-size: 0.75rem; color: var(--chat-text-muted); }

/* #12: Query count progress ring */
.progress-ring-container {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.progress-ring {
    width: 36px;
    height: 36px;
    transform: rotate(-90deg);
}
.progress-ring .ring-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 3;
}
.progress-ring .ring-fill {
    fill: none;
    stroke: var(--chat-primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease, stroke 0.3s;
}
.progress-ring-text {
    font-size: 0.8rem;
    color: var(--chat-text-muted);
}
.progress-ring-text strong {
    color: var(--chat-text);
    font-size: 0.9rem;
}

/* #9: Mobile bottom sheet for sidebar */
@media (max-width: 991px) {
    .sidebar-questions {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-height: 70vh;
        border-radius: 16px 16px 0 0 !important;
        transform: translateY(100%) !important;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 1050 !important;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.15) !important;
        overflow-y: auto;
    }
    .sidebar-questions.active {
        transform: translateY(0) !important;
    }
    .sidebar-questions .sidebar-header {
        position: sticky;
        top: 0;
        z-index: 2;
        background: inherit;
        padding-top: 12px;
    }
    .sidebar-questions .sidebar-header::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
        margin: 0 auto 12px;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1049;
        opacity: 0;
        transition: opacity 0.3s;
    }
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}

.suggestions-section {
    margin-bottom: 20px;
}

.suggestions-label {
    color: #475569;
    margin-bottom: 12px;
    font-size: 0.95rem;
    font-weight: 500;
}

.category-tabs {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 15px;
}

.category-tab {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 10px 18px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.category-tab.active {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #10b981;
    color: #10b981;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
    font-weight: 600;
}

.category-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.suggestions-carousel {
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.carousel-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.category-content {
    display: none;
}

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

.carousel-track {
    display: flex;
    gap: 10px;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding: 10px 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    justify-content: center;
}

.carousel-track.scrollable {
    justify-content: flex-start;
}

.carousel-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.carousel-nav {
    background: rgba(59, 130, 246, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    margin: 0 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.carousel-nav:hover {
    background: rgba(59, 130, 246, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.carousel-nav-left {
    order: -1;
}

.carousel-nav-right {
    order: 1;
}

.suggestion-pill {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    padding: 12px 20px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: max-content;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.suggestion-pill:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.status-indicator {
    text-align: center;
    margin-top: 20px;
    background: rgba(34, 197, 94, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(34, 197, 94, 0.3);
    display: inline-block;
}

.results-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--chat-border), transparent);
    margin: var(--chat-space-lg) 0 var(--chat-space-md) 0;
}

.results-section {
    margin-top: 0;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
}

.results-content {
    padding: var(--chat-space-lg) var(--chat-space-lg) var(--chat-space-md) var(--chat-space-lg);
    color: var(--chat-text);
    background: var(--chat-card-bg);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    overflow-x: hidden;
    overflow-y: visible;
    max-width: 100%;
    height: auto;
    max-height: none;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow-x: hidden;
    max-width: 1400px;
    margin: 0 auto;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 50px;
}

.question-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.malter-analytics-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.malter-analytics-logo img {
    height: 60px;
    width: auto;
    object-fit: contain;
}

/* Make all card headers more compact */
.card-header.bg-primary {
    padding: 10px 16px !important;
    min-height: auto !important;
    display: flex !important;
    align-items: center !important;
    overflow: visible !important;
}

.card-header.bg-primary .question-header {
    margin-bottom: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    width: 100%;
    align-items: center !important;
}

/* Logo properly sized for all card headers */
.card-header.bg-primary .malter-analytics-logo img {
    height: 35px;
    width: auto;
    object-fit: contain;
    display: block;
}

.results-content table {
    text-align: left;
}

.results-content table td,
.results-content table th {
    text-align: left;
}

/* Handle wide tables with horizontal scroll */
.results-content .table-responsive {
    overflow-x: hidden;
    margin-bottom: 0;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    max-width: 100%;
}

.results-content .table-responsive table {
    min-width: 100%;
    white-space: normal;
    margin-bottom: 0;
    width: 100%;
    table-layout: auto;
    word-wrap: break-word;
}

.results-content .table-responsive table th,
.results-content .table-responsive table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-width: 80px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* For very wide tables, allow container to expand */
.wide-table .results-content .table-responsive table {
    width: auto;
    min-width: max-content;
}

/* Optimize wide table cell spacing */
.wide-table .results-content .table-responsive table th,
.wide-table .results-content .table-responsive table td {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    min-width: 70px;
    white-space: nowrap;
}

/* Ensure player performance tables use full width */
.results-content .table-responsive table.table-hover {
    width: 100%;
}

/* Ensure table styling matches the original design */
.results-content .table-dark {
    background-color: #4a5568 !important;
}

.results-content .badge.bg-primary {
    background-color: #18bc9c !important;
}

/* Force wide tables to be more vertical - prevent horizontal overflow */
.results-content .table-responsive {
    max-width: 100%;
    overflow-x: hidden;
}

.results-content .table-responsive table {
    max-width: 100%;
    table-layout: auto;
}

/* For very wide historical analysis tables - make them vertical */
@media (max-width: 1200px) {
    .results-content .table-responsive table th,
    .results-content .table-responsive table td {
        min-width: 60px;
        font-size: 0.75rem;
        padding: 0.3rem 0.4rem;
        word-break: break-word;
        white-space: normal;
    }
}

/* Mobile table transformation */
@media (max-width: 992px) {
    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) {
        overflow-x: visible !important;
        overflow-y: visible !important;
        border: none !important;
    }

    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) table {
        display: block !important;
        width: 100% !important;
        border: none !important;
    }

    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) table thead {
        display: none !important;
    }

    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) table tbody {
        display: block !important;
    }

    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) table tr {
        display: block !important;
        background: white !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        margin-bottom: 15px !important;
        margin-left: 10px !important;
        margin-right: 10px !important;
        padding: 15px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }

    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        padding: 8px 0 !important;
        margin-bottom: 8px !important;
        border: none !important;
        border-bottom: 1px solid #f0f0f0 !important;
        text-align: left !important;
        word-wrap: break-word !important;
        white-space: normal !important;
        line-height: 1.4 !important;
    }

    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) table td:last-child {
        border-bottom: none !important;
        margin-bottom: 0 !important;
    }

    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) table td:before {
        content: attr(data-label) !important;
        font-weight: bold !important;
        color: #666 !important;
        flex-shrink: 0 !important;
        margin-right: 15px !important;
        min-width: 100px !important;
    }

    .results-content .table-responsive:not(.metric-value-table):not(.game-outcomes-table):not(.multi-row-table):not(.fantasy-table):not(.perplexity-table) table td .mobile-value {
        flex: 1 !important;
        text-align: right !important;
        word-break: break-word !important;
    }

    /* Perplexity table mobile fixes */
    .perplexity-table {
        overflow-x: visible !important;
        max-width: 100% !important;
    }

    .perplexity-table table {
        width: 100% !important;
        table-layout: auto !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    .perplexity-table table td,
    .perplexity-table table th {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        max-width: none !important;
        padding: 8px 4px !important;
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
    }

    .perplexity-table table td:first-child,
    .perplexity-table table th:first-child {
        min-width: 80px !important;
        width: 35% !important;
    }

    .perplexity-table table td:last-child,
    .perplexity-table table th:last-child {
        width: 65% !important;
    }

    /* Keep Metric/Value tables as single box on mobile */
    .results-content .metric-value-table {
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        margin: 10px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
        background: white !important;
    }

    .results-content .metric-value-table table {
        width: 100% !important;
        margin: 0 !important;
    }

    .results-content .metric-value-table table thead {
        background: #343a40 !important;
    }

    .results-content .metric-value-table table thead th {
        color: white !important;
        padding: 12px !important;
        font-size: 0.9rem !important;
    }

    .results-content .metric-value-table table tbody tr {
        border-bottom: 1px solid #eee !important;
    }

    .results-content .metric-value-table table tbody tr:last-child {
        border-bottom: none !important;
    }

    .results-content .metric-value-table table td {
        padding: 10px 12px !important;
        font-size: 0.9rem !important;
    }

    .results-content .metric-value-table table td:first-child {
        font-weight: 500 !important;
        color: #666 !important;
    }

    .results-content .metric-value-table table td:last-child {
        text-align: left !important;
        font-weight: 600 !important;
        color: #1e293b !important;
    }

    /* Keep Game Outcomes, Multi-Row, and Fantasy tables as scrollable tables on mobile, but prevent Perplexity horizontal scrolling */
    .results-content .game-outcomes-table,
    .results-content .multi-row-table,
    .results-content .fantasy-table {
        overflow-x: hidden !important;
    }
    
    .results-content .perplexity-table {
        overflow-x: hidden !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        margin: 10px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
        background: white !important;
    }

    .results-content .game-outcomes-table table,
    .results-content .multi-row-table table,
    .results-content .fantasy-table table,
    .results-content .perplexity-table table {
        width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        font-size: 0.85rem !important;
    }

    .results-content .game-outcomes-table table thead th,
    .results-content .multi-row-table table thead th,
    .results-content .fantasy-table table thead th,
    .results-content .perplexity-table table thead th {
        padding: 10px 8px !important;
        font-size: 0.8rem !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    .results-content .game-outcomes-table table tbody td,
    .results-content .multi-row-table table tbody td,
    .results-content .fantasy-table table tbody td,
    .results-content .perplexity-table table tbody td {
        padding: 10px 8px !important;
        font-size: 0.85rem !important;
        vertical-align: middle !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Make prediction column wrappable on mobile */
    .results-content .game-outcomes-table table tbody td:first-child {
        white-space: normal !important;
        word-wrap: break-word !important;
        min-width: 200px !important;
    }

    /* Keep probability and odds columns compact */
    .results-content .game-outcomes-table table tbody td:nth-child(2),
    .results-content .game-outcomes-table table tbody td:nth-child(3) {
        white-space: nowrap !important;
        text-align: center !important;
    }
}

@media (max-width: 991px) {
    .chat-title {
        font-size: 2.5rem;
    }
    
    .sport-selector {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    
    /* Make all sport bubbles the same size on mobile */
    .sport-option label {
        min-width: 80px;
        min-height: 50px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 8px 10px;
    }
    
    /* Hide the "(Coming Soon)" text on mobile for consistent sizing */
    .sport-option label small {
        display: none;
    }
    
    .suggestions-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .suggestion-pill {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }
    
    /* Chart container mobile responsiveness */
    .chart-container {
        width: calc(100% - 4px) !important;
        max-width: calc(100% - 4px) !important;
        height: 550px !important; /* Increased from 450px to 550px */
        margin: 2px !important;
        padding: 8px !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        position: relative !important;
    }
    
    .chart-container canvas {
        max-width: calc(100% - 8px) !important; /* Reduced margin from 16px to 8px */
        max-height: calc(100% - 8px) !important;
        width: calc(100% - 8px) !important;
        height: calc(100% - 8px) !important;
        box-sizing: border-box !important;
        position: relative !important;
        margin: 4px !important; /* Reduced margin from 8px to 4px */
    }
    
    /* MLB Visualization container mobile responsiveness */
    .card-body > div[style*="height: 750px"] {
        height: 700px !important; /* Adjusted to account for filter container space */
        padding: 5px !important; /* Reduce padding from 10px to 5px for more space */
    }
    
    /* MLB Visualization canvas mobile sizing */
    canvas[id^="viz-"] {
        max-width: 98% !important;
        max-height: 98% !important;
        width: 98% !important;
        height: auto !important;
    }
    
    /* Increase plot title font size on mobile */
    .card-header h6 {
        font-size: 1.2rem !important; /* Increased from 1rem to 1.2rem */
        font-weight: 600 !important;
        line-height: 1.3 !important;
    }
    
    /* Reduce margins on mobile for more compact layout */
    .card.border-0.shadow-sm.mb-3 {
        margin-bottom: 1rem !important; /* Reduce from default margin */
    }
    
    /* Move content higher on mobile */
    .modern-chat-container {
        padding-top: 10px !important; /* Reduce top padding */
    }
    
    /* Responsive filter positioning for MLB visualizations */
    .card-body .loading-spinner ~ canvas {
        margin-top: -10px !important; /* Pull canvas up slightly */
    }
    
    /* Move MLB visualization containers higher on mobile */
    .card.border-0.shadow-sm.mb-3 {
        margin-top: -5px !important; /* Slight pull higher without cutting header */
    }
    
    /* Historical analysis card mobile optimization */
    .card-header .question-header h6 {
        font-size: 1rem !important;
    }
    
    .card-body h5 {
        font-size: 1.1rem !important;
        padding: 10px !important;
        margin-bottom: 10px !important;
    }
}

/* Center content on left side when sidebar is collapsed on tablet and web view */
@media (min-width: 769px) {
    .modern-chat-container.sidebar-collapsed .main-content-area {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 1000px !important;
        padding-left: 50px !important;
        padding-right: 50px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .modern-chat-container.sidebar-collapsed .main-content-area .sport-header-section {
        width: 100% !important;
        max-width: 1100px !important;
    }
    
    .modern-chat-container.sidebar-collapsed .main-content-area .main-chat-input {
        width: 100% !important;
        max-width: 1100px !important;
    }
    
    .modern-chat-container.sidebar-collapsed .main-content-area .chat-results {
        width: 100% !important;
        max-width: 1100px !important;
    }
}

/* Login Overlay Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-overlay-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
    animation: overlaySlideIn 0.3s ease-out;
}

.login-overlay-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.login-overlay-header h3 {
    margin: 0;
    color: #334155;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-overlay-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-overlay-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.login-overlay-body {
    padding: 24px;
}

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

/* Fix for navbar dropdown on mobile to match other pages */
@media (max-width: 991px) {
    /* Ensure navbar dropdown appears above page content */
    .navbar-collapse {
        z-index: 10000 !important;
    }
}

/* Ensure Perplexity insights are visible on mobile */
@media (max-width: 991px) {
    /* Fix response content positioning on mobile */
    .results-section {
        margin: 0 -20px 0 -20px !important;
        width: calc(100% + 40px) !important;
        max-width: calc(100% + 40px) !important;
        box-sizing: border-box !important;
        padding: 0 !important;
    }
    
    .results-content {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 20px !important;
        box-sizing: border-box !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
    
    /* Make cards use more screen width */
    .results-content .card {
        margin: 0 auto !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .perplexity-insights-section {
        margin: 10px 0 0 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .perplexity-insights-section h6 {
        font-size: 0.95rem !important;
    }
    
    .perplexity-content {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    /* Mobile table layout for Perplexity stats */
    .perplexity-table-wrapper perplexity-table {
        margin: 0 !important;
        overflow: auto !important;
        width: 100% !important;
    }
    
    .perplexity-table {
        width: 100% !important;
        background: white !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        margin: 10px 0 !important;
    }
    
    .perplexity-table tbody tr:last-child {
        border-bottom: none !important;
    }
    
    .perplexity-table td {
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
    }
}
    
    /* Reset any conflicting styles from this page */
    .sidebar-overlay {
        z-index: 9998 !important; /* Below navbar dropdown */
    }

    /* Auto-complete dropdown styling */
    .autocomplete-dropdown {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
        z-index: 999999 !important;
        max-height: 200px !important;
        overflow-y: auto !important;
        margin-top: 4px !important;
        width: 100% !important;
    }

    .autocomplete-item {
        padding: 12px 16px;
        cursor: pointer;
        border-bottom: 1px solid #f1f5f9;
        transition: background-color 0.2s ease;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .autocomplete-item:last-child {
        border-bottom: none;
    }

    .autocomplete-item:hover,
    .autocomplete-item.selected {
        background-color: #f8fafc;
        color: #10b981;
    }

    .autocomplete-item .highlight {
        background-color: #fef3c7;
        font-weight: 500;
    }

    .chat-input-wrapper {
        position: relative !important;
        overflow: visible !important;
    }
    
    .main-chat-input {
        overflow: visible !important;
    }

    /* Final autocomplete styling */
    .autocomplete-dropdown {
        background: white !important;
        border: 1px solid #e2e8f0 !important;
        color: #374151 !important;
        z-index: 999999 !important;
    }
    
    /* Ensure all parent containers allow overflow for dropdown */
    .chat-input-wrapper,
    .main-chat-input,
    .main-content-box {
        overflow: visible !important;
    }
    
    /* Mobile-specific autocomplete fixes */
    @media (max-width: 991px) {
        .autocomplete-dropdown {
            position: absolute !important;
            left: 0 !important;
            right: 0 !important;
            width: auto !important;
            border-radius: 8px !important;
            font-size: 16px !important; /* Prevent zoom on iOS */
        }
        
        .autocomplete-item {
            padding: 12px 16px !important;
            font-size: 16px !important; /* Prevent zoom on iOS */
            min-height: 44px !important; /* Minimum touch target */
            display: block !important; /* Change from flex to block */
            line-height: 1.5 !important;
            white-space: normal !important;
            word-wrap: break-word !important;
            text-align: left !important;
        }
        
        .autocomplete-item .highlight {
            display: inline !important;
            background-color: #fef3c7 !important;
            font-weight: 500 !important;
            padding: 0 !important;
            margin: 0 !important;
        }
    }
}
