<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:background="@color/white">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/white"
        app:layout_constraintTop_toTopOf="parent"
        app:navigationIcon="@android:drawable/ic_menu_revert"
        app:title="Reservar Mesa"
        app:titleTextColor="@color/colorTextPrimary" />

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:fillViewport="true"
        app:layout_constraintBottom_toTopOf="@+id/confirmContainer"
        app:layout_constraintTop_toBottomOf="@+id/toolbar">

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

            <!-- Number of People -->
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:fontFamily="sans-serif-black"
                android:text="Número de Pessoas"
                android:textColor="@color/colorTextPrimary"
                android:textSize="18sp" />

            <com.google.android.material.card.MaterialCardView
                style="@style/Widget.NaMesa.Card"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="12dp"
                app:cardElevation="0dp"
                app:strokeColor="@color/colorBorder"
                app:strokeWidth="1dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="64dp"
                    android:gravity="center"
                    android:orientation="horizontal">

                    <ImageButton
                        android:id="@+id/btnDecreaseGuests"
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:background="?attr/selectableItemBackgroundBorderless"
                        android:src="@android:drawable/ic_menu_delete"
                        app:tint="@color/colorPrimary" />

                    <TextView
                        android:id="@+id/txtGuestCount"
                        android:layout_width="80dp"
                        android:layout_height="wrap_content"
                        android:gravity="center"
                        android:text="2"
                        android:textColor="@color/colorTextPrimary"
                        android:textSize="20sp"
                        android:textStyle="bold" />

                    <ImageButton
                        android:id="@+id/btnIncreaseGuests"
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:background="?attr/selectableItemBackgroundBorderless"
                        android:src="@android:drawable/ic_menu_add"
                        app:tint="@color/colorPrimary" />
                </LinearLayout>
            </com.google.android.material.card.MaterialCardView>

            <!-- Date Selection -->
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="32dp"
                android:fontFamily="sans-serif-black"
                android:text="Data da Reserva"
                android:textColor="@color/colorTextPrimary"
                android:textSize="18sp" />

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/cardDatePicker"
                style="@style/Widget.NaMesa.Card"
                android:layout_width="match_parent"
                android:layout_height="64dp"
                android:layout_marginTop="12dp"
                app:cardElevation="0dp"
                app:strokeColor="@color/colorBorder"
                app:strokeWidth="1dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:gravity="center_vertical"
                    android:paddingHorizontal="16dp">

                    <ImageView
                        android:layout_width="24dp"
                        android:layout_height="24dp"
                        android:src="@android:drawable/ic_menu_my_calendar"
                        app:tint="@color/colorTextSecondary" />

                    <TextView
                        android:id="@+id/txtSelectedDate"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="12dp"
                        android:layout_weight="1"
                        android:text="Selecionar Data"
                        android:textColor="@color/colorTextPrimary"
                        android:textSize="16sp" />
                </LinearLayout>
            </com.google.android.material.card.MaterialCardView>

            <!-- Time Slots -->
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="32dp"
                android:fontFamily="sans-serif-black"
                android:text="Horários Disponíveis"
                android:textColor="@color/colorTextPrimary"
                android:textSize="18sp" />

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rvTimeSlots"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="12dp"
                android:clipToPadding="false"
                app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
                app:spanCount="3"
                tools:listitem="@layout/item_time_slot" />

            <!-- Special Requests -->
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="32dp"
                android:fontFamily="sans-serif-black"
                android:text="Pedidos Especiais (Opcional)"
                android:textColor="@color/colorTextPrimary"
                android:textSize="18sp" />

            <com.google.android.material.card.MaterialCardView
                style="@style/Widget.NaMesa.Card"
                android:layout_width="match_parent"
                android:layout_height="120dp"
                android:layout_marginTop="12dp"
                app:cardElevation="0dp"
                app:strokeColor="@color/colorBorder"
                app:strokeWidth="1dp">

                <EditText
                    android:id="@+id/etSpecialRequests"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@null"
                    android:gravity="top"
                    android:hint="Ex: Cadeira para bebé, alergias..."
                    android:padding="16dp"
                    android:textColor="@color/colorTextPrimary"
                    android:textColorHint="@color/colorTextHint"
                    android:textSize="15sp" />
            </com.google.android.material.card.MaterialCardView>

        </LinearLayout>
    </androidx.core.widget.NestedScrollView>

    <com.google.android.material.card.MaterialCardView
        android:id="@+id/confirmContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="@color/white"
        app:cardCornerRadius="0dp"
        app:cardElevation="16dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:strokeWidth="0dp">

        <com.google.android.material.button.MaterialButton
            android:id="@+id/btnConfirmReservation"
            style="@style/Widget.NaMesa.Button"
            android:layout_width="match_parent"
            android:layout_height="64dp"
            android:layout_margin="20dp"
            android:text="Confirmar Reserva"
            android:textSize="18sp" />
    </com.google.android.material.card.MaterialCardView>

</androidx.constraintlayout.widget.ConstraintLayout>
