<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/bg_dark"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingStart="16dp"
        android:paddingEnd="16dp"
        android:paddingTop="20dp"
        android:paddingBottom="24dp">

        <!-- Step 1 Card -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cardStep1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="4dp"
            app:cardBackgroundColor="@color/card_dark"
            app:cardCornerRadius="12dp"
            app:strokeColor="@color/accent_cyan_alpha20"
            app:strokeWidth="1dp">

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

                <!-- Step Label -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="center_vertical"
                    android:layout_marginBottom="12dp">

                    <TextView
                        android:layout_width="28dp"
                        android:layout_height="28dp"
                        android:text="1"
                        android:textColor="@color/bg_dark"
                        android:textSize="13sp"
                        android:textStyle="bold"
                        android:textAlignment="center"
                        android:gravity="center"
                        android:background="@drawable/bg_nfc_circle" />

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:layout_marginStart="10dp"
                        android:text="@string/clone_step1"
                        android:textColor="@color/text_primary"
                        android:textSize="15sp"
                        android:textStyle="bold" />

                </LinearLayout>

                <TextView
                    android:id="@+id/tvSourceStatus"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp"
                    android:text="@string/clone_no_data"
                    android:textColor="@color/text_secondary"
                    android:textSize="13sp" />

                <!-- Source Details (hidden until read) -->
                <LinearLayout
                    android:id="@+id/layoutSourceDetails"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_marginBottom="12dp"
                    android:paddingStart="12dp"
                    android:paddingEnd="12dp"
                    android:paddingTop="10dp"
                    android:paddingBottom="10dp"
                    android:background="@drawable/bg_status_waiting"
                    android:visibility="gone">

                    <TextView
                        android:id="@+id/tvSourceUid"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:fontFamily="monospace"
                        android:textColor="@color/accent_cyan"
                        android:textSize="12sp" />

                    <TextView
                        android:id="@+id/tvSourceType"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="4dp"
                        android:textColor="@color/text_secondary"
                        android:textSize="12sp" />

                    <TextView
                        android:id="@+id/tvSourceSize"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="4dp"
                        android:fontFamily="monospace"
                        android:textColor="@color/text_mono"
                        android:textSize="12sp" />

                </LinearLayout>

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/btnReadSource"
                    android:layout_width="match_parent"
                    android:layout_height="48dp"
                    android:text="@string/clone_read_source_btn"
                    android:textColor="@color/bg_dark"
                    android:textStyle="bold"
                    app:backgroundTint="@color/accent_cyan"
                    app:cornerRadius="10dp" />

            </LinearLayout>
        </com.google.android.material.card.MaterialCardView>

        <!-- Connector Arrow -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="32dp"
            android:orientation="horizontal"
            android:gravity="center">

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:background="@color/divider" />

        </LinearLayout>

        <!-- Step 2 Card -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cardStep2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp"
            app:cardBackgroundColor="@color/card_dark"
            app:cardCornerRadius="12dp"
            app:strokeColor="@color/divider"
            app:strokeWidth="1dp">

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

                <!-- Step Label -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="center_vertical"
                    android:layout_marginBottom="12dp">

                    <TextView
                        android:layout_width="28dp"
                        android:layout_height="28dp"
                        android:text="2"
                        android:textColor="@color/text_secondary"
                        android:textSize="13sp"
                        android:textStyle="bold"
                        android:textAlignment="center"
                        android:gravity="center"
                        android:background="@drawable/ring_pulse" />

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:layout_marginStart="10dp"
                        android:text="@string/clone_step2"
                        android:textColor="@color/text_primary"
                        android:textSize="15sp"
                        android:textStyle="bold" />

                </LinearLayout>

                <TextView
                    android:id="@+id/tvTargetStatus"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="12dp"
                    android:textColor="@color/text_secondary"
                    android:textSize="13sp" />

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/btnWriteTarget"
                    android:layout_width="match_parent"
                    android:layout_height="48dp"
                    android:enabled="false"
                    android:text="@string/clone_write_target_btn"
                    android:textStyle="bold"
                    app:cornerRadius="10dp" />

            </LinearLayout>
        </com.google.android.material.card.MaterialCardView>

        <!-- UID Warning -->
        <com.google.android.material.card.MaterialCardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardBackgroundColor="@color/warning_alpha20"
            app:cardCornerRadius="12dp"
            app:strokeColor="@color/warning_orange"
            app:strokeWidth="1dp">

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

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:textColor="@color/warning_orange"
                    android:textSize="12sp"
                    android:lineSpacingExtra="2dp"
                    android:text="UID wird NICHT geklont. UID-basierte Zugangssysteme erkennen den Klon nicht." />

            </LinearLayout>
        </com.google.android.material.card.MaterialCardView>

    </LinearLayout>
</ScrollView>
