/* Mobile Safari & Chrome Touch Fixes */

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Ensure all clickable elements work on iOS */
    .mobile-menu-toggle,
    .smart-chat-btn,
    .smart-chat-toggle,
    #smartChatButton,
    button,
    [role="button"] {
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        touch-action: manipulation !important;
    }
    
    /* Force hardware acceleration for smoother animations */
    .mobile-menu-toggle,
    #mainNav,
    .smart-chat-btn,
    .smart-chat-toggle,
    #smartChatButton {
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
        will-change: transform !important;
    }
    
    /* Mobile viewport fixes */
    body {
        -webkit-text-size-adjust: 100% !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
    }
    
    /* Mobile menu specific iOS fixes */
    .mobile-menu-toggle {
        position: fixed !important;
        top: 15px !important;
        right: 15px !important;
        z-index: 1002 !important;
        min-width: 44px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(59, 130, 246, 0.95) !important;
        border-radius: 8px !important;
        border: none !important;
        padding: 8px !important;
        cursor: pointer !important;
    }
    
    /* Chat button iOS positioning fix */
    .smart-chat-btn,
    .smart-chat-toggle,
    #smartChatButton {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        z-index: 999999 !important;
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Navigation overlay iOS fix */
    #mainNav.active {
        -webkit-transform: translateX(0) translateZ(0) !important;
        transform: translateX(0) translateZ(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Chrome Mobile specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    @media (max-width: 768px) {
        /* Chrome mobile optimization */
        .mobile-menu-toggle {
            -webkit-appearance: none !important;
            appearance: none !important;
            outline: none !important;
            border: none !important;
            background: rgba(59, 130, 246, 0.95) !important;
            position: fixed !important;
            top: 15px !important;
            right: 15px !important;
            z-index: 1002 !important;
            min-width: 44px !important;
            min-height: 44px !important;
            border-radius: 8px !important;
            cursor: pointer !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            flex-direction: column !important;
            gap: 3px !important;
        }
        
        .mobile-menu-toggle .hamburger-line {
            display: block !important;
            width: 20px !important;
            height: 2px !important;
            background: #ffffff !important;
            border-radius: 1px !important;
            transition: all 0.3s ease !important;
        }
        
        .smart-chat-btn,
        .smart-chat-toggle,
        #smartChatButton {
            position: fixed !important;
            bottom: 20px !important;
            right: 20px !important;
            z-index: 999999 !important;
            width: 56px !important;
            height: 56px !important;
            border-radius: 50% !important;
        }
    }
}

/* Universal mobile fixes for both Safari and Chrome */
@media (max-width: 768px) {
    /* Ensure mobile elements are always on top */
    .mobile-menu-toggle {
        z-index: 1002 !important;
        position: fixed !important;
        top: 15px !important;
        right: 15px !important;
    }
    
    .smart-chat-btn,
    .smart-chat-toggle,
    #smartChatButton {
        z-index: 999999 !important;
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
    }
    
    #mainNav {
        z-index: 999 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100vh !important;
    }
    
    /* Dark mode mobile adjustments */
    @media (prefers-color-scheme: dark) {
        .mobile-menu-toggle {
            background: rgba(51, 65, 85, 0.95) !important;
            border: 1px solid rgba(148, 163, 184, 0.3) !important;
        }
        
        .mobile-menu-toggle .hamburger-line {
            background: #f1f5f9 !important;
        }
        
        #mainNav {
            background: rgba(30, 41, 59, 0.98) !important;
        }
        
        #mainNav a {
            background: #334155 !important;
            color: #f1f5f9 !important;
            border: 1px solid #475569 !important;
        }
    }
}