<?php
/**
 * @var \App\View\AppView $this
 * @var \App\Model\Entity\User $user
 */
?>

<style>
    .edit-wrapper {
        display:flex;
        justify-content:center;
        align-items:center;
        min-height:80vh;
        padding:40px 20px;
    }
    .edit-card {
        background:#fff;
        border-radius:16px;
        box-shadow:0 8px 24px rgba(0,0,0,0.1);
        padding:40px;
        max-width:500px;
        width:100%;
        text-align:center;
    }
    .edit-title {
        font-family:"Playfair Display", serif;
        font-size:28px;
        color:#3b302a;
        margin-bottom:25px;
    }
    .form-style label {
        display:block;
        text-align:left;
        font-weight:500;
        color:#3b302a;
        font-size:14px;
        margin-bottom:6px;
    }
    .form-style input, .form-style select {
        width:100%;
        margin-bottom:16px;
        padding:10px 12px;
        border-radius:6px;
        border:1px solid #ccc;
        font-size:15px;
    }
    .button-main {
        background-color:#3b302a;
        color:white;
        border:none;
        padding:12px;
        border-radius:8px;
        width:100%;
        font-size:16px;
        cursor:pointer;
        transition:background 0.3s;
        margin-top:10px;
    }
    .button-main:hover {
        background-color:#57463d;
    }
    .action-links {
        margin-top:20px;
        display:flex;
        flex-direction:column;
        gap:10px;
    }
    .action-links a, .action-links form {
        font-size:14px;
        color:#3b302a;
        text-decoration:underline;
    }
</style>

<div class="edit-wrapper">
    <div class="edit-card">
        <h2 class="edit-title">Edit User</h2>
        <?= $this->Form->create($user, ['class'=>'form-style']) ?>
            <?= $this->Form->control('email', [
                'label'=>'Email',
                'class'=>'login-input',
                'templates'=>['label'=>'<label>{{text}}</label>']
            ]) ?>
            <?= $this->Form->control('password', [
                'label'=>'Password',
                'class'=>'login-input',
                'templates'=>['label'=>'<label>{{text}}</label>']
            ]) ?>
            <?= $this->Form->control('first_name', [
                'label'=>'First Name',
                'class'=>'login-input',
                'templates'=>['label'=>'<label>{{text}}</label>']
            ]) ?>
            <?= $this->Form->control('last_name', [
                'label'=>'Last Name',
                'class'=>'login-input',
                'templates'=>['label'=>'<label>{{text}}</label>']
            ]) ?>
            <?= $this->Form->control('dob', [
                'label'=>'Date of Birth',
                'empty' => 'true',
                'class'=>'login-input',
                'templates'=>['label'=>'<label>{{text}}</label>']
            ]) ?>
            <?= $this->Form->control('phone', [
                'label'=>'Phone Number',
                'class'=>'login-input',
                'templates'=>['label'=>'<label>{{text}}</label>']
            ]) ?>
            <?= $this->Form->button('Submit', ['class'=>'button-main']) ?>
        <?= $this->Form->end() ?>

        <div class="action-links">
            <?= $this->Form->postLink(
                'Delete User',
                ['action' => 'delete', $user->id],
                ['confirm' => __('Are you sure you want to delete # {0}?', $user->id)]
            ) ?>
            <?= $this->Html->link('Back to Profile', ['controller'=>'profile','action' => 'index']) ?>
        </div>
    </div>
</div>
