<?php 
$pageTitle = Lang::get('contact') . ' - ' . Lang::get('app_name');
$pageDescription = 'Contact NotaphilyCatalogue support team. Get help with your numismatic collection management, report issues, or send feedback. We respond within 24 hours.';
$pageUrl = APP_URL . '/contact';
$contactEmail = Env::get('MAIL_FROM_EMAIL') ?: null;
$extraJsonLd = Schema::render([
    Schema::contactPage(
        $pageUrl,
        Lang::get('contact'),
        $pageDescription,
        $contactEmail,
        [
            ['name' => Lang::get('home'), 'item' => APP_URL . '/'],
            ['name' => Lang::get('contact'), 'item' => $pageUrl],
        ]
    ),
]);
?>
<?php require APP_ROOT . '/views/layouts/header.php'; ?>
<?= Recaptcha::renderScript() ?>

<div class="max-w-2xl mx-auto">
    <div class="text-center mb-8">
        <h1 class="text-3xl font-bold mb-2"><?= Lang::get('contact_title') ?></h1>
        <p class="text-gray-600"><?= Lang::get('contact_subtitle') ?></p>
    </div>

    <form method="POST" action="<?= APP_URL ?>/contact"<?php if (Recaptcha::isEnabled()): ?> onsubmit="executeRecaptcha(() => this.submit()); return false;"<?php endif; ?>>
        <input type="hidden" name="csrf_token" value="<?= Session::getCsrfToken() ?>">
        <?= Recaptcha::renderHiddenInput() ?>

        <div class="bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 p-6 mb-6">
            <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
                <div>
                    <label for="first_name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"><?= Lang::get('first_name') ?> *</label>
                    <input type="text" id="first_name" name="first_name" required
                           class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none transition-colors">
                </div>
                <div>
                    <label for="last_name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"><?= Lang::get('last_name') ?> *</label>
                    <input type="text" id="last_name" name="last_name" required
                           class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none transition-colors">
                </div>
            </div>

            <div class="mb-4">
                <label for="email" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"><?= Lang::get('email') ?> *</label>
                <input type="email" id="email" name="email" required
                       class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none transition-colors">
            </div>

            <div class="mb-4">
                <label for="subject" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"><?= Lang::get('subject') ?> *</label>
                <select id="subject" name="subject" required
                        class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none transition-colors">
                    <option value=""><?= Lang::get('select_subject') ?></option>
                    <option value="<?= Lang::get('subject_general') ?>"><?= Lang::get('subject_general') ?></option>
                    <option value="<?= Lang::get('subject_profile') ?>"><?= Lang::get('subject_profile') ?></option>
                    <option value="<?= Lang::get('subject_suggestion') ?>"><?= Lang::get('subject_suggestion') ?></option>
                    <option value="<?= Lang::get('subject_bug') ?>"><?= Lang::get('subject_bug') ?></option>
                </select>
            </div>

            <div class="mb-6">
                <label for="message" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"><?= Lang::get('message') ?> *</label>
                <textarea id="message" name="message" rows="6" required
                          class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none transition-colors resize-y"
                          placeholder="<?= Lang::get('message') ?>..."></textarea>
            </div>

            <button type="submit" class="w-full btn-gradient btn-gradient-blue btn-gradient-lg">
                <?= Lang::get('send') ?>
            </button>
        </div>
    </form>
</div>

<?= Recaptcha::renderJavaScript() ?>
<?php require APP_ROOT . '/views/layouts/footer.php'; ?>
