<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/login_background"
    android:id="@+id/main"
    android:padding="16dp">

    <!-- Logo 图片：水平居中 -->
    <ImageView
        android:id="@+id/logoFrame"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:src="@mipmap/loge"
        android:contentDescription="Logo"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:layout_marginTop="32dp" />

    <!-- 文字：放在图片下方，水平居中 -->
    <TextView
        android:id="@+id/logoText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/login_title"
        android:textSize="26dp"
        android:textStyle="bold"
        android:textColor="@color/black"
        app:layout_constraintTop_toBottomOf="@id/logoFrame"
        app:layout_constraintStart_toStartOf="@id/logoFrame"
        app:layout_constraintEnd_toEndOf="@id/logoFrame"
        android:layout_marginTop="12dp" />

    <!-- Tab 切换栏背景（可选下划线指示器） -->
    <View
        android:id="@+id/tabDivider"
        android:layout_width="0dp"
        android:layout_height="2dp"
        app:layout_constraintTop_toBottomOf="@+id/tvSmsLogin"
        app:layout_constraintStart_toStartOf="@+id/tvSmsLogin"
        app:layout_constraintEnd_toEndOf="@+id/tvPwdLogin"
        app:layout_constraintWidth_percent="0.5"
        android:visibility="invisible" />

    <!-- 验证码登录 Tab -->
    <TextView
        android:id="@+id/tvSmsLogin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="58dp"
        android:gravity="center"
        android:paddingTop="16dp"
        android:paddingBottom="16dp"
        android:text="@string/sms_login"
        android:textColor="@color/black"
        android:textSize="18sp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/logoText" />

    <!-- 密码登录 Tab -->
    <TextView
        android:id="@+id/tvPwdLogin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/password_login"
        android:textSize="18sp"
        android:gravity="center"
        android:paddingTop="16dp"
        android:paddingBottom="16dp"
        android:textColor="@color/gray"
        app:layout_constraintTop_toTopOf="@+id/tvSmsLogin"
        app:layout_constraintStart_toEndOf="@+id/tvSmsLogin"
        android:layout_marginStart="24dp" />
    <!-- 手机号输入行容器 -->
    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/phoneRowLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/textinput_white_bg"
        app:layout_constraintTop_toBottomOf="@+id/tvSmsLogin"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:paddingStart="16dp"
        android:paddingEnd="16dp">
        <ImageView
            android:id="@+id/ivPhoneIcon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:src="@mipmap/lg"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent" />
        <!-- 手机号输入框 -->
        <EditText
            android:id="@+id/etPhone"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:hint="@string/phone_hint"
            android:textColorHint="@color/gray"
            android:textColor="@android:color/black"
            android:background="@null"
            android:inputType="phone"
            android:paddingVertical="16dp"
            app:layout_constraintStart_toEndOf="@+id/ivPhoneIcon"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>


    <!-- 验证码登录专用区域：图标 + 验证码输入框 + 发送按钮 -->
    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/smsRowLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:background="@drawable/textinput_white_bg"
        android:paddingStart="16dp"
        android:paddingEnd="16dp"
        app:layout_constraintTop_toBottomOf="@+id/phoneRowLayout"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:visibility="visible">

        <!-- 左侧图标 -->
        <ImageView
            android:id="@+id/ivSmsIcon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:src="@mipmap/vc"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent" />

        <!-- 验证码输入框（无背景） -->
        <EditText
            android:id="@+id/etSmsCode"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:hint="@string/sms_code_hint"
            android:textColorHint="@color/gray"
            android:textColor="@android:color/black"
            android:background="@null"
        android:inputType="number"
        android:paddingVertical="16dp"
        app:layout_constraintStart_toEndOf="@+id/ivSmsIcon"
        app:layout_constraintEnd_toStartOf="@+id/sendCodeBtn"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent" />

        <!-- 发送验证码按钮 -->
        <android.widget.Button
            android:id="@+id/sendCodeBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/send_sms_code"
            android:textSize="16sp"
            android:textColor="@color/white"
            android:background="@drawable/rounded_blue_bg"
            android:paddingHorizontal="12dp"
            android:maxWidth="120dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            android:layout_marginStart="12dp" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <!-- 密码登录专用区域：图标 + 密码输入框 -->
    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/passwordRowLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:background="@drawable/textinput_white_bg"
        android:paddingStart="16dp"
        android:paddingEnd="16dp"
        app:layout_constraintTop_toBottomOf="@+id/phoneRowLayout"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:visibility="gone">      <!-- 初始隐藏 -->

        <!-- 左侧图标 -->
        <ImageView
            android:id="@+id/ivPasswordIcon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:src="@mipmap/ma"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent" />

        <!-- 密码输入框（无背景） -->
        <EditText
            android:id="@+id/etPassword"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:hint="@string/password_hint"
            android:textColorHint="@color/gray"
            android:textColor="@android:color/black"
            android:background="@null"
            android:inputType="textPassword"
            android:paddingVertical="16dp"
            app:layout_constraintStart_toEndOf="@+id/ivPasswordIcon"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>


    <!-- 登录按钮 -->
    <android.widget.Button
        android:id="@+id/loginBtn"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="40dp"
        android:text="@string/login"
        android:textSize="18sp"
        android:background="@drawable/rounded_blue_bg"
        android:textColor="@color/white"
        app:layout_constraintTop_toBottomOf="@+id/smsRowLayout"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <!-- 立即注册 -->
    <TextView
        android:id="@+id/registerText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/register"
        android:textSize="14sp"
        android:textColor="@color/green"
        android:padding="8dp"
        app:layout_constraintTop_toBottomOf="@+id/loginBtn"
        app:layout_constraintStart_toStartOf="@+id/loginBtn"
        android:layout_marginTop="20dp" />

    <!-- 忘记密码 -->
    <TextView
        android:id="@+id/forgetText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/forgot_password"
        android:textSize="14sp"
        android:textColor="@color/green"
        android:padding="8dp"
        android:visibility="gone"
        app:layout_constraintTop_toTopOf="@+id/registerText"
        app:layout_constraintEnd_toEndOf="@+id/loginBtn" />

</androidx.constraintlayout.widget.ConstraintLayout>