<?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/background"
    android:padding="16dp">

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

        <!-- Header -->
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/dashboard_title"
            android:textColor="@color/terminal_green"
            android:textSize="24sp"
            android:textStyle="bold"
            android:fontFamily="monospace"
            android:layout_marginBottom="16dp" />

        <!-- Server Discovery Section -->
        <com.google.android.material.card.MaterialCardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="12dp"
            app:cardBackgroundColor="@color/surface"
            app:cardCornerRadius="8dp"
            app:strokeColor="@color/terminal_green"
            app:strokeWidth="1dp">

            <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/server_discovery"
                    android:textColor="@color/terminal_green"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:fontFamily="monospace"
                    android:layout_marginBottom="12dp" />

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

                    <View
                        android:id="@+id/discovery_status_dot"
                        android:layout_width="10dp"
                        android:layout_height="10dp"
                        android:background="@color/status_offline"
                        android:layout_marginEnd="8dp" />

                    <TextView
                        android:id="@+id/discovery_status_text"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="@string/discovery_idle"
                        android:textColor="@color/text_primary"
                        android:fontFamily="monospace"
                        android:textSize="14sp" />
                </LinearLayout>

                <TextView
                    android:id="@+id/discovery_method_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/discovery_methods"
                    android:textColor="@color/text_secondary"
                    android:fontFamily="monospace"
                    android:textSize="12sp"
                    android:layout_marginBottom="8dp" />

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/btn_discover"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/scan_network"
                    android:textColor="@color/background"
                    android:fontFamily="monospace"
                    app:backgroundTint="@color/terminal_green"
                    app:cornerRadius="4dp" />

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

        <!-- Connection Status -->
        <com.google.android.material.card.MaterialCardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="12dp"
            app:cardBackgroundColor="@color/surface"
            app:cardCornerRadius="8dp"
            app:strokeColor="@color/terminal_green_dim"
            app:strokeWidth="1dp">

            <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="Connection Status"
                    android:textColor="@color/terminal_green"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:fontFamily="monospace"
                    android:layout_marginBottom="12dp" />

                <!-- Privilege -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="center_vertical"
                    android:layout_marginBottom="8dp">

                    <View
                        android:id="@+id/privilege_status_dot"
                        android:layout_width="10dp"
                        android:layout_height="10dp"
                        android:background="@color/status_offline"
                        android:layout_marginEnd="8dp" />

                    <TextView
                        android:id="@+id/privilege_status_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Privilege: checking..."
                        android:textColor="@color/text_secondary"
                        android:fontFamily="monospace"
                        android:textSize="13sp" />
                </LinearLayout>

                <!-- Server -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="center_vertical"
                    android:layout_marginBottom="8dp">

                    <View
                        android:id="@+id/server_status_dot"
                        android:layout_width="10dp"
                        android:layout_height="10dp"
                        android:background="@color/status_offline"
                        android:layout_marginEnd="8dp" />

                    <TextView
                        android:id="@+id/server_status_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Server: checking..."
                        android:textColor="@color/text_secondary"
                        android:fontFamily="monospace"
                        android:textSize="13sp" />
                </LinearLayout>

                <!-- WireGuard -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="center_vertical">

                    <View
                        android:id="@+id/wg_status_dot"
                        android:layout_width="10dp"
                        android:layout_height="10dp"
                        android:background="@color/status_offline"
                        android:layout_marginEnd="8dp" />

                    <TextView
                        android:id="@+id/wg_status_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/wg_checking"
                        android:textColor="@color/text_secondary"
                        android:fontFamily="monospace"
                        android:textSize="13sp" />
                </LinearLayout>

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

        <!-- Output Log -->
        <com.google.android.material.card.MaterialCardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardBackgroundColor="@color/surface_dark"
            app:cardCornerRadius="8dp">

            <TextView
                android:id="@+id/output_log"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="80dp"
                android:padding="12dp"
                android:text="@string/ready"
                android:textColor="@color/terminal_green_dim"
                android:fontFamily="monospace"
                android:textSize="12sp"
                android:scrollbars="vertical" />

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

    </LinearLayout>
</ScrollView>
