<?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:background="@color/background">

    <!-- AppBar -->
    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/primary">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:title="@string/app_name"
            app:titleTextColor="@android:color/white">

            <ImageButton
                android:id="@+id/btnProfile"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_gravity="end"
                android:layout_marginEnd="16dp"
                android:background="?attr/selectableItemBackgroundBorderless"
                android:src="@drawable/ic_profile"
                android:contentDescription="@string/profile" />

        </androidx.appcompat.widget.Toolbar>

    </com.google.android.material.appbar.AppBarLayout>

    <!-- Main Content -->
    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

            <!-- کارت اتصال -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                app:cardCornerRadius="16dp"
                app:cardElevation="4dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="24dp"
                    android:gravity="center">

                    <!-- Progress Indicator -->
                    <com.google.android.material.progressindicator.CircularProgressIndicator
                        android:id="@+id/progressIndicator"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:visibility="gone"
                        app:indicatorColor="@color/primary" />

                    <!-- وضعیت اتصال -->
                    <TextView
                        android:id="@+id/tvStatus"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="قطع شده"
                        android:textSize="24sp"
                        android:textStyle="bold"
                        android:textColor="@color/gray_500"
                        android:layout_marginTop="16dp" />

                    <!-- دکمه اتصال -->
                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/btnConnect"
                        android:layout_width="200dp"
                        android:layout_height="200dp"
                        android:layout_marginTop="24dp"
                        android:text="اتصال"
                        android:textSize="20sp"
                        android:textStyle="bold"
                        app:cornerRadius="100dp"
                        app:backgroundTint="@color/primary"
                        app:elevation="8dp" />

                </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_marginBottom="16dp"
                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="مصرف ترافیک"
                        android:textSize="16sp"
                        android:textStyle="bold"
                        android:textColor="@color/text_primary" />

                    <!-- Progress Bar -->
                    <com.google.android.material.progressindicator.LinearProgressIndicator
                        android:id="@+id/trafficProgress"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="12dp"
                        android:layout_marginBottom="8dp"
                        app:indicatorColor="@color/primary"
                        app:trackColor="@color/gray_200" />

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

                        <TextView
                            android:id="@+id/tvTrafficUsed"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="0 GB"
                            android:textSize="14sp"
                            android:textColor="@color/text_secondary" />

                        <TextView
                            android:id="@+id/tvTrafficTotal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="از 100 GB"
                            android:textSize="14sp"
                            android:textColor="@color/text_secondary" />

                    </LinearLayout>

                    <!-- تاریخ انقضا -->
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:layout_marginTop="12dp"
                        android:padding="8dp"
                        android:background="@drawable/bg_rounded_light">

                        <TextView
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="تاریخ انقضا:"
                            android:textSize="14sp"
                            android:textColor="@color/text_primary" />

                        <TextView
                            android:id="@+id/tvExpiryDate"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="2024-02-15"
                            android:textSize="14sp"
                            android:textStyle="bold"
                            android:textColor="@color/primary" />

                    </LinearLayout>

                </LinearLayout>

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

            <!-- لیست سرورها -->
            <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="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="انتخاب سرور"
                        android:textSize="16sp"
                        android:textStyle="bold"
                        android:textColor="@color/text_primary"
                        android:padding="16dp" />

                    <androidx.recyclerview.widget.RecyclerView
                        android:id="@+id/recyclerServers"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:nestedScrollingEnabled="false"
                        android:paddingBottom="8dp" />

                </LinearLayout>

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

            <!-- پیام بدون اشتراک -->
            <LinearLayout
                android:id="@+id/layoutNotSubscribed"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:gravity="center"
                android:padding="32dp"
                android:visibility="gone">

                <ImageView
                    android:layout_width="120dp"
                    android:layout_height="120dp"
                    android:src="@drawable/ic_no_subscription"
                    android:contentDescription="@string/no_subscription" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="شما هیچ اشتراک فعالی ندارید"
                    android:textSize="18sp"
                    android:textStyle="bold"
                    android:textColor="@color/text_primary"
                    android:layout_marginTop="16dp"
                    android:gravity="center" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="برای استفاده از VPN، یک اشتراک خریداری کنید"
                    android:textSize="14sp"
                    android:textColor="@color/text_secondary"
                    android:layout_marginTop="8dp"
                    android:gravity="center" />

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/btnBuySubscription"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="خرید اشتراک"
                    android:layout_marginTop="24dp"
                    app:cornerRadius="8dp" />

            </LinearLayout>

        </LinearLayout>

    </androidx.core.widget.NestedScrollView>

    <!-- Bottom Navigation -->
    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottomNavigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:menu="@menu/bottom_nav_menu"
        app:labelVisibilityMode="labeled"
        android:background="@android:color/white"
        app:elevation="8dp" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
