/* Fixed CSS for Restaurant Profile Scrolling and Mobile Responsiveness */

/* =============================================================================
   RESTAURANT PROFILE FIXES
   ============================================================================= */

/* Fix the restaurant profile hero image sticking issue */
.profile-hero {
    height: 250px;
    background-size: cover;
    background-position: center;
    position: relative;
    /* Remove any position: fixed or sticky properties */
    flex-shrink: 0; /* Prevent the hero from shrinking */
}

/* Ensure the overlay screen scrolls properly */
.overlay-screen {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: 100vh;
    background: #1a1a1a;
    z-index: 200;
    display: none;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden; /* Prevent outer scroll */
}

/* Make the profile content scrollable */
.profile-content {
    flex: height: calc(100vh - 200px);;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Add smooth scrolling */
    scroll-behavior: smooth;
    /* Fix webkit scrolling issues */
    -webkit-overflow-scrolling: touch;
}

/* Ensure action buttons stay at bottom */
.action-buttons {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: rgba(0,0,0,0.95);
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0; /* Prevent buttons from shrinking */
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* =============================================================================
   MOBILE RESPONSIVENESS FIXES
   ============================================================================= */
/* Base responsive viewport - Force full width on all mobile sizes */
@media screen and (max-width: 430px) {
    .app-container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    .header {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important; /* Add: Override centering on mobile */
        transform: none !important; /* Add: Remove transform on mobile */
        padding: 15px;
        margin: 0 !important;
    }
    
    .feed-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 15px 15px 15px;
        margin: 0 !important;
    }
    
    .search-bar {
        width: 100% !important;
        max-width: 100% !important;
        margin: 15px 0 !important;
        padding: 0 15px;
        box-sizing: border-box;
    }
    
    /* Fix overlay screens for mobile - EXCLUDE map overlay */
    .overlay-screen:not(#mapOverlay) {
        max-width: 430px;
        width: 100%;
        left: 50%;
        transform: translateX(-50%);
        height: 100vh;
        height: 100dvh;
    }
    
    .overlay-screen.show {
        animation: slideUp 0.3s ease;
    }
    
    /* Fix bottom navigation for mobile */
    .bottom-nav {
        max-width: 430px;
        width: 100%;
        padding: 10px 15px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* Additional zoom protection */
@media screen and (max-width: 430px) and (min-resolution: 1.5dppx) {
    .app-container,
    .header,
    .feed-container {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
    

/* iPhone 13 specific (390x844) */
@media screen and (max-width: 390px) and (max-height: 844px) {
    /* Adjust header padding */
    .header {
        padding: 15px;
    }
    
    /* Reduce margins in feeds */
    .feed-container {
        padding: 0 15px 15px 15px;
    }
    
    /* Adjust business cards */
    .business-card {
        margin-bottom: 15px;
    }
    
    /* Fix user feed items */
    .user-feed-item {
        margin: 0 10px 15px 10px;
    }
    
    /* Adjust profile hero height */
    .profile-hero {
        height: 200px;
    }
    
    /* Reduce profile content padding */
    .profile-content {
        padding: 15px;
    }
    
    /* Make form inputs more touch-friendly */
    .auth-input,
    .form-input {
        padding: 14px 18px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Adjust navigation items */
    .nav-item {
        padding: 6px 8px;
        min-width: 60px;
    }
    
    .nav-icon {
        font-size: 18px;
        margin-bottom: 2px;
    }
    
    .nav-label {
        font-size: 9px;
    }
}

/* Small phones (iPhone SE, etc.) */
@media screen and (max-width: 375px) {
    /* Further reduce spacing */
    .stories-section {
        padding: 15px;
    }
    
    .search-bar {
        margin: 15px;
        gap: 8px;
    }
    
    /* Smaller user feed items */
    .user-feed-item {
        margin: 0 5px 15px 5px;
    }
    
    /* Adjust filter options */
    .filter-options {
        padding: 0 15px 15px 15px;
        gap: 8px;
    }
    
    .filter-chip {
        padding: 8px 14px;
        font-size: 13px;
        min-width: 100px;
    }
    
    /* Smaller photo grid */
    .photo-grid {
        gap: 10px;
    }
    
    /* Adjust action buttons */
    .action-buttons {
        gap: 10px;
        padding: 15px;
    }
    
    .action-button {
        padding: 12px;
        font-size: 13px;
    }
}

/* Large phones and small tablets */
@media screen and (min-width: 431px) and (max-width: 768px) {
    .app-container {
        max-width: 500px;
    }
    
    .overlay-screen {
        max-width: 500px;
    }
    
    .bottom-nav {
        max-width: 500px;
    }
}

/* =============================================================================
   CHAT AND MESSAGING FIXES
   ============================================================================= */

/* Fix chat messages scrolling */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Fix chat input at bottom */
.chat-input {
    display: flex;
    padding: 15px 20px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
    background: rgba(0,0,0,0.95);
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

@media screen and (max-width: 390px) {
    .chat-input {
        padding: 12px 15px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    
    .chat-messages {
        padding: 15px;
    }
}

/* =============================================================================
   PROFILE EDITOR FIXES
   ============================================================================= */

/* Fix profile editor scrolling */
.profile-editor {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
}

@media screen and (max-width: 390px) {
    .profile-editor {
        padding: 15px;
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    
    /* Make choice buttons more mobile-friendly */
    .choice-group {
        gap: 8px;
    }
    
    .choice-btn {
        min-width: 100px;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Adjust interests grid */
    .interests-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .interest-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* =============================================================================
   SETTINGS FIXES
   ============================================================================= */

/* Fix settings scrolling */
.settings-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 120px; /* Account for logout button */
    -webkit-overflow-scrolling: touch;
}

@media screen and (max-width: 390px) {
    .settings-content {
        padding-bottom: calc(140px + env(safe-area-inset-bottom));
    }
    
    .settings-user-info {
        gap: 15px;
        padding: 15px;
    }
    
    .settings-section {
        padding: 0 15px;
        margin-bottom: 25px;
    }
    
    .settings-logout-section {
        padding: 15px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* =============================================================================
   SAFE AREA FIXES FOR iOS
   ============================================================================= */

/* Add safe area support for iOS devices */
@supports (padding: max(0px)) {
    .header {
        padding-top: max(20px, env(safe-area-inset-top));
    }
    
    .bottom-nav {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    .chat-input {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    .settings-logout-section {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    .action-buttons {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* =============================================================================
   HORIZONTAL SCROLLING FIXES
   ============================================================================= */

/* Fix stories horizontal scroll on mobile */
.stories-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

.story-item {
    scroll-snap-align: start;
    flex-shrink: 0;
}

@media screen and (max-width: 390px) {
    .stories-scroll {
        gap: 12px;
    }
    
    .story-item {
        width: 100px;
        height: 150px;
    }
    
    /* Fix matches scroll */
    .matches-scroll {
        gap: 12px;
    }
    
    .match-avatar {
        width: 50px;
        height: 50px;
    }
}

/* =============================================================================
   LOADING AND ERROR STATES
   ============================================================================= */

/* Fix loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* =============================================================================
   UTILITY CLASSES FOR MOBILE
   ============================================================================= */

/* Hide elements on mobile */
@media screen and (max-width: 390px) {
    .mobile-hidden {
        display: none !important;
    }
}

/* Show only on mobile */
@media screen and (min-width: 391px) {
    .mobile-only {
        display: none !important;
    }
}

/* Touch-friendly tap targets */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Improve scrollbar appearance on mobile */
@media screen and (max-width: 430px) {
    /* Hide scrollbars but keep functionality */
    .profile-content::-webkit-scrollbar,
    .settings-content::-webkit-scrollbar,
    .chat-messages::-webkit-scrollbar,
    .profile-editor::-webkit-scrollbar {
        display: none;
    }
    
    .profile-content,
    .settings-content,
    .chat-messages,
    .profile-editor {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
}


/* ===== MOBILE FORM FIX - Prevent iOS Auto-Zoom ===== */
/* All interactive form elements must be 16px minimum to prevent auto-zoom */

/* Profile Editor - All inputs and selects */
#profileEditor input[type="text"],
#profileEditor input[type="email"],
#profileEditor input[type="date"],
#profileEditor input[type="number"],
#profileEditor select,
#profileEditor textarea {
    font-size: 16px !important;
}

/* Profile Editor - Interest buttons (the actual class name) */
#profileEditor .interest-btn {
    font-size: 16px !important;
}

/* Profile Editor - Choice buttons (Career, Zodiac, What I Like Most, etc.) */
#profileEditor .choice-btn {
    font-size: 16px !important;
}

/* Profile Editor - Career buttons (if they exist with similar naming) */
#profileEditor .career-btn {
    font-size: 16px !important;
}

/* Profile Editor - Priority/Looking for buttons */
#profileEditor .priority-btn,
#profileEditor .looking-for-btn {
    font-size: 16px !important;
}

/* Profile Editor - Save button */
#profileEditor .save-profile-btn {
    font-size: 16px !important;
}

/* Height, Zodiac, Birthday dropdowns */
#profileHeight,
#profileBirthday,
#profileZodiac {
    font-size: 16px !important;
}

/* Business Profile Editor - Same treatment */
#businessProfileEditor input,
#businessProfileEditor select,
#businessProfileEditor textarea,
#businessProfileEditor .interest-btn,
#businessProfileEditor .save-profile-btn {
    font-size: 16px !important;
}

/* Login/Register screens */
#loginEmail,
#loginPassword,
#registerName,
#registerEmail,
#registerPassword,
#registerConfirmPassword {
    font-size: 16px !important;
}

/* Settings inputs */
#settingsOverlay input,
#settingsOverlay select {
    font-size: 16px !important;
}
