/**
 * NUCLEAR SOLUTION: Completely prevent UFO panel from loading on mobile
 * Add this code BEFORE the ufo_control_panel.php include in header.php
 */

// Detect mobile devices server-side
$is_mobile = false;
if (isset($_SERVER['HTTP_USER_AGENT'])) {
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    $mobile_agents = array('Mobile', 'Android', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone');
    foreach ($mobile_agents as $agent) {
        if (stripos($user_agent, $agent) !== false) {
            $is_mobile = true;
            break;
        }
    }
}

// Also check viewport width via cookie (if set by JavaScript)
if (isset($_COOKIE['viewport_width']) && $_COOKIE['viewport_width'] <= 980) {
    $is_mobile = true;
}

// Only load UFO panel on desktop
if (!$is_mobile) {
    include 'header_parts/ufo_control_panel.php';
} else {
    // Mobile: Output placeholder comment for debugging
    echo '<!-- UFO Control Panel: Hidden on mobile to prevent blocking overlay -->';
}
