/* Enhanced Mobile Optimizations for Job Listings and Forms */

/* Mobile-first approach for all mobile devices */
@media screen and (max-width: 768px) {
    /* Job Modal Enhancements */
    #job-details-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 9999 !important;
        background: rgba(0, 0, 0, 0.95) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }
    
    #job-details-modal .modal-content {
        background: white !important;
        min-height: 100vh !important;
        min-height: calc(var(--vh, 1vh) * 100) !important;
        position: relative !important;
        z-index: 10000 !important;
    }
    
    /* Modal Header Mobile Enhancements */
    #job-details-modal .bg-white.border-b {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10001 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Modal Footer Mobile Enhancements */
    #job-details-modal .bg-white.border-t {
        position: -webkit-sticky !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10001 !important;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Modal Buttons */
    #job-details-modal button {
        min-height: 44px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    #job-details-modal button:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease !important;
    }
    
    /* Job Cards Mobile Enhancements */
    .job-card {
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
        cursor: pointer !important;
    }
    
    .job-card:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease !important;
    }
    
    /* Disable hover effects on mobile */
    .job-card:hover {
        transform: none !important;
    }
    
    /* Form Enhancements */
    .form-step {
        padding: 16px !important;
    }
    
    .form-step input,
    .form-step select,
    .form-step textarea {
        font-size: 16px !important;
        min-height: 48px !important;
        padding: 14px 16px !important;
        border-radius: 8px !important;
        border: 2px solid #e5e7eb !important;
        background: white !important;
        width: 100% !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .form-step input:focus,
    .form-step select:focus,
    .form-step textarea:focus {
        outline: none !important;
        border-color: #3b82f6 !important;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
        transform: none !important;
        -webkit-transform: none !important;
        transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    }
    
    .form-step input.mobile-focused {
        border-color: #3b82f6 !important;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
        transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    }
    
    .form-step label {
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #374151 !important;
        margin-bottom: 8px !important;
        display: block !important;
    }
    
    .form-step .validation-error {
        font-size: 14px !important;
        color: #ef4444 !important;
        margin-top: 8px !important;
        padding: 8px 12px !important;
        background: #fef2f2 !important;
        border-radius: 6px !important;
        border: 1px solid #fecaca !important;
    }
    
    /* Form Buttons */
    .form-step button {
        min-height: 48px !important;
        padding: 14px 24px !important;
        font-size: 16px !important;
        border-radius: 8px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        font-weight: 600 !important;
    }
    
    .form-step button:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease !important;
    }
    
    /* Disable excessive animations on mobile */
    .form-step button:hover {
        box-shadow: none !important;
        transform: none !important;
    }
    
    .form-step .next-btn,
    .form-step .prev-btn {
        width: 100% !important;
        margin: 8px 0 !important;
    }
    
    /* File Input Enhancements */
    .form-step input[type="file"] {
        display: none !important;
    }
    
    .mobile-file-input-wrapper {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 24px !important;
        border: 2px dashed #d1d5db !important;
        border-radius: 12px !important;
        background: #f9fafb !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        text-align: center !important;
        min-height: 100px !important;
        touch-action: manipulation !important;
    }
    
    .mobile-file-input-wrapper:hover {
        border-color: #3b82f6 !important;
        background: #eff6ff !important;
    }
    
    .mobile-file-button {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 14px 24px !important;
        background: #3b82f6 !important;
        color: white !important;
        border: none !important;
        border-radius: 8px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        touch-action: manipulation !important;
        min-height: 48px !important;
    }
    
    .mobile-file-button:hover {
        background: #2563eb !important;
    }
    
    .mobile-file-button:active {
        transform: scale(0.98) !important;
        background: #1d4ed8 !important;
    }
    
    /* Checkbox and Radio Enhancements */
    .form-step input[type="checkbox"],
    .form-step input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
        min-height: 20px !important;
        margin-right: 12px !important;
        accent-color: #3b82f6 !important;
    }
    
    /* Select Dropdown Enhancements */
    .form-step select {
        background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E") !important;
        background-position: right 16px center !important;
        background-repeat: no-repeat !important;
        background-size: 16px !important;
        padding-right: 48px !important;
        cursor: pointer !important;
    }
    
    /* Textarea Enhancements */
    .form-step textarea {
        min-height: 120px !important;
        resize: vertical !important;
        line-height: 1.6 !important;
        font-family: inherit !important;
    }
    
    /* Progress Bar Mobile Enhancements */
    .progress-step-item {
        padding: 12px !important;
        border-radius: 8px !important;
        margin-bottom: 8px !important;
    }
    
    .progress-step-item.active {
        background: #eff6ff !important;
        border-color: #3b82f6 !important;
    }
    
    .progress-step-item.completed {
        background: #f0fdf4 !important;
        border-color: #10b981 !important;
    }
    
    .progress-step-item .icon-wrapper {
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-right: 12px !important;
    }
    
    .progress-step-item .step-text {
        font-size: 14px !important;
        line-height: 1.4 !important;
    }
    
    .progress-step-item .step-number {
        font-weight: 600 !important;
        color: #374151 !important;
    }
    
    .progress-step-item .step-title {
        color: #6b7280 !important;
        margin-top: 2px !important;
    }
    
    /* Input Wrapper Enhancements */
    .input-wrapper {
        margin-bottom: 24px !important;
    }
    
    .input-wrapper .input-icon {
        display: none !important;
    }
    
    .input-wrapper input.has-icon {
        padding-left: 16px !important;
    }
    
    /* Form Step Titles */
    .form-step h3 {
        font-size: 24px !important;
        margin-bottom: 8px !important;
        line-height: 1.2 !important;
        color: #111827 !important;
        font-weight: 700 !important;
    }
    
    .form-step > p {
        font-size: 16px !important;
        margin-bottom: 24px !important;
        line-height: 1.5 !important;
        color: #6b7280 !important;
    }
    
    /* Prevent iOS zoom on input focus */
    input[type="text"],
    input[type="email"], 
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100% !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
    }
    
    /* Smooth scrolling for modal */
    #job-details-modal {
        scroll-behavior: smooth !important;
    }
    
    /* Loading states */
    .form-submitting {
        pointer-events: none !important;
        opacity: 0.8 !important;
    }
    
    .form-submitting * {
        cursor: wait !important;
    }
}

/* Landscape orientation fixes */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .form-step {
        padding: 12px !important;
    }
    
    .form-step h3 {
        font-size: 20px !important;
        margin-bottom: 6px !important;
    }
    
    .form-step > p {
        font-size: 14px !important;
        margin-bottom: 16px !important;
    }
    
    .input-wrapper {
        margin-bottom: 16px !important;
    }
    
    .form-step input,
    .form-step select,
    .form-step textarea {
        min-height: 44px !important;
        padding: 12px 16px !important;
    }
    
    .form-step button {
        min-height: 44px !important;
        padding: 12px 20px !important;
    }
}

/* Very small screens (iPhone SE, etc.) */
@media screen and (max-width: 375px) {
    .form-step {
        padding: 12px !important;
    }
    
    .form-step h3 {
        font-size: 22px !important;
    }
    
    .form-step input,
    .form-step select,
    .form-step textarea {
        padding: 12px 14px !important;
    }
    
    .form-step button {
        padding: 12px 20px !important;
    }
    
    .mobile-file-input-wrapper {
        padding: 20px !important;
        min-height: 80px !important;
    }
    
    .mobile-file-button {
        padding: 12px 20px !important;
    }
}

/* High DPI screens */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    #job-details-modal {
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
    
    .form-step input,
    .form-step select,
    .form-step textarea,
    .form-step button {
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
}

/* Dark mode support for mobile */
@media screen and (max-width: 768px) and (prefers-color-scheme: dark) {
    .form-step input,
    .form-step select,
    .form-step textarea {
        background: #1f2937 !important;
        color: #f9fafb !important;
        border-color: #4b5563 !important;
    }
    
    .form-step input:focus,
    .form-step select:focus,
    .form-step textarea:focus {
        border-color: #60a5fa !important;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1) !important;
    }
    
    .form-step label {
        color: #e5e7eb !important;
    }
    
    .form-step h3 {
        color: #f9fafb !important;
    }
    
    .form-step > p {
        color: #d1d5db !important;
    }
}
