@extends('admin.layouts.app')
@section('title', 'Edit SEO Page')
@section('content')
<div class="card" style="max-width:800px">
    <div class="card-header">Edit SEO Page: <code style="color:#f0c040">/{{ $seoPage->page_url }}</code></div>
    <form action="{{ route('admin.seo-pages.update', $seoPage) }}" method="POST">
        @csrf @method('PUT')
        <div class="form-row">
            <div class="form-group">
                <label>Page URL *</label>
                <input type="text" name="page_url" class="form-control" value="{{ old('page_url', $seoPage->page_url) }}" placeholder="e.g. about, contact, shop/categories" required>
                <small class="text-muted">Relative path without leading slash</small>
            </div>
            <div class="form-group">
                <label>Title (Browser Tab)</label>
                <input type="text" name="title" class="form-control" value="{{ old('title', $seoPage->title) }}" placeholder="e.g. About Us | AutoDiag">
            </div>
        </div>
        <div class="form-group">
            <label>Meta Title</label>
            <input type="text" name="meta_title" class="form-control" value="{{ old('meta_title', $seoPage->meta_title) }}" placeholder="SEO title (if different from browser title)">
        </div>
        <div class="form-group">
            <label>Meta Description</label>
            <textarea name="meta_description" class="form-control" placeholder="Brief description for search results">{{ old('meta_description', $seoPage->meta_description) }}</textarea>
        </div>
        <div class="form-group">
            <label>Meta Keywords</label>
            <input type="text" name="meta_keywords" class="form-control" value="{{ old('meta_keywords', $seoPage->meta_keywords) }}" placeholder="Comma-separated keywords">
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>OG Title</label>
                <input type="text" name="og_title" class="form-control" value="{{ old('og_title', $seoPage->og_title) }}">
            </div>
            <div class="form-group">
                <label>OG Image URL</label>
                <input type="text" name="og_image" class="form-control" value="{{ old('og_image', $seoPage->og_image) }}" placeholder="https://...">
            </div>
        </div>
        <div class="form-group">
            <label>OG Description</label>
            <textarea name="og_description" class="form-control">{{ old('og_description', $seoPage->og_description) }}</textarea>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>Canonical URL</label>
                <input type="text" name="canonical_url" class="form-control" value="{{ old('canonical_url', $seoPage->canonical_url) }}" placeholder="Leave empty to use page URL">
            </div>
            <div class="form-group" style="padding-top:25px">
                <label class="checkbox-label"><input type="checkbox" name="is_active" value="1" {{ $seoPage->is_active ? 'checked' : '' }}> Active</label>
            </div>
        </div>
        <button type="submit" class="btn btn-primary">Update SEO Page</button>
    </form>
</div>
@endsection
