<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <!-- Main row (always visible) -->
    <LinearLayout
        android:id="@+id/credentialRow"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:paddingVertical="12dp"
        android:paddingHorizontal="16dp"
        android:background="?attr/selectableItemBackground">

        <!-- Letter avatar -->
        <FrameLayout
            android:layout_width="40dp"
            android:layout_height="40dp">

            <View
                android:id="@+id/avatarBackground"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/bg_icon_circle" />

            <TextView
                android:id="@+id/avatarLetter"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:textSize="18sp"
                android:textStyle="bold"
                tools:text="G" />

        </FrameLayout>

        <!-- Text content -->
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_marginStart="12dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/rpIdText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:textColor="?android:attr/textColorPrimary"
                android:textSize="15sp"
                tools:text="github.com" />

            <TextView
                android:id="@+id/userText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:textColor="?android:attr/textColorSecondary"
                android:textSize="14sp"
                tools:text="johndoe" />

        </LinearLayout>

        <!-- Expand indicator -->
        <ImageView
            android:id="@+id/expandIcon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:src="@drawable/arrow_down_24"
            android:contentDescription="@null"
            android:alpha="0.5" />

    </LinearLayout>

    <!-- Expandable details -->
    <LinearLayout
        android:id="@+id/detailsContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingHorizontal="24dp"
        android:paddingTop="8dp"
        android:paddingBottom="12dp"
        android:background="?android:attr/colorBackgroundFloating"
        android:visibility="gone">

        <!-- Display Name -->
        <LinearLayout
            android:id="@+id/displayNameRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginBottom="8dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/credential_detail_display_name"
                android:textColor="?android:attr/textColorSecondary"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/displayNameValue"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="?android:attr/textColorPrimary"
                android:textSize="16sp"
                tools:text="John Doe" />

        </LinearLayout>

        <!-- Username -->
        <LinearLayout
            android:id="@+id/usernameRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginBottom="8dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/credential_detail_username"
                android:textColor="?android:attr/textColorSecondary"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/usernameValue"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="?android:attr/textColorPrimary"
                android:textSize="16sp"
                tools:text="johndoe" />

        </LinearLayout>

        <!-- User ID -->
        <LinearLayout
            android:id="@+id/userIdRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginBottom="8dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/credential_detail_user_id"
                android:textColor="?android:attr/textColorSecondary"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/userIdValue"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="monospace"
                android:textColor="?android:attr/textColorPrimary"
                android:textSize="12sp"
                android:textIsSelectable="true"
                tools:text="7f8e9d0c1b2a3f4e5d6c7b8a90123456" />

        </LinearLayout>

        <!-- Credential ID -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginBottom="8dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/credential_detail_credential_id"
                android:textColor="?android:attr/textColorSecondary"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/credentialIdValue"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="monospace"
                android:textColor="?android:attr/textColorPrimary"
                android:textSize="12sp"
                android:textIsSelectable="true"
                tools:text="a1b2c3d4e5f67890abcdef1234567890" />

        </LinearLayout>

        <!-- Protection -->
        <LinearLayout
            android:id="@+id/protectionRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginBottom="12dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/credential_detail_protection"
                android:textColor="?android:attr/textColorSecondary"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/protectionValue"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="?android:attr/textColorPrimary"
                android:textSize="16sp"
                tools:text="userVerificationRequired" />

        </LinearLayout>

        <!-- Delete button -->
        <com.google.android.material.button.MaterialButton
            android:id="@+id/deleteButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/credential_delete"
            android:textColor="@android:color/holo_red_dark"
            app:icon="@drawable/delete_24"
            app:iconTint="@android:color/holo_red_dark"
            app:iconPadding="8dp"
            app:iconGravity="textStart"
            style="@style/Widget.Material3.Button.TextButton" />

    </LinearLayout>

</LinearLayout>
