@extends('layouts.app')
@section('title', 'Edit Perusahaan - FIN-ANALYSIS PRO')
@section('content')
<div class="max-w-lg mx-auto">
    <div style="margin-bottom:2rem">
        <a href="{{ route('companies.show', urlencode($name)) }}"
           style="color:#1A56DB;text-decoration:none;font-size:.875rem;display:inline-flex;align-items:center;gap:4px;margin-bottom:.75rem">
            <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg>
            Kembali ke Detail
        </a>
        <h1 class="page-title">Edit Perusahaan</h1>
        <p class="page-subtitle">Mengubah nama akan memperbarui semua riwayat analisis terkait</p>
    </div>

    <div class="card">
        <form action="{{ route('companies.update', urlencode($name)) }}" method="POST">
            @csrf @method('PUT')
            <div class="form-group">
                <label class="form-label">Nama Perusahaan <span class="required">*</span></label>
                <input type="text" name="company_name" class="form-control {{ $errors->has('company_name')?'is-invalid':'' }}"
                       value="{{ old('company_name', $name) }}" required>
                @error('company_name')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div style="margin-top:.5rem;padding:.75rem;background:#FEF3C7;border-radius:8px;font-size:.8125rem;color:#92400E">
                ⚠️ Perubahan nama akan diterapkan ke <strong>{{ $analyses->count() }} analisis</strong> yang terkait.
            </div>
            <div style="display:flex;gap:.75rem;margin-top:1.5rem">
                <a href="{{ route('companies.show', urlencode($name)) }}" class="btn btn-secondary" style="flex:1;justify-content:center">Batal</a>
                <button type="submit" class="btn btn-primary" style="flex:1">Simpan Perubahan</button>
            </div>
        </form>
    </div>
</div>
@endsection