/* Mobile-optimized styles for Sudoku Solver */
/* Include this in all pages for consistent mobile experience */

@media (max-width: 768px) {
    /* Global mobile optimizations */
    * {
        -webkit-tap-highlight-color: rgba(30, 60, 114, 0.1);
        touch-action: manipulation;
    }

    /* Prevent zoom on input focus for iOS */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="file"],
    textarea,
    select {
        font-size: 16px !important;
        -webkit-appearance: none;
        appearance: none;
    }

    /* Touch-friendly buttons */
    button, .btn, .mode-button, .upload-option {
        min-height: 44px; /* Apple's recommended minimum touch target */
        min-width: 44px;
        cursor: pointer;
        transition: all 0.1s ease;
    }

    button:active, .btn:active, .mode-button:active, .upload-option:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Prevent text selection on interactive elements */
    button, .btn, .mode-button, .upload-option, .sudoku-cell, .manual-cell {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    /* Better scrolling on mobile */
    html, body {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }

    /* Improved readability */
    body {
        font-size: 16px;
        line-height: 1.5;
    }

    h1 {
        font-size: 1.8em;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.4em;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.2em;
        line-height: 1.3;
    }

    p, li {
        font-size: 16px;
        line-height: 1.5;
    }

    /* Mobile-friendly containers */
    .container, .section {
        margin: 0 5px;
        border-radius: 8px;
    }

    /* Better grid layouts */
    .sudoku-grid, .manual-grid {
        width: 100% !important;
        max-width: 100% !important;
        padding: 8px;
        gap: 1px;
    }

    .sudoku-cell, .manual-cell {
        min-height: 32px;
        font-size: 14px;
        border-radius: 3px;
    }

    /* Improved form elements */
    .grid-size-select {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        border: 2px solid #ddd;
        border-radius: 6px;
        background: white;
        margin-bottom: 10px;
    }

    /* Better spacing for mobile */
    .section {
        margin: 10px 0;
        padding: 15px;
    }

    /* Mobile navigation */
    .back-button {
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1000;
        padding: 8px 12px;
        font-size: 14px;
        background: rgba(30, 60, 114, 0.9);
        border-radius: 6px;
        text-decoration: none;
        color: white;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

    /* Hide back button on very small screens */
    @media (max-width: 480px) {
        .back-button {
            padding: 6px 10px;
            font-size: 12px;
        }
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .sudoku-cell, .manual-cell {
        min-height: 28px;
        font-size: 12px;
        padding: 2px;
    }

    .sudoku-grid, .manual-grid {
        padding: 6px;
        gap: 1px;
    }

    h1 {
        font-size: 1.6em;
    }

    .container, .section {
        padding: 12px;
        margin: 5px 0;
    }
}
