/* Additional mobile-specific fixes and enhancements */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Touch-friendly spacing */
@media (max-width: 768px) {
    /* Ensure all interactive elements are at least 44x44px (iOS guidelines) */
    button,
    .btn,
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better touch targets for links */
    .nav-link,
    .trainer-actions button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Prevent text size adjustment on iOS */
    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    /* Better viewport handling */
    main {
        width: 100%;
        overflow-x: hidden;
    }
    
    /* Container adjustments */
    .container {
        padding: 0 15px;
        max-width: 100%;
    }
    
    /* Form improvements */
    select {
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 35px;
    }
    
    /* Better badge wrapping */
    .trainer-interests {
        flex-wrap: wrap;
    }
    
    .badge {
        font-size: 0.85em;
        padding: 5px 10px;
        margin: 2px;
    }
    
    /* Breadcrumb wrapping */
    .breadcrumb {
        flex-wrap: wrap;
        font-size: 0.9em;
    }
    
    /* Improved table scrolling for small screens */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better modal positioning */
    .modal {
        padding: 10px;
    }
    
    /* Footer adjustments */
    footer {
        padding: 20px 0;
        text-align: center;
    }
    
    footer .container p {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    /* Center logo on mobile */
    header .container {
        text-align: center;
    }
    
    header a img {
        margin-left: auto;
        margin-right: auto;
    }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    header h1 {
        font-size: 1.3em;
    }
    
    .tagline {
        font-size: 0.85em;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .trainer-code .code-display {
        font-size: 1em;
        letter-spacing: 1px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-container {
        height: 300px;
        max-height: 50vh;
    }
    
    .location-selector,
    .post-form fieldset {
        padding: 15px 10px;
    }
}
