<?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:id="@+id/clientRoot"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorBackground"
    tools:context=".ClientDashboardActivity">

    <androidx.core.widget.NestedScrollView
        android:id="@+id/clientScroll"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:fillViewport="true"
        android:scrollbars="none"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toTopOf="@id/bottomNavigation"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent">

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

            <!-- Header -->
            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingHorizontal="24dp"
                android:paddingTop="32dp">

                <TextView
                    android:id="@+id/txtClientGreeting"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="Olá, convidado!"
                    android:textColor="@color/colorTextPrimary"
                    android:textSize="28sp"
                    android:textStyle="bold"
                    android:fontFamily="sans-serif"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toStartOf="@id/imgNotification"
                    android:layout_marginEnd="16dp" />
                    
                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="Encontre a sua próxima mesa."
                    android:textColor="@color/colorTextSecondary"
                    android:textSize="16sp"
                    app:layout_constraintTop_toBottomOf="@id/txtClientGreeting"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toStartOf="@id/imgNotification" />

                <ImageButton
                    android:id="@+id/imgNotification"
                    android:layout_width="48dp"
                    android:layout_height="48dp"
                    android:background="@drawable/bg_circle_white"
                    android:src="@android:drawable/ic_popup_reminder"
                    app:tint="@color/colorTextPrimary"
                    android:layout_marginEnd="12dp"
                    app:layout_constraintTop_toTopOf="@id/cardProfile"
                    app:layout_constraintBottom_toBottomOf="@id/cardProfile"
                    app:layout_constraintEnd_toStartOf="@id/cardProfile" />

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/cardProfile"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    app:cardCornerRadius="25dp"
                    app:cardElevation="2dp"
                    app:strokeWidth="0dp"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent">

                    <ImageView
                        android:id="@+id/imgProfile"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:scaleType="centerCrop"
                        android:src="@drawable/circle_bg" />
                </com.google.android.material.card.MaterialCardView>
            </androidx.constraintlayout.widget.ConstraintLayout>

            <!-- Search Bar -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="56dp"
                android:layout_marginHorizontal="24dp"
                android:layout_marginTop="24dp"
                app:cardCornerRadius="16dp"
                app:cardElevation="4dp"
                app:strokeWidth="0dp"
                app:cardBackgroundColor="@color/colorSurface">

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

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

                    <EditText
                        android:id="@+id/etSearch"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginStart="12dp"
                        android:background="@null"
                        android:hint="Pesquisar restaurantes..."
                        android:textColor="@color/colorTextPrimary"
                        android:textColorHint="@color/colorTextHint"
                        android:textSize="16sp"
                        android:maxLines="1"
                        android:inputType="text" />
                </LinearLayout>
            </com.google.android.material.card.MaterialCardView>

            <!-- Category Pills -->
            <HorizontalScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="24dp"
                android:scrollbars="none"
                android:clipToPadding="false"
                android:paddingHorizontal="20dp">

                <com.google.android.material.chip.ChipGroup
                    android:id="@+id/chipGroupCategories"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:singleLine="true"
                    app:singleSelection="true">
                    <!-- Chips will be added programmatically -->
                </com.google.android.material.chip.ChipGroup>
            </HorizontalScrollView>

            <!-- Loading Spinner -->
            <ProgressBar
                android:id="@+id/progressBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="40dp"
                android:visibility="visible"
                android:indeterminateTint="@color/colorPrimary" />

            <!-- Featured / Destaques -->
            <LinearLayout
                android:id="@+id/layoutFeatured"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone"
                android:layout_marginTop="24dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="24dp"
                    android:text="Destaques"
                    android:textColor="@color/colorTextPrimary"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:fontFamily="sans-serif" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvFeatured"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:clipToPadding="false"
                    android:paddingStart="24dp"
                    android:paddingEnd="8dp"
                    android:orientation="horizontal"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_restaurant_featured" />
            </LinearLayout>

            <!-- Melhor Avaliados -->
            <LinearLayout
                android:id="@+id/layoutTopRated"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone"
                android:layout_marginTop="32dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="24dp"
                    android:text="Melhor Avaliados"
                    android:textColor="@color/colorTextPrimary"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:fontFamily="sans-serif" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvTopRated"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:clipToPadding="false"
                    android:paddingStart="24dp"
                    android:paddingEnd="8dp"
                    android:orientation="horizontal"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_restaurant_featured" />
            </LinearLayout>

            <!-- Pizzas -->
            <LinearLayout
                android:id="@+id/layoutPizzas"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone"
                android:layout_marginTop="32dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="24dp"
                    android:text="Pizzas"
                    android:textColor="@color/colorTextPrimary"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:fontFamily="sans-serif" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvPizzas"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:clipToPadding="false"
                    android:paddingStart="24dp"
                    android:paddingEnd="8dp"
                    android:orientation="horizontal"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_restaurant_featured" />
            </LinearLayout>

            <!-- Sushi -->
            <LinearLayout
                android:id="@+id/layoutSushi"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone"
                android:layout_marginTop="32dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="24dp"
                    android:text="Sushi"
                    android:textColor="@color/colorTextPrimary"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:fontFamily="sans-serif" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvSushi"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:clipToPadding="false"
                    android:paddingStart="24dp"
                    android:paddingEnd="8dp"
                    android:orientation="horizontal"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_restaurant_featured" />
            </LinearLayout>

            <!-- Carnes -->
            <LinearLayout
                android:id="@+id/layoutCarnes"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone"
                android:layout_marginTop="32dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="24dp"
                    android:text="Carnes"
                    android:textColor="@color/colorTextPrimary"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:fontFamily="sans-serif" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvCarnes"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:clipToPadding="false"
                    android:paddingStart="24dp"
                    android:paddingEnd="8dp"
                    android:orientation="horizontal"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_restaurant_featured" />
            </LinearLayout>

            <!-- Massas -->
            <LinearLayout
                android:id="@+id/layoutMassas"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone"
                android:layout_marginTop="32dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="24dp"
                    android:text="Massas"
                    android:textColor="@color/colorTextPrimary"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:fontFamily="sans-serif" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvMassas"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:clipToPadding="false"
                    android:paddingStart="24dp"
                    android:paddingEnd="8dp"
                    android:orientation="horizontal"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_restaurant_featured" />
            </LinearLayout>

            <!-- Sobremesas -->
            <LinearLayout
                android:id="@+id/layoutSobremesas"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone"
                android:layout_marginTop="32dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="24dp"
                    android:text="Sobremesas"
                    android:textColor="@color/colorTextPrimary"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:fontFamily="sans-serif" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvSobremesas"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:clipToPadding="false"
                    android:paddingStart="24dp"
                    android:paddingEnd="8dp"
                    android:paddingBottom="16dp"
                    android:orientation="horizontal"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_restaurant_featured" />
            </LinearLayout>

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

    <!-- Bottom Navigation Bar -->
    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottomNavigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorSurface"
        app:itemIconTint="@color/colorPrimary"
        app:itemTextColor="@color/colorPrimary"
        app:menu="@menu/bottom_nav_menu"
        app:elevation="16dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
