<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="#F3F6FB"
    tools:context=".ui.map.MapFragment">

    <androidx.core.widget.NestedScrollView
        android:id="@+id/scrollView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@+id/sosButton"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

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

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="210dp">

                <View
                    android:layout_width="match_parent"
                    android:layout_height="210dp"
                    android:background="@drawable/bg_header_top" />

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

                    <TextView
                        android:id="@+id/headerTitle"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:fontFamily="sans-serif-medium"
                        android:text="@string/header_title"
                        android:textColor="#FFFFFF"
                        android:textSize="28sp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/headerSubtitle"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="6dp"
                        android:text="@string/header_subtitle"
                        android:textColor="#E1EAFF"
                        android:textSize="14sp" />
                </LinearLayout>
            </FrameLayout>

            <androidx.cardview.widget.CardView
                android:id="@+id/userStatusCard"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="20dp"
                android:layout_marginEnd="20dp"
                android:layout_marginTop="-60dp"
                android:elevation="6dp"
                android:translationZ="6dp"
                app:cardCornerRadius="22dp"
                app:cardUseCompatPadding="false">

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

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

                        <FrameLayout
                            android:layout_width="60dp"
                            android:layout_height="60dp"
                            android:background="@drawable/bg_avatar_placeholder"
                            android:padding="6dp">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:gravity="center"
                                android:text="@string/status_avatar_emoji"
                                android:textSize="26sp" />
                        </FrameLayout>

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="16dp"
                            android:layout_weight="1"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/status_name"
                                android:textColor="#111827"
                                android:textSize="18sp"
                                android:textStyle="bold" />

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

                                <View
                                    android:layout_width="10dp"
                                    android:layout_height="10dp"
                                    android:background="@drawable/bg_status_online" />

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:layout_marginStart="6dp"
                                    android:text="@string/status_online"
                                    android:textColor="#1FB66F"
                                    android:textSize="14sp"
                                    android:textStyle="bold" />
                            </LinearLayout>
                        </LinearLayout>

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

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

                                <ImageView
                                    android:layout_width="20dp"
                                    android:layout_height="20dp"
                                    android:src="@drawable/ic_battery" />

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:layout_marginStart="4dp"
                                    android:text="@string/battery_percent"
                                    android:textColor="#111827"
                                    android:textStyle="bold" />
                            </LinearLayout>

                            <LinearLayout
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="6dp"
                                android:gravity="center_vertical"
                                android:orientation="horizontal">

                                <ImageView
                                    android:layout_width="20dp"
                                    android:layout_height="20dp"
                                    android:src="@drawable/ic_signal_gps" />

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:layout_marginStart="4dp"
                                    android:text="@string/gps_label"
                                    android:textColor="#111827"
                                    android:textStyle="bold" />
                            </LinearLayout>
                        </LinearLayout>
                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:background="@drawable/bg_safe_banner"
                        android:gravity="center_vertical"
                        android:orientation="horizontal"
                        android:padding="16dp">

                        <FrameLayout
                            android:layout_width="40dp"
                            android:layout_height="40dp"
                            android:background="@drawable/bg_safe_banner_icon">

                            <ImageView
                                android:layout_width="20dp"
                                android:layout_height="20dp"
                                android:layout_gravity="center"
                                android:src="@drawable/ic_location_pin" />
                        </FrameLayout>

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="12dp"
                            android:layout_weight="1"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/status_safe_zone_line1"
                                android:textColor="#0B6635"
                                android:textStyle="bold" />

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="4dp"
                                android:text="@string/status_safe_zone_line2"
                                android:textColor="#0B6635" />
                        </LinearLayout>
                    </LinearLayout>
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <androidx.cardview.widget.CardView
                android:id="@+id/mapContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="20dp"
                android:layout_marginTop="12dp"
                android:layout_marginEnd="20dp"
                app:cardCornerRadius="36dp"
                app:cardElevation="4dp">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="380dp"
                    android:background="@drawable/bg_map_card"
                    android:clipToPadding="false"
                    android:padding="24dp">

                    <androidx.fragment.app.FragmentContainerView
                        android:id="@+id/map"
                        android:name="com.google.android.gms.maps.SupportMapFragment"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <View
                        android:id="@+id/safeZone"
                        android:layout_width="280dp"
                        android:layout_height="280dp"
                        android:background="@drawable/bg_safe_zone_circle"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <LinearLayout
                        android:id="@+id/userMarker"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="center_horizontal"
                        android:orientation="vertical"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent">

                        <View
                            android:layout_width="24dp"
                            android:layout_height="24dp"
                            android:background="@drawable/bg_marker_user" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="6dp"
                            android:text="@string/map_marker_miguel"
                            android:textColor="#111827"
                            android:textStyle="bold" />
                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/homeMarker"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="12dp"
                        android:layout_marginBottom="48dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintStart_toStartOf="parent">

                        <FrameLayout
                            android:layout_width="48dp"
                            android:layout_height="48dp"
                            android:background="@drawable/bg_marker_avatar">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:gravity="center"
                                android:text="@string/zone_home_icon"
                                android:textSize="18sp" />
                        </FrameLayout>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="8dp"
                            android:background="@drawable/bg_marker_label"
                            android:text="@string/map_marker_home"
                            android:textColor="#111827"
                            android:textStyle="bold" />
                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/schoolMarker"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:layout_marginTop="24dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal"
                        app:layout_constraintEnd_toEndOf="@+id/safeZone"
                        app:layout_constraintTop_toTopOf="@+id/safeZone">

                        <FrameLayout
                            android:layout_width="48dp"
                            android:layout_height="48dp"
                            android:background="@drawable/bg_marker_avatar">

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:gravity="center"
                                android:text="@string/zone_school_icon"
                                android:textSize="18sp" />
                        </FrameLayout>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="8dp"
                            android:background="@drawable/bg_marker_label"
                            android:text="@string/map_marker_school"
                            android:textColor="#111827"
                            android:textStyle="bold" />
                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/zoomControls"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintTop_toTopOf="parent">

                        <ImageButton
                            android:id="@+id/zoomInButton"
                            android:layout_width="52dp"
                            android:layout_height="52dp"
                            android:background="@drawable/bg_zoom_button"
                            android:contentDescription="@string/zoom_in"
                            android:src="@drawable/ic_zoom_plus" />

                        <ImageButton
                            android:id="@+id/zoomOutButton"
                            android:layout_width="52dp"
                            android:layout_height="52dp"
                            android:layout_marginTop="10dp"
                            android:background="@drawable/bg_zoom_button"
                            android:contentDescription="@string/zoom_out"
                            android:src="@drawable/ic_zoom_minus" />
                    </LinearLayout>

                    <com.google.android.material.floatingactionbutton.FloatingActionButton
                        android:id="@+id/navigationFab"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="12dp"
                        android:layout_marginBottom="12dp"
                        android:contentDescription="@string/navigate"
                        app:backgroundTint="#1F6AEF"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:srcCompat="@drawable/ic_navigation_plane" />

                    <FrameLayout
                        android:id="@+id/messagesFabContainer"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="12dp"
                        android:layout_marginBottom="12dp"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent">

                        <com.google.android.material.floatingactionbutton.FloatingActionButton
                            android:id="@+id/messagesFab"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:contentDescription="@string/messages"
                            app:backgroundTint="#1DB45A"
                            app:srcCompat="@drawable/ic_chat_bubble" />

                        <TextView
                            android:id="@+id/messagesBadge"
                            android:layout_width="22dp"
                            android:layout_height="22dp"
                            android:layout_gravity="top|end"
                            android:background="@drawable/bg_badge"
                            android:gravity="center"
                            android:text="@string/messages_badge"
                            android:textColor="#FFFFFF"
                            android:textSize="12sp"
                            android:textStyle="bold" />
                    </FrameLayout>
                </androidx.constraintlayout.widget.ConstraintLayout>
            </androidx.cardview.widget.CardView>
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>

    <com.google.android.material.button.MaterialButton
        android:id="@+id/sosButton"
        style="@style/Widget.MaterialComponents.Button"
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:layout_marginStart="24dp"
        android:layout_marginEnd="24dp"
        android:layout_marginBottom="16dp"
        android:backgroundTint="#E53935"
        app:cornerRadius="18dp"
        android:drawablePadding="12dp"
        android:drawableEnd="@android:drawable/ic_menu_call"
        app:icon="@android:drawable/ic_dialog_alert"
        app:iconPadding="12dp"
        app:iconTint="#FFFFFF"
        android:text="@string/sos_button_text"
        android:textAllCaps="true"
        android:textColor="#FFFFFF"
        android:textStyle="bold"
        app:iconGravity="textStart"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
