<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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="wrap_content"
    android:background="@drawable/bottom_sheet_background">

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="64dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="-5dp"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="17dp"
                android:layout_marginBottom="10dp"
                android:orientation="horizontal">

                <ImageButton
                    android:id="@+id/resetSearchFilter"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_gravity="start|center_vertical"
                    android:layout_marginStart="17dp"
                    android:background="@null"
                    android:rotation="180"
                    android:scaleType="fitCenter"
                    android:src="@drawable/ic_round_reset_star_24"
                    app:tint="?attr/colorPrimary" />

                <TextView
                    android:id="@+id/bottomSheerCustomTitle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="45dp"
                    android:layout_marginTop="-2dp"
                    android:layout_weight="1"
                    android:fontFamily="@font/poppins_semi_bold"
                    android:text="@string/filter"
                    android:textAlignment="center"
                    android:textSize="23sp" />

                <ImageButton
                    android:id="@+id/countryFilter"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_gravity="end|center_vertical"
                    android:layout_marginEnd="10dp"
                    android:background="@null"
                    android:scaleType="fitCenter"
                    android:src="@drawable/ic_round_globe_search_googlefonts"
                    app:tint="?attr/colorPrimary" />

                <ImageButton
                    android:id="@+id/sortByFilter"
                    android:layout_width="35dp"
                    android:layout_height="35dp"
                    android:layout_gravity="end|center_vertical"
                    android:layout_marginEnd="17dp"
                    android:background="@null"
                    android:scaleType="fitCenter"
                    android:src="@drawable/ic_round_filter_alt_24"
                    app:tint="?attr/colorPrimary" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="8dp"
                android:baselineAligned="false"
                android:orientation="horizontal">

                <com.google.android.material.textfield.TextInputLayout
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    android:layout_weight="1"
                    android:hint="@string/source"
                    app:boxCornerRadiusBottomEnd="16dp"
                    app:boxCornerRadiusBottomStart="16dp"
                    app:boxCornerRadiusTopEnd="16dp"
                    app:boxCornerRadiusTopStart="16dp"
                    app:boxStrokeColor="@color/text_input_layout_stroke_color"
                    app:hintAnimationEnabled="true">

                    <AutoCompleteTextView
                        android:id="@+id/searchSource"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_weight="1"
                        android:fontFamily="@font/poppins_bold"
                        android:freezesText="false"
                        android:inputType="none"
                        android:padding="8dp"
                        android:singleLine="true"
                        android:textAllCaps="true"
                        android:textColor="?android:attr/textColorSecondary"
                        android:textSize="14sp"
                        tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.textfield.TextInputLayout
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    android:layout_weight="1"
                    android:hint="@string/format"
                    app:boxCornerRadiusBottomEnd="16dp"
                    app:boxCornerRadiusBottomStart="16dp"
                    app:boxCornerRadiusTopEnd="16dp"
                    app:boxCornerRadiusTopStart="16dp"
                    app:boxStrokeColor="@color/text_input_layout_stroke_color"
                    app:hintAnimationEnabled="true">

                    <AutoCompleteTextView
                        android:id="@+id/searchFormat"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_weight="1"
                        android:fontFamily="@font/poppins_bold"
                        android:freezesText="false"
                        android:inputType="none"
                        android:padding="8dp"
                        android:singleLine="true"
                        android:textAllCaps="true"
                        android:textColor="?android:attr/textColorSecondary"
                        android:textSize="14sp"
                        tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
                </com.google.android.material.textfield.TextInputLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="8dp"
                android:baselineAligned="false"
                android:orientation="horizontal">


                <com.google.android.material.textfield.TextInputLayout
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    android:layout_weight="1"
                    android:hint="@string/status_title"
                    app:boxCornerRadiusBottomEnd="16dp"
                    app:boxCornerRadiusBottomStart="16dp"
                    app:boxCornerRadiusTopEnd="16dp"
                    app:boxCornerRadiusTopStart="16dp"
                    app:boxStrokeColor="@color/text_input_layout_stroke_color"
                    app:hintAnimationEnabled="true">

                    <AutoCompleteTextView
                        android:id="@+id/searchStatus"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_weight="1"
                        android:fontFamily="@font/poppins_bold"
                        android:freezesText="false"
                        android:inputType="none"
                        android:padding="8dp"
                        android:singleLine="true"
                        android:textAllCaps="true"
                        android:textColor="?android:attr/textColorSecondary"
                        android:textSize="14sp"
                        tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/searchSeasonCont"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    android:layout_weight="1"
                    android:hint="@string/season"
                    app:boxCornerRadiusBottomEnd="16dp"
                    app:boxCornerRadiusBottomStart="16dp"
                    app:boxCornerRadiusTopEnd="16dp"
                    app:boxCornerRadiusTopStart="16dp"
                    app:boxStrokeColor="@color/text_input_layout_stroke_color"
                    app:hintAnimationEnabled="true">

                    <AutoCompleteTextView
                        android:id="@+id/searchSeason"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_weight="1"
                        android:fontFamily="@font/poppins_bold"
                        android:freezesText="false"
                        android:inputType="none"
                        android:padding="8dp"
                        android:singleLine="true"
                        android:textAllCaps="true"
                        android:textColor="?android:attr/textColorSecondary"
                        android:textSize="14sp"
                        tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.textfield.TextInputLayout
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    android:layout_weight="1"
                    android:hint="@string/year"
                    app:boxCornerRadiusBottomEnd="16dp"
                    app:boxCornerRadiusBottomStart="16dp"
                    app:boxCornerRadiusTopEnd="16dp"
                    app:boxCornerRadiusTopStart="16dp"
                    app:boxStrokeColor="@color/text_input_layout_stroke_color"
                    app:hintAnimationEnabled="true">

                    <AutoCompleteTextView
                        android:id="@+id/searchYear"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_weight="1"
                        android:fontFamily="@font/poppins_bold"
                        android:freezesText="false"
                        android:inputType="none"
                        android:padding="8dp"
                        android:singleLine="true"
                        android:textAllCaps="true"
                        android:textColor="?android:attr/textColorSecondary"
                        android:textSize="14sp"
                        tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
                </com.google.android.material.textfield.TextInputLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="32dp"
                android:layout_marginTop="8dp"
                android:layout_marginEnd="32dp"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:fontFamily="@font/poppins_bold"
                    android:text="@string/genres"
                    android:textSize="16sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="10dp"
                    android:fontFamily="@font/poppins_semi_bold"
                    android:text="@string/grid" />

                <com.google.android.material.materialswitch.MaterialSwitch
                    android:id="@+id/searchGenresGrid"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
            </LinearLayout>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/searchFilterGenres"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clipToPadding="false"
                android:fadingEdge="horizontal"
                android:orientation="horizontal"
                android:paddingStart="16dp"
                android:paddingTop="4dp"
                android:paddingEnd="16dp"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                app:spanCount="6"
                tools:listitem="@layout/item_chip" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="32dp"
                android:layout_marginTop="8dp"
                android:layout_marginEnd="32dp"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:fontFamily="@font/poppins_bold"
                    android:text="@string/tags"
                    android:textSize="16sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="10dp"
                    android:fontFamily="@font/poppins_semi_bold"
                    android:text="@string/grid" />

                <com.google.android.material.materialswitch.MaterialSwitch
                    android:id="@+id/searchTagsGrid"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
            </LinearLayout>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/searchFilterTags"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clipToPadding="false"
                android:fadeScrollbars="true"
                android:orientation="horizontal"
                android:paddingStart="16dp"
                android:paddingTop="4dp"
                android:paddingEnd="16dp"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                app:spanCount="6"
                tools:listitem="@layout/item_chip" />

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="16dp"
                android:background="?android:attr/listDivider" />
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:orientation="horizontal">

        <Button
            android:id="@+id/searchFilterCancel"
            style="@style/Widget.Material3.Button.OutlinedButton"
            android:layout_width="0dp"
            android:layout_height="56dp"
            android:layout_margin="8dp"
            android:layout_weight="1"
            android:fontFamily="@font/poppins_bold"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:padding="8dp"
            android:text="@string/cancel"
            android:textSize="16sp"
            app:cornerRadius="16dp"
            app:strokeColor="?attr/colorPrimaryContainer"
            tools:ignore="SpeakableTextPresentCheck" />

        <Button
            android:id="@+id/searchFilterApply"
            style="@style/Widget.Material3.Button.OutlinedButton"
            android:layout_width="0dp"
            android:layout_height="56dp"
            android:layout_margin="8dp"
            android:layout_weight="1"
            android:fontFamily="@font/poppins_bold"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:padding="8dp"
            android:text="@string/apply"
            android:textSize="16sp"
            app:cornerRadius="16dp"
            app:strokeColor="?attr/colorPrimaryContainer"
            tools:ignore="SpeakableTextPresentCheck" />
    </LinearLayout>
</FrameLayout>