<x-app-layout>
    <x-slot name="header">
        <h2 class="serif" style="font-size: 1.3rem; color: var(--cream); font-weight: 400; letter-spacing: 0.05em;">
            {{ __('Admin / Edit Hero Banner') }}
        </h2>
    </x-slot>

    <style>
        .form-card {
            background: #fff;
            border-radius: 4px;
            border: 1px solid rgba(26,24,20,0.08);
            padding: 3rem;
            max-width: 800px;
            margin: 0 auto;
        }
        .form-group { margin-bottom: 1.5rem; }
        .form-label {
            display: block;
            font-size: 0.7rem;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--warm-gray);
            font-weight: 600;
            margin-bottom: 0.6rem;
        }
        .form-input {
            width: 100%;
            padding: 0.8rem 1rem;
            background: var(--ivory);
            border: 1px solid rgba(26,24,20,0.08);
            border-radius: 2px;
            font-family: 'DM Sans', sans-serif;
            font-size: 0.9rem;
            color: var(--ink);
            transition: border-color 0.2s;
        }
        .form-input:focus {
            outline: none;
            border-color: var(--amber);
        }
        .btn-save {
            background: var(--charcoal);
            color: var(--cream);
            border: none;
            border-radius: 2px;
            padding: 1rem 2rem;
            font-size: 0.8rem;
            letter-spacing: 0.15em;
            text-transform: uppercase;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }
        .btn-save:hover {
            background: var(--amber);
            color: var(--charcoal);
        }
    </style>

    <div style="padding: 4rem 0 8rem;">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            
            <div class="form-card">
                <form action="{{ route('admin.banners.update', $banner) }}" method="POST" enctype="multipart/form-data">
                    @csrf
                    @method('PUT')

                    <div class="form-group">
                        <label class="form-label">Banner Title</label>
                        <input type="text" name="title" class="form-input" value="{{ $banner->title }}" required>
                    </div>

                    <div class="form-group">
                        <label class="form-label">Subtitle</label>
                        <input type="text" name="subtitle" class="form-input" value="{{ $banner->subtitle }}">
                    </div>

                    <div class="form-group">
                        <label class="form-label">Description</label>
                        <textarea name="description" rows="3" class="form-input">{{ $banner->description }}</textarea>
                    </div>

                    <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;">
                        <div class="form-group">
                            <label class="form-label">Banner Image</label>
                            @if($banner->image)
                                <div style="margin-bottom: 1rem;">
                                    <img src="{{ asset('storage/' . $banner->image) }}" style="width: 200px; height: 80px; object-fit: cover; border-radius: 2px;">
                                </div>
                            @endif
                            <input type="file" name="image" class="form-input">
                        </div>
                        <div class="form-group">
                            <label class="form-label">Display Order</label>
                            <input type="number" name="order" value="{{ $banner->order }}" class="form-input">
                        </div>
                    </div>

                    <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;">
                        <div class="form-group">
                            <label class="form-label">Button Text</label>
                            <input type="text" name="button_text" class="form-input" value="{{ $banner->button_text }}">
                        </div>
                        <div class="form-group">
                            <label class="form-label">Button URL</label>
                            <input type="text" name="button_url" class="form-input" value="{{ $banner->button_url }}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="form-label">
                            <input type="checkbox" name="is_active" value="1" {{ $banner->is_active ? 'checked' : '' }}> 
                            Active (Visible on Slider)
                        </label>
                    </div>

                    <div style="margin-top: 3rem; display: flex; justify-content: space-between; align-items: center;">
                        <a href="{{ route('admin.banners.index') }}" style="color: var(--warm-gray); text-decoration: none; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em;">Cancel</a>
                        <button type="submit" class="btn-save">Update Banner</button>
                    </div>
                </form>
            </div>

        </div>
    </div>
</x-app-layout>
