<?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/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.cart.CartActivity">

    <include
        android:id="@+id/header"
        layout="@layout/header" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rvCart"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="#F5F5F5"
        app:layout_constraintBottom_toTopOf="@+id/bottomCheckoutLayout"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/header"/>

    <TextView
        android:id="@+id/tvWholesaleWarning"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#F44336"
        android:textSize="12sp"
        android:gravity="center"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@id/bottomCheckoutLayout" />

    <!-- Bottom Checkout Layout -->
    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/bottomCheckoutLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/white"
        android:elevation="8dp"
        android:padding="16dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <CheckBox
            android:id="@+id/cbSelectAll"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Semua"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/tvTotalLabel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Total: "
            android:visibility="gone"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toEndOf="@+id/cbSelectAll"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/tvTotalPrice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Rp0"
            android:textColor="@android:color/black"
            android:textSize="16sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toEndOf="@+id/tvTotalLabel"
            app:layout_constraintTop_toTopOf="parent" />



        <Button
            android:id="@+id/btnCheckout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_button_outline"
            android:paddingStart="24dp"
            android:paddingEnd="24dp"
            android:text="Beli (0)"
            android:textColor="@android:color/white"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <!-- Empty State View (Shown when cart is empty) -->
    <LinearLayout
        android:id="@+id/emptyStateLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:gravity="center"
        android:orientation="vertical"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@+id/bottomCheckoutLayout"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/header">

        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:src="@drawable/outline_shopping_cart_24" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="Keranjang Anda kosong"
            android:textColor="@android:color/black"
            android:textSize="18sp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:gravity="center"
            android:paddingStart="32dp"
            android:paddingEnd="32dp"
            android:text="Silakan tambahkan produk ke keranjang"
            android:textColor="#757575"
            android:textSize="14sp" />

        <Button
            android:id="@+id/btnShopNow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="24dp"
            android:background="@drawable/bg_button_outline"
            android:paddingStart="24dp"
            android:paddingEnd="24dp"
            android:text="Belanja Sekarang"
            android:textColor="@android:color/white" />

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>