<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    android:background="@color/background_light">

    <!-- Header -->
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:paddingHorizontal="16dp"
        android:background="@color/white"
        android:elevation="4dp">

        <ImageButton
            android:id="@+id/btnBack"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_centerVertical="true"
            android:background="?attr/selectableItemBackgroundBorderless"
            android:src="@drawable/ic_back"
            app:tint="@color/text_secondary" />


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="@string/settings"
                            android:textColor="@color/text_primary"

            android:textSize="20sp"
            android:textStyle="bold" />
    </RelativeLayout>

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="20dp">

            <!-- Preferences Section -->
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/preferences"
                android:textColor="@color/text_secondary"

                android:textAllCaps="true"
                android:textSize="12sp"
                android:textStyle="bold"
                android:layout_marginBottom="8dp" />

            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardCornerRadius="16dp"
                app:cardElevation="0dp"
                android:backgroundTint="@color/white"
                android:layout_marginBottom="24dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                        
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/dark_mode"
                                            android:textColor="@color/text_primary"

                            android:textSize="16sp"
                            android:textStyle="bold" />

                        <com.google.android.material.switchmaterial.SwitchMaterial
                            android:id="@+id/switchDarkMode"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true" />
                    </RelativeLayout>
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <!-- Account Section -->
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/account"
                android:textColor="@color/text_secondary"

                android:textAllCaps="true"
                android:textSize="12sp"
                android:textStyle="bold"
                android:layout_marginBottom="8dp" />

            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardCornerRadius="16dp"
                app:cardElevation="0dp"
                android:backgroundTint="@color/white"
                android:layout_marginBottom="24dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <TextView
                        android:id="@+id/tvEmail"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="email@exemplo.com"
                                        android:textColor="@color/text_primary"

                        android:textSize="15sp"
                        android:textStyle="bold" />

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="@color/border_color"

                        android:layout_marginVertical="12dp" />

                    <TextView
                        android:id="@+id/btnChangePassword"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/change_password"
                        android:textColor="@color/primary_purple"

                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:clickable="true"
                        android:focusable="true" />
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <!-- Privacy Section -->
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/privacy"
                android:textColor="@color/text_secondary"

                android:textAllCaps="true"
                android:textSize="12sp"
                android:textStyle="bold"
                android:layout_marginBottom="8dp" />

            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardCornerRadius="16dp"
                app:cardElevation="0dp"
                android:backgroundTint="@color/white"
                android:layout_marginBottom="24dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/private_account"
                                            android:textColor="@color/text_primary"

                            android:textSize="16sp"
                            android:textStyle="bold" />

                        <com.google.android.material.switchmaterial.SwitchMaterial
                            android:id="@+id/switchPrivacy"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true" />
                    </RelativeLayout>
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <!-- Notifications Section -->
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/notifications"
                android:textColor="@color/text_secondary"

                android:textAllCaps="true"
                android:textSize="12sp"
                android:textStyle="bold"
                android:layout_marginBottom="8dp" />

            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardCornerRadius="16dp"
                app:cardElevation="0dp"
                android:backgroundTint="@color/white"
                android:layout_marginBottom="24dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/notifications"
                                            android:textColor="@color/text_primary"

                            android:textSize="16sp"
                            android:textStyle="bold" />

                        <com.google.android.material.switchmaterial.SwitchMaterial
                            android:id="@+id/switchNotifications"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true" />
                    </RelativeLayout>
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <!-- App Section -->
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/app_section"
                android:textColor="@color/text_secondary"

                android:textAllCaps="true"
                android:textSize="12sp"
                android:textStyle="bold"
                android:layout_marginBottom="8dp" />

            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardCornerRadius="16dp"
                app:cardElevation="0dp"
                android:backgroundTint="@color/white"
                android:layout_marginBottom="40dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/language"
                                            android:textColor="@color/text_primary"

                            android:textSize="16sp"
                            android:textStyle="bold" />

                        <Spinner
                            android:id="@+id/spinnerLanguage"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true"
                            android:textAlignment="viewEnd" />
                    </RelativeLayout>
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <!-- Logout Button -->
            <com.google.android.material.button.MaterialButton
                android:id="@+id/btnLogout"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:text="@string/logout"
                android:textColor="@color/error_red"
                android:textStyle="bold"
                app:backgroundTint="#FEE2E2"
                app:cornerRadius="16dp"
                app:elevation="0dp"
                app:icon="@drawable/ic_back"
                app:iconGravity="textStart"
                app:iconTint="@color/error_red"

                android:layout_marginBottom="20dp"/>

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

</LinearLayout>
