<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/home_background">

    <FrameLayout
        android:id="@+id/home_search"
        android:layout_width="0dp"
        android:layout_height="44dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/bg_home_search"
        android:clickable="true"
        android:focusable="true"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

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

            <ImageView
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:contentDescription="@null"
                android:src="@drawable/ic_nav_search"
                app:tint="@color/home_secondary" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="6dp"
                android:fontFamily="sans"
                android:text="@string/home_search_hint"
                android:textColor="@color/home_secondary"
                android:textSize="17sp" />
        </LinearLayout>
    </FrameLayout>

    <HorizontalScrollView
        android:id="@+id/home_chip_scroll"
        android:layout_width="match_parent"
        android:layout_height="34.5dp"
        android:layout_marginTop="16dp"
        android:clipToPadding="false"
        android:fillViewport="false"
        android:overScrollMode="never"
        android:scrollbars="none"
        app:layout_constraintTop_toBottomOf="@id/home_search">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="34.5dp"
            android:orientation="horizontal"
            android:paddingStart="16dp"
            android:paddingEnd="16dp">

            <TextView
                android:id="@+id/chip_genres"
                android:layout_width="92.5dp"
                android:layout_height="34.5dp"
                android:background="@drawable/bg_home_chip"
                android:clickable="true"
                android:drawableStart="@drawable/ic_home_categories"
                android:drawablePadding="8dp"
                android:focusable="true"
                android:fontFamily="sans"
                android:gravity="center"
                android:maxLines="1"
                android:singleLine="true"
                android:text="@string/home_chip_genres"
                android:textColor="@color/home_primary"
                android:textSize="16sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/chip_recommendations"
                android:layout_width="111.75dp"
                android:layout_height="34.5dp"
                android:layout_marginStart="8dp"
                android:background="@drawable/bg_home_chip"
                android:clickable="true"
                android:focusable="true"
                android:fontFamily="sans"
                android:gravity="center"
                android:maxLines="1"
                android:singleLine="true"
                android:text="@string/home_chip_recommendations"
                android:textColor="@color/home_primary"
                android:textSize="16sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/chip_books"
                android:layout_width="106.5dp"
                android:layout_height="34.5dp"
                android:layout_marginStart="8dp"
                android:background="@drawable/bg_home_chip"
                android:clickable="true"
                android:focusable="true"
                android:fontFamily="sans"
                android:gravity="center"
                android:maxLines="1"
                android:singleLine="true"
                android:text="@string/home_chip_books"
                android:textColor="@color/home_primary"
                android:textSize="16sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/chip_authors"
                android:layout_width="90dp"
                android:layout_height="34.5dp"
                android:layout_marginStart="8dp"
                android:background="@drawable/bg_home_chip"
                android:clickable="true"
                android:focusable="true"
                android:fontFamily="sans"
                android:gravity="center"
                android:maxLines="1"
                android:singleLine="true"
                android:text="@string/home_chip_authors"
                android:textColor="@color/home_primary"
                android:textSize="16sp"
                android:textStyle="bold" />
        </LinearLayout>
    </HorizontalScrollView>

    <androidx.core.widget.NestedScrollView
        android:id="@+id/home_content_scroll"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="8dp"
        android:background="@color/home_background"
        android:clipToPadding="false"
        android:fillViewport="true"
        android:overScrollMode="never"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@id/home_chip_scroll">

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

            <HorizontalScrollView
                android:id="@+id/home_banner_scroll"
                android:layout_width="match_parent"
                android:layout_height="138.5dp"
                android:layout_marginTop="8dp"
                android:clipToPadding="false"
                android:fillViewport="false"
                android:overScrollMode="never"
                android:scrollbars="none">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="138.5dp"
                    android:orientation="horizontal">

                    <com.google.android.material.card.MaterialCardView
                        android:id="@+id/home_banner_first"
                        android:layout_width="341.5dp"
                        android:layout_height="138.5dp"
                        android:layout_marginEnd="8dp"
                        android:clickable="true"
                        android:focusable="true"
                        app:cardBackgroundColor="@android:color/transparent"
                        app:cardCornerRadius="20dp"
                        app:cardElevation="0dp"
                        app:strokeWidth="0dp">

                        <FrameLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:background="@drawable/bg_home_banner_first">

                            <ImageView
                                android:id="@+id/home_banner_cover_1"
                                android:layout_width="156dp"
                                android:layout_height="match_parent"
                                android:layout_gravity="end"
                                android:alpha="0.86"
                                android:contentDescription="@null"
                                android:scaleType="centerCrop"
                                android:src="@drawable/default_cover" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:background="@drawable/bg_home_banner_overlay" />

                            <LinearLayout
                                android:layout_width="210dp"
                                android:layout_height="match_parent"
                                android:gravity="center_vertical"
                                android:orientation="vertical"
                                android:paddingStart="24dp"
                                android:paddingEnd="12dp">

                                <TextView
                                    android:id="@+id/home_banner_title_1"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:fontFamily="sans"
                                    android:maxLines="2"
                                    android:text="@string/home_banner_first_title"
                                    android:textColor="@color/white"
                                    android:textSize="21sp"
                                    android:textStyle="bold" />

                                <TextView
                                    android:id="@+id/home_banner_subtitle_1"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_marginTop="8dp"
                                    android:ellipsize="end"
                                    android:maxLines="1"
                                    android:text="@string/home_banner_first_subtitle"
                                    android:textColor="#DDFFFFFF"
                                    android:textSize="12sp" />
                            </LinearLayout>
                        </FrameLayout>
                    </com.google.android.material.card.MaterialCardView>

                    <com.google.android.material.card.MaterialCardView
                        android:id="@+id/home_banner_second"
                        android:layout_width="341.5dp"
                        android:layout_height="138.5dp"
                        android:layout_marginEnd="8dp"
                        android:clickable="true"
                        android:focusable="true"
                        app:cardBackgroundColor="@android:color/transparent"
                        app:cardCornerRadius="20dp"
                        app:cardElevation="0dp"
                        app:strokeWidth="0dp">

                        <FrameLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:background="@drawable/bg_home_banner_second">

                            <ImageView
                                android:id="@+id/home_banner_cover_2"
                                android:layout_width="156dp"
                                android:layout_height="match_parent"
                                android:layout_gravity="end"
                                android:alpha="0.86"
                                android:contentDescription="@null"
                                android:scaleType="centerCrop"
                                android:src="@drawable/default_cover" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:background="@drawable/bg_home_banner_overlay" />

                            <LinearLayout
                                android:layout_width="210dp"
                                android:layout_height="match_parent"
                                android:gravity="center_vertical"
                                android:orientation="vertical"
                                android:paddingStart="24dp"
                                android:paddingEnd="12dp">

                                <TextView
                                    android:id="@+id/home_banner_title_2"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:fontFamily="sans"
                                    android:maxLines="2"
                                    android:text="@string/home_banner_second_title"
                                    android:textColor="@color/white"
                                    android:textSize="21sp"
                                    android:textStyle="bold" />

                                <TextView
                                    android:id="@+id/home_banner_subtitle_2"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_marginTop="8dp"
                                    android:ellipsize="end"
                                    android:maxLines="1"
                                    android:text="@string/home_banner_second_subtitle"
                                    android:textColor="#DDFFFFFF"
                                    android:textSize="12sp" />
                            </LinearLayout>
                        </FrameLayout>
                    </com.google.android.material.card.MaterialCardView>

                    <com.google.android.material.card.MaterialCardView
                        android:id="@+id/home_banner_third"
                        android:layout_width="341.5dp"
                        android:layout_height="138.5dp"
                        android:clickable="true"
                        android:focusable="true"
                        app:cardBackgroundColor="@android:color/transparent"
                        app:cardCornerRadius="20dp"
                        app:cardElevation="0dp"
                        app:strokeWidth="0dp">

                        <FrameLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:background="@drawable/bg_home_banner_third">

                            <ImageView
                                android:id="@+id/home_banner_cover_3"
                                android:layout_width="156dp"
                                android:layout_height="match_parent"
                                android:layout_gravity="end"
                                android:alpha="0.86"
                                android:contentDescription="@null"
                                android:scaleType="centerCrop"
                                android:src="@drawable/default_cover" />

                            <View
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:background="@drawable/bg_home_banner_overlay" />

                            <LinearLayout
                                android:layout_width="210dp"
                                android:layout_height="match_parent"
                                android:gravity="center_vertical"
                                android:orientation="vertical"
                                android:paddingStart="24dp"
                                android:paddingEnd="12dp">

                                <TextView
                                    android:id="@+id/home_banner_title_3"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:fontFamily="sans"
                                    android:maxLines="2"
                                    android:text="@string/home_banner_third_title"
                                    android:textColor="@color/white"
                                    android:textSize="21sp"
                                    android:textStyle="bold" />

                                <TextView
                                    android:id="@+id/home_banner_subtitle_3"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_marginTop="8dp"
                                    android:ellipsize="end"
                                    android:maxLines="1"
                                    android:text="@string/home_banner_third_subtitle"
                                    android:textColor="#DDFFFFFF"
                                    android:textSize="12sp" />
                            </LinearLayout>
                        </FrameLayout>
                    </com.google.android.material.card.MaterialCardView>
                </LinearLayout>
            </HorizontalScrollView>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="37.75dp"
                android:layout_marginTop="13.75dp"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                android:paddingStart="16dp"
                android:paddingEnd="4dp">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:fontFamily="sans"
                    android:gravity="center_vertical"
                    android:maxLines="1"
                    android:text="@string/home_new_books"
                    android:textColor="@color/home_primary"
                    android:textSize="22sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/catalog_all"
                    android:layout_width="48dp"
                    android:layout_height="match_parent"
                    android:clickable="true"
                    android:focusable="true"
                    android:fontFamily="sans"
                    android:gravity="center"
                    android:text="@string/action_show_all"
                    android:textColor="@color/home_secondary"
                    android:textSize="16sp" />
            </LinearLayout>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/catalog_recycler"
                android:layout_width="match_parent"
                android:layout_height="250dp"
                android:clipToPadding="false"
                android:nestedScrollingEnabled="false"
                android:overScrollMode="never"
                android:paddingStart="16dp"
                android:paddingTop="11dp"
                android:paddingEnd="16dp"
                android:scrollbars="none" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="37.75dp"
                android:layout_marginTop="8dp"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                android:paddingStart="16dp"
                android:paddingEnd="4dp">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:fontFamily="sans"
                    android:gravity="center_vertical"
                    android:maxLines="1"
                    android:text="@string/home_downloaded_books"
                    android:textColor="@color/home_primary"
                    android:textSize="22sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/downloaded_all"
                    android:layout_width="48dp"
                    android:layout_height="match_parent"
                    android:clickable="true"
                    android:focusable="true"
                    android:fontFamily="sans"
                    android:gravity="center"
                    android:text="@string/action_show_all"
                    android:textColor="@color/home_secondary"
                    android:textSize="16sp" />
            </LinearLayout>

            <TextView
                android:id="@+id/downloaded_empty"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginTop="10dp"
                android:layout_marginEnd="16dp"
                android:text="@string/home_downloaded_empty"
                android:textColor="@color/home_secondary"
                android:textSize="14sp" />

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/downloaded_recycler"
                android:layout_width="match_parent"
                android:layout_height="250dp"
                android:clipToPadding="false"
                android:nestedScrollingEnabled="false"
                android:overScrollMode="never"
                android:paddingStart="16dp"
                android:paddingTop="11dp"
                android:paddingEnd="16dp"
                android:scrollbars="none" />
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
