<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
    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="#F0F4F8"> <!-- 浅灰色背景提升质感 -->

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="12dp">

        <!-- 顶部：搜索卡片 -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/card_search"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:cardCornerRadius="16dp"
            app:cardElevation="4dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent">

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

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="公交车轮胎管理"
                    android:textSize="18sp"
                    android:textStyle="bold"
                    android:textColor="#202020"
                    android:layout_gravity="center_horizontal"
                    android:layout_marginBottom="20dp"/>

                <!-- 车牌号输入 -->
                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/til_plate_number"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="请输入车牌号"
                    android:layout_marginBottom="16dp"
                    app:endIconMode="custom"
                    app:endIconDrawable="@mipmap/search_icon">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/et_plate_number"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="textCapCharacters"
                        android:maxLines="1" />
                </com.google.android.material.textfield.TextInputLayout>

                <Button
                    android:id="@+id/btn_retrieve"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="立即检索"
                    android:textSize="16sp"
                    app:cornerRadius="8dp" />
            </LinearLayout>
        </com.google.android.material.card.MaterialCardView>

        <!-- 底部：三轴轮位图展示区 -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/card_visual"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginTop="16dp"
            app:cardCornerRadius="16dp"
            app:cardElevation="2dp"
            app:layout_constraintTop_toBottomOf="@id/card_search"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="16dp">

                <!-- 辅助线：垂直中心线 (分隔左右轮胎) -->
                <androidx.constraintlayout.widget.Guideline
                    android:id="@+id/guideline_vertical_center"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    app:layout_constraintGuide_percent="0.5" />

                <!-- 辅助线：水平线 1 (第1轴位置) -->
                <androidx.constraintlayout.widget.Guideline
                    android:id="@+id/guideline_axis_1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    app:layout_constraintGuide_begin="96dp" />

                <!-- 辅助线：水平线 2 (第2轴位置) -->
                <androidx.constraintlayout.widget.Guideline
                    android:id="@+id/guideline_axis_2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    app:layout_constraintGuide_begin="241dp" />

                <!-- 辅助线：水平线 3 (第3轴位置) -->
                <androidx.constraintlayout.widget.Guideline
                    android:id="@+id/guideline_axis_3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    app:layout_constraintGuide_begin="399dp" />

                <!-- 车头指示 -->
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="🚗 车头方向"
                    android:textColor="#999999"
                    android:textSize="10sp"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toEndOf="parent" />

                <!-- ================= 第1轴 (前轴) ================= -->
                <!-- 左侧轮胎 (1轴) -->
                <include
                    android:id="@+id/tire_left_front"
                    layout="@layout/item_tire"
                    android:layout_width="0dp"
                    android:layout_height="120dp"
                    app:layout_constraintBottom_toBottomOf="@id/guideline_axis_1"
                    app:layout_constraintEnd_toStartOf="@id/guideline_vertical_center"
                    app:layout_constraintHorizontal_bias="0.5"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@id/guideline_axis_1" />

                <!-- 右侧轮胎 (1轴) -->

                <!-- ================= 第2轴 (中轴) ================= -->
                <!-- 左侧轮胎 (2轴) -->

                <include
                    android:id="@+id/tire_right_front"
                    layout="@layout/item_tire"
                    android:layout_width="0dp"
                    android:layout_height="120dp"
                    app:layout_constraintBottom_toBottomOf="@id/guideline_axis_1"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintHorizontal_bias="0.0"
                    app:layout_constraintStart_toEndOf="@id/guideline_vertical_center"
                    app:layout_constraintTop_toTopOf="@id/guideline_axis_1" />

                <include
                    android:id="@+id/tire_middle_left"
                    layout="@layout/item_tire"
                    android:layout_width="0dp"
                    android:layout_height="120dp"
                    app:layout_constraintTop_toTopOf="@id/guideline_axis_2"
                    app:layout_constraintBottom_toBottomOf="@id/guideline_axis_2"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toStartOf="@id/guideline_vertical_center"
                    app:layout_constraintHorizontal_bias="0.5" />

                <!-- 右侧轮胎 (2轴) -->
                <include
                    android:id="@+id/tire_middle_right"
                    layout="@layout/item_tire"
                    android:layout_width="0dp"
                    android:layout_height="120dp"
                    app:layout_constraintTop_toTopOf="@id/guideline_axis_2"
                    app:layout_constraintBottom_toBottomOf="@id/guideline_axis_2"
                    app:layout_constraintStart_toEndOf="@id/guideline_vertical_center"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintHorizontal_bias="0.5" />

                <!-- ================= 第3轴 (后轴) ================= -->
                <!-- 左侧轮胎 (3轴) -->
                <include
                    android:id="@+id/tire_bottom_left"
                    layout="@layout/item_tire"
                    android:layout_width="0dp"
                    android:layout_height="120dp"
                    app:layout_constraintTop_toTopOf="@id/guideline_axis_3"
                    app:layout_constraintBottom_toBottomOf="@id/guideline_axis_3"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toStartOf="@id/guideline_vertical_center"
                    app:layout_constraintHorizontal_bias="0.5" />

                <!-- 右侧轮胎 (3轴) -->
                <include
                    android:id="@+id/tire_bottom_right"
                    layout="@layout/item_tire"
                    android:layout_width="0dp"
                    android:layout_height="120dp"
                    app:layout_constraintTop_toTopOf="@id/guideline_axis_3"
                    app:layout_constraintBottom_toBottomOf="@id/guideline_axis_3"
                    app:layout_constraintStart_toEndOf="@id/guideline_vertical_center"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintHorizontal_bias="0.5" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </com.google.android.material.card.MaterialCardView>

    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>