<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
    android:background="@color/background_color"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/statsTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="@string/stats_title"
        android:textSize="36sp"
        android:textStyle="bold"
        android:textColor="#333333"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ScrollView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"
        app:layout_constraintBottom_toTopOf="@+id/backButton"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/statsTitle"
        android:fillViewport="true">

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

            <TextView
                style="@style/SectionTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/general_section" />
            <LinearLayout
                style="@style/SectionContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <TextView android:id="@+id/high_score_stats_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/high_score_stats" />
                <TextView android:id="@+id/total_games_played_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/total_games_played" />
                <TextView android:id="@+id/total_games_started_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/total_games_started" />
                <TextView android:id="@+id/win_percentage_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/win_percentage" />
                <TextView android:id="@+id/total_play_time_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/total_play_time" />
                <TextView android:id="@+id/total_moves_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/total_moves" />
            </LinearLayout>

            <TextView
                style="@style/SectionTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/current_game_section" />
            <LinearLayout
                style="@style/SectionContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <TextView android:id="@+id/current_moves_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/current_moves" />
                <TextView android:id="@+id/current_game_time_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/current_game_time" />
                <TextView android:id="@+id/merges_this_game" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/merges_this_game_label" />
            </LinearLayout>

            <TextView
                style="@style/SectionTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/single_player_section" />
            <LinearLayout
                style="@style/SectionContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <TextView android:id="@+id/average_game_time_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/average_time_per_game" />
                <TextView android:id="@+id/best_winning_time_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/best_winning_time" />
                <TextView android:id="@+id/worst_winning_time_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/worst_winning_time" />
                <TextView android:id="@+id/total_merges_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/total_merges" />
                <TextView android:id="@+id/highest_tile_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/highest_tile" />
                <TextView android:id="@+id/number_of_time_objective_reached_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/number_of_time_objective_reached" />
            </LinearLayout>

            <TextView
                style="@style/SectionTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/multiplayer_section" />
            <LinearLayout
                style="@style/SectionContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <TextView android:id="@+id/multiplayer_games_won_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/multiplayer_games_won" />
                <TextView android:id="@+id/multiplayer_games_played_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/multiplayer_games_played" />
                <TextView android:id="@+id/multiplayer_win_rate_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/multiplayer_win_rate" />
                <TextView android:id="@+id/multiplayer_best_winning_streak_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/multiplayer_best_winning_streak" />
                <TextView android:id="@+id/multiplayer_average_score_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/multiplayer_average_score" />
                <TextView
                    android:id="@+id/average_time_per_game_multi_label"
                    style="@style/StatLabel"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/average_time_per_game_label" />
                <TextView android:id="@+id/total_multiplayer_losses_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/total_multiplayer_losses" />
                <TextView android:id="@+id/multiplayer_high_score_label" style="@style/StatLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/multiplayer_high_score" />
            </LinearLayout>

        </LinearLayout>
    </ScrollView>

    <Button
        android:id="@+id/backButton"
        style="@style/ButtonStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="24dp"
        android:text="@string/back_button_label"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>