<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@color/background_grey">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:background="@color/primary_dark"
            android:gravity="center_vertical"
            android:paddingStart="16dp"
            android:paddingEnd="16dp"
            android:orientation="horizontal">

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="Process Refund"
                android:textColor="@color/white"
                android:textSize="20sp"
                android:textStyle="bold"/>

        </LinearLayout>

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

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

                <!-- Load Sale Card -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/rounded_card"
                    android:padding="16dp"
                    android:layout_marginBottom="16dp">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Load Original Sale"
                        android:textColor="@color/text_dark"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:layout_marginBottom="8dp"/>

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

                        <EditText
                            android:id="@+id/etRefundSaleId"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:hint="Enter Sale ID"
                            android:inputType="number"
                            android:layout_marginEnd="8dp"/>

                        <Button
                            android:id="@+id/btnLoadSale"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Load"
                            android:backgroundTint="@color/primary_medium"
                            android:textColor="@color/white"/>

                    </LinearLayout>

                    <TextView
                        android:id="@+id/tvSaleInfo"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="@color/text_light"
                        android:textSize="12sp"
                        android:layout_marginTop="8dp"
                        android:visibility="gone"/>

                </LinearLayout>

                <!-- Original Sale Items Card -->
                <LinearLayout
                    android:id="@+id/cardOriginalItems"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/rounded_card"
                    android:padding="16dp"
                    android:layout_marginBottom="16dp"
                    android:visibility="gone">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Original Sale Items"
                        android:textColor="@color/text_dark"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:layout_marginBottom="8dp"/>

                    <LinearLayout
                        android:id="@+id/llOriginalItems"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"/>

                </LinearLayout>

                <!-- Refund Items Card -->
                <LinearLayout
                    android:id="@+id/cardRefundItems"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/rounded_card"
                    android:padding="16dp"
                    android:layout_marginBottom="16dp"
                    android:visibility="gone">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Items to Refund"
                        android:textColor="@color/text_dark"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:layout_marginBottom="8dp"/>

                    <LinearLayout
                        android:id="@+id/llRefundItems"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"/>

                    <TextView
                        android:id="@+id/tvRefundTotal"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Refund Total: $0.00"
                        android:textColor="@color/accent_coral"
                        android:textSize="16sp"
                        android:textStyle="bold"
                        android:layout_gravity="end"
                        android:layout_marginTop="12dp"/>

                </LinearLayout>

                <!-- Payment Method Card -->
                <LinearLayout
                    android:id="@+id/cardPayment"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@drawable/rounded_card"
                    android:padding="16dp"
                    android:layout_marginBottom="16dp"
                    android:visibility="gone">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Refund Payment Method"
                        android:textColor="@color/text_dark"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:layout_marginBottom="8dp"/>

                    <Spinner
                        android:id="@+id/spinnerRefundPayment"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"/>

                </LinearLayout>

            </LinearLayout>

        </ScrollView>

        <!-- Bottom Buttons -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:background="@color/white"
            android:padding="16dp">

            <Button
                android:id="@+id/btnRefundBack"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginEnd="8dp"
                android:text="Back"
                android:backgroundTint="@color/primary_medium"
                android:textColor="@color/white"/>

            <Button
                android:id="@+id/btnProcessRefund"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginStart="8dp"
                android:text="Process Refund"
                android:backgroundTint="@color/accent_coral"
                android:textColor="@color/white"
                android:visibility="gone"/>

        </LinearLayout>

    </LinearLayout>

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:visibility="gone"
        android:indeterminateTint="@color/accent_coral"/>

</FrameLayout>