<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background"
    >

    <LinearLayout
        android:id="@+id/linearLayout5"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="@color/light_gray"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textTime"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1.2"
            android:gravity="start|center_vertical"
            android:text="1911/01/01 01:01:01"
            android:textColor="@color/gray"
            android:textSize="18sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/textTemperature"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.8"
            android:gravity="center"
            android:text="0 ℃"
            android:textColor="@color/gray"
            android:textSize="18sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/textNetwork"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1.0"
            android:gravity="center_vertical|end"
            android:text="@string/no_internet"
            android:textColor="@color/gray"
            android:textSize="18sp"
            android:textStyle="bold" />

    </LinearLayout>

    <RelativeLayout
        android:id="@+id/relativeLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginBottom="2dp"
        android:background="@color/black"
        app:layout_constraintDimensionRatio="21:9"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.media3.ui.PlayerView
            android:id="@+id/videoView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:resize_mode="zoom"
            app:show_subtitle_button="true"
            app:use_artwork="true"
            app:use_controller="false" />

        <ImageView
            android:id="@+id/imageAd"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:visibility="gone"
            />
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/machine_info_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/cardSurface"
        android:elevation="4dp"
        android:layout_marginBottom="8dp"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:paddingStart="26dp"
        android:paddingEnd="26dp"
        android:paddingTop="16dp"
        android:paddingBottom="16dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/relativeLayout">

        <!-- 機台名稱 -->
        <TextView
            android:id="@+id/textMachineInfoName"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="start|center_vertical"
            android:text="--"
            android:textColor="@color/gray"
            android:textSize="16sp"
            android:alpha="0.9"
            android:singleLine="true"
            android:ellipsize="end" />

        <!-- 時間資訊 -->
        <TextView
            android:id="@+id/textMachineInfoTime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:gravity="start|center_vertical"
            android:text="--:--:--"
            android:textColor="@color/black"
            android:textSize="16sp"
            android:textStyle="bold"
            android:singleLine="true" />

        <!-- 網路資訊 -->
        <TextView
            android:id="@+id/textMachineInfoNetwork"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:gravity="start|center_vertical"
            android:text="訊號__"
            android:textColor="@color/black"
            android:textSize="16sp"
            android:textStyle="bold"
            android:singleLine="true"
            android:ellipsize="end"
            android:drawableStart="@drawable/network_wifi_1_bar_24"
            android:drawablePadding="4dp"
            app:drawableTint="@color/black" />

        <!-- 溫度資訊 -->
        <TextView
            android:id="@+id/textMachineInfoTemperature"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:gravity="start|center_vertical"
            android:text="0 ℃"
            android:textColor="@color/black"
            android:textSize="16sp"
            android:textStyle="bold"
            android:drawableStart="@drawable/device_thermostat_24"
            android:drawablePadding="4dp"
            app:drawableTint="@color/black" />

        <!-- 多國語言按鈕 -->
        <LinearLayout
            android:id="@+id/textMachineInfoLang"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:background="@drawable/button_outline_black"
            android:paddingStart="15dp"
            android:paddingEnd="15dp"
            android:paddingTop="6dp"
            android:paddingBottom="6dp"
            android:layout_marginStart="16dp">

            <ImageView
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:src="@drawable/language_24"
                app:tint="@color/black" />

            <TextView
                android:id="@+id/textMachineInfoLangText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="中文"
                android:textSize="16sp"
                android:textColor="@color/black"
                android:textStyle="bold"
                android:layout_marginStart="4dp" />
        </LinearLayout>

    </LinearLayout>

    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/machine_info_bar" />

    <LinearLayout
        android:id="@+id/bottom_navigation"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal"
        app:layout_constraintBottom_toTopOf="@id/bottom_bar"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:visibility="gone"
            android:paddingStart="10dp"
            android:paddingEnd="10dp">

            <com.google.android.material.button.MaterialButton
                android:id="@+id/buttonVmc"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/drinksale"
                app:cornerRadius="12dp"
                android:backgroundTint="@android:color/transparent"
                app:strokeColor="@color/gray"
                android:textSize="38sp"
                app:strokeWidth="2dp"
                android:visibility="gone"
                android:layout_margin="4dp"/>

            <com.google.android.material.button.MaterialButton
                android:id="@+id/buttonElectric"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/board_games"
                app:cornerRadius="12dp"
                android:backgroundTint="@android:color/transparent"
                app:strokeColor="@color/gray"
                android:textSize="38sp"
                android:visibility="gone"
                app:strokeWidth="2dp"
                android:layout_margin="4dp"/>

            <com.google.android.material.button.MaterialButton
                android:id="@+id/buttonOther"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:visibility="gone"
                android:text="@string/other"
                app:cornerRadius="12dp"
                android:backgroundTint="@android:color/transparent"
                app:strokeColor="@color/gray"
                android:textSize="38sp"
                app:strokeWidth="2dp"
                android:layout_margin="4dp"/>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/bottom_bar"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:background="@color/light_gray"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <TextView
            android:id="@+id/textVersion"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1.5"
            android:gravity="start"
            android:text="20250108ver1"
            android:textColor="@color/gray"
            android:textSize="16sp"
            android:textStyle="bold" />

        <!-- 語言切換按鈕移至機台資訊列，此處保留 ID 以相容程式碼，隱藏顯示 -->
        <TextView
            android:id="@+id/btnswitchlanTW"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="🌐"
            android:textSize="20sp"
            android:textColor="@color/gray"
            android:textStyle="bold"
            android:layout_marginEnd="10dp"
            android:visibility="gone" />

        <TextView
            android:id="@+id/btnswitchlanEn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="En"
            android:textSize="16sp"
            android:textColor="@color/gray"
            android:textStyle="bold"
            android:layout_marginEnd="10dp"
            android:visibility="gone" />

        <TextView
            android:id="@+id/btnswitchlanJa"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="日"
            android:textSize="16sp"
            android:textColor="@color/gray"
            android:textStyle="bold"
            android:visibility="gone" />

        <TextView
            android:id="@+id/textThreadCount"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1.0"
            android:gravity="end"
            android:text="TC:0"
            android:textColor="@color/gray"
            android:textSize="16sp"
            android:textStyle="bold" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/floatButtonPickupCode"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:gravity="center"
        android:layout_marginEnd="24dp"
        android:layout_marginBottom="24dp"
        android:visibility="gone"
        android:clipChildren="false"
        android:clipToPadding="false"
        app:layout_constraintBottom_toTopOf="@+id/floatButtonShoppingCart"
        app:layout_constraintEnd_toEndOf="@+id/bottom_navigation">

        <androidx.cardview.widget.CardView
            android:layout_width="96dp"
            android:layout_height="96dp"
            android:layout_margin="12dp"
            app:cardCornerRadius="16dp"
            app:cardBackgroundColor="@color/cardSurface"
            app:cardElevation="6dp"
            android:layout_gravity="center"
            android:foreground="?android:attr/selectableItemBackground">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:gravity="center"
                android:paddingTop="12dp"
                android:paddingBottom="8dp"
                android:paddingHorizontal="8dp">

                <ImageView
                    android:id="@+id/imgFloatPickupCode"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:src="@drawable/package_24"
                    app:tint="@color/black" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:text="@string/pickup_code"
                    android:textColor="@color/black"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:gravity="center" />
            </LinearLayout>
        </androidx.cardview.widget.CardView>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/floatButtonShoppingCart"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:gravity="center"
        android:layout_marginEnd="24dp"
        android:layout_marginBottom="24dp"
        android:visibility="gone"
        android:clipChildren="false"
        android:clipToPadding="false"
        app:layout_constraintBottom_toBottomOf="@+id/fragment_container"
        app:layout_constraintEnd_toEndOf="@+id/bottom_navigation">

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clipChildren="false"
            android:clipToPadding="false">

            <androidx.cardview.widget.CardView
                android:layout_width="96dp"
                android:layout_height="96dp"
                android:layout_margin="12dp"
                app:cardCornerRadius="16dp"
                app:cardBackgroundColor="@color/cardSurface"
                app:cardElevation="6dp"
                android:layout_gravity="center"
                android:foreground="?android:attr/selectableItemBackground">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical"
                    android:gravity="center"
                    android:paddingTop="12dp"
                    android:paddingBottom="8dp"
                    android:paddingHorizontal="8dp">

                    <ImageView
                        android:id="@+id/imgFloatShoppingCart"
                        android:layout_width="40dp"
                        android:layout_height="40dp"
                        android:src="@drawable/shopping_cart_24"
                        app:tint="@color/black" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="4dp"
                        android:text="@string/shopping_cart_title"
                        android:textColor="@color/black"
                        android:textSize="16sp"
                        android:textStyle="bold"
                        android:gravity="center" />
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <TextView
                android:id="@+id/textCartBadge"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:minWidth="34dp"
                android:minHeight="34dp"
                android:paddingHorizontal="6dp"
                android:layout_gravity="top|end"
                android:background="@drawable/rounded_background_red"
                android:textColor="@color/white"
                android:textSize="16sp"
                android:textStyle="bold"
                android:gravity="center"
                android:elevation="10dp"
                android:visibility="gone" />
        </FrameLayout>
    </LinearLayout>


    <Button
        android:id="@+id/btnTopRight"
        android:layout_width="200dp"
        android:layout_height="100dp"
        android:text="進入後台"
        android:textSize="24sp"
        android:backgroundTint="@color/error"
        android:textColor="@android:color/white"
        android:alpha="1"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:visibility="gone"
        android:layout_marginTop="60dp"
        android:layout_marginEnd="8dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
