<?php
declare(strict_types=1);

/**
 * @var \App\View\AppView $this
 */
?>
<?php $this->assign('title', 'Sign in · CandleCraft Admin'); ?>

<header class="cc-adminlogin__topbar">
    <a class="cc-adminlogin__brand" href="<?= $this->Url->build(['_name' => 'home']) ?>" aria-label="CandleCraft Academy home">
        <span class="cc-mark" aria-hidden="true"></span>
        <span>CandleCraft <span class="cc-adminlogin__brand-sub">· Admin</span></span>
    </a>
    <a class="cc-adminlogin__back" href="<?= $this->Url->build(['_name' => 'home']) ?>">
        <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
            <line x1="19" y1="12" x2="5" y2="12"/>
            <polyline points="12 19 5 12 12 5"/>
        </svg>
        Back to site
    </a>
</header>

<div class="cc-adminlogin">
    <div class="cc-adminlogin__hero">
        <div class="cc-eyebrow cc-adminlogin__hero-eyebrow">The admin room</div>
        <h1>Welcome back. Let's read today's post.</h1>
        <p>The admin room is where enquiries and bookings land. Read them carefully, reply in your own time, mark what's done.</p>
        <div class="cc-adminlogin__stats">
            <div class="cc-adminlogin__stat">
                <strong style="color: var(--cc-clay);">~2 days</strong>
                <span class="cc-adminlogin__stat-label">avg reply time</span>
            </div>
            <div class="cc-adminlogin__stat">
                <strong>★ 4.9</strong>
                <span class="cc-adminlogin__stat-label">from 120+ classes</span>
            </div>
            <div class="cc-adminlogin__stat">
                <strong style="color: var(--cc-moss);">Secure</strong>
                <span class="cc-adminlogin__stat-label">CSRF + hashed pw</span>
            </div>
        </div>
    </div>

    <div class="cc-adminlogin__form-wrap">
        <div class="cc-adminlogin__card">
            <div class="cc-eyebrow" style="margin-bottom: 14px;">Admin · Sign in</div>
            <h2>Sign in to the inbox</h2>
            <p class="cc-adminlogin__card-sub">Use your admin credentials. Sessions expire after 7 days.</p>

            <?= $this->Form->create(null, ['url' => ['_name' => 'admin_login']]) ?>
                <label class="cc-label" for="email">Email</label>
                <?= $this->Form->control('email', [
                    'label' => false,
                    'class' => 'cc-input',
                    'id' => 'email',
                    'type' => 'email',
                    'autocomplete' => 'username',
                    'placeholder' => 'admin@candlecraft.local',
                ]) ?>
                <div style="height: 14px;"></div>
                <label class="cc-label" for="password">Password</label>
                <?= $this->Form->control('password', [
                    'label' => false,
                    'class' => 'cc-input',
                    'id' => 'password',
                    'type' => 'password',
                    'autocomplete' => 'current-password',
                ]) ?>
                <label class="cc-adminlogin__keep">
                    <input type="checkbox" name="remember_me" value="1" style="width:16px;height:16px;">
                    Keep me signed in on this device
                </label>
                <button class="cc-btn cc-btn--primary cc-btn--block cc-btn--lg" type="submit">Sign in</button>
            <?= $this->Form->end() ?>

            <div class="cc-adminlogin__security">
                <span class="cc-adminlogin__security-dot" aria-hidden="true"></span>
                <div>
                    Secure · CSRF + hashed password.<br>
                    Admin sessions expire after 7 days.
                </div>
            </div>
        </div>
    </div>
</div>
