<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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/background">

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

        <!-- Cabeçalho -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="20dp"
            android:gravity="center_vertical">

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="Finzora"
                android:textSize="24sp"
                android:textStyle="bold"
                android:textColor="@color/primary" />

            <ImageButton
                android:id="@+id/btnMenu"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:src="@drawable/ic_menu"
                android:background="?attr/selectableItemBackground" />

        </LinearLayout>

        <!-- Cards de Resumo -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="16dp"
            android:gravity="center">

            <!-- Saldo Total -->
            <androidx.cardview.widget.CardView
                android:id="@+id/cardBalance"
                android:layout_width="0dp"
                android:layout_height="120dp"
                android:layout_weight="1"
                app:cardCornerRadius="16dp"
                app:cardElevation="4dp"
                app:cardUseCompatPadding="true"
                android:layout_margin="8dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical"
                    android:gravity="center"
                    android:background="@drawable/gradient_primary">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Saldo Total"
                        android:textColor="@color/white"
                        android:textSize="14sp"
                        android:layout_marginBottom="8dp" />

                    <TextView
                        android:id="@+id/tvBalance"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="€0.00"
                        android:textColor="@color/white"
                        android:textSize="28sp"
                        android:textStyle="bold" />

                </LinearLayout>

            </androidx.cardview.widget.CardView>

        </LinearLayout>

        <!-- Receitas e Despesas -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingHorizontal="16dp">

            <!-- Receitas -->
            <androidx.cardview.widget.CardView
                android:id="@+id/cardIncome"
                android:layout_width="0dp"
                android:layout_height="100dp"
                android:layout_weight="1"
                app:cardCornerRadius="12dp"
                app:cardElevation="2dp"
                android:layout_margin="8dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical"
                    android:gravity="center">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Receitas"
                        android:textColor="@color/text_secondary"
                        android:textSize="14sp"
                        android:layout_marginBottom="8dp" />

                    <TextView
                        android:id="@+id/tvIncome"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="+€0.00"
                        android:textColor="@color/green"
                        android:textSize="20sp"
                        android:textStyle="bold" />

                </LinearLayout>

            </androidx.cardview.widget.CardView>

            <!-- Despesas -->
            <androidx.cardview.widget.CardView
                android:id="@+id/cardExpense"
                android:layout_width="0dp"
                android:layout_height="100dp"
                android:layout_weight="1"
                app:cardCornerRadius="12dp"
                app:cardElevation="2dp"
                android:layout_margin="8dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical"
                    android:gravity="center">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Despesas"
                        android:textColor="@color/text_secondary"
                        android:textSize="14sp"
                        android:layout_marginBottom="8dp" />

                    <TextView
                        android:id="@+id/tvExpense"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="-€0.00"
                        android:textColor="@color/red"
                        android:textSize="20sp"
                        android:textStyle="bold" />

                </LinearLayout>

            </androidx.cardview.widget.CardView>

        </LinearLayout>

        <!-- Título das Transações -->
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Transações Recentes"
            android:textSize="18sp"
            android:textStyle="bold"
            android:textColor="@color/text_primary"
            android:layout_marginStart="24dp"
            android:layout_marginTop="32dp"
            android:layout_marginBottom="16dp" />

        <!-- Lista de Transações -->
        <LinearLayout
            android:id="@+id/layoutTransactions"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingHorizontal="16dp" />

        <!-- Espaço para o botão flutuante -->
        <View
            android:layout_width="match_parent"
            android:layout_height="80dp" />

    </LinearLayout>

    <!-- Botão Flutuante para Adicionar Transação -->
    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/btnAddTransaction"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="24dp"
        android:src="@drawable/ic_add"
        app:backgroundTint="@color/primary"
        app:tint="@color/white" />

</ScrollView>