<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true">

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="?attr/actionBarSize"
            app:title="@string/add_card" />
    </com.google.android.material.appbar.AppBarLayout>

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:showIn="@layout/activity_pick_stack">

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/inputWrapper"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/title_mandatory"
                android:labelFor="@id/input"
                android:padding="@dimen/spacer_2x"
                android:visibility="gone"
                app:layout_constraintBottom_toTopOf="@id/fragment_container_wrapper"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:visibility="visible">

                <EditText
                    android:id="@+id/input"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:imeOptions="actionDone"
                    android:importantForAutofill="no"
                    android:inputType="text">

                    <requestFocus />
                </EditText>

            </com.google.android.material.textfield.TextInputLayout>

            <androidx.core.widget.NestedScrollView
                android:id="@+id/fragment_container_wrapper"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_above="@+id/buttonBar"
                android:padding="@dimen/spacer_2x"
                app:layout_constraintBottom_toTopOf="@id/buttonBar"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/inputWrapper"
                app:layout_constraintVertical_weight="1">

                <androidx.fragment.app.FragmentContainerView
                    android:id="@+id/fragment_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
            </androidx.core.widget.NestedScrollView>

            <LinearLayout
                android:id="@+id/buttonBar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:orientation="horizontal"
                android:padding="@dimen/spacer_2x"
                android:weightSum="1.0"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent">

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/cancel"
                    style="@style/Widget.Material3.Button.TextButton"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/spacer_1x"
                    android:layout_weight=".5"
                    android:text="@android:string/cancel"
                    android:textColor="@color/defaultBrand" />

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/submit"
                    style="@style/Widget.Material3.Button"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/spacer_1x"
                    android:layout_weight=".5"
                    android:enabled="false"
                    android:text="@string/simple_add"
                    app:backgroundTint="@color/defaultBrand" />
            </LinearLayout>
        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>