/* Mobile Responsive CSS for Guided Mode */
/* This file enhances mobile experience for guided.html */

/* Reset and ensure full width usage on mobile */
@media screen and (max-width: 768px) {
    * {
        box-sizing: border-box !important;
    }
    
    html {
        margin: 0 !important;
        padding: 0 !important;
        width: 100vw !important;
        overflow-x: hidden !important;
    }
}

/* Mobile First Approach - Base styles for mobile */
@media screen and (max-width: 768px) {
    
    /* Fix body padding and viewport - Remove left margin/padding */
    body {
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: hidden;
        width: 100vw !important;
        max-width: 100vw !important;
    }
    
    /* Navigation improvements - Full width */
    .nav-framer {
        padding: 0.5rem 0 !important;
        width: 100vw !important;
        margin: 0 !important;
        left: 0 !important;
        right: 0 !important;
    }
    
    .nav-framer-inner {
        padding: 0 0.5rem;
        flex-wrap: wrap;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
    }
    
    .nav-logo {
        font-size: 1.1rem !important;
    }
    
    .nav-logo img {
        height: 30px !important;
    }
    
    .nav-links {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        justify-content: center;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .nav-link {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.8rem !important;
    }
    
    /* Main container adjustments - Full width on mobile */
    .main-container {
        margin: 1rem 0 2rem 0 !important;
        padding: 0 0.5rem !important;
        width: 100vw !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    
    /* Analysis card mobile optimization - Full width */
    .analysis-card {
        padding: 1rem !important;
        margin: 0 0.5rem 1rem 0.5rem !important;
        border-radius: 12px !important;
        width: calc(100vw - 1rem) !important;
        max-width: calc(100vw - 1rem) !important;
        box-sizing: border-box !important;
    }
    
    .analysis-header {
        margin-bottom: 1.5rem !important;
    }
    
    .analysis-header h1 {
        font-size: 1.75rem !important;
        line-height: 1.2;
    }
    
    .analysis-header p {
        font-size: 0.95rem !important;
    }
    
    /* Email section mobile - Full width */
    .email-section {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    .email-section label {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem;
    }
    
    .email-input {
        width: 100% !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Form grid - stack on mobile */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Text areas mobile optimization */
    .modern-textarea {
        min-height: 200px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* File upload buttons */
    .file-upload-btn {
        font-size: 0.85rem !important;
        padding: 0.6rem 1rem !important;
        width: 100%;
        justify-content: center;
    }
    
    /* Options section - Adjust padding */
    .options-section {
        padding: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .options-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Select elements mobile */
    .modern-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.8rem !important;
    }
    
    /* Tab navigation mobile */
    .input-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 0.5rem !important;
    }
    
    .tab-btn {
        font-size: 0.85rem !important;
        padding: 0.6rem 1rem !important;
        white-space: nowrap;
    }
    
    /* Tab content mobile */
    .tab-content {
        width: 100% !important;
        overflow-x: hidden !important;
        padding: 0 !important;
    }
    
    #arbetsformedlingen-tab {
        width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* Job Bank Section - Complete Mobile Optimization */
    #jobBankSection {
        width: 100% !important;
        max-width: 100% !important;
        margin: 1rem 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
    }
    
    .job-search-section {
        width: 100% !important;
        padding: 0 !important;
        margin-bottom: 1rem !important;
    }
    
    /* Job search filters mobile */
    .search-filters {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Modern input fields */
    .modern-input,
    .modern-select {
        width: 100% !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px 16px !important;
        border-radius: 8px !important;
        border: 1px solid #e0e0e0 !important;
        box-sizing: border-box !important;
        background: white !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
    
    /* Search button mobile */
    .search-btn {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        border-radius: 8px !important;
        background: var(--primary, #2c5aa0) !important;
        color: white !important;
        border: none !important;
        font-weight: 600 !important;
        justify-content: center !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    /* Job results container mobile */
    .job-results {
        max-height: 85vh !important;
        padding: 0.5rem !important;
        margin: 0 !important;
        width: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px !important;
        -webkit-overflow-scrolling: touch !important;
        box-sizing: border-box !important;
    }
    
    /* Arbetsförmedlingen search section mobile */
    .af-search-section {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .af-search-section h3 {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
        text-align: center !important;
    }
    
    .af-search-filters {
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .af-search-field,
    .af-search-button {
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .af-search-field label {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem !important;
        display: block !important;
    }
    
    #afCity,
    #afRole {
        width: 100% !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        box-sizing: border-box !important;
    }
    
    #afSearchBtn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.8rem 1.5rem !important;
        box-sizing: border-box !important;
    }
    
    /* AF results mobile */
    .af-results,
    #afResults {
        padding: 0.5rem !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* AF job cards mobile */
    .af-job-card {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Selected AF jobs section */
    .selected-af-jobs {
        padding: 0.75rem !important;
    }
    
    #matchSelectedAFBtn {
        width: 100% !important;
        padding: 0.8rem 1.5rem !important;
        font-size: 0.95rem !important;
    }
    
    /* Job Bank Cards - Mobile Optimization */
    .job-card {
        display: block !important;
        width: 100% !important;
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px !important;
        background: white !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
        box-sizing: border-box !important;
        position: relative !important;
    }
    
    .job-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    }
    
    .job-card.selected {
        border-color: #2c5aa0 !important;
        background: #f0f7ff !important;
    }
    
    /* Job card selection area */
    .job-selection {
        position: absolute !important;
        top: 1rem !important;
        right: 1rem !important;
        z-index: 10 !important;
    }
    
    /* Job card header mobile */
    .job-card-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        margin-bottom: 0.75rem !important;
        padding-right: 3rem !important; /* Space for checkbox */
    }
    
    /* Job title mobile */
    .job-title {
        font-size: 1.1rem !important;
        font-weight: 600 !important;
        color: #2c5aa0 !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        word-wrap: break-word !important;
        width: 100% !important;
    }
    
    /* Job provider badge */
    .job-provider {
        display: inline-block !important;
        padding: 4px 8px !important;
        background: #f0f0f0 !important;
        color: #666 !important;
        border-radius: 12px !important;
        font-size: 0.75rem !important;
        font-weight: 500 !important;
        margin-top: 0.25rem !important;
    }
    
    /* Job details mobile */
    .job-details {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.4rem !important;
        margin-bottom: 0.75rem !important;
        font-size: 0.85rem !important;
        color: #666 !important;
    }
    
    .job-detail {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    .job-detail i {
        color: #999 !important;
        font-size: 0.8rem !important;
        width: 14px !important;
    }
    
    /* Job description mobile */
    .job-description {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
        color: #444 !important;
        margin: 0.5rem 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .job-description p {
        margin: 0 !important;
        word-wrap: break-word !important;
    }
    
    /* Job action buttons mobile */
    .show-job-btn,
    .apply-btn {
        display: inline-block !important;
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
        border-radius: 6px !important;
        text-decoration: none !important;
        font-weight: 500 !important;
        margin-right: 0.5rem !important;
        margin-top: 0.5rem !important;
        border: 1px solid #ddd !important;
        background: #f8f9fa !important;
        color: #333 !important;
    }
    
    .apply-btn {
        background: #28a745 !important;
        color: white !important;
        border-color: #28a745 !important;
    }
    
    /* Job checkboxes mobile */
    .job-bank-checkbox,
    .af-job-checkbox {
        width: 20px !important;
        height: 20px !important;
        cursor: pointer !important;
    }
    
    /* Language selection mobile */
    .language-selection {
        gap: 0.5rem !important;
    }
    
    .language-option {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem !important;
    }
    
    .language-option span:last-child {
        font-size: 0.8rem !important;
    }
    
    /* Motivation letter options mobile */
    #motivationLetterOptions {
        grid-template-columns: 1fr !important;
    }
    
    /* Action section mobile */
    .action-section {
        padding: 1rem 0 !important;
    }
    
    .analyze-btn {
        padding: 0.8rem 2rem !important;
        font-size: 1rem !important;
        width: 100%;
        max-width: 300px;
    }
    
    /* Progress container mobile */
    #progressContainer {
        padding: 1rem !important;
        margin-top: 1rem !important;
    }
    
    .progress-status {
        font-size: 0.85rem !important;
    }
    
    /* Features grid mobile */
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .feature-card {
        padding: 1.5rem !important;
    }
    
    .feature-icon {
        width: 50px !important;
        height: 50px !important;
    }
    
    .feature-card h4 {
        font-size: 1.1rem !important;
    }
    
    .feature-card p {
        font-size: 0.9rem !important;
    }
    
    /* Loading overlay mobile */
    .loading-card {
        padding: 2rem !important;
        margin: 1rem;
        max-width: 90% !important;
    }
    
    .loading-spinner {
        width: 50px !important;
        height: 50px !important;
    }
    
    /* Selected Jobs Section Mobile */
    .selected-jobs {
        background: #f8f9fa !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px !important;
        padding: 1rem !important;
        margin-top: 1rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .selected-jobs h4 {
        font-size: 1rem !important;
        color: #333 !important;
        margin-bottom: 0.75rem !important;
    }
    
    .selected-jobs-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .selected-job-item {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        padding: 0.75rem !important;
        background: white !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 6px !important;
        font-size: 0.85rem !important;
    }
    
    .remove-job-btn {
        background: #dc3545 !important;
        color: white !important;
        border: none !important;
        border-radius: 4px !important;
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
        margin-left: 0.5rem !important;
    }
    
    /* Loading states mobile */
    .loading,
    .loading-state {
        padding: 2rem 1rem !important;
        text-align: center !important;
        color: #666 !important;
    }
    
    .loading i,
    .loading-state i {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
        display: block !important;
    }
    
    .empty-state,
    .error-state {
        padding: 2rem 1rem !important;
        text-align: center !important;
        color: #999 !important;
    }
    
    .empty-state i,
    .error-state i {
        font-size: 2.5rem !important;
        margin-bottom: 1rem !important;
        display: block !important;
        color: #ccc !important;
    }
    
    /* Job Details Modal Mobile */
    .job-details-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0,0,0,0.5) !important;
        z-index: 1000 !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        padding: 1rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .job-details-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        margin: 2rem 0 !important;
        background: white !important;
        border-radius: 8px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .job-details-modal .modal-header {
        padding: 1rem !important;
        border-bottom: 1px solid #e0e0e0 !important;
        position: sticky !important;
        top: 0 !important;
        background: white !important;
        z-index: 10 !important;
    }
    
    .job-details-modal .modal-header h3 {
        font-size: 1.1rem !important;
        margin: 0 !important;
        padding-right: 2rem !important;
        line-height: 1.3 !important;
    }
    
    .job-details-modal .modal-close {
        position: absolute !important;
        top: 1rem !important;
        right: 1rem !important;
        background: #f0f0f0 !important;
        border: none !important;
        border-radius: 50% !important;
        width: 32px !important;
        height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
    }
    
    .job-details-modal .modal-body {
        padding: 1rem !important;
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
    }
    
    .job-details-modal .job-meta p {
        margin: 0.5rem 0 !important;
        font-size: 0.85rem !important;
    }
    
    .job-details-modal .job-full-description,
    .job-details-modal .job-requirements {
        margin: 1rem 0 !important;
    }
    
    .job-details-modal .job-actions {
        padding: 1rem !important;
        border-top: 1px solid #e0e0e0 !important;
        text-align: center !important;
    }
    
    .job-details-modal .apply-btn {
        width: 100% !important;
        padding: 0.75rem !important;
        font-size: 1rem !important;
        border-radius: 6px !important;
        background: #28a745 !important;
        color: white !important;
        border: none !important;
        font-weight: 600 !important;
    }
    
    /* General Modal mobile optimization */
    .modal-content {
        margin: 0.5rem !important;
        max-height: 95vh !important;
        width: calc(100% - 1rem) !important;
        max-width: 100% !important;
    }
    
    .modal-header {
        padding: 1rem !important;
        border-bottom: 1px solid #e0e0e0 !important;
    }
    
    .modal-header h3 {
        font-size: 1.2rem !important;
    }
    
    .modal-body {
        padding: 1rem !important;
    }
    
    /* Login modal mobile optimization */
    #loginModal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.8) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        z-index: 10000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 1rem !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
    }
    
    #loginModal .login-container,
    #loginModal > div {
        background: white !important;
        padding: 1.5rem !important;
        border-radius: 12px !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
        max-width: 350px !important;
        width: calc(100vw - 2rem) !important;
        margin: auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        box-sizing: border-box !important;
        position: relative !important;
        transform: none !important;
    }
    
    #loginModal h2 {
        margin: 0 0 1.5rem 0 !important;
        color: #2c5aa0 !important;
        text-align: center !important;
        font-size: 1.5rem !important;
    }
    
    #loginModal .form-group,
    #loginModal div[style*="margin-bottom"] {
        margin-bottom: 1rem !important;
    }
    
    #loginModal label {
        display: block !important;
        margin-bottom: 0.5rem !important;
        color: #555 !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
    }
    
    #loginModal input[type="text"],
    #loginModal input[type="password"] {
        width: 100% !important;
        padding: 0.75rem !important;
        border: 2px solid #ddd !important;
        border-radius: 8px !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        transition: border-color 0.3s !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
    
    #loginModal input[type="text"]:focus,
    #loginModal input[type="password"]:focus {
        border-color: #2c5aa0 !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1) !important;
    }
    
    #loginModal button[type="submit"] {
        width: 100% !important;
        padding: 0.875rem !important;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: white !important;
        border: none !important;
        border-radius: 8px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        transition: transform 0.2s, box-shadow 0.2s !important;
        margin-top: 0.5rem !important;
    }
    
    #loginModal #loginError {
        color: #dc3545 !important;
        margin-bottom: 1rem !important;
        text-align: center !important;
        font-size: 0.875rem !important;
    }
    
    #loginModal p:last-child {
        margin-top: 1rem !important;
        text-align: center !important;
        color: #999 !important;
        font-size: 0.8rem !important;
        margin-bottom: 0 !important;
    }
    
    /* Match jobs button mobile */
    .match-jobs-btn {
        padding: 0.8rem 1.5rem !important;
        font-size: 0.95rem !important;
        width: 100%;
    }
    
    /* Job selection checkbox */
    .checkbox-label {
        width: 24px !important;
        height: 24px !important;
        flex-shrink: 0;
    }
    
    /* Remove hover effects on touch devices */
    @media (hover: none) {
        .job-card:hover {
            transform: none !important;
        }
        
        .feature-card:hover {
            transform: none !important;
        }
        
        .analyze-btn:hover {
            transform: none !important;
        }
    }
}

/* Small mobile devices (max-width: 480px) */
@media screen and (max-width: 480px) {
    
    /* Even smaller navigation */
    .nav-framer {
        position: relative !important;
    }
    
    .nav-logo span {
        display: none !important; /* Hide text, keep logo only */
    }
    
    .btn-framer {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.6rem !important;
    }
    
    /* Analysis header adjustments */
    .analysis-header h1 {
        font-size: 1.5rem !important;
    }
    
    /* Smaller buttons */
    .analyze-btn {
        font-size: 0.95rem !important;
        padding: 0.7rem 1.5rem !important;
    }
    
    /* Language options - make them smaller */
    .language-option {
        padding: 0.3rem 0.6rem !important;
    }
    
    /* Theme selector mobile */
    .theme-selector {
        margin-left: 0.5rem !important;
    }
    
    .theme-selector-btn {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.8rem !important;
    }
    
    .theme-selector-btn .theme-name {
        display: none !important; /* Hide theme name on mobile */
    }
    
    .theme-dropdown {
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%);
        min-width: 150px !important;
    }
    
    .language-option span:first-child {
        font-size: 1.2rem !important;
    }
    
    /* Job cards more compact */
    .job-card {
        padding: 0.6rem !important;
    }
    
    .job-title {
        font-size: 0.95rem !important;
    }
    
    .job-details {
        font-size: 0.75rem !important;
    }
}

/* Landscape mobile adjustments */
@media screen and (max-height: 600px) and (orientation: landscape) {
    body {
        padding-top: 50px !important;
    }
    
    .nav-framer {
        padding: 0.3rem !important;
    }
    
    .analysis-card {
        padding: 1rem !important;
    }
    
    .modern-textarea {
        min-height: 150px !important;
    }
    
    .job-results {
        max-height: 250px !important;
    }
}

/* Email input styling for required field */
#userEmail:invalid {
    border-color: #dc3545 !important;
}

#userEmail:valid {
    border-color: #28a745 !important;
}

#userEmail:focus {
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1) !important;
}

/* Disable analyze button when email is empty */
#analyzeBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc !important;
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    /* Increase touch targets */
    .btn-framer,
    .tab-btn,
    .file-upload-btn,
    .search-btn,
    .analyze-btn,
    .job-card,
    .language-option {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    /* Increase spacing between clickable elements */
    .nav-links,
    .input-tabs,
    .language-selection {
        gap: 0.75rem !important;
    }
}

/* Ensure login modal is visible when shown on mobile */
@media screen and (max-width: 768px) {
    #loginModal[style*="display: flex"] {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Fix login button on mobile navigation */
    .nav-links .btn-framer-secondary,
    button[onclick*="showLogin"] {
        min-width: 80px !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
        background-color: #f3f4f6 !important;
        color: #374151 !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 6px !important;
        white-space: nowrap !important;
        cursor: pointer !important;
        transition: all 0.2s !important;
    }
    
    .nav-links .btn-framer-secondary:active,
    button[onclick*="showLogin"]:active {
        background-color: #e5e7eb !important;
        transform: scale(0.98) !important;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Prevent iOS zoom on form inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Fix iOS momentum scrolling */
    .job-results,
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix iOS button appearance */
    button,
    .btn-framer,
    .analyze-btn {
        -webkit-appearance: none;
    }
    
    /* Fix iOS modal display issues */
    #loginModal {
        position: fixed !important;
        -webkit-transform: translateZ(0);
    }
    
    /* Fix iOS momentum scrolling for login modal */
    #loginModal > div {
        -webkit-overflow-scrolling: touch;
    }
}

/* Dark mode support for mobile */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    body {
        background: #1a1a1a;
        color: #f0f0f0;
    }
    
    .analysis-card,
    .modal-content {
        background: #2a2a2a;
        color: #f0f0f0;
    }
    
    .modern-textarea,
    .modern-input,
    .modern-select {
        background: #333;
        color: #f0f0f0;
        border-color: #444;
    }
}

/* Additional mobile fixes for better UX */
@media screen and (max-width: 768px) {
    /* Fix viewport meta tag issues */
    body {
        min-height: 100vh;
        position: relative;
    }
    
    /* Ensure modals close properly on mobile when logged in */
    .logged-in #loginModal,
    body.authenticated #loginModal {
        display: none !important;
    }
    
    /* Fix sticky elements on mobile */
    .nav-framer {
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        background: var(--surface-50, white) !important;
    }
    
    /* Improve form usability on mobile */
    input, textarea, select, button {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Fix mobile keyboard issues */
    input:focus, textarea:focus, select:focus {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    /* Better touch targets */
    a, button, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Fix content jumping when keyboard appears */
    .modal-open {
        position: fixed;
        width: 100%;
    }
    
    /* Ensure content is visible when authenticated on mobile */
    body.authenticated .main-container,
    body.authenticated #jobBankSection,
    body.authenticated #analysisSection,
    body.authenticated .analysis-card {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Fix Job Bank section visibility on mobile */
    body.authenticated #jobBankSection {
        width: 100vw !important;
        max-width: 100vw !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: hidden !important;
    }
    
    /* Job Bank container full width on mobile */
    body.authenticated .job-bank-wrapper {
        width: 100% !important;
        padding: 0.5rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Time filter buttons responsive layout */
    .job-bank-time-filters {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
        width: 100% !important;
    }
    
    .time-filter-btn {
        flex: 1 1 calc(50% - 0.25rem) !important;
        min-width: 120px !important;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
    }
    
    /* City quick filter buttons responsive */
    .job-bank-city-quick-filters {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
        width: 100% !important;
    }
    
    .city-quick-filter-btn {
        flex: 1 1 auto !important;
        min-width: 80px !important;
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
    }
    
    /* Job Bank filters responsive grid */
    .job-bank-filters {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .filter-group {
        width: 100% !important;
    }
    
    /* Job cards full width on mobile */
    .job-cards-container {
        width: 100% !important;
        padding: 0 !important;
    }
    
    .job-card {
        width: 100% !important;
        margin: 0 0 0.75rem 0 !important;
        padding: 0.75rem !important;
    }
    
    /* Fix tab panel content on mobile */
    .tab-content {
        width: 100% !important;
        padding: 0 !important;
        overflow-x: hidden !important;
    }
    
    #analysis-tab, 
    #job-bank-tab,
    #admin-tab {
        width: 100% !important;
        padding: 0.5rem !important;
        overflow-x: hidden !important;
    }
}