<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:background="@color/white">

    <RelativeLayout
        android:id="@+id/head"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/bg_img"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_200sdp"

            android:src="@drawable/ic_dashboard_cp"/>

        <LinearLayout
            android:id="@+id/home_head_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            >

            <RelativeLayout
                android:id="@+id/time_head"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="15dp"
                android:layout_marginTop="25dp"
                >

                <TextView
                    android:id="@+id/current_time"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"

                    android:layout_centerVertical="true"

                    android:fontFamily="@font/nunito_bold"
                    tools:text="12 : 00 PM"
                    android:textColor="@color/white_bg"
                    android:textSize="@dimen/_22ssp" />

                <de.hdodenhof.circleimageview.CircleImageView
                    android:id="@+id/profile"
                    android:layout_width="45dp"
                    android:layout_height="45dp"

                    android:src="@drawable/senior_img"

                    android:layout_alignParentEnd="true"

                    app:civ_border_color="@color/white_bg"
                    app:civ_border_width="1dp"

                    android:elevation="5dp"

                    />

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_toStartOf="@id/profile"
                    android:layout_marginHorizontal="15dp"
                    >

                    <ImageView
                        android:id="@+id/notifications"
                        android:layout_width="35dp"
                        android:layout_height="35dp"
                        android:contentDescription="@string/notification"
                        app:srcCompat="@drawable/ic_notification_home"
                        app:tint="@color/white"
                        android:layout_alignParentEnd="true"
                        />

                    <RelativeLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        >

                        <TextView
                            android:id="@+id/notification_count"
                            android:layout_width="@dimen/_15sdp"
                            android:layout_height="@dimen/_15sdp"

                            android:background="@drawable/round_corners"
                            android:backgroundTint="@android:color/holo_red_light"

                            android:visibility="gone"

                            tools:text="99"
                            android:fontFamily="@font/nunito_regular"
                            android:textColor="@color/white"
                            android:textSize="11sp"
                            android:gravity="center"

                            android:layout_marginStart="7dp"

                            android:maxLength="2"
                            android:singleLine="true"

                            />

                    </RelativeLayout>

                </RelativeLayout>

            </RelativeLayout>

            <TextView
                android:id="@+id/day_of_week"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                tools:text="Sunday"
                android:fontFamily="@font/nunito_regular"
                android:textColor="@color/white_bg"
                android:textSize="@dimen/_18ssp"

                android:layout_marginHorizontal="15dp"

                />

            <TextView
                android:id="@+id/date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                tools:text="April 4th, 2023"
                android:fontFamily="@font/nunito_regular"
                android:textSize="@dimen/_18ssp"
                android:textColor="@color/white_bg"

                android:layout_marginHorizontal="15dp"

                android:layout_marginBottom="5dp"

                />

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/home_reminder"
                android:visibility="visible"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:layout_marginHorizontal="15dp"
                android:layout_marginTop="25dp"

                app:cardBackgroundColor="@color/color_accent"
                >

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

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"

                        android:text="@string/upcoming_activity_"
                        android:fontFamily="@font/nunito_bold"
                        android:textColor="@color/black"
                        android:textSize="@dimen/_16ssp"

                        android:maxLines="2"
                        android:ellipsize="end"
                        />

                    <TextView
                        android:id="@+id/activity_message"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"

                        tools:text="Run at 3:30 pm"
                        android:fontFamily="@font/nunito_medium"
                        android:textColor="@color/black"
                        android:textSize="@dimen/_14ssp"

                        android:maxLines="1"
                        android:ellipsize="end"

                        />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"

                        android:text="@string/next_medication_schedule"
                        android:fontFamily="@font/nunito_bold"
                        android:textColor="@color/black"
                        android:textSize="@dimen/_16ssp"

                        android:maxLines="2"
                        android:ellipsize="end"

                        android:layout_marginTop="10dp"
                        />

                    <TextView
                        android:id="@+id/reminder_message"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"

                        tools:text="Paracetamol at 3:30 pm"
                        android:fontFamily="@font/nunito_medium"
                        android:textColor="@color/black"
                        android:textSize="@dimen/_14ssp"

                        android:maxLines="1"
                        android:ellipsize="end"

                        />

                    <ImageView
                        android:id="@+id/close_reminder_"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:contentDescription="@string/close"
                        android:visibility="gone"

                        app:srcCompat="@drawable/ic_close_primary"

                        android:layout_gravity="end"

                        />

                    <ImageView
                        android:id="@+id/refresh_btn_"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:src="@drawable/ic_refresh"
                        android:contentDescription="@string/refresh"
                        android:layout_gravity="end"
                        android:visibility="visible"
                        />

                    <ProgressBar
                        android:id="@+id/refresh_progress_"
                        android:visibility="gone"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="end"
                        android:indeterminateTint="@color/color_primary_dark"
                        android:indeterminate="true"
                        />

                </LinearLayout>

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

        </LinearLayout>

    </RelativeLayout>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/head"
        android:layout_above="@id/sos_btn"
        android:overScrollMode="never">

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

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

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/calls"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="5"

                    app:strokeColor="@color/color_accent"
                    app:strokeWidth="0.5dp"
                    app:cardCornerRadius="5dp"
                    app:cardElevation="1dp"

                    android:layout_marginStart="15dp"
                    android:layout_marginEnd="10dp"
                    android:layout_marginTop="25dp"
                    android:layout_marginBottom="10dp"

                    >

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

                        <ImageView
                            android:layout_width="@dimen/_60sdp"
                            android:layout_height="@dimen/_60sdp"
                            android:contentDescription="@string/calls"

                            app:srcCompat="@drawable/img_doc_contact"/>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/calls"
                            android:fontFamily="@font/nunito_regular"
                            android:textSize="@dimen/_14ssp"
                            android:textColor="@color/black"

                            android:layout_marginTop="5dp"

                            />

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/chats"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="5"

                    app:strokeColor="@color/color_accent"
                    app:strokeWidth="0.5dp"
                    app:cardCornerRadius="5dp"
                    app:cardElevation="1dp"

                    android:layout_marginStart="10dp"
                    android:layout_marginEnd="15dp"

                    android:layout_marginTop="25dp"
                    android:layout_marginBottom="10dp"

                    >

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

                        <RelativeLayout
                            android:layout_width="@dimen/_70sdp"
                            android:layout_height="wrap_content"
                            >

                            <ImageView
                                android:layout_width="@dimen/_60sdp"
                                android:layout_height="@dimen/_60sdp"
                                android:contentDescription="@string/chats"

                                android:layout_centerInParent="true"
                                app:srcCompat="@drawable/img_chats"/>

                            <TextView
                                android:id="@+id/chat_notification_count"
                                android:layout_width="@dimen/_15sdp"
                                android:layout_height="@dimen/_15sdp"

                                android:background="@drawable/round_corners"
                                android:backgroundTint="@android:color/holo_red_light"

                                android:visibility="gone"
                                android:layout_alignParentEnd="true"

                                tools:text="9"
                                android:fontFamily="@font/nunito_regular"
                                android:textColor="@color/white"
                                android:textSize="11sp"
                                android:gravity="center"

                                android:layout_marginStart="7dp"

                                android:maxLength="2"
                                android:singleLine="true"

                                />

                        </RelativeLayout>

                        <TextView
                            android:id="@+id/chat_with"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/chats"
                            android:fontFamily="@font/nunito_regular"
                            android:textSize="@dimen/_14ssp"
                            android:textColor="@color/black"

                            android:textAlignment="center"
                            android:maxLines="2"
                            android:ellipsize="end"

                            android:layout_marginTop="5dp"
                            android:layout_marginHorizontal="5dp"

                            />

                    </LinearLayout>

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

            </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/apps"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="5"

                    app:strokeColor="@color/color_accent"
                    app:strokeWidth="0.5dp"
                    app:cardCornerRadius="5dp"
                    app:cardElevation="1dp"

                    android:layout_marginStart="15dp"
                    android:layout_marginEnd="10dp"
                    android:layout_marginVertical="10dp"

                    >

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

                        <ImageView
                            android:layout_width="@dimen/_60sdp"
                            android:layout_height="@dimen/_60sdp"
                            android:contentDescription="@string/apps"

                            app:srcCompat="@drawable/img_apps"/>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/apps"
                            android:fontFamily="@font/nunito_regular"
                            android:textSize="@dimen/_14ssp"
                            android:textColor="@color/black"

                            android:layout_marginTop="5dp"

                            />

                    </LinearLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/directions"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="5"

                    app:strokeColor="@color/color_accent"
                    app:strokeWidth="0.5dp"
                    app:cardCornerRadius="5dp"
                    app:cardElevation="1dp"

                    android:layout_marginStart="10dp"
                    android:layout_marginEnd="15dp"
                    android:layout_marginVertical="10dp"
                    >

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

                        <ImageView
                            android:layout_width="@dimen/_60sdp"
                            android:layout_height="@dimen/_60sdp"
                            android:contentDescription="@string/direction"

                            app:srcCompat="@drawable/img_directions"/>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/direction"
                            android:fontFamily="@font/nunito_regular"
                            android:textSize="@dimen/_14ssp"
                            android:textColor="@color/black"

                            android:layout_marginTop="5dp"

                            />

                    </LinearLayout>

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

            </LinearLayout>

        </LinearLayout>

    </ScrollView>

    <com.google.android.material.button.MaterialButton
        android:id="@+id/sos_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"

        android:layout_marginHorizontal="15dp"
        android:fontFamily="@font/nunito_regular"
        android:paddingVertical="15dp"
        android:text="@string/sos"
        android:textAllCaps="true"

        android:layout_marginBottom="5dp"

        android:textAppearance="@style/TextAppearance.Material3.TitleMedium"

        android:textColor="@color/white_bg"
        app:backgroundTint="@color/color_primary_dark"
        app:cornerRadius="10dp" />

</RelativeLayout>