<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/definicoesRoot"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorBackground"
    tools:context=".DefinicoesAdminActivity">

    <com.google.android.material.button.MaterialButton
        android:id="@+id/btnVoltar"
        style="@style/Widget.Material3.Button.TextButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:text="← Voltar"
        android:textAllCaps="false"
        android:textColor="@color/colorTextSecondary"
        android:textSize="16sp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ScrollView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:fillViewport="true"
        android:scrollbars="none"
        app:layout_constraintTop_toBottomOf="@id/btnVoltar"
        app:layout_constraintBottom_toBottomOf="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:paddingHorizontal="24dp"
            android:paddingTop="8dp"
            android:paddingBottom="48dp">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Definições do Estabelecimento"
                android:textColor="@color/colorTextPrimary"
                android:textSize="28sp"
                android:fontFamily="sans-serif-medium"
                android:textAlignment="center" />

            <!-- Improved Logo using MaterialCardView -->
            <com.google.android.material.card.MaterialCardView
                android:layout_width="120dp"
                android:layout_height="120dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="32dp"
                app:cardCornerRadius="60dp"
                app:cardElevation="2dp"
                app:strokeWidth="1dp"
                app:strokeColor="@color/colorDivider">
                <ImageView
                    android:id="@+id/imgRestaurantLogo"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop"
                    android:src="@drawable/circle_bg" />
            </com.google.android.material.card.MaterialCardView>

            <com.google.android.material.button.MaterialButton
                android:id="@+id/btnChangeLogo"
                style="@style/Widget.Material3.Button.OutlinedButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="16dp"
                android:text="Alterar Logótipo"
                android:textAllCaps="false" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="24dp"
                android:text="Configure o raio de segurança para check-in antecipado e regras associadas."
                android:textColor="@color/colorTextSecondary"
                android:textAlignment="center"
                android:textSize="14sp" />

            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="24dp"
                app:cardBackgroundColor="@color/colorSurface"
                app:cardCornerRadius="20dp"
                app:cardElevation="2dp"
                app:strokeWidth="1dp"
                app:strokeColor="@color/colorDivider">

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

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="Raio de Segurança (metros)"
                        android:textColor="@color/colorTextPrimary"
                        android:textSize="16sp"
                        android:fontFamily="sans-serif-medium" />

                    <EditText
                        android:id="@+id/inputRadius"
                        android:layout_width="match_parent"
                        android:layout_height="54dp"
                        android:layout_marginTop="12dp"
                        android:hint="Ex: 500"
                        android:inputType="number"
                        android:paddingHorizontal="16dp"
                        android:background="@drawable/input_bg"
                        android:textColor="@color/colorTextPrimary" />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="24dp"
                        android:text="Informação do Restaurante"
                        android:textColor="@color/colorTextPrimary"
                        android:textSize="16sp"
                        android:fontFamily="sans-serif-medium" />

                    <EditText
                        android:id="@+id/inputAddress"
                        android:layout_width="match_parent"
                        android:layout_height="54dp"
                        android:layout_marginTop="12dp"
                        android:hint="Morada (Ex: Rua Estreita, 12)"
                        android:inputType="textPostalAddress"
                        android:paddingHorizontal="16dp"
                        android:background="@drawable/input_bg"
                        android:textColor="@color/colorTextPrimary" />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="20dp"
                        android:text="Categoria"
                        android:textColor="@color/colorTextSecondary"
                        android:textSize="15sp" />

                    <Spinner
                        android:id="@+id/spinnerCategory"
                        android:layout_width="match_parent"
                        android:layout_height="54dp"
                        android:layout_marginTop="8dp"
                        android:background="@drawable/input_bg" />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="24dp"
                        android:text="Horário de Funcionamento"
                        android:textColor="@color/colorTextPrimary"
                        android:textSize="16sp"
                        android:fontFamily="sans-serif-medium" />

                    <LinearLayout
                        android:id="@+id/containerSchedule"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="12dp"
                        android:orientation="vertical" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/btnSaveSettings"
                        android:layout_width="match_parent"
                        android:layout_height="56dp"
                        android:layout_marginTop="32dp"
                        app:cornerRadius="14dp"
                        app:backgroundTint="@color/colorPrimary"
                        android:text="Guardar Definições"
                        android:textAllCaps="false"
                        android:textSize="16sp" />

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

        </LinearLayout>
    </ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
