<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/rootLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    android:keepScreenOn="true">

    <!-- ExoPlayer Video View -->
    <androidx.media3.ui.PlayerView
        android:id="@+id/playerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:use_controller="false"
        app:resize_mode="fit"
        app:surface_type="texture_view"
        android:visibility="gone" />

    <!-- Image View for static images -->
    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitCenter"
        android:visibility="gone"
        android:contentDescription="Display content" />

    <!-- WebView for YouTube embeds -->
    <WebView
        android:id="@+id/youtubeWebView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

    <!-- Status Overlay -->
    <LinearLayout
        android:id="@+id/statusOverlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical"
        android:background="#000000"
        android:visibility="visible">

        <ImageView
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:src="@android:drawable/ic_media_play"
            android:layout_marginBottom="16dp"
            android:alpha="0.3"
            android:contentDescription="Logo" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="RemoteDisplay"
            android:textColor="#3B82F6"
            android:textSize="28sp"
            android:textStyle="bold"
            android:layout_marginBottom="8dp" />

        <TextView
            android:id="@+id/statusText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Connecting..."
            android:textColor="#94A3B8"
            android:textSize="16sp" />

        <ProgressBar
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginTop="24dp"
            android:indeterminate="true" />
    </LinearLayout>

    <!-- #109: PiP overlay layer (otherwise-transparent, empty). PipOverlay renders the
         overlay box into this; the playlist renderers never touch it.
         NOTE: at runtime MainActivity REPARENTS this out of rootLayout up to the window
         content (android.R.id.content) so it composites ABOVE the YouTube WebView's video
         plane (the in-rootLayout position was occluded — see #109). MainActivity mirrors
         rootView's orientation/wall transform onto it so corner positions still track the
         rotated content. It is declared here only so it inflates with a known id. -->
    <FrameLayout
        android:id="@+id/pipLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</FrameLayout>
