<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:fillViewport="true"
    android:background="#F8F9FA">

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

        <!-- Header con gradiente y título -->
        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/header_container"
            android:layout_width="match_parent"
            android:layout_height="120dp"
            android:background="@drawable/side_nav_bar">

            <TextView
                android:id="@+id/text_comida_title"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="24dp"
                android:layout_marginEnd="24dp"
                android:text="Comida"
                android:textAppearance="?attr/textAppearanceHeadline4"
                android:textColor="@android:color/white"
                android:textStyle="bold"
                android:gravity="center"
                android:maxLines="2"
                android:ellipsize="end"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"/>

        </androidx.constraintlayout.widget.ConstraintLayout>

        <!-- Card de Imagen/Icono de la comida -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/image_container"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            app:cardCornerRadius="12dp"
            app:cardElevation="6dp"
            app:strokeColor="#E0E0E0"
            app:strokeWidth="1dp">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#F5F5F5">

                <ImageView
                    android:id="@+id/icon_comida_detalle"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    android:src="@drawable/ic_restaurante"
                    android:tint="@color/primary"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"/>

            </androidx.constraintlayout.widget.ConstraintLayout>

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

        <!-- Card de Información Nutricional -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/nutrition_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            app:cardCornerRadius="12dp"
            app:cardElevation="4dp"
            app:strokeColor="#E0E0E0"
            app:strokeWidth="1dp">

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

                <!-- Header de Información Nutricional -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="center_vertical">

                    <ImageView
                        android:id="@+id/icon_nutrition"
                        android:layout_width="24dp"
                        android:layout_height="24dp"
                        android:src="@android:drawable/ic_menu_info_details"
                        android:tint="?android:attr/textColorPrimary"/>

                    <TextView
                        android:id="@+id/label_nutrition"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:layout_marginStart="12dp"
                        android:text="Información Nutricional"
                        android:textAppearance="?attr/textAppearanceSubtitle1"
                        android:textColor="?android:attr/textColorPrimary"
                        android:textStyle="bold"/>

                </LinearLayout>

                <!-- Contenedor de Calorías -->
                <LinearLayout
                    android:id="@+id/calories_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="16dp"
                    android:padding="12dp"
                    android:background="@drawable/rounded_rect_orange"
                    android:orientation="horizontal"
                    android:gravity="center_vertical">

                    <TextView
                        android:layout_width="16dp"
                        android:layout_height="16dp"
                        android:text="🔥"
                        android:textSize="14sp"
                        android:gravity="center"/>

                    <TextView
                        android:id="@+id/text_calories_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="12dp"
                        android:text="Calorías:"
                        android:textAppearance="?attr/textAppearanceBody1"
                        android:textColor="?android:attr/textColorPrimary"
                        android:textStyle="bold"/>

                    <TextView
                        android:id="@+id/text_calories_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:text="450 kcal"
                        android:textAppearance="?attr/textAppearanceBody1"
                        android:textColor="@color/warning"
                        android:textStyle="bold"/>

                </LinearLayout>

                <!-- Grid de Macronutrientes usando LinearLayout horizontal -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:orientation="horizontal"
                    android:weightSum="3">

                    <!-- Proteínas -->
                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:layout_margin="2dp"
                        android:padding="12dp"
                        android:background="@drawable/rounded_rect_green"
                        android:orientation="vertical"
                        android:gravity="center">

                        <TextView
                            android:layout_width="16dp"
                            android:layout_height="16dp"
                            android:text="💪"
                            android:textSize="14sp"
                            android:gravity="center"/>

                        <TextView
                            android:id="@+id/text_proteins_value"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="4dp"
                            android:text="25g"
                            android:textAppearance="?attr/textAppearanceBody2"
                            android:textColor="@color/success"
                            android:textStyle="bold"
                            android:gravity="center"/>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="2dp"
                            android:text="Proteínas"
                            android:textAppearance="?attr/textAppearanceCaption"
                            android:textColor="?android:attr/textColorSecondary"
                            android:gravity="center"/>

                    </LinearLayout>

                    <!-- Carbohidratos -->
                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:layout_margin="2dp"
                        android:padding="12dp"
                        android:background="@drawable/rounded_rect_blue"
                        android:orientation="vertical"
                        android:gravity="center">

                        <TextView
                            android:layout_width="16dp"
                            android:layout_height="16dp"
                            android:text="🌾"
                            android:textSize="14sp"
                            android:gravity="center"/>

                        <TextView
                            android:id="@+id/text_carbs_value"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="4dp"
                            android:text="45g"
                            android:textAppearance="?attr/textAppearanceBody2"
                            android:textColor="@color/info"
                            android:textStyle="bold"
                            android:gravity="center"/>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="2dp"
                            android:text="Carbohidratos"
                            android:textAppearance="?attr/textAppearanceCaption"
                            android:textColor="?android:attr/textColorSecondary"
                            android:gravity="center"/>

                    </LinearLayout>

                    <!-- Grasas -->
                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:layout_margin="2dp"
                        android:padding="12dp"
                        android:background="@drawable/rounded_rect_yellow"
                        android:orientation="vertical"
                        android:gravity="center">

                        <TextView
                            android:layout_width="16dp"
                            android:layout_height="16dp"
                            android:text="🥑"
                            android:textSize="14sp"
                            android:gravity="center"/>

                        <TextView
                            android:id="@+id/text_fats_value"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="4dp"
                            android:text="15g"
                            android:textAppearance="?attr/textAppearanceBody2"
                            android:textColor="#FF9800"
                            android:textStyle="bold"
                            android:gravity="center"/>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="2dp"
                            android:text="Grasas"
                            android:textAppearance="?attr/textAppearanceCaption"
                            android:textColor="?android:attr/textColorSecondary"
                            android:gravity="center"/>

                    </LinearLayout>

                </LinearLayout>

            </LinearLayout>

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

        <!-- Card de Ingredientes -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/ingredients_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            app:cardCornerRadius="12dp"
            app:cardElevation="4dp"
            app:strokeColor="#E0E0E0"
            app:strokeWidth="1dp">

            <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:orientation="horizontal"
                    android:gravity="center_vertical">

                    <ImageView
                        android:id="@+id/icon_ingredients"
                        android:layout_width="24dp"
                        android:layout_height="24dp"
                        android:src="@android:drawable/ic_menu_agenda"
                        android:tint="?android:attr/textColorPrimary"/>

                    <TextView
                        android:id="@+id/label_ingredients"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:layout_marginStart="12dp"
                        android:text="Ingredientes"
                        android:textAppearance="?attr/textAppearanceSubtitle1"
                        android:textColor="?android:attr/textColorPrimary"
                        android:textStyle="bold"/>

                </LinearLayout>

                <TextView
                    android:id="@+id/text_ingredients_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:text="Ingredientes de la comida"
                    android:textAppearance="?attr/textAppearanceBody1"
                    android:textColor="?android:attr/textColorSecondary"
                    android:lineSpacingExtra="2dp"/>

            </LinearLayout>

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

        <!-- Card de Receta -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/recipe_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            app:cardCornerRadius="12dp"
            app:cardElevation="4dp"
            app:strokeColor="#E0E0E0"
            app:strokeWidth="1dp">

            <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:orientation="horizontal"
                    android:gravity="center_vertical">

                    <ImageView
                        android:id="@+id/icon_recipe"
                        android:layout_width="24dp"
                        android:layout_height="24dp"
                        android:src="@android:drawable/ic_menu_edit"
                        android:tint="?android:attr/textColorPrimary"/>

                    <TextView
                        android:id="@+id/label_recipe"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:layout_marginStart="12dp"
                        android:text="Preparación"
                        android:textAppearance="?attr/textAppearanceSubtitle1"
                        android:textColor="?android:attr/textColorPrimary"
                        android:textStyle="bold"/>

                </LinearLayout>

                <TextView
                    android:id="@+id/text_recipe_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="12dp"
                    android:text="Instrucciones de preparación"
                    android:textAppearance="?attr/textAppearanceBody1"
                    android:textColor="?android:attr/textColorSecondary"
                    android:lineSpacingExtra="2dp"/>

            </LinearLayout>

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

</ScrollView>