<?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:theme="@style/Theme.Recordatorios">

    <ImageView
        android:id="@+id/ivBackground"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:visibility="gone" />

    <View
        android:id="@+id/backgroundScrim"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

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

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:background="?attr/colorPrimaryContainer"
            app:tabTextColor="?attr/colorOnPrimaryContainer"
            app:tabSelectedTextColor="?attr/colorOnPrimaryContainer"
            app:tabIndicatorColor="?attr/colorOnPrimaryContainer"
            app:tabIndicatorHeight="2dp"
            app:tabIconTint="?attr/colorOnPrimaryContainer"
            app:tabMode="fixed">

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:icon="@drawable/ic_sun" />

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:icon="@drawable/ic_clock" />

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:icon="@drawable/ic_calendar" />

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:icon="@drawable/ic_trash" />

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:icon="@drawable/ic_settings" />

        </com.google.android.material.tabs.TabLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:layout_marginHorizontal="12dp"
            android:layout_marginTop="1dp"
            android:layout_marginBottom="1dp">

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/searchLayout"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:hint="Buscar..."
                app:endIconMode="clear_text"
                app:endIconDrawable="@android:drawable/ic_menu_close_clear_cancel"
                app:startIconDrawable="@android:drawable/ic_menu_search">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/etSearch"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="text"
                    android:maxLines="1"
                    android:imeOptions="actionSearch" />

            </com.google.android.material.textfield.TextInputLayout>

            <ImageButton
                android:id="@+id/btnFilter"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_marginStart="4dp"
                android:src="@drawable/ic_filter"
                android:contentDescription="Filtro avanzado"
                android:background="?attr/selectableItemBackgroundBorderless"
                android:scaleType="centerInside"
                android:tint="?attr/colorOnSurface"
                android:visibility="gone" />

        </LinearLayout>

        <com.google.android.material.chip.ChipGroup
            android:id="@+id/chipGroupFilter"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="12dp"
            android:layout_marginBottom="1dp"
            app:singleSelection="false"
            app:selectionRequired="false"
            app:chipSpacing="4dp"
            android:visibility="gone" />

        <FrameLayout
            android:id="@+id/contentContainer"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recyclerView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false"
                android:padding="8dp" />

            <TextView
                android:id="@+id/emptyView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:gravity="center"
                android:text="@string/no_notes"
                android:textSize="16sp"
                android:textColor="?attr/colorOnSurfaceVariant"
                android:visibility="gone" />

            <LinearLayout
                android:id="@+id/calendarContainer"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:visibility="gone"
                android:padding="8dp">

                <LinearLayout
                    android:id="@+id/calendarContent"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">

                <TextView
                    android:id="@+id/textMonthYear"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:textSize="18sp"
                    android:textStyle="bold"
                    android:textColor="?attr/colorOnSurface"
                    android:paddingVertical="8dp" />

                <LinearLayout
                    android:id="@+id/calendarDayNames"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:orientation="horizontal" />

                <GridLayout
                    android:id="@+id/calendarDaysGrid"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:columnCount="7" />

                <TextView
                    android:id="@+id/labelMonthNotes"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:layout_marginHorizontal="8dp"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    android:textColor="?attr/colorOnSurface" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/monthNotesList"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:clipToPadding="false"
                    android:padding="4dp" />

                </LinearLayout>

            </LinearLayout>

            <LinearLayout
                android:id="@+id/settingsContainer"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:visibility="gone"
                android:padding="16dp">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/settings"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:textColor="?attr/colorOnSurface"
                    android:layout_marginBottom="24dp" />

                <ScrollView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:fillViewport="true">

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

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:cardCornerRadius="12dp"
                    app:cardElevation="2dp">

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

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/biometric_title"
                                android:textSize="16sp"
                                android:textColor="?attr/colorOnSurface" />

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/biometric_summary"
                                android:textSize="12sp"
                                android:textColor="?attr/colorOnSurfaceVariant"
                                android:layout_marginTop="4dp" />

                        </LinearLayout>

                        <com.google.android.material.switchmaterial.SwitchMaterial
                            android:id="@+id/switchBiometric"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    app:cardCornerRadius="12dp"
                    app:cardElevation="2dp">

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

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/theme_title"
                            android:textSize="16sp"
                            android:textColor="?attr/colorOnSurface" />

                        <com.google.android.material.chip.ChipGroup
                            android:id="@+id/chipGroupTheme"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="12dp"
                            app:singleSelection="true"
                            app:selectionRequired="true"
                            app:chipSpacing="8dp">

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipThemeSystem"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/theme_system"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipThemeLight"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/theme_light"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipThemeDark"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/theme_dark"
                                android:checkable="true" />

                        </com.google.android.material.chip.ChipGroup>

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    app:cardCornerRadius="12dp"
                    app:cardElevation="2dp">

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

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/background_title"
                            android:textSize="16sp"
                            android:textColor="?attr/colorOnSurface" />

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal"
                            android:layout_marginTop="12dp"
                            android:gravity="center_vertical">

                            <com.google.android.material.button.MaterialButton
                                android:id="@+id/btnPickBackground"
                                style="@style/Widget.Material3.Button.TextButton"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="@string/background_pick"
                                android:icon="@android:drawable/ic_menu_gallery" />

                            <com.google.android.material.button.MaterialButton
                                android:id="@+id/btnRemoveBackground"
                                style="@style/Widget.Material3.Button.TextButton"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="@string/background_remove"
                                android:icon="@drawable/ic_trash"
                                android:textColor="?attr/colorError"
                                app:iconTint="?attr/colorError" />

                        </LinearLayout>

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    app:cardCornerRadius="12dp"
                    app:cardElevation="2dp">

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

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/notif_image_title"
                                android:textSize="16sp"
                                android:textColor="?attr/colorOnSurface" />

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/notif_image_summary"
                                android:textSize="12sp"
                                android:textColor="?attr/colorOnSurfaceVariant"
                                android:layout_marginTop="4dp" />

                        </LinearLayout>

                        <com.google.android.material.switchmaterial.SwitchMaterial
                            android:id="@+id/switchNotifImage"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    app:cardCornerRadius="12dp"
                    app:cardElevation="2dp">

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

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/snooze_title"
                            android:textSize="16sp"
                            android:textColor="?attr/colorOnSurface" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/snooze_summary"
                            android:textSize="12sp"
                            android:textColor="?attr/colorOnSurfaceVariant"
                            android:layout_marginTop="4dp" />

                        <com.google.android.material.chip.ChipGroup
                            android:id="@+id/chipGroupSnooze"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="12dp"
                            app:singleSelection="true"
                            app:selectionRequired="true"
                            app:chipSpacing="8dp">

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipSnooze10Min"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/snooze_10min"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipSnooze30Min"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/snooze_30min"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipSnooze1Hour"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/snooze_1hour"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipSnooze2Hours"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/snooze_2hours"
                                android:checkable="true" />

                        </com.google.android.material.chip.ChipGroup>

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    app:cardCornerRadius="12dp"
                    app:cardElevation="2dp">

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

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/trash_title"
                            android:textSize="16sp"
                            android:textColor="?attr/colorOnSurface" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/trash_auto_clean"
                            android:textSize="12sp"
                            android:textColor="?attr/colorOnSurfaceVariant"
                            android:layout_marginTop="4dp" />

                        <com.google.android.material.chip.ChipGroup
                            android:id="@+id/chipGroupTrash"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="12dp"
                            app:singleSelection="true"
                            app:selectionRequired="true"
                            app:chipSpacing="8dp">

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipTrashOff"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/trash_disabled"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipTrash1Day"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/trash_1day"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipTrash3Days"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/trash_3days"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipTrash7Days"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/trash_7days"
                                android:checkable="true" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/chipTrash30Days"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/trash_30days"
                                android:checkable="true" />

                        </com.google.android.material.chip.ChipGroup>

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    app:cardCornerRadius="12dp"
                    app:cardElevation="2dp">

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

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Ayuda"
                            android:textSize="16sp"
                            android:textColor="?attr/colorOnSurface" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Guía de uso de la aplicación"
                            android:textSize="12sp"
                            android:textColor="?attr/colorOnSurfaceVariant"
                            android:layout_marginTop="4dp" />

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/btnHelpGuide"
                            style="@style/Widget.Material3.Button.TextButton"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="12dp"
                            android:text="Ver guía de uso"
                            android:icon="@android:drawable/ic_menu_help" />

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:layout_marginBottom="12dp"
                    app:cardCornerRadius="12dp"
                    app:cardElevation="2dp">

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

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Datos"
                            android:textSize="16sp"
                            android:textColor="?attr/colorOnSurface" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Exportar o importar notas y categorías"
                            android:textSize="12sp"
                            android:textColor="?attr/colorOnSurfaceVariant"
                            android:layout_marginTop="4dp" />

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal"
                            android:layout_marginTop="12dp"
                            android:gravity="center_vertical">

                            <com.google.android.material.button.MaterialButton
                                android:id="@+id/btnExport"
                                style="@style/Widget.Material3.Button.TextButton"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Exportar"
                                android:icon="@android:drawable/ic_menu_save" />

                            <com.google.android.material.button.MaterialButton
                                android:id="@+id/btnImport"
                                style="@style/Widget.Material3.Button.TextButton"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Importar"
                                android:icon="@android:drawable/ic_menu_upload" />

                        </LinearLayout>

                    </LinearLayout>

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

                        </LinearLayout>

                </ScrollView>

            </LinearLayout>

        </FrameLayout>

    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="1dp"
        android:orientation="horizontal"
        android:gravity="center_vertical">

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/btnVoiceAdd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="12dp"
            android:contentDescription="Agregar nota por voz"
            android:src="@drawable/ic_mic"
            app:tint="?attr/colorOnSecondaryContainer"
            app:backgroundTint="?attr/colorSecondaryContainer"
            app:fabSize="mini" />

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/btnAdd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/add_note"
            android:src="@android:drawable/ic_input_add"
            app:tint="?attr/colorOnSecondaryContainer"
            app:backgroundTint="?attr/colorSecondaryContainer" />

    </LinearLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
