<div class="container py-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h1 class="h3 mb-1">Edit Solicitor</h1>
            <p class="text-muted mb-0">Update solicitor details</p>
        </div>

        <div class="d-flex gap-2">
            <a wire:navigate href="{{ route('solicitors.index') }}" class="btn btn-outline-secondary">
                Back to List
            </a>
        </div>
    </div>

    @if (session()->has('success'))
        <div class="alert alert-success">
            {{ session('success') }}
        </div>
    @endif

    <div class="card shadow-sm">
        <div class="card-body">
            <form wire:submit="save">
                <div class="row g-3">
                    <div class="col-md-6">
                        <label for="name" class="form-label">Name</label>
                        <input
                                id="name"
                                type="text"
                                class="form-control @error('name') is-invalid @enderror"
                                wire:model.live="name"
                        >
                        @error('name')
                        <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="col-md-6">
                        <label for="domain" class="form-label">Domain</label>
                        <input
                                id="domain"
                                type="text"
                                class="form-control @error('domain') is-invalid @enderror"
                                wire:model.live="domain"
                                placeholder="example.com"
                        >
                        @error('domain')
                        <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="col-md-6">
                        <label for="email_address" class="form-label">Email Address</label>
                        <input
                                id="email_address"
                                type="email"
                                class="form-control @error('email_address') is-invalid @enderror"
                                wire:model.live="email_address"
                        >
                        @error('email_address')
                        <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="col-md-6">
                        <label for="phone_number" class="form-label">Phone Number</label>
                        <input
                                id="phone_number"
                                type="text"
                                class="form-control @error('phone_number') is-invalid @enderror"
                                wire:model.live="phone_number"
                        >
                        @error('phone_number')
                        <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="col-md-6">
                        <label for="company_number" class="form-label">Company Registration Number</label>
                        <input
                                id="company_number"
                                type="text"
                                class="form-control @error('company_number') is-invalid @enderror"
                                wire:model.live="company_number"
                                placeholder="e.g. 13900519"
                        >
                        @error('company_number')
                        <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="col-md-6">
                        <label for="sra_number" class="form-label">SRA Number</label>
                        <input
                                id="sra_number"
                                type="text"
                                class="form-control @error('sra_number') is-invalid @enderror"
                                wire:model.live="sra_number"
                                placeholder="e.g. 8000579"
                        >
                        @error('sra_number')
                        <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>
                </div>

                <hr class="my-4"/>

                <h5 class="mb-3">
                    <i class="mdi mdi-draw-pen me-1"></i>Default email signature
                </h5>
                <p class="text-muted small">
                    The firm-wide signature appended to outbound emails.
                    Per-sender signatures (under <em>Email Senders</em>) override this when present.
                </p>

                <x-ui.signature-editor
                    name="signature"
                    text-name="signature_text"
                    label="Signature"
                    help="Used as the default for any sender that does not have its own signature."
                    :initial="$signature"
                />

                <div class="d-flex justify-content-end gap-2 mt-4">
                    <a wire:navigate href="{{ route('solicitors.index') }}" class="btn btn-outline-secondary">
                        Cancel
                    </a>

                    <button type="submit" class="btn btn-primary">
                        Save Changes
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>