<?php $__env->startSection('title', $page->meta_title ?: $page->title); ?>
<?php $__env->startSection('meta_description', $page->meta_description ?? 'Contact Hillcrest Living for referrals, enquiries, and directions.'); ?>

<?php $__env->startSection('content'); ?>
    <?php
        $branches = collect($siteSettings->contact_branches ?? [])
            ->filter(fn ($branch) => filled($branch['name'] ?? null) && filled($branch['address'] ?? null))
            ->values();
        $primaryBranch = $branches->first(fn ($branch) => (bool) ($branch['is_primary'] ?? false)) ?? $branches->first();
        $turnstileEnabled = (bool) config('hillcrest.turnstile.enabled')
            && filled(config('hillcrest.turnstile.site_key'))
            && filled(config('hillcrest.turnstile.secret_key'));
    ?>
    <div class="section-contrast-sage section-gap">
        <div class="section-shell">
            <div class="grid gap-10 lg:grid-cols-2 lg:gap-12">
                <div data-aos="fade-up">
                    <h1 class="font-display text-4xl font-bold text-[var(--color-heading)] md:text-5xl" style="font-family: var(--font-heading);">Contact Us</h1>
                    <p class="mt-5 max-w-xl text-lg text-neutral-700">Ready to discuss supported living, referrals, or partnership opportunities? Our team will guide you through the right next step.</p>

                <div class="mt-8 grid gap-3 sm:grid-cols-2">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(filled($primaryBranch['phone'] ?? null) || filled($siteSettings->contact_phone)): ?>
                        <a class="rounded-xl border border-neutral-200 bg-white px-4 py-3 text-sm text-neutral-700 shadow-sm transition hover:-translate-y-0.5 hover:border-[var(--color-accent)]/60 hover:shadow-md" href="tel:<?php echo e(preg_replace('/\s+/', '', $primaryBranch['phone'] ?? $siteSettings->contact_phone)); ?>">
                            <p class="inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-[var(--color-heading)]/70">
                                <i data-lucide="phone-call" class="h-3.5 w-3.5"></i>
                                Phone
                            </p>
                            <p class="mt-1 font-semibold text-[var(--color-heading)]"><?php echo e($primaryBranch['phone'] ?? $siteSettings->contact_phone); ?></p>
                        </a>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(filled($primaryBranch['email'] ?? null) || filled($siteSettings->contact_email)): ?>
                        <a class="rounded-xl border border-neutral-200 bg-white px-4 py-3 text-sm text-neutral-700 shadow-sm transition hover:-translate-y-0.5 hover:border-[var(--color-accent)]/60 hover:shadow-md" href="mailto:<?php echo e($primaryBranch['email'] ?? $siteSettings->contact_email); ?>">
                            <p class="inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-[var(--color-heading)]/70">
                                <i data-lucide="mail" class="h-3.5 w-3.5"></i>
                                Email
                            </p>
                            <p class="mt-1 break-all font-semibold text-[var(--color-heading)]"><?php echo e($primaryBranch['email'] ?? $siteSettings->contact_email); ?></p>
                        </a>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>

                <div class="mt-8 rounded-2xl border border-neutral-200 bg-white/90 p-4 shadow-sm sm:p-5" x-data="{ selectedBranch: 0, branches: <?php echo \Illuminate\Support\Js::from($branches)->toHtml() ?> }">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($branches->isNotEmpty()): ?>
                        <div class="mb-3 flex items-center justify-between gap-3">
                            <h2 class="inline-flex items-center gap-2 font-display text-lg font-semibold text-[var(--color-heading)]" style="font-family: var(--font-heading);">
                                <i data-lucide="building-2" class="h-4 w-4 text-[var(--color-accent)]"></i>
                                Our locations
                            </h2>
                            <p class="text-xs text-neutral-500" x-text="`${branches.length} branch${branches.length > 1 ? 'es' : ''}`"></p>
                        </div>
                        <div class="flex flex-wrap gap-2">
                            <template x-for="(branch, idx) in branches" :key="idx">
                                <button type="button" @click="selectedBranch = idx" class="rounded-full border px-3 py-1.5 text-sm font-medium transition" :class="selectedBranch === idx ? 'border-[var(--color-accent)] bg-[var(--color-accent)] text-white shadow-sm' : 'border-neutral-300 bg-white text-neutral-700 hover:border-[var(--color-accent)]/50'">
                                    <span x-text="branch.name"></span>
                                </button>
                            </template>
                        </div>
                        <div class="mt-4 grid gap-4 lg:grid-cols-[0.95fr_1.05fr]">
                            <div class="rounded-xl border border-neutral-200 bg-[var(--color-surface-alt)]/80 p-4 text-sm text-neutral-700">
                                <p class="inline-flex items-center gap-2 font-semibold text-[var(--color-heading)]">
                                    <i data-lucide="map-pin" class="h-4 w-4 text-[var(--color-accent)]"></i>
                                    <span x-text="branches[selectedBranch]?.name"></span>
                                </p>
                                <p class="mt-2 whitespace-pre-line leading-relaxed" x-text="branches[selectedBranch]?.address"></p>
                                <template x-if="branches[selectedBranch]?.phone">
                                    <p class="mt-3 inline-flex items-center gap-2">
                                        <i data-lucide="phone" class="h-3.5 w-3.5 text-[var(--color-accent)]"></i>
                                        <span class="font-semibold text-[var(--color-heading)]">Phone:</span> <span x-text="branches[selectedBranch]?.phone"></span>
                                    </p>
                                </template>
                                <template x-if="branches[selectedBranch]?.email">
                                    <p class="mt-1 inline-flex items-center gap-2 break-all">
                                        <i data-lucide="at-sign" class="h-3.5 w-3.5 shrink-0 text-[var(--color-accent)]"></i>
                                        <span class="font-semibold text-[var(--color-heading)]">Email:</span> <span x-text="branches[selectedBranch]?.email"></span>
                                    </p>
                                </template>
                            </div>
                            <div class="overflow-hidden rounded-xl border border-neutral-200 shadow-sm">
                                <div class="aspect-[16/11]" x-show="branches[selectedBranch]?.map_embed_url">
                                    <iframe :src="branches[selectedBranch]?.map_embed_url" class="h-full w-full" title="Branch location map" style="border:0" loading="lazy" referrerpolicy="no-referrer-when-downgrade" allowfullscreen></iframe>
                                </div>
                                <div class="inline-flex w-full items-center gap-1.5 bg-white px-3 py-2 text-xs text-neutral-500">
                                    <i data-lucide="navigation" class="h-3.5 w-3.5"></i>
                                    Interactive map for selected branch
                                </div>
                            </div>
                        </div>
                    <?php elseif(filled($siteSettings->contact_map_embed_url)): ?>
                        <h2 class="mb-3 inline-flex items-center gap-2 font-display text-lg font-semibold text-[var(--color-heading)]" style="font-family: var(--font-heading);">
                            <i data-lucide="map-pinned" class="h-4 w-4 text-[var(--color-accent)]"></i>
                            Location
                        </h2>
                        <div class="aspect-[16/11] overflow-hidden rounded-xl border border-neutral-200 shadow-sm">
                            <iframe src="<?php echo e($siteSettings->contact_map_embed_url); ?>" class="h-full w-full" title="<?php echo e($siteSettings->contact_map_place_label ?: 'Office location map'); ?>" style="border:0" loading="lazy" referrerpolicy="no-referrer-when-downgrade" allowfullscreen></iframe>
                        </div>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(filled($siteSettings->contact_map_place_label)): ?>
                            <p class="mt-2 text-xs text-neutral-600"><?php echo e($siteSettings->contact_map_place_label); ?></p>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(filled($primaryBranch['address'] ?? null) || filled($siteSettings->contact_address)): ?>
                            <p class="mt-3 whitespace-pre-line rounded-xl border border-neutral-200 bg-[var(--color-surface-alt)]/70 p-3 text-sm text-neutral-700"><?php echo e($primaryBranch['address'] ?? $siteSettings->contact_address); ?></p>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php else: ?>
                        <p class="text-sm text-neutral-600">A map embed can be added from the admin panel under Site settings.</p>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>
                </div>

                <div data-aos="fade-left">
                    <div class="floral-soft overflow-hidden rounded-2xl border border-neutral-100 bg-[var(--color-surface-alt)] p-6 shadow-sm transition hover:-translate-y-1 hover:shadow-xl md:p-7">
                        <h2 class="inline-flex items-center gap-2 font-display text-2xl font-semibold text-[var(--color-heading)]" style="font-family: var(--font-heading);">
                            <i data-lucide="messages-square" class="h-5 w-5 text-[var(--color-accent)]"></i>
                            Send us a message
                        </h2>
                        <p class="mt-2 text-sm text-neutral-600">Use this form for enquiries, support requests, referrals, and service interest.</p>

                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('status')): ?>
                        <div class="mt-4 rounded-lg border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-900" role="status"><?php echo e(session('status')); ?></div>
                    <?php else: ?>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($errors->any()): ?>
                            <div class="mt-4 rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-900" role="alert">
                                <p class="font-semibold">Please review the highlighted fields.</p>
                                <ul class="mt-2 list-disc pl-5">
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <li><?php echo e($error); ?></li>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </ul>
                            </div>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                        <form class="mt-6 space-y-4" action="<?php echo e(route('contact.store')); ?>" method="post">
                            <?php echo csrf_field(); ?>
                            <?php echo view('honeypot::honeypotFormFields'); ?>
                            <div class="grid gap-4 sm:grid-cols-2">
                                <div>
                                    <label class="block text-sm font-medium" for="enquiry_type">Enquiry type</label>
                                    <select class="mt-2 w-full min-h-[44px] rounded-md border border-neutral-300 px-3" id="enquiry_type" name="enquiry_type" required>
                                        <option value="general" <?php if(old('enquiry_type') === 'general'): echo 'selected'; endif; ?>>General enquiry</option>
                                        <option value="services" <?php if(old('enquiry_type') === 'services'): echo 'selected'; endif; ?>>Service interest</option>
                                        <option value="referral" <?php if(old('enquiry_type') === 'referral'): echo 'selected'; endif; ?>>Referral discussion</option>
                                        <option value="partnership" <?php if(old('enquiry_type') === 'partnership'): echo 'selected'; endif; ?>>Partnership enquiry</option>
                                        <option value="careers" <?php if(old('enquiry_type') === 'careers'): echo 'selected'; endif; ?>>Careers enquiry</option>
                                        <option value="other" <?php if(old('enquiry_type') === 'other'): echo 'selected'; endif; ?>>Other</option>
                                    </select>
                                </div>
                                <div>
                                    <label class="block text-sm font-medium" for="preferred_contact">Preferred contact</label>
                                    <select class="mt-2 w-full min-h-[44px] rounded-md border border-neutral-300 px-3" id="preferred_contact" name="preferred_contact">
                                        <option value="either" <?php if(old('preferred_contact') === 'either'): echo 'selected'; endif; ?>>Either email or phone</option>
                                        <option value="email" <?php if(old('preferred_contact') === 'email'): echo 'selected'; endif; ?>>Email preferred</option>
                                        <option value="phone" <?php if(old('preferred_contact') === 'phone'): echo 'selected'; endif; ?>>Phone preferred</option>
                                    </select>
                                </div>
                            </div>
                            <div>
                                <label class="block text-sm font-medium" for="name">Name</label>
                                <input class="mt-2 w-full min-h-[44px] rounded-md border border-neutral-300 px-3" id="name" name="name" type="text" value="<?php echo e(old('name')); ?>" required>
                            </div>
                            <div class="grid gap-4 sm:grid-cols-2">
                                <div>
                                    <label class="block text-sm font-medium" for="email">Email</label>
                                    <input class="mt-2 w-full min-h-[44px] rounded-md border border-neutral-300 px-3" id="email" name="email" type="email" value="<?php echo e(old('email')); ?>" required>
                                </div>
                                <div>
                                    <label class="block text-sm font-medium" for="phone">Phone (optional)</label>
                                    <input class="mt-2 w-full min-h-[44px] rounded-md border border-neutral-300 px-3" id="phone" name="phone" type="text" value="<?php echo e(old('phone')); ?>">
                                </div>
                            </div>
                            <div>
                                <label class="block text-sm font-medium" for="subject">Subject</label>
                                <input class="mt-2 w-full min-h-[44px] rounded-md border border-neutral-300 px-3" id="subject" name="subject" type="text" value="<?php echo e(old('subject')); ?>" required>
                            </div>
                            <div>
                                <label class="block text-sm font-medium" for="message">Message</label>
                                <textarea class="mt-2 w-full rounded-md border border-neutral-300 px-3 py-2 text-sm" id="message" name="message" rows="6" required><?php echo e(old('message')); ?></textarea>
                                <p class="mt-1 text-xs text-neutral-500">Please avoid adding multiple links. Messages with excessive links may be blocked as spam.</p>
                            </div>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($turnstileEnabled): ?>
                                <div>
                                    <div class="cf-turnstile" data-sitekey="<?php echo e(config('hillcrest.turnstile.site_key')); ?>" data-theme="light"></div>
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['cf-turnstile-response'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <p class="mt-1 text-xs text-red-700"><?php echo e($message); ?></p>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </div>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            <button class="inline-flex min-h-[44px] w-full items-center justify-center gap-2 rounded-md bg-[var(--color-accent)] px-4 py-3 text-sm font-semibold text-white hover:opacity-90" type="submit">
                                <i data-lucide="send" class="h-4 w-4"></i>
                                Submit
                            </button>
                        </form>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($turnstileEnabled): ?>
    <?php $__env->startPush('scripts'); ?>
        <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
    <?php $__env->stopPush(); ?>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

<?php echo $__env->make('layouts.site', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\MrKennyJava\Herd\hillcrest-web\resources\views/site/contact.blade.php ENDPATH**/ ?>