<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    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="?attr/colorSurface"
    android:fitsSystemWindows="true">

    <!-- Material 3: AppBarLayout ohne Elevation für bessere Material You Integration -->
    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:elevation="0dp"
        android:background="?attr/colorSurface">

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:elevation="0dp"
            app:title="@string/app_name"
            app:titleTextAppearance="@style/TextAppearance.Material3.TitleLarge" />

        <!-- 🔄 v1.3.1: Sync Status Banner -->
        <LinearLayout
            android:id="@+id/syncStatusBanner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:paddingHorizontal="16dp"
            android:paddingVertical="8dp"
            android:background="?attr/colorPrimaryContainer"
            android:visibility="gone">

            <com.google.android.material.progressindicator.CircularProgressIndicator
                android:id="@+id/syncProgressIndicator"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:indeterminate="true"
                app:indicatorSize="24dp"
                app:trackThickness="3dp"
                app:indicatorColor="?attr/colorOnPrimaryContainer" />

            <TextView
                android:id="@+id/syncStatusText"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginStart="12dp"
                android:text="@string/sync_status_syncing"
                android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
                android:textColor="?attr/colorOnPrimaryContainer" />

        </LinearLayout>

    </com.google.android.material.appbar.AppBarLayout>

    <!-- SwipeRefreshLayout für Pull-to-Refresh (v1.1.2) -->
    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipeRefreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <!-- RecyclerView mit größerem Padding für Material 3 -->
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerViewNotes"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            android:padding="16dp" />

    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

    <!-- Material 3 Empty State Card -->
    <com.google.android.material.card.MaterialCardView
        android:id="@+id/emptyStateCard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginStart="32dp"
        android:layout_marginEnd="32dp"
        android:visibility="gone"
        app:cardElevation="0dp"
        app:cardCornerRadius="16dp"
        style="@style/Widget.Material3.CardView.Filled">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="32dp"
            android:gravity="center">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/empty_state_emoji"
                android:textSize="64sp"
                android:layout_marginBottom="16dp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/empty_state_title"
                android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall"
                android:layout_marginBottom="8dp"
                android:gravity="center" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/empty_state_message"
                android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
                android:textColor="?attr/colorOnSurfaceVariant"
                android:gravity="center" />

        </LinearLayout>

    </com.google.android.material.card.MaterialCardView>

    <!-- Material 3: Extended FAB (wird später mit Text erweitert in Task 11) -->
    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fabAddNote"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="16dp"
        android:contentDescription="@string/add_note"
        app:srcCompat="@android:drawable/ic_input_add"
        app:shapeAppearanceOverlay="@style/ShapeAppearance.Material3.Corner.Large" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
