<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background_surface"
    android:fillViewport="true">

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

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Histórico"
            android:textColor="@color/neutral_dark"
            android:textSize="24sp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:layout_marginBottom="20dp"
            android:text="Registo de medicação tomada"
            android:textColor="@color/neutral_medium"
            android:textSize="14sp" />

        <!-- Calendar Card -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_guardian_card"
            android:orientation="vertical"
            android:padding="12dp">

            <!-- Month Title -->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                android:paddingBottom="12dp">

                <TextView
                    android:id="@+id/textMonthTitle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="Março 2026"
                    android:textColor="@color/neutral_dark"
                    android:textSize="18sp"
                    android:textStyle="bold" />

                <ImageView
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:src="@android:drawable/ic_menu_today"
                    android:tint="@color/primary" />
            </LinearLayout>

            <!-- Weekday Headers - 7 equal TextViews in a TableRow-like layout -->
            <LinearLayout
                android:id="@+id/weekdayHeaders"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <!-- 7 headers added programmatically to guarantee equal width -->
            </LinearLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginTop="6dp"
                android:layout_marginBottom="6dp"
                android:background="@color/divider" />

            <!-- Calendar Grid - rows added programmatically -->
            <LinearLayout
                android:id="@+id/calendarGrid"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" />

        </LinearLayout>

        <!-- Legend -->
        <LinearLayout
            android:id="@+id/legendContainer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Legenda"
                android:textSize="16sp"
                android:textStyle="bold"
                android:textColor="@color/neutral_dark"
                android:layout_marginBottom="8dp" />
        </LinearLayout>

    </LinearLayout>
</ScrollView>
