<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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/compareRoot"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    android:fillViewport="true"
    android:paddingStart="20dp"
    android:paddingTop="12dp"
    android:paddingEnd="20dp"
    android:paddingBottom="28dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/btnBack"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:background="@drawable/bg_chip"
                android:clickable="true"
                android:focusable="true"
                android:gravity="center"
                android:text="@string/back"
                android:textColor="@color/white"
                android:textSize="18sp" />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:layout_weight="1"
                android:gravity="center"
                android:maxLines="1"
                android:text="@string/face_compare_title"
                android:textColor="@color/white"
                android:textSize="17sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/currentModel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/bg_chip"
                android:gravity="center"
                android:maxLines="1"
                android:paddingStart="10dp"
                android:paddingTop="5dp"
                android:paddingEnd="10dp"
                android:paddingBottom="5dp"
                android:textColor="@color/liveness_accent"
                android:textSize="11sp"
                tools:text="Model · Megatron" />
        </LinearLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="26dp"
            android:text="@string/face_compare_heading"
            android:textColor="@color/white"
            android:textSize="27sp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="7dp"
            android:lineSpacingExtra="2dp"
            android:text="@string/face_compare_hint"
            android:textColor="@color/home_text_secondary"
            android:textSize="14sp" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="24dp">

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/cardImageA"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:clickable="true"
                android:focusable="true"
                android:foreground="?attr/selectableItemBackground"
                app:cardBackgroundColor="@color/home_surface"
                app:cardCornerRadius="20dp"
                app:cardElevation="0dp"
                app:layout_constraintDimensionRatio="1:1"
                app:layout_constraintEnd_toStartOf="@id/cardImageB"
                app:layout_constraintHorizontal_chainStyle="spread"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:strokeColor="@color/home_stroke"
                app:strokeWidth="1dp">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageA"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:contentDescription="@string/image_a"
                        android:scaleType="centerCrop" />

                    <com.example.inspireface_example.widget.FaceImageOverlayView
                        android:id="@+id/faceOverlayA"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" />

                    <LinearLayout
                        android:id="@+id/placeholderA"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:padding="12dp">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/add_symbol"
                            android:textColor="@color/liveness_accent"
                            android:textSize="34sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="2dp"
                            android:text="@string/upload_image_a"
                            android:textColor="@color/white"
                            android:textSize="14sp"
                            android:textStyle="bold" />
                    </LinearLayout>

                    <TextView
                        android:id="@+id/statusA"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="bottom"
                        android:background="@color/compare_status_scrim"
                        android:gravity="center"
                        android:maxLines="1"
                        android:paddingStart="8dp"
                        android:paddingTop="7dp"
                        android:paddingEnd="8dp"
                        android:paddingBottom="7dp"
                        android:text="@string/image_empty"
                        android:textColor="@color/home_text_secondary"
                        android:textSize="11sp" />
                </FrameLayout>
            </com.google.android.material.card.MaterialCardView>

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/cardImageB"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginStart="12dp"
                android:clickable="true"
                android:focusable="true"
                android:foreground="?attr/selectableItemBackground"
                app:cardBackgroundColor="@color/home_surface"
                app:cardCornerRadius="20dp"
                app:cardElevation="0dp"
                app:layout_constraintDimensionRatio="1:1"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@id/cardImageA"
                app:layout_constraintTop_toTopOf="parent"
                app:strokeColor="@color/home_stroke"
                app:strokeWidth="1dp">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/imageB"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:contentDescription="@string/image_b"
                        android:scaleType="centerCrop" />

                    <com.example.inspireface_example.widget.FaceImageOverlayView
                        android:id="@+id/faceOverlayB"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" />

                    <LinearLayout
                        android:id="@+id/placeholderB"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:padding="12dp">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/add_symbol"
                            android:textColor="@color/liveness_accent"
                            android:textSize="34sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="2dp"
                            android:text="@string/upload_image_b"
                            android:textColor="@color/white"
                            android:textSize="14sp"
                            android:textStyle="bold" />
                    </LinearLayout>

                    <TextView
                        android:id="@+id/statusB"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="bottom"
                        android:background="@color/compare_status_scrim"
                        android:gravity="center"
                        android:maxLines="1"
                        android:paddingStart="8dp"
                        android:paddingTop="7dp"
                        android:paddingEnd="8dp"
                        android:paddingBottom="7dp"
                        android:text="@string/image_empty"
                        android:textColor="@color/home_text_secondary"
                        android:textSize="11sp" />
                </FrameLayout>
            </com.google.android.material.card.MaterialCardView>
        </androidx.constraintlayout.widget.ConstraintLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="28dp"
            android:gravity="center"
            android:text="@string/similarity_title"
            android:textColor="@color/white"
            android:textSize="17sp"
            android:textStyle="bold" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginTop="10dp">

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/compareCropCardA"
                android:layout_width="58dp"
                android:layout_height="58dp"
                android:layout_marginEnd="6dp"
                android:visibility="invisible"
                app:cardBackgroundColor="@color/home_surface"
                app:cardCornerRadius="14dp"
                app:cardElevation="3dp"
                app:layout_constraintBottom_toBottomOf="@id/similarityGauge"
                app:layout_constraintEnd_toStartOf="@id/similarityGauge"
                app:layout_constraintHorizontal_chainStyle="packed"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="@id/similarityGauge"
                app:strokeColor="@color/liveness_accent"
                app:strokeWidth="2dp"
                tools:visibility="visible">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/compareCropA"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:contentDescription="@string/compare_selected_face_a"
                        android:scaleType="centerCrop" />

                    <TextView
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="bottom|end"
                        android:background="@color/compare_status_scrim"
                        android:gravity="center"
                        android:text="@string/compare_face_a_badge"
                        android:textColor="@color/white"
                        android:textSize="11sp"
                        android:textStyle="bold" />
                </FrameLayout>
            </com.google.android.material.card.MaterialCardView>

            <com.example.inspireface_example.widget.SimilarityGaugeView
                android:id="@+id/similarityGauge"
                android:layout_width="0dp"
                android:layout_height="200dp"
                app:layout_constraintEnd_toStartOf="@id/compareCropCardB"
                app:layout_constraintStart_toEndOf="@id/compareCropCardA"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintWidth_max="200dp" />

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/compareCropCardB"
                android:layout_width="58dp"
                android:layout_height="58dp"
                android:layout_marginStart="6dp"
                android:visibility="invisible"
                app:cardBackgroundColor="@color/home_surface"
                app:cardCornerRadius="14dp"
                app:cardElevation="3dp"
                app:layout_constraintBottom_toBottomOf="@id/similarityGauge"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@id/similarityGauge"
                app:layout_constraintTop_toTopOf="@id/similarityGauge"
                app:strokeColor="@color/liveness_accent"
                app:strokeWidth="2dp"
                tools:visibility="visible">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/compareCropB"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:contentDescription="@string/compare_selected_face_b"
                        android:scaleType="centerCrop" />

                    <TextView
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="bottom|end"
                        android:background="@color/compare_status_scrim"
                        android:gravity="center"
                        android:text="@string/compare_face_b_badge"
                        android:textColor="@color/white"
                        android:textSize="11sp"
                        android:textStyle="bold" />
                </FrameLayout>
            </com.google.android.material.card.MaterialCardView>
        </androidx.constraintlayout.widget.ConstraintLayout>

        <TextView
            android:id="@+id/comparisonDetails"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:minHeight="20dp"
            android:textColor="@color/home_text_muted"
            android:textSize="11sp"
            tools:text="cosine confidence 0.82 · threshold 0.45" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="14dp"
            android:gravity="center"
            android:text="@string/on_device_privacy"
            android:textColor="@color/home_text_muted"
            android:textSize="12sp" />
    </LinearLayout>
</androidx.core.widget.NestedScrollView>
