<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".features.demo.channel_sounding.activities.ChannelSoundingActivity">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <!-- Fake Status Bar View -->
        <View
            android:id="@+id/fakeStatusBar"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:background="@color/silabs_redtheme_status_bar_color"
            app:layout_constraintBottom_toTopOf="@+id/statusBarToolbarSeparator"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <View
            android:id="@+id/statusBarToolbarSeparator"
            android:layout_width="0dp"
            android:layout_height="@dimen/matter_1dp"
            android:background="@color/grey"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/fakeStatusBar"
            app:layout_constraintBottom_toTopOf="@id/toolbar" />

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/silabs_redtheme_tool_bar_color"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/statusBarToolbarSeparator"
            app:title="@string/channel_sounding_screen_name"
            app:titleTextColor="#ffff" />
    </androidx.constraintlayout.widget.ConstraintLayout>

    <FrameLayout
        android:id="@+id/configure_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="@dimen/cs_top_margin"
        android:layout_marginBottom="10dp"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/appBarLayout"
        tools:text="Channel Sounding Demo" />

    <LinearLayout
        android:background="@drawable/modal_bg"
        android:id="@+id/channelSoundingActivityContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="@dimen/cs_top_margin"
        android:paddingTop="8dp"
        android:orientation="vertical"
        android:visibility="visible">

        <TextView
            android:id="@+id/configure_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:includeFontPadding="false"
            android:text="@string/channel_sounding_initiator_title"
            android:textSize="14sp"
            android:lineSpacingExtra="0dp"
            android:fontFamily="@font/stolzl_medium"
            android:textColor="@color/silabs_redtheme_subheader_text_color" />
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:id="@+id/calculations"
            android:gravity="center"
            android:visibility="gone">
            <TextView
                android:id="@+id/confidence_score"
                style="@style/settings_header"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/channel_sounding_confidence_score"
                android:textSize="20sp"
                android:gravity="start"/>
        </LinearLayout>

        <!-- Raw and Filtered Distance Values Display (Figma: 302×56, 22dp gap, boxes 140×56) -->
        <LinearLayout
            android:id="@+id/distanceValuesContainer"
            android:layout_width="302dp"
            android:layout_height="56dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="10dp"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:visibility="visible">

            <!-- Raw Distance Value Box -->
            <LinearLayout
                android:id="@+id/rawDistanceBox"
                android:layout_width="140dp"
                android:layout_height="56dp"
                android:background="@drawable/channel_sounding_distance_value_box_bg"
                android:gravity="center_horizontal"
                android:orientation="vertical"
                android:paddingStart="14dp"
                android:paddingEnd="14dp"
                android:paddingTop="6dp"
                android:paddingBottom="6dp">

                <TextView
                    android:id="@+id/rawDistanceLabel"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/stolzl_regular"
                    android:includeFontPadding="false"
                    android:lineSpacingExtra="0dp"
                    android:text="Raw Distance"
                    android:textSize="12sp"
                    android:textColor="@color/silabs_dark_gray_text" />

                <TextView
                    android:id="@+id/rawDistanceValue"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:fontFamily="@font/stolzl_medium"
                    android:includeFontPadding="false"
                    android:lineSpacingExtra="0dp"
                    android:text="0.00 m"
                    android:textSize="14sp"
                    android:textColor="@color/silabs_redtheme_primary_color" />
            </LinearLayout>

            <!-- Filtered (Kalman) Distance Value Box -->
            <LinearLayout
                android:id="@+id/filteredDistanceBox"
                android:layout_width="140dp"
                android:layout_height="56dp"
                android:layout_marginStart="22dp"
                android:background="@drawable/channel_sounding_distance_value_box_bg"
                android:gravity="center_horizontal"
                android:orientation="vertical"
                android:paddingStart="14dp"
                android:paddingEnd="14dp"
                android:paddingTop="6dp"
                android:paddingBottom="6dp">

                <TextView
                    android:id="@+id/filteredDistanceLabel"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/stolzl_regular"
                    android:includeFontPadding="false"
                    android:lineSpacingExtra="0dp"
                    android:text="Filtered (Kalman)"
                    android:textSize="12sp"
                    android:textColor="@color/silabs_dark_gray_text" />

                <TextView
                    android:id="@+id/filteredDistanceValue"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:fontFamily="@font/stolzl_medium"
                    android:includeFontPadding="false"
                    android:lineSpacingExtra="0dp"
                    android:text="0.00 m"
                    android:textSize="14sp"
                    android:textColor="@color/channel_sounding_filtered_distance" />
            </LinearLayout>
        </LinearLayout>

        <!-- Distance Measurement Chart (Raw vs Kalman Filtered) -->
        <com.github.mikephil.charting.charts.LineChart
            android:id="@+id/distanceChart"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginHorizontal="16dp"
            android:layout_marginTop="8dp"
            android:visibility="gone" />

        <!-- Chart Display Options -->
        <LinearLayout
            android:visibility="gone"
            android:id="@+id/chartOptionsLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="16dp"
            android:layout_marginBottom="8dp"
            android:orientation="horizontal"
            android:gravity="center_vertical">

            <androidx.appcompat.widget.AppCompatCheckBox
                android:id="@+id/showRawDistanceCheckbox"
                style="@style/full_line_checkbox_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Show Raw Distance"
                android:textSize="12sp"
                android:textColor="@color/silabs_subtle_text"
                android:checked="false"
                android:layout_marginEnd="16dp"
                app:buttonTint="@color/filter_fragment_checkbox_button_tint" />

            <androidx.appcompat.widget.AppCompatCheckBox
                android:id="@+id/showSpikesCheckbox"
                style="@style/full_line_checkbox_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Show Spikes"
                android:textSize="12sp"
                android:textColor="@color/silabs_subtle_text"
                android:checked="false"
                app:buttonTint="@color/filter_fragment_checkbox_button_tint" />
        </LinearLayout>

        <RelativeLayout
            android:id="@+id/channel_sounding_parent_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginStart="@dimen/matter_10dp"
            android:layout_marginEnd="@dimen/matter_10dp"
            android:layout_marginTop="15dp"
            android:gravity="center_horizontal">

            <com.siliconlabs.bledemo.features.demo.channel_sounding.views.DynamicRippleView
                android:id="@+id/ripple_animation"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:rippleColor="@color/silabs_rebranding_2373_fly_bar_gradient"
                android:layout_centerInParent="true"
                android:gravity="center"
                app:rippleDuration="3000"
                app:rippleRadius="50dp"
                app:rippleAmount="6"
                app:rippleScale="6">

                <TextView
                    android:id="@+id/distanceResult"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:fontFamily="sans-serif-black"
                    android:text="@string/channel_sounding_default_text_00_00_m"
                    android:textSize="@dimen/channel_sounding_distance_text_size"
                    android:textColor="@color/silabs_white"
                    android:shadowColor="@android:color/black"
                    android:shadowDx="2"
                    android:shadowDy="2"
                    android:shadowRadius="4" />
            </com.siliconlabs.bledemo.features.demo.channel_sounding.views.DynamicRippleView>

            <TextView
                android:id="@+id/poorSignalMessage"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/ripple_animation"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:text="@string/channel_sounding_poor_signal"
                android:textSize="14sp"
                android:textColor="@color/silabs_white"
                android:visibility="gone" />
        </RelativeLayout>
    </LinearLayout>
</LinearLayout>