<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Вход администратора — Hotel Pineta</title>
    <style>
        :root {
            --bg: #eef3ed;
            --panel: #ffffff;
            --line: #d8dfd1;
            --accent: #29563a;
            --text: #22301f;
            --muted: #687562;
            --error-bg: #fff1f1;
            --error-text: #9d2020;
        }
        * { box-sizing: border-box; }
        body {
            margin: 0;
            min-height: 100vh;
            display: grid;
            place-items: center;
            background: radial-gradient(circle at top, #f7fbf7 0, #eef3ed 48%, #e6ece4 100%);
            color: var(--text);
            font-family: Arial, Helvetica, sans-serif;
        }
        .panel {
            width: min(460px, calc(100vw - 32px));
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 24px;
            padding: 28px;
            box-shadow: 0 22px 55px rgba(41, 86, 58, .12);
        }
        .brand {
            display: flex;
            align-items: center;
            gap: 14px;
            margin-bottom: 22px;
        }
        .brand img {
            width: 56px;
            height: 56px;
            border-radius: 16px;
            object-fit: cover;
            background: #fff;
            padding: 4px;
        }
        h1 {
            margin: 0 0 6px;
            font-size: 28px;
        }
        p {
            margin: 0;
            color: var(--muted);
            line-height: 1.5;
        }
        .field { margin-top: 16px; }
        label {
            display: block;
            margin-bottom: 6px;
            font-size: 14px;
            color: var(--muted);
        }
        input {
            width: 100%;
            border: 1px solid var(--line);
            border-radius: 14px;
            padding: 14px 16px;
            font-size: 15px;
        }
        .error {
            margin-top: 16px;
            border-radius: 14px;
            background: var(--error-bg);
            color: var(--error-text);
            padding: 12px 14px;
            font-size: 14px;
        }
        .row {
            margin-top: 18px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
        }
        button {
            border: 0;
            border-radius: 14px;
            background: var(--accent);
            color: #fff;
            padding: 14px 18px;
            font-size: 15px;
            cursor: pointer;
        }
        .small {
            margin-top: 18px;
            font-size: 13px;
            color: var(--muted);
        }
    </style>
</head>
<body>
<div class="panel">
    <div class="brand">
        <img src="{{ asset('images/hotel/emblem.jpg') }}" alt="Hotel Pineta">
        <div>
            <h1>Hotel Pineta</h1>
        </div>
    </div>


    @if ($errors->any())
        <div class="error">{{ $errors->first() }}</div>
    @endif

    <form method="post" action="{{ route('admin.login.store') }}">
        @csrf

        <div class="field">
            <label for="phone">Телефон администратора</label>
            <input id="phone" class="pineta-phone-input" data-pineta-phone="1" type="tel" name="phone" value="{{ old('phone') }}" placeholder="393669749520" required autofocus>
        </div>

        <div class="field">
            <label for="password">Пароль</label>
            <input id="password" type="password" name="password" placeholder="Введите пароль" minlength="6" required>
            <label style="display:flex; align-items:center; gap:8px; margin-top:10px; color:var(--text);">
                <input type="checkbox" id="show-admin-password" style="width:auto; padding:0;"> Показать пароль
            </label>
        </div>

        <div class="row">
            <label style="display:flex; align-items:center; gap:8px; margin:0;">
                <input type="checkbox" name="remember" value="1" style="width:auto; padding:0;"> Запомнить меня
            </label>

            <button type="submit">Войти</button>
        </div>
    </form>

    <div class="small"><a href="{{ route('home') }}">← На главную</a></div>
</div>

<script>
    document.getElementById('show-admin-password')?.addEventListener('change', function () {
        const field = document.getElementById('password');
        if (field) field.type = this.checked ? 'text' : 'password';
    });
</script>
<script src="{{ asset('assets/js/phone-fields.js') }}"></script>
</body>
</html>
