@extends('home.layout', ['template' => $template, 'content' => $content])

@section('body_class', 'home-split-page')

@section('body')
    <main class="home-main">
        <div class="auth-split min-vh-100">
            <div class="auth-split-brand @if(! empty($content['hero_image_url'])) auth-split-brand-has-image @endif"
                 @if(! empty($content['hero_image_url'])) style="background-image: linear-gradient(135deg, rgba(65, 84, 241, 0.92), rgba(49, 46, 129, 0.88)), url('{{ $content['hero_image_url'] }}'); background-size: cover; background-position: center;" @endif>
                <div class="auth-split-brand-content">
                    <a href="{{ url('/') }}" class="auth-brand-logo">
                        <img src="{{ asset('assets/img/logo.webp') }}" alt="{{ config('app.name') }}" onerror="this.style.display='none'">
                        <span>{{ config('app.name') }}</span>
                    </a>
                    <div class="auth-brand-text">
                        <span class="home-eyebrow d-inline-block mb-3" style="background: rgba(255,255,255,0.15); color:#fff; border:1px solid rgba(255,255,255,0.2);">{{ $content['subtitle'] }}</span>
                        <h2 class="auth-brand-heading">{{ $content['headline'] }}</h2>
                        <div class="auth-brand-desc home-description">
                            {!! \App\Support\HomepageSettings::sanitizeHtml($content['description']) !!}
                        </div>
                    </div>
                    @if (! empty($content['features']))
                        <div class="auth-brand-features">
                            @foreach ($content['features'] as $feature)
                                <div class="auth-brand-feature">
                                    <i class="bi bi-check-circle-fill"></i>
                                    <span>{{ $feature }}</span>
                                </div>
                            @endforeach
                        </div>
                    @endif
                </div>
            </div>

            <div class="auth-split-form">
                <div class="auth-container d-flex flex-column justify-content-center min-vh-100 py-4 py-lg-5">
                    <div class="home-mobile-brand">
                        <a href="{{ url('/') }}" class="auth-brand-logo justify-content-center mb-3">
                            <img src="{{ asset('assets/img/logo.webp') }}" alt="{{ config('app.name') }}" onerror="this.style.display='none'">
                            <span>{{ config('app.name') }}</span>
                        </a>
                        <h1 class="h4 fw-bold mb-2">{{ $content['headline'] }}</h1>
                        <p class="text-muted small mb-0">{{ $content['subtitle'] }}</p>
                    </div>

                    <div class="card home-split-card">
                        <div class="card-body p-4 p-md-5">
                            <div class="auth-card-header">
                                <div class="mb-3">
                                    <span class="d-inline-flex align-items-center justify-content-center rounded-circle bg-primary-subtle text-primary" style="width:56px;height:56px;">
                                        <i class="bi bi-shield-lock fs-4"></i>
                                    </span>
                                </div>
                                <h2 class="auth-title h3 mb-2">Secure Admin Access</h2>
                                <p class="auth-subtitle text-muted mb-0">Sign in to manage your platform, staff, and settings from one place.</p>
                            </div>

                            @if (! empty($content['features']))
                                <ul class="list-unstyled mb-4">
                                    @foreach (array_slice($content['features'], 0, 3) as $feature)
                                        <li class="d-flex align-items-start gap-2 mb-2 text-muted small">
                                            <i class="bi bi-check2 text-primary mt-1"></i>
                                            <span>{{ $feature }}</span>
                                        </li>
                                    @endforeach
                                </ul>
                            @endif

                            @guest
                                <a href="{{ route('login') }}" class="btn btn-primary w-100 btn-lg home-cta-primary justify-content-center">
                                    <i class="bi bi-box-arrow-in-right"></i>
                                    {{ $content['button_text'] }}
                                </a>
                            @else
                                <a href="{{ route('dashboard') }}" class="btn btn-primary w-100 btn-lg home-cta-primary justify-content-center">
                                    <i class="bi bi-speedometer2"></i>
                                    Go to Dashboard
                                </a>
                            @endguest

                            <p class="text-center text-muted small mt-4 mb-0">
                                &copy; {{ date('Y') }} {{ config('app.name') }}
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
@endsection
