/* MOBILE FORCE FIX - ABSOLUTE HIGHEST PRIORITY */
/* Version: 2026061903 - Force all fixes + modal positioning + filter elements */

@media only screen and (max-width: 768px) {
    /* ===== HIDE ELEMENTS THAT CREATE SPACE ===== */
    
    /* Hide filter and search control elements on mobile */
    .filter-compact,
    .age-filter,
    .search-controls,
    div[class*="filter-compact"],
    div[class*="age-filter"],
    div[class*="search-controls"] {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        visibility: hidden !important;
    }
    
    /* ===== MODAL FIXES - ENSURE NO SPACE CREATED ===== */
    
    /* All modals must be fixed and not create layout space */
    body .modal:not(.active),
    body div[id*="modal"]:not(.active),
    body div[id*="Modal"]:not(.active),
    body div[class*="modal"]:not(.active) {
        position: fixed !important;
        display: none !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 10000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Active modals should display as flex */
    body .modal.active,
    body div[id*="modal"].active,
    body div[id*="Modal"].active,
    body div[id="deleteAccountModal"] {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 10000 !important;
        background: rgba(0,0,0,0.7) !important;
    }
    
    /* Modal content should be centered and visible */
    body .modal-content,
    body #deleteAccountModal .modal-content {
        position: relative !important;
        display: block !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        margin: auto !important;
        background: white !important;
        border-radius: 12px !important;
        padding: 20px 16px 16px !important;
        width: calc(100% - 24px) !important;
        max-width: 480px !important;
        z-index: 10001 !important;
        box-shadow: 0 20px 60px rgba(0,0,0,0.4) !important;
    }
    
    /* Ensure modal doesn't get clipped */
    body #deleteAccountModal {
        padding: 20px 12px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* ===== SPACING FIXES ===== */
    
    /* Main content - proper padding and NO min-height */
    body .app-container .main-content {
        padding: 20px 16px !important;
        padding-bottom: 100px !important;
        min-height: auto !important;
        height: auto !important;
        background: #F2F2F7 !important;
    }
    
    /* Welcome widget - BIGGER SPACE BELOW */
    body .main-content .welcome-widget {
        margin-bottom: 32px !important;
        padding: 18px !important;
    }
    
    /* Status widget - BIGGER SPACE BELOW */
    body .main-content .status-widget {
        margin-bottom: 36px !important;
        padding: 18px !important;
    }
    
    /* Stats grid - SPACE BELOW */
    body .main-content .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        margin-bottom: 32px !important;
    }
    
    /* Section title - BIG SPACE ABOVE AND BELOW */
    body .main-content .section-title {
        margin-top: 44px !important;
        margin-bottom: 24px !important;
        display: block !important;
    }
    
    /* Quick actions grid - SPACE BELOW */
    body .main-content .quick-actions-grid {
        display: flex !important;
        gap: 12px !important;
        margin-bottom: 48px !important;
        overflow-x: auto !important;
        padding-bottom: 16px !important;
    }
    
    /* Action buttons */
    body .quick-actions-grid .action-btn {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 16px 20px !important;
        background: #FFFFFF !important;
        border: none !important;
        border-radius: 16px !important;
        min-width: 85px !important;
        flex: 0 0 auto !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    }
    
    body .quick-actions-grid .action-icon {
        width: 52px !important;
        height: 52px !important;
        border-radius: 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }
    
    body .quick-actions-grid .action-icon i {
        font-size: 1.35rem !important;
        color: white !important;
    }
    
    body .quick-actions-grid .action-btn span {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        color: #000 !important;
        text-align: center !important;
        line-height: 1.2 !important;
        display: block !important;
    }
    
    /* Tip widget - space below */
    body .main-content .tip-widget {
        margin-bottom: 24px !important;
    }
    
    /* ===== REMOVE EMPTY SPACE AT BOTTOM ===== */
    
    /* Sections should NOT have min-height */
    body .main-content #homeSection,
    body .main-content #searchSection,
    body .main-content #matchesSection,
    body .main-content #requestsSection,
    body .main-content #profileSection,
    body .main-content #settingsSection,
    body .main-content #boostSection {
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
        padding-bottom: 0 !important;
    }
    
    /* Section should not flex-grow */
    body .main-content .section {
        display: none !important;
        flex-grow: 0 !important;
        flex-shrink: 0 !important;
        min-height: 0 !important;
        height: auto !important;
    }
    
    body .main-content .section.active {
        display: block !important;
    }
    
    /* App container structure */
    body .app-container {
        min-height: 100vh !important;
        max-height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    
    /* Status bar fixed size */
    body .app-container .status-bar {
        flex-shrink: 0 !important;
        height: auto !important;
    }
    
    /* Header fixed size */
    body .app-container .app-header {
        flex-shrink: 0 !important;
        height: auto !important;
    }
    
    /* Main content should scroll */
    body .app-container .main-content {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Bottom nav fixed */
    body .bottom-nav,
    body .mobile-bottom-nav {
        flex-shrink: 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        z-index: 9999 !important;
        transform: translateZ(0) !important;
        backface-visibility: hidden !important;
    }
    
    body.keyboard-visible .mobile-bottom-nav {
        transform: translateY(100%) !important;
    }
    
    /* Last element in section should not add excessive margin */
    body .section > *:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Widget cards consistent spacing */
    body .widget-card {
        margin-bottom: 16px !important;
    }
    
    /* ===== VISIBILITY FIXES ===== */
    
    /* Force these to be visible - CRITICAL */
    body .stats-grid,
    body .section-title,
    body .quick-actions-grid,
    body .action-btn,
    body .nav-item,
    body .stat-widget {
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
    }
    
    body .stats-grid {
        display: grid !important;
    }
    
    body .quick-actions-grid {
        display: flex !important;
    }
    
    body .action-btn {
        display: flex !important;
    }
}
