/* Mobile Fixes for TeamSchedule - Fixed Button Accessibility */

/* Core mobile viewport improvements */
@media (max-width: 768px) {
    
    /* Ensure body and html allow proper scrolling */
    html, body {
        height: 100%;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Schedule container - ensure content is accessible above fixed buttons */
    .schedule-container {
        padding-bottom: 300px !important; /* Generous padding for all mobile devices */
        margin-bottom: 20px;
        max-height: calc(100vh - 160px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Schedule table container - additional mobile padding */
    .schedule-table-container {
        padding-bottom: 280px !important;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Schedule and payment sections - ensure proper mobile scrolling */
    #schedule,
    #payment {
        padding-bottom: 320px !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: 100vh;
    }
    
    /* Fixed button containers - improve mobile accessibility */
    #scheduleButtonsContainer {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 2px solid #000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        padding: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        min-height: 80px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    #additionalButtonsContainer {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 2px solid #000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        padding: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        min-height: 80px;
    }
    
    #additionalButtonsContainer.show {
        display: flex !important;
        flex-direction: column;
        gap: 12px;
    }
    
    /* Order buttons container - mobile accessibility */
    .order-main-container.order-bottom-bar {
        position: fixed;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 2px solid var(--brand-blue);
        box-shadow: 0 -4px 20px rgba(19, 57, 106, 0.15);
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        min-height: 120px;
    }
    
    /* Workflow container mobile constraints */
    #workflowContainer {
        max-height: calc(100vh - env(safe-area-inset-bottom));
    }
    
    .workflow-content-area {
        max-height: calc(100vh - 160px); /* Account for header and safe area */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Search results and dropdowns - ensure they don't get cut off */
    .search-results {
        max-height: calc(100vh - 300px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 2000; /* Above fixed buttons */
    }
    
    datalist {
        max-height: calc(100vh - 300px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Sport buttons container - ensure scrollability */
    .sport-buttons-container {
        max-height: calc(100vh - 300px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 200px;
    }
    
    /* Gender and sport selection - mobile improvements */
    .button-group,
    .button-grid {
        padding-bottom: 200px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    
    /* Even more generous padding for small screens */
    .schedule-container {
        padding-bottom: 350px !important;
    }
    
    .schedule-table-container {
        padding-bottom: 320px !important;
    }
    
    #schedule,
    #payment {
        padding-bottom: 380px !important;
    }
    
    /* Ensure buttons are easily tappable on small screens */
    #scheduleButtonsContainer button,
    #additionalButtonsContainer button,
    .order-btn {
        min-height: 48px; /* iOS/Android recommended minimum tap target */
        padding: 14px;
        font-size: 16px;
    }
    
}

/* Landscape orientation fixes for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    
    /* Reduce padding in landscape to maximize content area */
    .schedule-container {
        padding-bottom: 180px !important;
        max-height: calc(100vh - 120px);
    }
    
    .schedule-table-container {
        padding-bottom: 160px !important;
        max-height: calc(100vh - 140px);
    }
    
    #schedule,
    #payment {
        padding-bottom: 200px !important;
    }
    
    /* Smaller button containers in landscape */
    #scheduleButtonsContainer,
    #additionalButtonsContainer {
        padding: 12px;
        min-height: 60px;
    }
    
    /* Workflow container landscape constraints - maximize content area */
    #workflowContainer {
        max-height: calc(100vh - env(safe-area-inset-bottom));
    }
    
    .workflow-content-area {
        max-height: calc(100vh - 120px); /* Smaller header in landscape */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
}

    /* Prevent mobile browser auto-zoom on input focus */
@media (max-width: 768px) {
    
    /* Target all input elements to prevent mobile zoom */
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    textarea,
    .school-search {
        font-size: 16px !important; /* Minimum 16px prevents iOS Safari auto-zoom */
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    /* Specific targeting for search input */
    .school-search,
    #teamInput {
        font-size: 16px !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        transform: scale(1);
        -webkit-transform: scale(1);
        transition: none;
        -webkit-transition: none;
    }
    
}

/* Ensure touch-friendly interactions */
@media (pointer: coarse) {
    
    /* All interactive elements should be touch-friendly */
    button,
    .selection-btn,
    .order-btn,
    input,
    select {
        min-width: 44px;
    }
    
    /* Increase touch targets for small UI elements */
    .trash-btn,
    .back-icon {
        min-height: 44px;
        min-width: 44px;
        padding: 8px;
    }
    
} 