<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/bg_dark"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingStart="16dp"
        android:paddingEnd="16dp"
        android:paddingTop="20dp"
        android:paddingBottom="24dp">

        <!-- Header -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="NACHRICHTENTYP"
            style="@style/JrzSectionLabel"
            android:layout_marginBottom="10dp" />

        <!-- Type Chips -->
        <com.google.android.material.chip.ChipGroup
            android:id="@+id/chipGroupType"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="20dp"
            app:selectionRequired="true"
            app:singleSelection="true">

            <com.google.android.material.chip.Chip
                android:id="@+id/chipText"
                style="@style/Widget.Material3.Chip.Filter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Text (de)"
                android:checked="true"
                app:checkedIconVisible="false" />

            <com.google.android.material.chip.Chip
                android:id="@+id/chipUrl"
                style="@style/Widget.Material3.Chip.Filter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="URL"
                app:checkedIconVisible="false" />

            <com.google.android.material.chip.Chip
                android:id="@+id/chipHex"
                style="@style/Widget.Material3.Chip.Filter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Roh-Hex"
                app:checkedIconVisible="false" />

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

        <!-- Input Card -->
        <com.google.android.material.card.MaterialCardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            app:cardBackgroundColor="@color/card_dark"
            app:cardCornerRadius="12dp"
            app:strokeColor="@color/divider"
            app:strokeWidth="1dp">

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

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/tilContent"
                    style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/write_content_hint"
                    app:boxStrokeColor="@color/accent_cyan_alpha20"
                    app:hintTextColor="@color/text_secondary">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/etContent"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:minLines="3"
                        android:gravity="top"
                        android:textColor="@color/text_primary"
                        android:inputType="textMultiLine" />

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

                <TextView
                    android:id="@+id/tvByteCount"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="6dp"
                    android:text="0 Bytes"
                    android:textColor="@color/text_secondary"
                    android:textSize="12sp"
                    android:fontFamily="monospace" />

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

        <!-- Write Button -->
        <com.google.android.material.button.MaterialButton
            android:id="@+id/btnWrite"
            android:layout_width="match_parent"
            android:layout_height="52dp"
            android:layout_marginTop="8dp"
            android:text="@string/write_btn"
            android:textColor="@color/bg_dark"
            android:textStyle="bold"
            android:letterSpacing="0.08"
            app:backgroundTint="@color/accent_cyan"
            app:cornerRadius="12dp" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/btnCancelWrite"
            style="@style/Widget.Material3.Button.OutlinedButton"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_marginTop="8dp"
            android:text="@string/write_cancel_btn"
            android:textColor="@color/text_secondary"
            android:visibility="gone"
            app:strokeColor="@color/divider"
            app:cornerRadius="12dp" />

        <!-- Status Card -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/writeStatusCard"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:visibility="gone"
            app:cardBackgroundColor="@color/card_dark"
            app:cardCornerRadius="12dp"
            app:strokeColor="@color/accent_cyan_alpha20"
            app:strokeWidth="1dp">

            <TextView
                android:id="@+id/tvWriteStatus"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="16dp"
                android:textAlignment="center"
                android:textColor="@color/text_primary"
                android:textSize="14sp" />

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

        <!-- Warning Card -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cardFormatWarning"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="12dp"
            android:visibility="gone"
            app:cardBackgroundColor="@color/warning_alpha20"
            app:cardCornerRadius="12dp"
            app:strokeColor="@color/warning_orange"
            app:strokeWidth="1dp">

            <TextView
                android:id="@+id/tvFormatWarning"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="14dp"
                android:textColor="@color/warning_orange"
                android:textSize="13sp" />

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

    </LinearLayout>
</ScrollView>
