/* ========================================
 * UNIFIED MOBILE RESPONSIVE STYLES
 * Consolidated from mobile-improvements.css and mobile-enhancements.css
 * Mobile-first responsive design with 768px primary breakpoint
 * ======================================== */

/* ========================================
 * CSS VARIABLES - MOBILE DESIGN TOKENS
 * ======================================== */

:root {
    --mobile-primary: #10B981;
    --mobile-primary-hover: #0B956C;
    --mobile-bg: #FFFFFF;
    --mobile-bg-alt: #F8F9FA;
    --mobile-border: #DEE2E6;
    --mobile-text: #212529;
    --mobile-text-muted: #6C757D;
    --mobile-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --mobile-radius: 0.75rem;
    --mobile-transition: all 0.3s ease;
}

/* Dark mode overrides for mobile variables */
[data-theme="dark"] {
    --mobile-bg: #121212;
    --mobile-bg-alt: #1e1e1e;
    --mobile-border: #495057;
    --mobile-text: #E9ECEF;
    --mobile-text-muted: #ADB5BD;
    --mobile-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* ========================================
 * CRITICAL MOBILE FOUNDATIONS
 * Prevent horizontal scroll and ensure proper viewport handling
 * ======================================== */

/* Prevent horizontal scroll on all pages */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Ensure all containers respect viewport width */
.container, .container-fluid {
    max-width: 100%;
}
/* Note: .row excluded - max-width breaks Bootstrap's negative margin system */

/* Pull-to-refresh hint - prevent conflicts with native pull-to-refresh */
@media (max-width: 768px) {
    body {
        overscroll-behavior-y: contain;
    }
}

/* ========================================
 * SAFE AREAS - NOTCH SUPPORT
 * iPhone X and newer - support for notches and rounded corners
 * ======================================== */

@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        body {
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
        }

        .navbar {
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
        }

        .modal-dialog {
            margin-left: max(0.5rem, env(safe-area-inset-left));
            margin-right: max(0.5rem, env(safe-area-inset-right));
        }
    }
}

/* Additional safe area support with padding-top */
@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .page-actions-bar {
            padding-top: calc(1rem + env(safe-area-inset-top));
        }

        .floating-actions {
            bottom: calc(2rem + env(safe-area-inset-bottom));
            right: calc(2rem + env(safe-area-inset-right));
        }
    }
}

/* ========================================
 * TOUCH-FRIENDLY INTERACTIONS
 * Minimum 44x44px tap targets (Apple HIG)
 * ======================================== */

@media (max-width: 768px) {
    /* Touch-friendly buttons and links */
    .btn, .nav-link, .schedule-card, a.team-link {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }

    /* Increase touch target for small buttons */
    .btn-sm {
        min-height: 44px;
        padding: 10px 14px;
    }

    /* Improve select dropdowns for touch */
    select, .form-select, .betting-provider {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 12px 40px 12px 12px; /* Extra padding for dropdown arrow */
    }

    /* Form inputs */
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    textarea,
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
    }
}

/* Enhanced touch interactions for touch-only devices */
@media (max-width: 768px) and (hover: none) {
    /* Disable hover effects on touch devices */
    .btn:hover,
    .nav-link:hover,
    .fab-item:hover,
    .fab-main:hover,
    .schedule-team-logo:hover,
    .team-logo:hover,
    .card:hover {
        transform: none;
    }

    /* Enhance tap targets */
    .btn {
        min-height: 48px;
        min-width: 48px;
    }

    .nav-link {
        min-height: 48px;
    }

    /* Add tap feedback */
    .btn:active,
    .nav-link:active,
    .fab-item:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* ========================================
 * HORIZONTAL SCROLL CONTAINERS WITH SHADOW INDICATORS
 * Visual feedback for scrollable content
 * ======================================== */

.table-scroll-container {
    position: relative;
    overflow: hidden;
}

.table-scroll-container::before,
.table-scroll-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.table-scroll-container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-secondary), transparent);
}

.table-scroll-container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-secondary), transparent);
}

.table-scroll-container.scroll-left::before,
.table-scroll-container.scroll-right::after {
    opacity: 1;
}

.table-scroll-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: thin;
}

/* ========================================
 * SCROLL HINT INDICATORS
 * Visual cue for horizontal scrollable content
 * ======================================== */

.scroll-hint {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

@media (min-width: 769px) {
    .scroll-hint {
        display: none;
    }
}

/* ========================================
 * DATA TABLES - MOBILE RESPONSIVE
 * Horizontal scroll with sticky columns and headers
 * ======================================== */

@media (max-width: 768px) {
    /* Table containers - horizontal scroll */
    .table-responsive,
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        width: 100%;
    }

    table {
        font-size: 0.85rem;
        min-width: 100%;
    }

    /* Sticky first column for context while scrolling */
    table thead th:first-child,
    table tbody td:first-child,
    .table-mobile-scroll th:first-child,
    .table-mobile-scroll td:first-child {
        position: sticky;
        left: 0;
        background: var(--bg-secondary);
        z-index: 10;
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    }

    /* Table headers - sticky on scroll */
    table thead th {
        position: sticky;
        top: 0;
        background: var(--bg-secondary);
        z-index: 5;
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Table cells - better mobile padding */
    table tbody td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }

    /* Table row hover - larger touch target */
    table tbody tr {
        cursor: pointer;
    }

    table tbody tr:active {
        background-color: rgba(var(--accent-primary-rgb), 0.1);
    }
}

/* Extra small screens - even more compact tables */
@media (max-width: 414px) {
    table {
        font-size: 0.75rem;
    }

    table thead th,
    table tbody td {
        padding: 0.5rem 0.25rem;
    }
}

/* Dark mode support for sticky table elements */
@media (max-width: 768px) {
    [data-theme="dark"] table thead th:first-child,
    [data-theme="dark"] table tbody td:first-child {
        background: var(--bg-secondary);
    }
}

/* ========================================
 * STICKY HEADER PATTERNS
 * Keep important content visible during scroll
 * ======================================== */

@media (max-width: 768px) {
    /* Enhanced page actions bar with sticky positioning */
    .page-actions-bar {
        position: sticky;
        top: 0;
        background: var(--mobile-bg);
        z-index: 100;
        padding: 1rem;
        margin: -1rem -0.5rem 1rem -0.5rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 1rem 1rem;
    }

    .page-actions-bar .d-flex {
        flex-direction: column;
        gap: 1rem;
    }

    .action-group {
        display: flex;
        gap: 0.5rem;
        width: 100%;
    }

    .action-group .btn {
        flex: 1;
        font-size: 0.875rem;
        padding: 0.625rem 0.75rem;
    }

    /* Mobile-optimized tab navigation */
    .tab-navigation {
        position: sticky;
        top: 0;
        z-index: 99;
        background: var(--mobile-bg);
        padding: 1rem 0;
        margin-bottom: 1rem;
    }

    .nav-pills {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0 1rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nav-pills::-webkit-scrollbar {
        display: none;
    }

    /* Tab-style navigation (nav-pills) - NOT navbar links */
    .nav-pills .nav-link {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0.75rem 1rem;
        border-radius: var(--mobile-radius);
        background: var(--mobile-bg-alt);
        color: var(--mobile-text-muted);
        border: 1px solid var(--mobile-border);
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 500;
        transition: var(--mobile-transition);
    }

    .nav-pills .nav-link.active {
        background: var(--mobile-primary);
        color: white;
        border-color: var(--mobile-primary);
    }

    .nav-pills .nav-link:hover:not(.active) {
        background: var(--mobile-bg);
        border-color: var(--mobile-primary);
    }

    /* Navbar links - use proper nav colors, transparent background */
    .navbar .nav-link {
        background: transparent;
        color: var(--nav-text);
        border: none;
    }

    .navbar .nav-link:hover,
    .navbar .nav-link:focus {
        background: rgba(255, 255, 255, 0.1);
        color: var(--nav-text);
    }
}

/* ========================================
 * FLOATING ACTION BUTTON (FAB)
 * Quick access to common actions
 * ======================================== */

.floating-actions {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: none;
}

@media (max-width: 768px) {
    .floating-actions {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 1rem;
    }
}

.fab-main {
    width: 56px;
    height: 56px;
    background: var(--mobile-primary);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: var(--mobile-transition);
    z-index: 1002;
}

.fab-main:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.4);
}

.fab-main:active {
    transform: scale(0.95);
}

.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.fab-item {
    width: 48px;
    height: 48px;
    background: var(--mobile-bg);
    color: var(--mobile-primary);
    border: 2px solid var(--mobile-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--mobile-transition);
    box-shadow: var(--mobile-shadow);
}

.fab-item:hover {
    background: var(--mobile-primary);
    color: white;
    transform: scale(1.05);
}

/* ========================================
 * SCHEDULE PAGE MOBILE IMPROVEMENTS
 * Optimized layout for game schedule cards
 * ======================================== */

@media (max-width: 768px) {
    /* Schedule container - single column on mobile */
    .schedule-container {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 0.5rem;
    }

    /* Schedule cards - optimized for mobile */
    .schedule-card {
        margin-bottom: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* Card header - more compact */
    .card-header {
        padding: 0.5rem 1rem;
    }

    .game-week {
        font-size: 0.8rem;
    }

    /* Card content - optimized spacing */
    .card-content {
        padding: 1rem;
        gap: 1rem;
    }

    /* Teams section - stack on small screens if needed */
    .teams-section {
        gap: 0.75rem;
    }

    /* Team logos - appropriate size for mobile */
    .schedule-team-logo {
        width: 80px !important;
        height: 80px !important;
        padding: 8px;
    }

    /* Team text - readable without overflow */
    .team-text {
        font-size: 0.95rem;
        white-space: normal; /* Allow wrapping on mobile */
        word-break: break-word;
        line-height: 1.2;
    }

    .team-record {
        font-size: 0.8rem;
    }

    /* VS divider */
    .vs-divider {
        font-size: 0.9rem;
        margin: 0 0.5rem;
    }

    /* Betting section - improved mobile layout */
    .betting-section {
        padding: 0.75rem;
    }

    .betting-provider-select {
        margin-bottom: 0.75rem;
    }

    /* Betting lines - stack on mobile */
    .line-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .line-item {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        background: var(--bg-primary);
        border-radius: 6px;
    }

    .line-label {
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .line-value {
        font-size: 0.9rem;
        text-align: right;
    }

    /* Info section - better mobile spacing */
    .info-section {
        padding-top: 1rem;
        gap: 0.5rem;
    }

    .info-item {
        font-size: 0.85rem;
        gap: 0.5rem;
    }

    /* Final score display */
    .game-final-score {
        padding: 0.75rem !important;
        margin: 0.75rem 0 !important;
    }

    .game-final-score span {
        font-size: 1.75rem !important;
    }

    .game-final-score div:last-child {
        font-size: 0.7rem !important;
    }
}

/* Extra small screens (320px - 414px) - more compact schedule */
@media (max-width: 414px) {
    .schedule-team-logo {
        width: 60px !important;
        height: 60px !important;
        padding: 6px;
    }

    .team-text {
        font-size: 0.85rem;
    }

    .team-record {
        font-size: 0.75rem;
    }

    .vs-divider {
        font-size: 0.8rem;
        margin: 0 0.25rem;
    }

    .card-content {
        padding: 0.75rem;
    }

    /* Stack teams vertically on very small screens */
    .teams-section {
        flex-direction: column;
        gap: 1rem;
    }

    .team {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        gap: 1rem;
    }

    .team-details {
        text-align: left;
    }
}

/* ========================================
 * REPORTING/ANALYTICS PAGE MOBILE
 * Optimized for data-heavy pages
 * ======================================== */

@media (max-width: 768px) {
    /* Section headings */
    .section-heading {
        margin: 1.5rem 0 1rem 0;
        font-size: 1.1rem;
    }

    .section-heading h2 {
        font-size: 1.25rem;
    }

    /* Record stats - stack on mobile */
    .record-stats {
        flex-direction: column;
        gap: 0.75rem;
    }

    .record-item {
        font-size: 1rem;
    }

    /* Team selection form - single column */
    .team-selection-form {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }

    /* Form groups */
    .form-group {
        margin-bottom: 0.75rem;
    }

    /* Submit button - full width on mobile */
    .submit-btn {
        width: 100%;
        justify-content: center;
    }

    /* Navigation links - stack vertically */
    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-link {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ========================================
 * CHARTS AND GRAPHS - MOBILE RESPONSIVE
 * Maintain readability for data visualizations
 * ======================================== */

@media (max-width: 768px) {
    /* Chart containers - allow horizontal scroll if needed */
    .chart-container {
        margin: 0.75rem 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    .chart-wrapper {
        min-width: 320px; /* Minimum width for charts */
        margin-bottom: 1rem;
    }

    /* Canvas elements - maintain aspect ratio */
    canvas {
        max-width: 100%;
        height: auto !important;
    }

    /* Chart legends - better mobile layout */
    .chart-legend {
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    /* PPA Charts and other team charts */
    .ppa-chart-container,
    .team-chart-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
 * FILTERS AND CONTROLS - MOBILE
 * Touch-friendly form controls
 * ======================================== */

@media (max-width: 768px) {
    /* Filter containers */
    .filters-container,
    .edge-ai-filters {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Filter groups */
    .filter-group {
        width: 100%;
    }

    /* Filter buttons - full width */
    .filter-btn {
        width: 100%;
        min-height: 44px;
    }

    /* Date pickers - touch-friendly */
    input[type="date"] {
        min-height: 44px;
        font-size: 16px;
    }
}

/* ========================================
 * GAME CARDS - MOBILE IMPROVEMENTS
 * Winner cards, prediction cards, and game cards
 * ======================================== */

@media (max-width: 768px) {
    /* Winner cards and game cards */
    .winner-card,
    .prediction-card,
    .game-card {
        min-height: auto;
        padding: 1rem;
    }

    /* Team logos in winner/prediction cards - doubled for better visibility */
    .winner-card .team-logo,
    .prediction-card .team-logo {
        width: 160px;
        height: 160px;
        padding: 8px;
    }

    /* Size container to match larger logo and add spacing */
    .winner-card .team-logo-container,
    .prediction-card .team-logo-container {
        width: 176px;
        height: 176px;
        margin-bottom: 1rem;
    }

    .winner-card .team-name,
    .prediction-card .team-name {
        position: relative;
        z-index: 2;
        margin-top: 0.75rem;
    }

    /* Legacy selector for other pages */
    .team-logo.team-logo-large {
        width: var(--logo-sm);
        height: var(--logo-sm);
        padding: 10px;
    }

    /* Score displays */
    .score-value {
        font-size: 2rem;
    }

    .score-dash {
        font-size: 1.5rem;
    }

    /* Edge AI badges */
    .edge-ai-pick-badge {
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem;
    }

    .edge-ai-banner {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
}

@media (max-width: 414px) {
    .winner-card,
    .prediction-card,
    .game-card {
        padding: 0.75rem;
    }

    /* Team logos - doubled for better visibility (was 70px) */
    .winner-card .team-logo,
    .prediction-card .team-logo {
        width: 140px;
        height: 140px;
        padding: 6px;
    }

    /* Size container to match larger logo and add spacing */
    .winner-card .team-logo-container,
    .prediction-card .team-logo-container {
        width: 156px;
        height: 156px;
        margin-bottom: 0.75rem;
    }

    .winner-card .team-name,
    .prediction-card .team-name {
        position: relative;
        z-index: 2;
        margin-top: 0.5rem;
    }

    .team-logo.team-logo-large {
        width: var(--logo-mobile-lg);
        height: var(--logo-mobile-lg);
        padding: 8px;
    }

    .score-value {
        font-size: 1.75rem;
    }

    .score-dash {
        font-size: 1.25rem;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    /* Team logos - doubled for better visibility (was 60px) */
    .winner-card .team-logo,
    .prediction-card .team-logo {
        width: 120px;
        height: 120px;
        padding: 5px;
    }

    /* Size container to match larger logo and add spacing */
    .winner-card .team-logo-container,
    .prediction-card .team-logo-container {
        width: 136px;
        height: 136px;
        margin-bottom: 0.5rem;
    }

    .winner-card .team-name,
    .prediction-card .team-name {
        position: relative;
        z-index: 2;
        margin-top: 0.375rem;
    }

    .team-logo.team-logo-large {
        width: var(--logo-mobile-lg);
        height: var(--logo-mobile-lg);
        padding: 6px;
    }
}

/* ========================================
 * MOBILE CARD LAYOUTS
 * General card styling for mobile
 * ======================================== */

@media (max-width: 768px) {
    .card {
        border-radius: var(--mobile-radius);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .insights-grid,
    .player-grid,
    .stats-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .insight-card,
    .player-card,
    .stat-card {
        width: 100%;
    }
}

/* ========================================
 * MOBILE SECTION HEADERS
 * Centered headers with improved readability
 * ======================================== */

@media (max-width: 768px) {
    .section-header {
        text-align: center;
        margin-bottom: 1.5rem;
        padding: 0 1rem;
    }

    .section-title {
        font-size: 1.375rem;
        font-weight: 700;
        color: var(--mobile-text);
        margin-bottom: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .section-subtitle {
        font-size: 0.9rem;
        color: var(--mobile-text-muted);
        line-height: 1.4;
        margin: 0;
    }
}

/* ========================================
 * MOBILE SUMMARY SECTIONS
 * Optimized summary card layouts
 * ======================================== */

@media (max-width: 768px) {
    .summary-card {
        padding: 1.5rem;
        border-radius: var(--mobile-radius);
        margin: 0 0.5rem;
    }

    .summary-advantages {
        flex-direction: column;
        gap: 1.5rem;
    }

    .advantage-item {
        text-align: center;
    }

    .vs-summary {
        order: -1;
        margin-bottom: 1rem;
    }

    .confidence-indicator {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .confidence-bar {
        width: 100%;
        max-width: 200px;
    }
}

/* ========================================
 * MODALS - MOBILE IMPROVEMENTS
 * Better sizing and layout for mobile modals
 * ======================================== */

@media (max-width: 768px) {
    /* Modal dialogs - better mobile sizing */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

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

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
        min-width: 120px;
    }
}

/* ========================================
 * TYPOGRAPHY - MOBILE READABILITY
 * Optimized font sizes for mobile screens
 * ======================================== */

@media (max-width: 768px) {
    /* Ensure all text is at least 16px to prevent iOS zoom */
    body {
        font-size: 16px;
    }

    /* Headings - proportional sizing */
    h1, .hero-section h1 {
        font-size: 1.75rem;
    }

    h2, .hero-section h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    /* Paragraph spacing */
    p {
        margin-bottom: 1rem;
        line-height: 1.5;
    }

    /* Small text - still readable */
    small,
    .small {
        font-size: 0.875rem;
    }

    /* Card and metric text */
    .card-title {
        font-size: 1.125rem;
    }

    .metric-label {
        font-size: 0.8rem;
    }

    .metric-value {
        font-size: 1rem;
    }
}

/* ========================================
 * SPACING AND LAYOUT - MOBILE
 * Optimized spacing for mobile screens
 * ======================================== */

@media (max-width: 768px) {
    /* Container padding - eliminate stacked padding on mobile */
    .main-wrapper {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .container,
    .container-fluid,
    .col-12 {
        padding-left: 0;
        padding-right: 0;
    }

    .main-content {
        padding-left: 0;
        padding-right: 0;
    }

    .team-container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .team-container.team-profile-page {
        padding-left: 0;
        padding-right: 0;
    }

    /* Section spacing */
    .schedule-section,
    .report-section {
        margin-bottom: 1.5rem;
    }

    /* Content sections */
    .content-sections {
        padding: 1rem 0.5rem;
        gap: 1.5rem;
    }

    .section-divider {
        margin: 2rem 0;
        opacity: 0.7;
    }

    /* Card spacing */
    .card {
        margin-bottom: 1rem;
    }

    /* Row gutters - reduce on mobile */
    .row {
        --bs-gutter-x: 1rem;
    }
}

@media (max-width: 414px) {
    /* Minimize wrapper padding on small phones */
    .main-wrapper {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .container,
    .container-fluid,
    .col-12 {
        padding-left: 0;
        padding-right: 0;
    }

    .main-content {
        padding-left: 0;
        padding-right: 0;
    }

    .team-container {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .team-container.team-profile-page {
        padding-left: 0;
        padding-right: 0;
    }

    .row {
        --bs-gutter-x: 0.5rem;
    }
}

/* ========================================
 * LOADING STATES - MOBILE
 * Optimized loading indicators
 * ======================================== */

@media (max-width: 768px) {
    /* Loading spinners */
    .spinner-border {
        width: 2rem;
        height: 2rem;
    }

    .loading-overlay {
        font-size: 1rem;
    }

    .loading-content {
        width: 95%;
        padding: 2rem 1.5rem;
        max-width: 350px;
    }

    .skeleton-chart-canvas {
        width: 250px;
        height: 250px;
    }

    .skeleton-player-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* Lazy loading support */
    .lazy-load {
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .lazy-load.loaded {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
 * ERROR STATES - MOBILE
 * Better error display on mobile
 * ======================================== */

@media (max-width: 768px) {
    .error-container {
        width: 95%;
        max-width: none;
    }

    .error-content {
        padding: 2rem 1.5rem;
    }

    .error-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .error-actions .btn {
        width: 100%;
    }
}

/* ========================================
 * ACCESSIBILITY - MOBILE
 * Enhanced accessibility for mobile users
 * ======================================== */

@media (max-width: 768px) {
    /* Focus states - more visible on mobile */
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus,
    .btn:focus,
    .nav-link:focus,
    .fab-main:focus,
    .fab-item:focus {
        outline: 3px solid var(--cta-primary);
        outline-offset: 2px;
    }

    /* Active states for touch feedback */
    button:active,
    .btn:active,
    a:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* High contrast mode */
    @media (prefers-contrast: high) {
        .btn,
        .nav-link,
        .fab-main,
        .fab-item {
            border-width: 2px;
        }

        .section-divider {
            height: 3px;
        }
    }

    /* Reduced motion preference */
    @media (prefers-reduced-motion: reduce) {
        .fab-main,
        .fab-item,
        .btn,
        .nav-link {
            transition: none;
        }

        .loading-spinner {
            animation: none;
        }
    }
}

/* ========================================
 * PERFORMANCE OPTIMIZATIONS - MOBILE
 * Reduce animations and optimize rendering
 * ======================================== */

@media (max-width: 768px) {
    /* Faster transitions for snappy mobile UI (not animations) */
    button,
    a,
    input,
    .btn,
    .nav-link,
    .card {
        transition-duration: 0.15s !important;
    }

    /* Quick entry animations for UI elements */
    .fade-in,
    .slide-in,
    .scale-in {
        animation-duration: 0.2s;
        animation-timing-function: ease-out;
    }

    /* Reduce motion for better performance when explicitly requested */
    .reduce-motion * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
 * DARK MODE - MOBILE SPECIFIC
 * Dark mode adjustments for mobile
 * ======================================== */

@media (max-width: 768px) {
    [data-theme="dark"] .line-item {
        background: var(--bg-primary);
    }
}

/* ========================================
 * LANDSCAPE ORIENTATION - MOBILE
 * Optimizations for landscape mode
 * ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    /* Reduce vertical spacing in landscape */
    .schedule-card {
        margin-bottom: 0.5rem;
    }

    .card-content {
        padding: 0.75rem;
    }

    /* Logos in landscape */
    .schedule-team-logo {
        width: 60px !important;
        height: 60px !important;
    }

    .team-logo.team-logo-large {
        width: 160px !important;
        height: 160px !important;
    }
}

/* Larger landscape adjustments */
@media (max-width: 1024px) and (orientation: landscape) {
    .page-actions-bar .d-flex {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .action-group {
        flex-direction: row;
        width: auto;
    }

    .summary-advantages {
        flex-direction: row;
    }

    .vs-summary {
        order: 0;
        margin: 0;
    }
}

/* ========================================
 * SWIPE GESTURES - OPTIONAL ENHANCEMENT
 * Support for swipe navigation
 * ======================================== */

@media (max-width: 768px) {
    .swipeable {
        touch-action: pan-y pinch-zoom;
    }

    .swipe-indicator {
        display: flex;
        justify-content: center;
        gap: 0.25rem;
        padding: 0.5rem;
    }

    .swipe-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--border-color);
        transition: background-color 0.2s;
    }

    .swipe-dot.active {
        background: var(--cta-primary);
    }
}

/* ========================================
 * FIXES FOR SPECIFIC ISSUES
 * Browser-specific fixes and workarounds
 * ======================================== */

@media (max-width: 768px) {
    /* Prevent text overflow in team names */
    .team-name,
    .team-text {
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    /* Fix for iOS input zoom */
    @supports (-webkit-touch-callout: none) {
        input,
        select,
        textarea {
            font-size: 16px !important;
        }
    }
}

/* ========================================
 * VERY SMALL SCREENS (< 380px)
 * Extra compact layout for smallest devices
 * ======================================== */

@media (max-width: 380px) {
    .content-sections {
        padding: 0.75rem 0.25rem;
    }

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

    .section-subtitle {
        font-size: 0.85rem;
    }

    .fab-main {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }

    .fab-item {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .floating-actions {
        bottom: 1.5rem;
        right: 1.5rem;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

/* ========================================
 * PRINT STYLES FOR MOBILE
 * Optimize for mobile printing
 * ======================================== */

@media print {
    .floating-actions,
    .page-actions-bar,
    .fab-menu {
        display: none !important;
    }

    .content-sections {
        padding: 0;
    }

    .section-divider {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--mobile-border);
        page-break-inside: avoid;
    }
}

/* ========================================
 * EDGE-TO-EDGE CARDS - MOBILE
 * Pricing section uses CSS variable overrides (not !important)
 * Picks page uses CSS Grid in picks.css
 * ======================================== */

@media (max-width: 575.98px) {
    /* Pricing section - override Bootstrap variables */
    .pricing-mobile-edge {
        padding-left: 0;
        padding-right: 0;
    }

    .pricing-mobile-edge .container {
        --bs-gutter-x: var(--gutter-mobile);
        max-width: 100%;
        padding-left: var(--container-padding-mobile);
        padding-right: var(--container-padding-mobile);
    }

    .pricing-mobile-edge .row {
        --bs-gutter-x: var(--gutter-mobile);
        margin-left: 0;
        margin-right: 0;
    }

    /* Cards fill width - use calc to account for any residual margins */
    .pricing-card {
        width: calc(100% - 1rem);  /* Account for 0.5rem margin each side */
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }
}
