<?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:fitsSystemWindows="true"
    android:background="?attr/colorSurface">

    <!-- Material 3 Toolbar -->
    <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/settings"
        app:titleTextAppearance="@style/TextAppearance.Material3.TitleLarge"
        app:navigationIcon="?attr/homeAsUpIndicator" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:fillViewport="true">

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

            <!-- Material 3 Card: Server Configuration -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                style="@style/Widget.Material3.CardView.Elevated"
                app:cardCornerRadius="16dp">

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

                    <!-- Section Header -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/server_settings"
                        android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
                        android:layout_marginBottom="16dp" />

                    <!-- Protocol Selection -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/server_connection_type"
                        android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                        android:layout_marginBottom="8dp" />

                    <RadioGroup
                        android:id="@+id/protocolRadioGroup"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:layout_marginBottom="16dp">

                        <com.google.android.material.radiobutton.MaterialRadioButton
                            android:id="@+id/radioHttp"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="@string/server_connection_http"
                            android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
                            android:checked="false" />

                        <com.google.android.material.radiobutton.MaterialRadioButton
                            android:id="@+id/radioHttps"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="@string/server_connection_https"
                            android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
                            android:checked="true" />

                    </RadioGroup>

                    <!-- Helper Text for Protocol Selection -->
                    <TextView
                        android:id="@+id/protocolHintText"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/server_connection_http_hint"
                        android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                        android:textColor="?attr/colorOnSurfaceVariant"
                        android:layout_marginBottom="16dp"
                        android:paddingStart="4dp"
                        android:paddingEnd="4dp" />

                    <!-- Server URL with Icon -->
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/textInputLayoutServerUrl"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:hint="@string/server_address"
                        android:layout_marginBottom="12dp"
                        style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                        app:startIconDrawable="@android:drawable/ic_menu_compass"
                        app:endIconMode="clear_text"
                        app:helperText="@string/server_address_hint"
                        app:helperTextEnabled="true"
                        app:boxCornerRadiusTopStart="12dp"
                        app:boxCornerRadiusTopEnd="12dp"
                        app:boxCornerRadiusBottomStart="12dp"
                        app:boxCornerRadiusBottomEnd="12dp">

                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/editTextServerUrl"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:inputType="textUri"
                            android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

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

                    <!-- Username with Icon -->
                    <com.google.android.material.textfield.TextInputLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:hint="@string/username"
                        android:layout_marginBottom="12dp"
                        style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                        app:startIconDrawable="@android:drawable/ic_menu_myplaces"
                        app:endIconMode="clear_text"
                        app:boxCornerRadiusTopStart="12dp"
                        app:boxCornerRadiusTopEnd="12dp"
                        app:boxCornerRadiusBottomStart="12dp"
                        app:boxCornerRadiusBottomEnd="12dp">

                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/editTextUsername"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:inputType="text"
                            android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

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

                    <!-- Password with Icon -->
                    <com.google.android.material.textfield.TextInputLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:hint="@string/password"
                        style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                        app:startIconDrawable="@android:drawable/ic_lock_lock"
                        app:endIconMode="password_toggle"
                        app:boxCornerRadiusTopStart="12dp"
                        app:boxCornerRadiusTopEnd="12dp"
                        app:boxCornerRadiusBottomStart="12dp"
                        app:boxCornerRadiusBottomEnd="12dp">

                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/editTextPassword"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:inputType="textPassword"
                            android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

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

                    <!-- Server Status Chip -->
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:orientation="horizontal"
                        android:gravity="center_vertical">

                        <TextView
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="@string/server_status_label"
                            android:textAppearance="@style/TextAppearance.Material3.LabelLarge" />

                        <TextView
                            android:id="@+id/textViewServerStatus"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/server_status_checking"
                            android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
                            android:textColor="?attr/colorOutline" />

                    </LinearLayout>

                    <!-- Action Buttons -->
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:orientation="horizontal"
                        android:gravity="end">

                        <Button
                            android:id="@+id/buttonTestConnection"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/test_connection"
                            android:layout_marginEnd="8dp"
                            style="@style/Widget.Material3.Button.OutlinedButton" />

                        <Button
                            android:id="@+id/buttonSyncNow"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/sync_now"
                            style="@style/Widget.Material3.Button" />

                    </LinearLayout>

                </LinearLayout>

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

            <!-- Material 3 Card: Synchronisation Settings (Auto-Sync + Interval) -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                style="@style/Widget.Material3.CardView.Elevated"
                app:cardCornerRadius="16dp">

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

                    <!-- Section Header -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/sync_settings"
                        android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
                        android:layout_marginBottom="12dp" />

                    <!-- Info Card -->
                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        app:cardBackgroundColor="?attr/colorSurfaceVariant"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:padding="16dp"
                            android:text="@string/auto_sync_info"
                            android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                            android:lineSpacingMultiplier="1.3" />

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

                    <!-- Auto-Sync Switch with MaterialSwitch -->
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        android:orientation="horizontal"
                        android:gravity="center_vertical">

                        <TextView
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="@string/auto_sync"
                            android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />

                        <androidx.appcompat.widget.SwitchCompat
                            android:id="@+id/switchAutoSync"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                    <!-- Divider -->
                    <View
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:layout_marginVertical="16dp"
                        android:background="?attr/colorOutlineVariant" />

                    <!-- Sync Interval Section -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/sync_interval_section"
                        android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                        android:layout_marginBottom="12dp" />

                    <!-- Interval Info Card -->
                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        app:cardBackgroundColor="?attr/colorSurfaceVariant"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:padding="16dp"
                            android:text="@string/sync_interval_info"
                            android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                            android:lineSpacingMultiplier="1.3" />

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

                    <!-- Sync Interval Radio Group -->
                    <RadioGroup
                        android:id="@+id/radioGroupSyncInterval"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">

                        <!-- 15 Minutes Option -->
                        <RadioButton
                            android:id="@+id/radioInterval15"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="@string/sync_interval_15min_title"
                            android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
                            android:paddingVertical="8dp" />

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="@string/sync_interval_15min_subtitle"
                            android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                            android:textColor="?attr/colorOutline"
                            android:paddingStart="48dp"
                            android:paddingBottom="12dp" />

                        <!-- 30 Minutes Option (Recommended) -->
                        <RadioButton
                            android:id="@+id/radioInterval30"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="@string/sync_interval_30min_title"
                            android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
                            android:paddingVertical="8dp" />

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="@string/sync_interval_30min_subtitle"
                            android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                            android:textColor="?attr/colorOutline"
                            android:paddingStart="48dp"
                            android:paddingBottom="12dp" />

                        <!-- 60 Minutes Option -->
                        <RadioButton
                            android:id="@+id/radioInterval60"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="@string/sync_interval_60min_title"
                            android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
                            android:paddingVertical="8dp" />

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="@string/sync_interval_60min_subtitle"
                            android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                            android:textColor="?attr/colorOutline"
                            android:paddingStart="48dp" />

                    </RadioGroup>

                </LinearLayout>

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

            <!-- Material 3 Card: Markdown Desktop-Integration (v1.2.0) -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                style="@style/Widget.Material3.CardView.Elevated"
                app:cardCornerRadius="16dp">

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

                    <!-- Section Header -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/settings_markdown"
                        android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
                        android:layout_marginBottom="12dp" />

                    <!-- Info Card -->
                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        app:cardBackgroundColor="?attr/colorPrimaryContainer"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:padding="16dp"
                            android:text="@string/markdown_info"
                            android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                            android:textColor="?attr/colorOnPrimaryContainer"
                            android:lineSpacingMultiplier="1.3" />

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

                    <!-- Markdown Auto-Sync Toggle (fusioniert Export + Auto-Import) -->
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="8dp"
                        android:orientation="horizontal"
                        android:gravity="center_vertical">

                        <TextView
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="@string/markdown_auto_sync_title"
                            android:textAppearance="@style/TextAppearance.Material3.BodyLarge" />

                        <androidx.appcompat.widget.SwitchCompat
                            android:id="@+id/switchMarkdownAutoSync"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:checked="false" />

                    </LinearLayout>

                    <!-- Auto-Sync Info Text -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        android:text="@string/markdown_auto_sync_subtitle"
                        android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                        android:textColor="?attr/colorOnSurfaceVariant" />

                    <!-- Manual Sync Info (nur sichtbar wenn Auto-Sync OFF) -->
                    <TextView
                        android:id="@+id/textViewManualSyncInfo"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:layout_marginBottom="8dp"
                        android:text="@string/settings_markdown_manual_hint"
                        android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
                        android:textColor="?attr/colorOnSurface"
                        android:visibility="gone" />

                    <!-- Manual Sync Button (nur sichtbar wenn Auto-Sync OFF) -->
                    <Button
                        android:id="@+id/buttonManualMarkdownSync"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/settings_markdown_manual_button"
                        android:visibility="gone"
                        style="@style/Widget.Material3.Button.TonalButton" />

                </LinearLayout>

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

            <!-- Material 3 Card: Backup & Restore -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                style="@style/Widget.Material3.CardView.Elevated"
                app:cardCornerRadius="16dp">

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

                    <!-- Section Header -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/backup_restore_title"
                        android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
                        android:layout_marginBottom="12dp" />

                    <!-- Info Card (anstatt Warning) -->
                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        app:cardBackgroundColor="?attr/colorPrimaryContainer"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:padding="16dp"
                            android:text="@string/settings_backup_info"
                            android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                            android:textColor="?attr/colorOnPrimaryContainer"
                            android:lineSpacingMultiplier="1.3" />

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

                    <!-- Lokales Backup Sektion -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/settings_backup_local_title"
                        android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                        android:layout_marginBottom="12dp" />

                    <!-- Backup erstellen Button -->
                    <Button
                        android:id="@+id/buttonCreateBackup"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/backup_create"
                        android:layout_marginBottom="8dp"
                        style="@style/Widget.Material3.Button.TonalButton" />

                    <!-- Aus Datei wiederherstellen Button -->
                    <Button
                        android:id="@+id/buttonRestoreFromFile"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/backup_restore_file"
                        android:layout_marginBottom="16dp"
                        style="@style/Widget.Material3.Button.TonalButton" />

                    <!-- Divider -->
                    <View
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="?attr/colorOutline"
                        android:layout_marginTop="8dp"
                        android:layout_marginBottom="16dp" />

                    <!-- Server-Backup Sektion -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/settings_backup_server_title"
                        android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                        android:layout_marginBottom="12dp" />

                    <!-- Vom Server wiederherstellen Button -->
                    <Button
                        android:id="@+id/buttonRestoreFromServer"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/backup_restore_server"
                        style="@style/Widget.Material3.Button.TonalButton" />

                </LinearLayout>

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

            <!-- Material 3 Card: About Section -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                style="@style/Widget.Material3.CardView.Elevated"
                app:cardCornerRadius="16dp">

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

                    <!-- Section Header -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/settings_about"
                        android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
                        android:layout_marginBottom="16dp" />

                    <!-- App Info Card -->
                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="12dp"
                        app:cardBackgroundColor="?attr/colorSurfaceVariant"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

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

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/settings_about_app_version"
                                android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                                android:textColor="?attr/colorPrimary"
                                android:layout_marginBottom="4dp" />

                            <TextView
                                android:id="@+id/textViewAppVersion"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/settings_about_app_version_loading"
                                android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

                        </LinearLayout>

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

                    <!-- GitHub Repository Card -->
                    <com.google.android.material.card.MaterialCardView
                        android:id="@+id/cardGitHubRepo"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="12dp"
                        android:clickable="true"
                        android:focusable="true"
                        app:cardBackgroundColor="?attr/colorSurfaceVariant"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

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

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/settings_about_github"
                                android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                                android:textColor="?attr/colorPrimary"
                                android:layout_marginBottom="4dp" />

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/about_github_subtitle"
                                android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

                        </LinearLayout>

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

                    <!-- Developer Profile Card -->
                    <com.google.android.material.card.MaterialCardView
                        android:id="@+id/cardDeveloperProfile"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="12dp"
                        android:clickable="true"
                        android:focusable="true"
                        app:cardBackgroundColor="?attr/colorSurfaceVariant"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

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

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/settings_about_developer"
                                android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                                android:textColor="?attr/colorPrimary"
                                android:layout_marginBottom="4dp" />

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/about_developer_subtitle"
                                android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

                        </LinearLayout>

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

                    <!-- License Card -->
                    <com.google.android.material.card.MaterialCardView
                        android:id="@+id/cardLicense"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:clickable="true"
                        android:focusable="true"
                        app:cardBackgroundColor="?attr/colorSurfaceVariant"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

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

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/settings_about_license"
                                android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                                android:textColor="?attr/colorPrimary"
                                android:layout_marginBottom="4dp" />

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/about_license_subtitle"
                                android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

                        </LinearLayout>

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

                </LinearLayout>

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

            <!-- Material 3 Card: Debug Section -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                style="@style/Widget.Material3.CardView.Elevated"
                app:cardCornerRadius="16dp">

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

                    <!-- Section Header -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/settings_debug"
                        android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
                        android:layout_marginBottom="16dp" />

                    <!-- File Logging Toggle -->
                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="12dp"
                        app:cardBackgroundColor="?attr/colorSurfaceVariant"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

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

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

                                <TextView
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:text="@string/settings_debug_file_logging"
                                    android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
                                    android:textColor="?attr/colorPrimary"
                                    android:layout_marginBottom="4dp" />

                                <TextView
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:text="@string/settings_debug_file_logging_desc"
                                    android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

                            </LinearLayout>

                            <com.google.android.material.materialswitch.MaterialSwitch
                                android:id="@+id/switchFileLogging"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content" />

                        </LinearLayout>

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

                    <!-- F-Droid Privacy Notice -->
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/file_logging_privacy_notice"
                        android:textAppearance="@style/TextAppearance.Material3.BodySmall"
                        android:textColor="?attr/colorOnSurfaceVariant"
                        android:layout_marginBottom="16dp"
                        android:paddingStart="4dp"
                        android:paddingEnd="4dp" />

                    <!-- Export Logs Button -->
                    <Button
                        android:id="@+id/buttonExportLogs"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/settings_debug_export_logs"
                        style="@style/Widget.Material3.Button.TonalButton"
                        android:layout_marginBottom="8dp" />

                    <!-- Clear Logs Button -->
                    <Button
                        android:id="@+id/buttonClearLogs"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/settings_debug_delete_logs"
                        style="@style/Widget.Material3.Button.OutlinedButton" />

                </LinearLayout>

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

        </LinearLayout>

    </ScrollView>

</LinearLayout>
