@csrf
<div class="row">
    <div class="col-xl-8">
        <div class="card">
            <div class="card-header border-0 pb-0"><h4 class="card-title mb-0">Marka Kiti Bilgileri</h4></div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-8 mb-3">
                        <label class="form-label">Marka Kiti Adı *</label>
                        <input type="text" name="name" class="form-control" value="{{ old('name', $brandKit->name) }}" required>
                        @error('name')<small class="text-danger">{{ $message }}</small>@enderror
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label">Müşteri Kapsamı</label>
                        <select name="client_id" class="form-control default-select">
                            <option value="">Genel marka kiti</option>
                            @foreach($clients as $client)
                                <option value="{{ $client->id }}" @selected(old('client_id', $brandKit->client_id)==$client->id)>{{ $client->company_name }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="col-12 mb-3">
                        <label class="form-label">Açıklama</label>
                        <textarea name="description" class="form-control" rows="3">{{ old('description', $brandKit->description) }}</textarea>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label">Kapak Tipi</label>
                        <select name="cover_style" class="form-control default-select">
                            @foreach(['gradient'=>'Gradient','minimal'=>'Minimal','image'=>'Görsel Arka Plan','dark'=>'Koyu Kurumsal'] as $key => $label)
                                <option value="{{ $key }}" @selected(old('cover_style', $brandKit->cover_style ?: 'gradient')===$key)>{{ $label }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label">Sıra</label>
                        <input type="number" name="sort_order" class="form-control" value="{{ old('sort_order', $brandKit->sort_order ?: 100) }}" min="0" max="9999">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label">Durum</label>
                        <div class="border rounded p-2">
                            <label class="me-3"><input type="checkbox" name="is_active" value="1" class="form-check-input me-1" @checked(old('is_active', $brandKit->is_active ?? true))> Aktif</label>
                            <label><input type="checkbox" name="is_default" value="1" class="form-check-input me-1" @checked(old('is_default', $brandKit->is_default))> Varsayılan</label>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="card">
            <div class="card-header border-0 pb-0"><h4 class="card-title mb-0">Logo ve İletişim</h4></div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6 mb-3"><label class="form-label">Ajans Adı</label><input type="text" name="agency_name" class="form-control" value="{{ old('agency_name', $brandKit->agency_name) }}"></div>
                    <div class="col-md-6 mb-3"><label class="form-label">Ajans Logo URL</label><input type="text" name="agency_logo_url" class="form-control" value="{{ old('agency_logo_url', $brandKit->agency_logo_url) }}"></div>
                    <div class="col-md-6 mb-3"><label class="form-label">Müşteri Logo URL</label><input type="text" name="client_logo_url" class="form-control" value="{{ old('client_logo_url', $brandKit->client_logo_url) }}"></div>
                    <div class="col-md-6 mb-3"><label class="form-label">Kapak Arka Plan Görsel URL</label><input type="text" name="cover_background_url" class="form-control" value="{{ old('cover_background_url', $brandKit->cover_background_url) }}"></div>
                    <div class="col-md-4 mb-3"><label class="form-label">İletişim E-posta</label><input type="email" name="contact_email" class="form-control" value="{{ old('contact_email', $brandKit->contact_email) }}"></div>
                    <div class="col-md-4 mb-3"><label class="form-label">Telefon</label><input type="text" name="contact_phone" class="form-control" value="{{ old('contact_phone', $brandKit->contact_phone) }}"></div>
                    <div class="col-md-4 mb-3"><label class="form-label">Web Sitesi</label><input type="text" name="website_url" class="form-control" value="{{ old('website_url', $brandKit->website_url) }}"></div>
                    <div class="col-12 mb-3"><label class="form-label">Rapor Alt Bilgisi</label><textarea name="footer_note" class="form-control" rows="3">{{ old('footer_note', $brandKit->footer_note) }}</textarea></div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-xl-4">
        <div class="card">
            <div class="card-header border-0 pb-0"><h4 class="card-title mb-0">Renk Paleti</h4></div>
            <div class="card-body">
                @foreach([
                    'primary_color' => 'Ana Renk',
                    'accent_color' => 'Vurgu Rengi',
                    'secondary_color' => 'Yumuşak Arka Plan',
                    'text_color' => 'Metin Rengi',
                    'muted_color' => 'Yardımcı Metin'
                ] as $key => $label)
                    <div class="mb-3">
                        <label class="form-label">{{ $label }}</label>
                        <input type="color" name="{{ $key }}" class="form-control form-control-color w-100" value="{{ old($key, $brandKit->{$key} ?: ['primary_color'=>'#111827','accent_color'=>'#ef5f86','secondary_color'=>'#f8fafc','text_color'=>'#111827','muted_color'=>'#6b7280'][$key]) }}">
                    </div>
                @endforeach
                <div class="rounded p-4 mb-3 text-white" style="background: {{ $brandKit->exists ? $brandKit->previewGradient() : 'linear-gradient(135deg,#111827,#ef5f86)' }};">
                    <strong>Rapor Kapak Önizleme</strong>
                    <p class="mb-0 small">Ana renk ve vurgu renginin rapor kapağındaki genel hissi.</p>
                </div>
                <button class="btn btn-primary w-100 mb-2">Kaydet</button>
                <a href="{{ route('admin.brand-kits.index') }}" class="btn btn-light w-100">Vazgeç</a>
            </div>
        </div>
    </div>
</div>
